mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-03 13:05:30 +02:00
formatting applied to most of the source code to tidy things up, and misc refactors
This commit is contained in:
@@ -5,6 +5,9 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -12,17 +15,15 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class McremoveCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
|
||||
@NotNull String label, String[] args) {
|
||||
if (args.length == 1) {
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
|
||||
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName))) {
|
||||
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(
|
||||
sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +36,8 @@ public class McremoveCommand implements TabExecutor {
|
||||
if (mcMMO.getDatabaseManager().removeUser(playerName, uuid)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
|
||||
} else {
|
||||
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
|
||||
sender.sendMessage(playerName
|
||||
+ " could not be removed from the database."); // Pretty sure this should NEVER happen.
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -44,10 +46,12 @@ public class McremoveCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command,
|
||||
@NotNull String alias, String[] args) {
|
||||
if (args.length == 1) {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames,
|
||||
new ArrayList<>(playerNames.size()));
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
Reference in New Issue
Block a user