mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Static Abuse Removal - CommandUtils -> CommandTools
This commit is contained in:
parent
762c3bd04e
commit
57b7050a2c
@ -7,4 +7,6 @@ import java.util.List;
|
||||
public class CommandConstants {
|
||||
public static final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
|
||||
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
||||
public static final List<String> TRUE_FALSE_OPTIONS = ImmutableList.of("on", "off", "true", "false", "enabled", "disabled");
|
||||
public static final List<String> RESET_OPTIONS = ImmutableList.of("clear", "reset");
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
@ -24,7 +23,7 @@ public class McscoreboardCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -56,7 +55,7 @@ public class McscoreboardCommand implements TabExecutor {
|
||||
|
||||
case 2:
|
||||
if (args[0].equalsIgnoreCase("time") || args[0].equalsIgnoreCase("timer")) {
|
||||
if (CommandUtils.isInvalidInteger(sender, args[1])) {
|
||||
if (pluginRef.getCommandTools().isInvalidInteger(sender, args[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
@ -17,7 +16,7 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -26,7 +25,7 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -39,14 +38,14 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, playerName, mcMMOPlayer)) {
|
||||
if (!pluginRef.getCommandTools().checkPlayerExistence(sender, playerName, mcMMOPlayer)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.isOffline(sender, mcMMOPlayer.getPlayer())) {
|
||||
if (pluginRef.getCommandTools().isOffline(sender, mcMMOPlayer.getPlayer())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -63,7 +62,7 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -60,7 +59,7 @@ public class XprateCommand implements TabExecutor {
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (CommandUtils.isInvalidInteger(sender, args[0])) {
|
||||
if (pluginRef.getCommandTools().isInvalidInteger(sender, args[0])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -69,9 +68,9 @@ public class XprateCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||
if (pluginRef.getCommandTools().shouldDisableToggle(args[1])) {
|
||||
pluginRef.setXPEventEnabled(false);
|
||||
} else if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||
} else if (pluginRef.getCommandTools().shouldEnableToggle(args[1])) {
|
||||
pluginRef.setXPEventEnabled(true);
|
||||
} else {
|
||||
return false;
|
||||
@ -116,9 +115,9 @@ public class XprateCommand implements TabExecutor {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
return StringUtil.copyPartialMatches(args[0], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
|
||||
return StringUtil.copyPartialMatches(args[0], CommandConstants.RESET_OPTIONS, new ArrayList<>(CommandConstants.RESET_OPTIONS.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], CommandConstants.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandConstants.TRUE_FALSE_OPTIONS.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.chat;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandConstants;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
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 org.bukkit.command.Command;
|
||||
@ -31,11 +31,11 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -50,11 +50,11 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (CommandUtils.shouldEnableToggle(args[0])) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().shouldEnableToggle(args[0])) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -62,11 +62,11 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.shouldDisableToggle(args[0])) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().shouldDisableToggle(args[0])) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
||||
return StringUtil.copyPartialMatches(args[0], CommandConstants.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandConstants.TRUE_FALSE_OPTIONS.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.commands.database;
|
||||
|
||||
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 org.bukkit.Bukkit;
|
||||
@ -25,9 +24,9 @@ public class McremoveCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args.length == 1) {
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
|
||||
|
||||
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, pluginRef.getDatabaseManager().loadPlayerProfile(playerName, false))) {
|
||||
if (UserManager.getOfflinePlayer(playerName) == null && pluginRef.getCommandTools().unloadedProfile(sender, pluginRef.getDatabaseManager().loadPlayerProfile(playerName, false))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -52,7 +51,7 @@ public class McremoveCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
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 org.bukkit.OfflinePlayer;
|
||||
@ -40,7 +39,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -97,7 +96,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
|
||||
int value = Integer.parseInt(args[2]);
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
@ -109,7 +108,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
}
|
||||
PlayerProfile profile = pluginRef.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
|
||||
|
||||
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||
if (pluginRef.getCommandTools().unloadedProfile(sender, profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -130,7 +129,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
|
||||
@ -150,7 +149,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill);
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
||||
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
|
||||
return !(pluginRef.getCommandTools().isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && pluginRef.getCommandTools().isInvalidSkill(sender, skillName)));
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -5,9 +5,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -46,7 +44,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
PrimarySkillType skill;
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -84,7 +82,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
skill = PrimarySkillType.getSkill(args[1]);
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
@ -96,7 +94,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
}
|
||||
PlayerProfile profile = pluginRef.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
|
||||
|
||||
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||
if (pluginRef.getCommandTools().unloadedProfile(sender, profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -117,7 +115,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
|
||||
@ -157,7 +155,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName) {
|
||||
return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName);
|
||||
return skillName.equalsIgnoreCase("all") || !pluginRef.getCommandTools().isInvalidSkill(sender, skillName);
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) {
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@ -29,7 +28,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
String targetName = pluginRef.getCommandTools().getMatchedPlayerName(args[1]);
|
||||
OfflinePlayer target = pluginRef.getServer().getOfflinePlayer(targetName);
|
||||
|
||||
if (!playerParty.hasMember(target.getUniqueId())) {
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
@ -93,7 +92,7 @@ public class PartyCommand implements TabExecutor {
|
||||
if (!pluginRef.getConfigManager().getConfigParty().isPartySystemEnabled())
|
||||
return true;
|
||||
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -220,7 +219,7 @@ public class PartyCommand implements TabExecutor {
|
||||
case INVITE:
|
||||
case KICK:
|
||||
case OWNER:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
||||
case XPSHARE:
|
||||
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<>(XPSHARE_COMPLETIONS.size()));
|
||||
@ -228,9 +227,9 @@ public class PartyCommand implements TabExecutor {
|
||||
return StringUtil.copyPartialMatches(args[1], ITEMSHARE_COMPLETIONS, new ArrayList<>(ITEMSHARE_COMPLETIONS.size()));
|
||||
case LOCK:
|
||||
case CHAT:
|
||||
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], CommandConstants.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandConstants.TRUE_FALSE_OPTIONS.size()));
|
||||
case PASSWORD:
|
||||
return StringUtil.copyPartialMatches(args[1], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], CommandConstants.RESET_OPTIONS, new ArrayList<>(CommandConstants.RESET_OPTIONS.size()));
|
||||
case TELEPORT:
|
||||
List<String> matches = StringUtil.copyPartialMatches(args[1], CommandConstants.TELEPORT_SUBCOMMANDS, new ArrayList<>(CommandConstants.TELEPORT_SUBCOMMANDS.size()));
|
||||
|
||||
@ -255,7 +254,7 @@ public class PartyCommand implements TabExecutor {
|
||||
}
|
||||
case 3:
|
||||
if (PartySubcommandType.getSubcommand(args[0]) == PartySubcommandType.ITEMSHARE && isItemShareCategory(args[1])) {
|
||||
return StringUtil.copyPartialMatches(args[2], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
||||
return StringUtil.copyPartialMatches(args[2], CommandConstants.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandConstants.TRUE_FALSE_OPTIONS.size()));
|
||||
}
|
||||
|
||||
return ImmutableList.of();
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -22,10 +21,10 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
String targetName = pluginRef.getCommandTools().getMatchedPlayerName(args[1]);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
if (!pluginRef.getCommandTools().checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -50,9 +49,9 @@ public class PartyItemShareCommand implements CommandExecutor {
|
||||
case 3:
|
||||
boolean toggle;
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[2])) {
|
||||
if (pluginRef.getCommandTools().shouldEnableToggle(args[2])) {
|
||||
toggle = true;
|
||||
} else if (CommandUtils.shouldDisableToggle(args[2])) {
|
||||
} else if (pluginRef.getCommandTools().shouldDisableToggle(args[2])) {
|
||||
toggle = false;
|
||||
} else {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -23,10 +22,10 @@ public class PartyJoinCommand implements CommandExecutor {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
case 3:
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
String targetName = pluginRef.getCommandTools().getMatchedPlayerName(args[1]);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
if (!pluginRef.getCommandTools().checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@ -29,7 +28,7 @@ public class PartyKickCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
String targetName = pluginRef.getCommandTools().getMatchedPlayerName(args[1]);
|
||||
|
||||
if (!playerParty.hasMember(targetName)) {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Party.NotInYourParty", targetName));
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -36,9 +35,9 @@ public class PartyLockCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||
if (pluginRef.getCommandTools().shouldEnableToggle(args[1])) {
|
||||
togglePartyLock(sender, true);
|
||||
} else if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||
} else if (pluginRef.getCommandTools().shouldDisableToggle(args[1])) {
|
||||
togglePartyLock(sender, false);
|
||||
} else {
|
||||
sendUsageStrings(sender);
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -36,9 +35,9 @@ public class PartyXpShareCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
|
||||
if (args[1].equalsIgnoreCase("none") || pluginRef.getCommandTools().shouldDisableToggle(args[1])) {
|
||||
handleChangingShareMode(party, ShareMode.NONE);
|
||||
} else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
|
||||
} else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || pluginRef.getCommandTools().shouldEnableToggle(args[1])) {
|
||||
handleChangingShareMode(party, ShareMode.EQUAL);
|
||||
} else {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
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 org.bukkit.ChatColor;
|
||||
@ -40,7 +39,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -119,7 +118,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
||||
List<String> matches = StringUtil.copyPartialMatches(args[0], CommandConstants.ALLIANCE_SUBCOMMANDS, new ArrayList<>(CommandConstants.ALLIANCE_SUBCOMMANDS.size()));
|
||||
|
||||
if (matches.size() == 0) {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(commandSender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party.alliance;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -22,10 +21,10 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 3:
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[2]);
|
||||
String targetName = pluginRef.getCommandTools().getMatchedPlayerName(args[2]);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
if (!pluginRef.getCommandTools().checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,8 @@ import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.items.TeleportationWarmup;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
@ -44,7 +41,7 @@ public class PtpCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -125,7 +122,7 @@ public class PtpCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
|
||||
sendTeleportRequest(sender, player, pluginRef.getCommandTools().getMatchedPlayerName(args[0]));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -30,14 +29,14 @@ public class InspectCommand implements TabExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
if (mcMMOPlayer == null) {
|
||||
PlayerProfile profile = pluginRef.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile
|
||||
|
||||
if (!CommandUtils.isLoaded(sender, profile)) {
|
||||
if (!pluginRef.getCommandTools().isLoaded(sender, profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -55,27 +54,27 @@ public class InspectCommand implements TabExecutor {
|
||||
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Stats.Header.Gathering"));
|
||||
for (PrimarySkillType skill : PrimarySkillType.GATHERING_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
sender.sendMessage(pluginRef.getCommandTools().displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Stats.Header.Combat"));
|
||||
for (PrimarySkillType skill : PrimarySkillType.COMBAT_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
sender.sendMessage(pluginRef.getCommandTools().displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Stats.Header.Misc"));
|
||||
for (PrimarySkillType skill : PrimarySkillType.MISC_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
sender.sendMessage(pluginRef.getCommandTools().displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
} else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
|
||||
if (pluginRef.getCommandTools().hidden(sender, target, Permissions.inspectHidden(sender))) {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
else if (pluginRef.getCommandTools().tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -88,9 +87,9 @@ public class InspectCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Stats", target.getName()));
|
||||
CommandUtils.printGatheringSkills(target, sender);
|
||||
CommandUtils.printCombatSkills(target, sender);
|
||||
CommandUtils.printMiscSkills(target, sender);
|
||||
pluginRef.getCommandTools().printGatheringSkills(target, sender);
|
||||
pluginRef.getCommandTools().printCombatSkills(target, sender);
|
||||
pluginRef.getCommandTools().printMiscSkills(target, sender);
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
|
||||
}
|
||||
|
||||
@ -105,7 +104,7 @@ public class InspectCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.player;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -24,11 +23,11 @@ public class MccooldownCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -31,7 +30,7 @@ public class McrankCommand implements TabExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -40,7 +39,7 @@ public class McrankCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,18 +53,18 @@ public class McrankCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||
|
||||
if (mcMMOPlayer != null) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
playerName = player.getName();
|
||||
|
||||
if (CommandUtils.tooFar(sender, player, Permissions.mcrankFar(sender))) {
|
||||
if (pluginRef.getCommandTools().tooFar(sender, player, Permissions.mcrankFar(sender))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -82,7 +81,7 @@ public class McrankCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -22,11 +21,11 @@ public class McstatsCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -50,9 +49,9 @@ public class McstatsCommand implements TabExecutor {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Stats.Own.Stats"));
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("mcMMO.NoSkillNote"));
|
||||
|
||||
CommandUtils.printGatheringSkills(player);
|
||||
CommandUtils.printCombatSkills(player);
|
||||
CommandUtils.printMiscSkills(player);
|
||||
pluginRef.getCommandTools().printGatheringSkills(player);
|
||||
pluginRef.getCommandTools().printCombatSkills(player);
|
||||
pluginRef.getCommandTools().printMiscSkills(player);
|
||||
|
||||
int powerLevelCap = pluginRef.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().getLevelCap();
|
||||
|
||||
|
@ -7,7 +7,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -54,7 +53,7 @@ public class MctopCommand implements TabExecutor {
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (CommandUtils.isInvalidInteger(sender, args[1])) {
|
||||
if (pluginRef.getCommandTools().isInvalidInteger(sender, args[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -89,7 +88,7 @@ public class MctopCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -127,13 +126,13 @@ public class MctopCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
||||
if (CommandUtils.isInvalidSkill(sender, skillName)) {
|
||||
if (pluginRef.getCommandTools().isInvalidSkill(sender, skillName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PrimarySkillType skill = PrimarySkillType.getSkill(skillName);
|
||||
|
||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
||||
if (pluginRef.getCommandTools().isChildSkill(sender, skill)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
@ -55,11 +54,11 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
if (pluginRef.getCommandTools().noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
if (!pluginRef.getCommandTools().hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.datatypes.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.gmail.nossr50.datatypes.party;
|
||||
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
|
||||
public enum ShareMode {
|
||||
NONE,
|
||||
EQUAL,
|
||||
@ -13,7 +11,7 @@ public enum ShareMode {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
if (string.equalsIgnoreCase("even")) {
|
||||
return EQUAL;
|
||||
} else if (CommandUtils.shouldDisableToggle(string)) {
|
||||
} else if (pluginRef.getCommandTools().shouldDisableToggle(string)) {
|
||||
return NONE;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@ import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||
|
@ -18,7 +18,6 @@ import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
@ -32,6 +32,7 @@ import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
|
||||
import com.gmail.nossr50.util.commands.CommandRegistrationManager;
|
||||
import com.gmail.nossr50.util.commands.CommandTools;
|
||||
import com.gmail.nossr50.util.experience.FormulaManager;
|
||||
import com.gmail.nossr50.util.nbt.NBTManager;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
@ -73,6 +74,9 @@ public class mcMMO extends JavaPlugin {
|
||||
private MobHealthBarManager mobHealthBarManager;
|
||||
private EventManager eventManager;
|
||||
|
||||
/* Not-Managers but my naming scheme sucks */
|
||||
private CommandTools commandTools;
|
||||
|
||||
/* File Paths */
|
||||
private String mainDirectory;
|
||||
private String localesDirectory;
|
||||
@ -201,6 +205,8 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
//Init Event Manager
|
||||
eventManager = new EventManager(this);
|
||||
|
||||
commandTools = new CommandTools(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -639,4 +645,8 @@ public class mcMMO extends JavaPlugin {
|
||||
public EventManager getEventManager() {
|
||||
return eventManager;
|
||||
}
|
||||
|
||||
public CommandTools getCommandTools() {
|
||||
return commandTools;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.items.TeleportationWarmup;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
@ -41,7 +40,7 @@ public final class PartyManager {
|
||||
public boolean canTeleport(CommandSender sender, Player player, String targetName) {
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
if (!pluginRef.getCommandTools().checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.runnables.items;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Location;
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.runnables.skills;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.util.MobHealthBarManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
|
@ -15,7 +15,10 @@ import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
@ -7,7 +7,10 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
|
@ -4,11 +4,11 @@ import com.gmail.nossr50.core.MetadataConstants;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -16,14 +16,14 @@ import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class CommandUtils {
|
||||
public static final List<String> TRUE_FALSE_OPTIONS = ImmutableList.of("on", "off", "true", "false", "enabled", "disabled");
|
||||
public static final List<String> RESET_OPTIONS = ImmutableList.of("clear", "reset");
|
||||
public final class CommandTools {
|
||||
private mcMMO pluginRef;
|
||||
|
||||
private CommandUtils() {
|
||||
public CommandTools(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
public static boolean isChildSkill(CommandSender sender, PrimarySkillType skill) {
|
||||
public boolean isChildSkill(CommandSender sender, PrimarySkillType skill) {
|
||||
if (skill == null || !skill.isChildSkill()) {
|
||||
return false;
|
||||
}
|
||||
@ -32,7 +32,7 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
|
||||
public boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
|
||||
if(!target.isOnline() && !hasPermission) {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Offline"));
|
||||
return true;
|
||||
@ -48,11 +48,11 @@ public final class CommandUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hidden(CommandSender sender, Player target, boolean hasPermission) {
|
||||
public boolean hidden(CommandSender sender, Player target, boolean hasPermission) {
|
||||
return sender instanceof Player && !((Player) sender).canSee(target) && !hasPermission;
|
||||
}
|
||||
|
||||
public static boolean noConsoleUsage(CommandSender sender) {
|
||||
public boolean noConsoleUsage(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
return false;
|
||||
}
|
||||
@ -61,7 +61,7 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isOffline(CommandSender sender, OfflinePlayer player) {
|
||||
public boolean isOffline(CommandSender sender, OfflinePlayer player) {
|
||||
if (player.isOnline()) {
|
||||
return false;
|
||||
}
|
||||
@ -78,9 +78,9 @@ public final class CommandUtils {
|
||||
* @param mcMMOPlayer mcMMOPlayer object of the target player
|
||||
* @return true if the player is online and a valid mcMMOPlayer object was found
|
||||
*/
|
||||
public static boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) {
|
||||
public boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) {
|
||||
if (mcMMOPlayer != null) {
|
||||
if (CommandUtils.hidden(sender, mcMMOPlayer.getPlayer(), false)) {
|
||||
if (hidden(sender, mcMMOPlayer.getPlayer(), false)) {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline"));
|
||||
return false;
|
||||
}
|
||||
@ -97,7 +97,7 @@ public final class CommandUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean unloadedProfile(CommandSender sender, PlayerProfile profile) {
|
||||
public boolean unloadedProfile(CommandSender sender, PlayerProfile profile) {
|
||||
if (profile.isLoaded()) {
|
||||
return false;
|
||||
}
|
||||
@ -106,7 +106,7 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean hasPlayerDataKey(CommandSender sender) {
|
||||
public boolean hasPlayerDataKey(CommandSender sender) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
@ -120,7 +120,7 @@ public final class CommandUtils {
|
||||
return hasPlayerDataKey;
|
||||
}
|
||||
|
||||
public static boolean isLoaded(CommandSender sender, PlayerProfile profile) {
|
||||
public boolean isLoaded(CommandSender sender, PlayerProfile profile) {
|
||||
if (profile.isLoaded()) {
|
||||
return true;
|
||||
}
|
||||
@ -129,7 +129,7 @@ public final class CommandUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isInvalidInteger(CommandSender sender, String value) {
|
||||
public boolean isInvalidInteger(CommandSender sender, String value) {
|
||||
if (StringUtils.isInt(value)) {
|
||||
return false;
|
||||
}
|
||||
@ -138,7 +138,7 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isInvalidDouble(CommandSender sender, String value) {
|
||||
public boolean isInvalidDouble(CommandSender sender, String value) {
|
||||
if (StringUtils.isDouble(value)) {
|
||||
return false;
|
||||
}
|
||||
@ -147,7 +147,7 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isInvalidSkill(CommandSender sender, String skillName) {
|
||||
public boolean isInvalidSkill(CommandSender sender, String skillName) {
|
||||
if (SkillUtils.isSkill(skillName)) {
|
||||
return false;
|
||||
}
|
||||
@ -156,11 +156,11 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean shouldEnableToggle(String arg) {
|
||||
public boolean shouldEnableToggle(String arg) {
|
||||
return arg.equalsIgnoreCase("on") || arg.equalsIgnoreCase("true") || arg.equalsIgnoreCase("enabled");
|
||||
}
|
||||
|
||||
public static boolean shouldDisableToggle(String arg) {
|
||||
public boolean shouldDisableToggle(String arg) {
|
||||
return arg.equalsIgnoreCase("off") || arg.equalsIgnoreCase("false") || arg.equalsIgnoreCase("disabled");
|
||||
}
|
||||
|
||||
@ -170,11 +170,11 @@ public final class CommandUtils {
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printGatheringSkills(Player inspect, CommandSender display) {
|
||||
public void printGatheringSkills(Player inspect, CommandSender display) {
|
||||
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Gathering"), PrimarySkillType.GATHERING_SKILLS);
|
||||
}
|
||||
|
||||
public static void printGatheringSkills(Player player) {
|
||||
public void printGatheringSkills(Player player) {
|
||||
printGatheringSkills(player, player);
|
||||
}
|
||||
|
||||
@ -184,11 +184,11 @@ public final class CommandUtils {
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printCombatSkills(Player inspect, CommandSender display) {
|
||||
public void printCombatSkills(Player inspect, CommandSender display) {
|
||||
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Combat"), PrimarySkillType.COMBAT_SKILLS);
|
||||
}
|
||||
|
||||
public static void printCombatSkills(Player player) {
|
||||
public void printCombatSkills(Player player) {
|
||||
printCombatSkills(player, player);
|
||||
}
|
||||
|
||||
@ -198,15 +198,15 @@ public final class CommandUtils {
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printMiscSkills(Player inspect, CommandSender display) {
|
||||
public void printMiscSkills(Player inspect, CommandSender display) {
|
||||
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Misc"), PrimarySkillType.MISC_SKILLS);
|
||||
}
|
||||
|
||||
public static void printMiscSkills(Player player) {
|
||||
public void printMiscSkills(Player player) {
|
||||
printMiscSkills(player, player);
|
||||
}
|
||||
|
||||
public static String displaySkill(PlayerProfile profile, PrimarySkillType skill) {
|
||||
public String displaySkill(PlayerProfile profile, PrimarySkillType skill) {
|
||||
if (skill.isChildSkill()) {
|
||||
return pluginRef.getLocaleManager().getString("Skills.ChildStats", pluginRef.getLocaleManager().getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill));
|
||||
}
|
||||
@ -214,7 +214,7 @@ public final class CommandUtils {
|
||||
return pluginRef.getLocaleManager().getString("Skills.Stats", pluginRef.getLocaleManager().getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
|
||||
}
|
||||
|
||||
private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<PrimarySkillType> skillGroup) {
|
||||
private void printGroupedSkillData(Player inspect, CommandSender display, String header, List<PrimarySkillType> skillGroup) {
|
||||
if (UserManager.getPlayer(inspect) == null)
|
||||
return;
|
||||
|
||||
@ -236,7 +236,7 @@ public final class CommandUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getOnlinePlayerNames(CommandSender sender) {
|
||||
public List<String> getOnlinePlayerNames(CommandSender sender) {
|
||||
Player player = sender instanceof Player ? (Player) sender : null;
|
||||
List<String> onlinePlayerNames = new ArrayList<>();
|
||||
|
||||
@ -255,7 +255,7 @@ public final class CommandUtils {
|
||||
* @param partialName Name to match
|
||||
* @return Matched name or {@code partialName} if no match was found
|
||||
*/
|
||||
public static String getMatchedPlayerName(String partialName) {
|
||||
public String getMatchedPlayerName(String partialName) {
|
||||
if (pluginRef.getConfigManager().getConfigCommands().getMisc().isMatchOfflinePlayers()) {
|
||||
List<String> matches = matchPlayer(partialName);
|
||||
|
||||
@ -282,7 +282,7 @@ public final class CommandUtils {
|
||||
* @param partialName Name to match
|
||||
* @return List of all possible names
|
||||
*/
|
||||
private static List<String> matchPlayer(String partialName) {
|
||||
private List<String> matchPlayer(String partialName) {
|
||||
List<String> matchedPlayers = new ArrayList<>();
|
||||
|
||||
for (OfflinePlayer offlinePlayer : pluginRef.getServer().getOfflinePlayers()) {
|
@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillRandomCheckEvent;
|
||||
import com.gmail.nossr50.util.EventManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -19,7 +19,9 @@ import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.bukkit.GameMode;
|
||||
|
Loading…
Reference in New Issue
Block a user