Current work
This commit is contained in:
@@ -33,7 +33,7 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
|
||||
itel.remove();
|
||||
}
|
||||
|
||||
return new ArrayList<String>(new HashSet<String>(list));
|
||||
return new ArrayList<>(new HashSet<>(list));
|
||||
}
|
||||
|
||||
protected ArrayList<String> getAllowedDisguises(
|
||||
|
@@ -4,6 +4,7 @@ import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -21,8 +22,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender.getName().equals("CONSOLE")) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
|
||||
|
||||
for (int i = player == null ? 0 : 1; i < args.length; i++) {
|
||||
String option = args[i];
|
||||
if (StringUtils.startsWithIgnoreCase(option, "ignoreEquip") || StringUtils.startsWithIgnoreCase(option,
|
||||
"ignoreEnquip")) {
|
||||
if (StringUtils.startsWithIgnoreCase(option, "ignoreEquip") || StringUtils
|
||||
.startsWithIgnoreCase(option, "ignoreEnquip")) {
|
||||
doEquipment = false;
|
||||
} else if (option.equalsIgnoreCase("doSneakSprint")) {
|
||||
doSneak = true;
|
||||
@@ -49,9 +49,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
|
||||
} else if (option.equalsIgnoreCase("doSprint")) {
|
||||
doSprint = true;
|
||||
} else {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_RED + "Unknown " + "option '%s" + "' - Valid options are 'IgnoreEquipment' 'DoSneakSprint' 'DoSneak' 'DoSprint'"),
|
||||
option));
|
||||
sender.sendMessage(LibsMsg.INVALID_CLONE.get(option));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -63,12 +61,10 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
|
||||
} else {
|
||||
LibsDisguises.getInstance().getListener().setDisguiseClone(sender.getName(), options);
|
||||
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Right click a entity in the next %s" + " seconds to grab the disguise reference!"),
|
||||
DisguiseConfig.getDisguiseCloneExpire()));
|
||||
sender.sendMessage(LibsMsg.CLICK_TIMER.get(DisguiseConfig.getDisguiseCloneExpire()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -100,11 +96,8 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
|
||||
@Override
|
||||
protected void sendCommandUsage(CommandSender sender,
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "Right click a entity to get a disguise reference you can pass to other " + "disguise commands!"));
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "Security note: Any references you create will be available to all players " + "able to use disguise references."));
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "/disguiseclone IgnoreEquipment" + ChatColor.DARK_GREEN + "(" + ChatColor.GREEN + "Optional" + ChatColor.DARK_GREEN + ")"));
|
||||
sender.sendMessage(LibsMsg.CLONE_HELP1.get());
|
||||
sender.sendMessage(LibsMsg.CLONE_HELP2.get());
|
||||
sender.sendMessage(LibsMsg.CLONE_HELP3.get());
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
@@ -31,8 +32,7 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Entity)) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the " + "console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,11 +71,9 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
|
||||
DisguiseAPI.disguiseToAll((Player) sender, disguise);
|
||||
|
||||
if (disguise.isDisguiseInUse()) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Now disguised as a %s"),
|
||||
disguise.getType().toReadable()));
|
||||
sender.sendMessage(LibsMsg.DISGUISED.get(disguise.getType().toReadable()));
|
||||
} else {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Failed to disguise as a %s"),
|
||||
disguise.getType().toReadable()));
|
||||
sender.sendMessage(LibsMsg.FAILED_DISGIUSE.get(disguise.getType().toReadable()));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -143,8 +141,8 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
|
||||
|
||||
if (addMethods) {
|
||||
// If this is a method, add. Else if it can be a param of the previous argument, add.
|
||||
for (Method method : ReflectionFlagWatchers.getDisguiseWatcherMethods(
|
||||
disguiseType.getWatcherClass())) {
|
||||
for (Method method : ReflectionFlagWatchers
|
||||
.getDisguiseWatcherMethods(disguiseType.getWatcherClass())) {
|
||||
tabs.add(method.getName());
|
||||
}
|
||||
}
|
||||
@@ -162,21 +160,18 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
|
||||
protected void sendCommandUsage(CommandSender sender,
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "Choose a disguise to become the disguise!"));
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can use the disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.DISG_HELP1.get());
|
||||
sender.sendMessage(LibsMsg.CAN_USE_DISGS
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "/disguise player " + "<Name>"));
|
||||
sender.sendMessage(LibsMsg.DISG_HELP2.get());
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "/disguise <DisguiseType> " + "<Baby>"));
|
||||
sender.sendMessage(LibsMsg.DISG_HELP3.get());
|
||||
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "/disguise " + "<Dropped_Item/Falling_Block> <Id> <Durability>"));
|
||||
sender.sendMessage(LibsMsg.DISG_HELP4.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
@@ -28,13 +29,12 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the " + "console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getPermissions(sender).isEmpty()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
LibsDisguises.getInstance().getListener().setDisguiseEntity(sender.getName(), disguise);
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Right click an entity in the next " + DisguiseConfig.getDisguiseEntityExpire() + " " + "seconds to disguise it as a " + disguise.getType().toReadable() + "!"));
|
||||
sender.sendMessage(
|
||||
LibsMsg.DISG_ENT_CLICK.get(DisguiseConfig.getDisguiseEntityExpire(), disguise.getType().toReadable()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (addMethods) {
|
||||
// If this is a method, add. Else if it can be a param of the previous argument, add.
|
||||
for (Method method : ReflectionFlagWatchers.getDisguiseWatcherMethods(
|
||||
disguiseType.getWatcherClass())) {
|
||||
for (Method method : ReflectionFlagWatchers
|
||||
.getDisguiseWatcherMethods(disguiseType.getWatcherClass())) {
|
||||
tabs.add(method.getName());
|
||||
}
|
||||
}
|
||||
@@ -158,21 +158,18 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "Choose a disguise then right click an entity to disguise it!"));
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can use the " + "disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.DISG_ENT_HELP1.get());
|
||||
sender.sendMessage(LibsMsg.DISG_ENT_HELP2
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "/disguiseentity player <Name>"));
|
||||
sender.sendMessage(LibsMsg.DISG_ENT_HELP3.get());
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "/disguiseentity <DisguiseType> <Baby>"));
|
||||
sender.sendMessage(LibsMsg.DISG_ENT_HELP4.get());
|
||||
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "/disguiseentity <Dropped_Item/Falling_Block> <Id> " + "<Durability>"));
|
||||
sender.sendMessage(LibsMsg.DISG_ENT_HELP5.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
@@ -24,8 +25,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
for (String node : new String[]{"disguise", "disguiseradius", "disguiseentity", "disguiseplayer"}) {
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> permMap = DisguiseParser.getPermissions(sender,
|
||||
"libsdisguises." + node + ".");
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> permMap = DisguiseParser
|
||||
.getPermissions(sender, "libsdisguises." + node + ".");
|
||||
|
||||
if (!permMap.isEmpty()) {
|
||||
if (args.length == 0) {
|
||||
@@ -45,9 +46,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
|
||||
if (help != null) {
|
||||
if (help.isEnums()) {
|
||||
sender.sendMessage(
|
||||
ChatColor.RED + help.getName() + ": " + ChatColor.GREEN + StringUtils.join(
|
||||
help.getEnums(""), ChatColor.RED + ", " + ChatColor.GREEN));
|
||||
sender.sendMessage(ChatColor.RED + help.getName() + ": " + ChatColor.GREEN + StringUtils
|
||||
.join(help.getEnums(""), ChatColor.RED + ", " + ChatColor.GREEN));
|
||||
} else {
|
||||
sender.sendMessage(
|
||||
ChatColor.RED + help.getName() + ": " + ChatColor.GREEN + help.getDescription());
|
||||
@@ -58,14 +58,12 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
DisguisePerm type = DisguiseParser.getDisguisePerm(args[0]);
|
||||
|
||||
if (type == null) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "Cannot find the disguise ") + args[0]);
|
||||
sender.sendMessage(LibsMsg.DHELP_CANTFIND.get(args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!permMap.containsKey(type)) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "You do not have permission for " + "that disguise!"));
|
||||
sender.sendMessage(LibsMsg.NO_PERM_DISGUISE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -109,12 +107,13 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
|
||||
if (declaring == LivingWatcher.class) {
|
||||
methodColor = ChatColor.AQUA;
|
||||
} else if (!(FlagWatcher.class.isAssignableFrom(
|
||||
declaring)) || declaring == FlagWatcher.class) {
|
||||
} else if (!(FlagWatcher.class
|
||||
.isAssignableFrom(declaring)) || declaring == FlagWatcher.class) {
|
||||
methodColor = ChatColor.GRAY;
|
||||
}
|
||||
|
||||
String str = method.getName() + ChatColor.DARK_RED + "(" + ChatColor.GREEN + info.getName() + ChatColor.DARK_RED + ")";
|
||||
String str = method.getName() + ChatColor.DARK_RED + "(" + ChatColor.GREEN + info
|
||||
.getName() + ChatColor.DARK_RED + ")";
|
||||
|
||||
map.put(str, methodColor);
|
||||
methods.add(str);
|
||||
@@ -134,13 +133,11 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
methods.add(ChatColor.RED + "No options with permission to use");
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.DARK_RED + type.toReadable() + TranslateType.MESSAGE.get(
|
||||
" options: ") + StringUtils.join(methods, ChatColor.DARK_RED + ", "));
|
||||
sender.sendMessage(LibsMsg.DHELP_OPTIONS.get(ChatColor.DARK_RED + type.toReadable(),
|
||||
StringUtils.join(methods, ChatColor.DARK_RED + ", ")));
|
||||
|
||||
if (ignored > 0) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Ignored %s" + " options you do not have permission to use. Add " + "'show' to view unusable options."),
|
||||
ignored));
|
||||
sender.sendMessage(LibsMsg.NO_PERMS_USE_OPTIONS.get(ignored));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -148,7 +145,7 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -158,8 +155,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
String[] args = getArgs(origArgs);
|
||||
|
||||
for (String node : new String[]{"disguise", "disguiseradius", "disguiseentity", "disguiseplayer"}) {
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> perms = DisguiseParser.getPermissions(sender,
|
||||
"libsdisguises." + node + ".");
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> perms = DisguiseParser
|
||||
.getPermissions(sender, "libsdisguises." + node + ".");
|
||||
|
||||
if (args.length == 0) {
|
||||
for (DisguisePerm type : perms.keySet()) {
|
||||
@@ -186,12 +183,10 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
@Override
|
||||
protected void sendCommandUsage(CommandSender sender,
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "/disguisehelp <DisguiseType> " + ChatColor.GREEN + "- View the options you can set " + "on a disguise. Add 'show' to reveal the options you don't have permission to use"));
|
||||
sender.sendMessage(LibsMsg.DHELP_HELP1.get());
|
||||
|
||||
for (ParamInfo s : ReflectionFlagWatchers.getParamInfos()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "/disguisehelp " + s.getName().replaceAll(" ",
|
||||
"") + ChatColor.GREEN + " - " + s.getDescription()));
|
||||
sender.sendMessage(LibsMsg.DHELP_HELP2.get(s.getName().replaceAll(" ", ""), s.getDescription()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
@@ -27,15 +28,14 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Entity)) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map = getPermissions(sender);
|
||||
|
||||
if (map.isEmpty()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,18 +47,19 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
||||
Disguise disguise = DisguiseAPI.getDisguise((Player) sender, (Entity) sender);
|
||||
|
||||
if (disguise == null) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are not disguised!"));
|
||||
sender.sendMessage(LibsMsg.NOT_DISGUISED.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!map.containsKey(new DisguisePerm(disguise.getType()))) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "No permission to modify your disguise!"));
|
||||
sender.sendMessage(LibsMsg.DMODIFY_NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
DisguiseParser.callMethods(sender, disguise,
|
||||
getPermissions(sender).get(new DisguisePerm(disguise.getType())), new ArrayList<String>(), args);
|
||||
DisguiseParser
|
||||
.callMethods(sender, disguise, getPermissions(sender).get(new DisguisePerm(disguise.getType())),
|
||||
new ArrayList<String>(), args);
|
||||
}
|
||||
catch (DisguiseParseException ex) {
|
||||
if (ex.getMessage() != null) {
|
||||
@@ -72,7 +73,7 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "Your disguise has been modified!"));
|
||||
sender.sendMessage(LibsMsg.DMODIFY_MODIFIED.get());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -152,12 +153,9 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
||||
protected void sendCommandUsage(CommandSender sender,
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "Modify your own disguise as you wear " + "it!"));
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "/disguisemodify setBaby true setSprinting true"));
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can modify the " + "disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.DMODIFY_HELP3.get());
|
||||
sender.sendMessage(LibsMsg.DMODIFY_HELP3.get());
|
||||
sender.sendMessage(LibsMsg.DMODIFY_HELP3
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package me.libraryaddict.disguise.commands;
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
@@ -23,13 +24,12 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the " + "console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getPermissions(sender).isEmpty()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,7 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
|
||||
|
||||
LibsDisguises.getInstance().getListener().setDisguiseModify(sender.getName(), args);
|
||||
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Right click a disguised entity " + "in the next %s seconds to modify their disguise!"),
|
||||
DisguiseConfig.getDisguiseEntityExpire()));
|
||||
sender.sendMessage(LibsMsg.DMODIFYENT_CLICK.get(DisguiseConfig.getDisguiseEntityExpire()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,8 +87,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
|
||||
|
||||
if (addMethods) {
|
||||
// If this is a method, add. Else if it can be a param of the previous argument, add.
|
||||
for (Method method : ReflectionFlagWatchers.getDisguiseWatcherMethods(
|
||||
perm.getType().getWatcherClass())) {
|
||||
for (Method method : ReflectionFlagWatchers
|
||||
.getDisguiseWatcherMethods(perm.getType().getWatcherClass())) {
|
||||
tabs.add(method.getName());
|
||||
}
|
||||
}
|
||||
@@ -110,10 +108,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "Choose the options for a disguise then right click a entity to modify it!"));
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can modify the " + "disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.DMODENT_HELP1.get());
|
||||
sender.sendMessage(LibsMsg.DMODENT_HELP2
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
}
|
||||
}
|
||||
|
@@ -5,9 +5,9 @@ import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -28,7 +28,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map = getPermissions(sender);
|
||||
|
||||
if (map.isEmpty()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Cannot find the player '%s" + "'"),
|
||||
args[0]));
|
||||
sender.sendMessage(LibsMsg.CANNOT_FIND_PLAYER.get(args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,15 +61,12 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
disguise = DisguiseAPI.getDisguise(player);
|
||||
|
||||
if (disguise == null) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "The player '%s' is " + "not disguised"),
|
||||
player.getName()));
|
||||
sender.sendMessage(LibsMsg.DMODPLAYER_NODISGUISE.get(player.getName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!map.containsKey(new DisguisePerm(disguise.getType()))) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "You do not have permission to modify this " + "disguise"));
|
||||
sender.sendMessage(LibsMsg.DMODPLAYER_NOPERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -91,8 +86,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "Modified the disguise of " + player.getName() + "!"));
|
||||
sender.sendMessage(LibsMsg.DMODPLAYER_MODIFIED.get(player.getName()));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -115,9 +109,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Cannot find the player '%s'"),
|
||||
args[0]));
|
||||
sender.sendMessage(LibsMsg.CANNOT_FIND_PLAYER.get(args[0]));
|
||||
return tabs;
|
||||
}
|
||||
|
||||
@@ -130,9 +122,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
disguise = DisguiseAPI.getDisguise(player);
|
||||
|
||||
if (disguise == null) {
|
||||
sender.sendMessage(String.format(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "The player '%s' " + "is not disguised"),
|
||||
player.getName()));
|
||||
sender.sendMessage(LibsMsg.DMODPLAYER_NODISGUISE.get(player.getName()));
|
||||
return tabs;
|
||||
}
|
||||
|
||||
@@ -179,8 +169,8 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
|
||||
if (addMethods) {
|
||||
// If this is a method, add. Else if it can be a param of the previous argument, add.
|
||||
for (Method method : ReflectionFlagWatchers.getDisguiseWatcherMethods(
|
||||
disguiseType.getWatcherClass())) {
|
||||
for (Method method : ReflectionFlagWatchers
|
||||
.getDisguiseWatcherMethods(disguiseType.getWatcherClass())) {
|
||||
tabs.add(method.getName());
|
||||
}
|
||||
}
|
||||
@@ -198,9 +188,8 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "Modify the disguise of another player!"));
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can modify the " + "disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.DMODPLAYER_HELP1.get());
|
||||
sender.sendMessage(LibsMsg.DMODPLAYER_HELP2
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
}
|
||||
}
|
||||
|
@@ -3,13 +3,10 @@ package me.libraryaddict.disguise.commands;
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.utilities.ClassGetter;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.*;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -53,15 +50,14 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender.getName().equals("CONSOLE")) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the " + "console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map = getPermissions(sender);
|
||||
|
||||
if (map.isEmpty()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,10 +75,8 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
||||
|
||||
Collections.sort(classes);
|
||||
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "EntityTypes usable " + "are: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(classes,
|
||||
ChatColor.DARK_GREEN + ", " + ChatColor.GREEN) + ChatColor.DARK_GREEN + "."));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_USABLE
|
||||
.get(ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -107,36 +101,30 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
||||
}
|
||||
|
||||
if (type == null) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Unrecognised " + "EntityType %s"),
|
||||
args[0]));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_UNRECOGNIZED.get(args[0]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == starting + 1) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "You need to supply the disguise options as well as the radius" + (starting != 0 ?
|
||||
" and EntityType" : "")));
|
||||
sender.sendMessage(
|
||||
(starting == 0 ? LibsMsg.DMODRADIUS_NEEDOPTIONS : LibsMsg.DMODRADIUS_NEEDOPTIONS_ENTITY).get());
|
||||
return true;
|
||||
} else if (args.length < 2) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "You need to supply a radius as well as " + "the disguise options"));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_NEEDOPTIONS.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isNumeric(args[starting])) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(ChatColor.RED + "%s is not a " + "number"),
|
||||
args[starting]));
|
||||
sender.sendMessage(LibsMsg.NOT_NUMBER.get(args[starting]));
|
||||
return true;
|
||||
}
|
||||
|
||||
int radius = Integer.parseInt(args[starting]);
|
||||
|
||||
if (radius > maxRadius) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Limited radius to %s! Don't want to make too much lag right?"), maxRadius));
|
||||
sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius));
|
||||
radius = maxRadius;
|
||||
}
|
||||
|
||||
@@ -192,16 +180,13 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
||||
}
|
||||
|
||||
if (noPermission > 0) {
|
||||
sender.sendMessage(String.format(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "No permission to modify " + "%s disguises!"),
|
||||
noPermission));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_NOPERM.get(noPermission));
|
||||
}
|
||||
|
||||
if (modifiedDisguises > 0) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Successfully modified the disguises of %s" + " entities!"), modifiedDisguises));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS.get(modifiedDisguises));
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "Couldn't find any disguised entities!"));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_NOENTS.get());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -241,8 +226,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
||||
int radius = Integer.parseInt(args[starting]);
|
||||
|
||||
if (radius > maxRadius) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Limited radius to %s! Don't want to make too much lag right?"), maxRadius));
|
||||
sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius));
|
||||
radius = maxRadius;
|
||||
}
|
||||
|
||||
@@ -293,8 +277,8 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
||||
|
||||
if (addMethods) {
|
||||
// If this is a method, add. Else if it can be a param of the previous argument, add.
|
||||
for (Method method : ReflectionFlagWatchers.getDisguiseWatcherMethods(
|
||||
disguiseType.getWatcherClass())) {
|
||||
for (Method method : ReflectionFlagWatchers
|
||||
.getDisguiseWatcherMethods(disguiseType.getWatcherClass())) {
|
||||
tabs.add(method.getName());
|
||||
}
|
||||
}
|
||||
@@ -312,31 +296,22 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "Modify the disguises in a radius! Caps at %s blocks!"), maxRadius));
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can modify the disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_HELP1.get(maxRadius));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_HELP2
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
|
||||
String optional = ChatColor.DARK_GREEN + "(" + ChatColor.GREEN + "Optional" + ChatColor.DARK_GREEN + ")";
|
||||
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
(ChatColor.DARK_GREEN + "/disguiseradius <EntityType" + optional + "> <Radius> player <Name>").replace(
|
||||
"<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">")));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_HELP3.get());
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
(ChatColor.DARK_GREEN + "/disguiseradius <EntityType" + optional + "> <Radius> <DisguiseType> <Baby" + optional + ">").replace(
|
||||
"<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">")));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_HELP4.get());
|
||||
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
(ChatColor.DARK_GREEN + "/disguiseradius <EntityType" + optional + "> <Radius> <Dropped_Item/Falling_Block> <Id> <Durability" + optional + ">").replace(
|
||||
"<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">")));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_HELP5.get());
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "See the EntityType's usable by " + ChatColor.GREEN + "/disguiseradius " + "EntityTypes"));
|
||||
sender.sendMessage(LibsMsg.DMODRADIUS_HELP6.get());
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
@@ -32,7 +33,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map = getPermissions(sender);
|
||||
|
||||
if (map.isEmpty()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,16 +43,14 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
||||
}
|
||||
|
||||
if (args.length == 1) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "You need to supply a disguise as well as " + "the player"));
|
||||
sender.sendMessage(LibsMsg.DPLAYER_SUPPLY.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Cannot find the player '%s'"), args[0]));
|
||||
sender.sendMessage(LibsMsg.CANNOT_FIND_PLAYER.get(args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,8 +80,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
||||
}
|
||||
|
||||
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Can't disguise a living entity as a misc disguise. This has been disabled in the" + " config!"));
|
||||
sender.sendMessage(LibsMsg.DISABLED_LIVING_TO_MISC.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,13 +98,9 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
||||
DisguiseAPI.disguiseToAll(player, disguise);
|
||||
|
||||
if (disguise.isDisguiseInUse()) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Successfully disguised %s as a %s!"),
|
||||
player.getName(), disguise.getType().toReadable()));
|
||||
sender.sendMessage(LibsMsg.DISG_PLAYER_AS_DISG.get(player.getName(), disguise.getType().toReadable()));
|
||||
} else {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Failed to disguise %s as a %s!"),
|
||||
player.getName(), disguise.getType().toReadable()));
|
||||
sender.sendMessage(LibsMsg.DISG_PLAYER_AS_DISG_FAIL.get(player.getName(), disguise.getType().toReadable()));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -175,8 +169,8 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (addMethods) {
|
||||
// If this is a method, add. Else if it can be a param of the previous argument, add.
|
||||
for (Method method : ReflectionFlagWatchers.getDisguiseWatcherMethods(
|
||||
disguiseType.getWatcherClass())) {
|
||||
for (Method method : ReflectionFlagWatchers
|
||||
.getDisguiseWatcherMethods(disguiseType.getWatcherClass())) {
|
||||
tabs.add(method.getName());
|
||||
}
|
||||
}
|
||||
@@ -195,22 +189,18 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Disguise another player!");
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can use the " + "disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.D_HELP1.get());
|
||||
sender.sendMessage(LibsMsg.D_HELP2
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "/disguiseplayer <PlayerName> player " + "<Name>"));
|
||||
sender.sendMessage(LibsMsg.D_HELP3.get());
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "/disguiseplayer <PlayerName> " + "<DisguiseType> <Baby>"));
|
||||
sender.sendMessage(LibsMsg.D_HELP4.get());
|
||||
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "/disguiseplayer <PlayerName> <Dropped_Item/Falling_Block> <Id> " + "<Durability>"));
|
||||
sender.sendMessage(LibsMsg.D_HELP5.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,13 +5,10 @@ import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.ClassGetter;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||
import me.libraryaddict.disguise.utilities.*;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -44,15 +41,14 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender.getName().equals("CONSOLE")) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map = getPermissions(sender);
|
||||
|
||||
if (map.isEmpty()) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -70,10 +66,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
Collections.sort(classes);
|
||||
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "EntityTypes usable are: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(classes,
|
||||
ChatColor.DARK_GREEN + ", " + ChatColor.GREEN)));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_ENTITIES
|
||||
.get(ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -98,36 +92,30 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
}
|
||||
|
||||
if (type == null) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Unrecognised " + "EntityType %s"),
|
||||
args[0]));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_UNRECOG.get(args[0]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == starting + 1) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "You need to supply a disguise as well as the radius" + (starting != 0 ?
|
||||
" and EntityType" : "")));
|
||||
sender.sendMessage(
|
||||
(starting == 0 ? LibsMsg.DRADIUS_NEEDOPTIONS : LibsMsg.DRADIUS_NEEDOPTIONS_ENTITY).get());
|
||||
return true;
|
||||
} else if (args.length < 2) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "You need to supply a radius as well as " + "the disguise"));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_NEEDOPTIONS.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isNumeric(args[starting])) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "%s is not a number"), args[starting]));
|
||||
sender.sendMessage(LibsMsg.NOT_NUMBER.get(args[starting]));
|
||||
return true;
|
||||
}
|
||||
|
||||
int radius = Integer.parseInt(args[starting]);
|
||||
|
||||
if (radius > maxRadius) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Limited radius to %s! Don't want to make too much lag right?"), maxRadius));
|
||||
sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius));
|
||||
radius = maxRadius;
|
||||
}
|
||||
|
||||
@@ -173,7 +161,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
}
|
||||
|
||||
if (type != null ? entity.getType() == type : entityClass.isAssignableFrom(entity.getClass())) {
|
||||
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() && entity instanceof LivingEntity) {
|
||||
if (disguise.isMiscDisguise() && !DisguiseConfig
|
||||
.isMiscDisguisesForLivingEnabled() && entity instanceof LivingEntity) {
|
||||
miscDisguises++;
|
||||
continue;
|
||||
}
|
||||
@@ -198,17 +187,13 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
}
|
||||
|
||||
if (disguisedEntitys > 0) {
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Successfully disguised %s" + " entities!"),
|
||||
disguisedEntitys));
|
||||
sender.sendMessage(LibsMsg.DISRADIUS.get(disguisedEntitys));
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "Couldn't find any entities to disguise!"));
|
||||
sender.sendMessage(LibsMsg.DISRADIUS_FAIL.get());
|
||||
}
|
||||
|
||||
if (miscDisguises > 0) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Failed to disguise %s entities because the option to disguise a living entity as" + " a non-living has been disabled in the config"),
|
||||
miscDisguises));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_MISCDISG.get(miscDisguises));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -299,8 +284,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (addMethods) {
|
||||
// If this is a method, add. Else if it can be a param of the previous argument, add.
|
||||
for (Method method : ReflectionFlagWatchers.getDisguiseWatcherMethods(
|
||||
disguiseType.getWatcherClass())) {
|
||||
for (Method method : ReflectionFlagWatchers
|
||||
.getDisguiseWatcherMethods(disguiseType.getWatcherClass())) {
|
||||
tabs.add(method.getName());
|
||||
}
|
||||
}
|
||||
@@ -319,31 +304,20 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
HashMap<DisguisePerm, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "Disguise all entities in a radius! Caps at %s blocks!"), maxRadius));
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.DARK_GREEN + "You can use the " + "disguises: %s"),
|
||||
ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
|
||||
String optional = ChatColor.DARK_GREEN + "(" + ChatColor.GREEN + "Optional" + ChatColor.DARK_GREEN + ")";
|
||||
sender.sendMessage(LibsMsg.DRADIUS_HELP1.get(maxRadius));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_HELP2
|
||||
.get(ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)));
|
||||
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
(ChatColor.DARK_GREEN + "/disguiseradius <EntityType" + optional + "> <Radius> player <Name>").replace(
|
||||
"<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">")));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_HELP3.get());
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
(ChatColor.DARK_GREEN + "/disguiseradius <EntityType" + optional + "> <Radius> <DisguiseType> <Baby" + optional + ">").replace(
|
||||
"<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">")));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_HELP4.get());
|
||||
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
(ChatColor.DARK_GREEN + "/disguiseradius <EntityType" + optional + "> <Radius> <Dropped_Item/Falling_Block> <Id> <Durability" + optional + ">").replace(
|
||||
"<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">")));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_HELP5.get());
|
||||
}
|
||||
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.DARK_GREEN + "See the EntityType's usable by " + ChatColor.GREEN + "/disguiseradius " + "EntityTypes"));
|
||||
sender.sendMessage(LibsMsg.DRADIUS_HELP6.get());
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -7,8 +9,6 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
|
||||
/**
|
||||
* @author Navid
|
||||
*/
|
||||
@@ -17,8 +17,7 @@ public class DisguiseViewSelfCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender.getName().equals("CONSOLE")) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the " + "console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,10 +25,10 @@ public class DisguiseViewSelfCommand implements CommandExecutor {
|
||||
|
||||
if (DisguiseAPI.isViewSelfToggled(player)) {
|
||||
DisguiseAPI.setViewDisguiseToggled(player, false);
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.GREEN + "Toggled viewing own disguise off!"));
|
||||
sender.sendMessage(LibsMsg.VIEW_SELF_ON.get());
|
||||
} else {
|
||||
DisguiseAPI.setViewDisguiseToggled(player, true);
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.GREEN + "Toggled viewing own disguise on!"));
|
||||
sender.sendMessage(LibsMsg.VIEW_SELF_OFF.get());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -35,7 +36,7 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
protected String[] getArgs(String[] args) {
|
||||
ArrayList<String> newArgs = new ArrayList<String>();
|
||||
ArrayList<String> newArgs = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < args.length - 1; i++) {
|
||||
String s = args[i];
|
||||
@@ -53,8 +54,9 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage(
|
||||
ChatColor.DARK_GREEN + "This server is running " + "Lib's Disguises v" + Bukkit.getPluginManager().getPlugin(
|
||||
"LibsDisguises").getDescription().getVersion() + " by libraryaddict, formerly maintained " + "by Byteflux and NavidK0." + (
|
||||
ChatColor.DARK_GREEN + "This server is running " + "Lib's Disguises v" + Bukkit.getPluginManager()
|
||||
.getPlugin("LibsDisguises").getDescription()
|
||||
.getVersion() + " by libraryaddict, formerly maintained " + "by Byteflux and NavidK0." + (
|
||||
sender.hasPermission("libsdisguises.reload") ?
|
||||
"\nUse " + ChatColor.GREEN + "/libsdisguises " + "reload" + ChatColor.DARK_GREEN + " to reload the config. All disguises will be blown by doing this" + "." :
|
||||
""));
|
||||
@@ -66,14 +68,13 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
||||
if (sender.hasPermission("libsdisguises.reload")) {
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
LibsDisguises.getInstance().reload();
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.GREEN + "[LibsDisguises] Reloaded config."));
|
||||
sender.sendMessage(LibsMsg.RELOADED_CONFIG.get());
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "[LibsDisguises] Did you mean 'reload'?"));
|
||||
sender.sendMessage(LibsMsg.LIBS_RELOAD_WRONG.get());
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -8,27 +10,26 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
|
||||
public class UndisguiseCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender.getName().equals("CONSOLE")) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the " + "console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender.hasPermission("libsdisguises.undisguise")) {
|
||||
if (DisguiseAPI.isDisguised((Entity) sender)) {
|
||||
DisguiseAPI.undisguiseToAll((Player) sender);
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are no longer disguised"));
|
||||
sender.sendMessage(LibsMsg.UNDISG.get());
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are not disguised!"));
|
||||
sender.sendMessage(LibsMsg.UNDISG_FAIL.get());
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -12,16 +13,14 @@ public class UndisguiseEntityCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender.getName().equals("CONSOLE")) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
if (sender.hasPermission("libsdisguises.undisguiseentity")) {
|
||||
LibsDisguises.getInstance().getListener().setDisguiseEntity(sender.getName(), null);
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Right click a disguised entity to " + "undisguise them!"));
|
||||
sender.sendMessage(LibsMsg.UND_ENTITY.get());
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -57,19 +56,18 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
||||
if (p != null) {
|
||||
if (DisguiseAPI.isDisguised(p)) {
|
||||
DisguiseAPI.undisguiseToAll(p);
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "The player is no longer disguised"));
|
||||
sender.sendMessage(LibsMsg.UNDISG_PLAYER.get(p.getName()));
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "The player is not disguised!"));
|
||||
sender.sendMessage(LibsMsg.UNDISG_PLAYER_FAIL.get(p.getName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "Player not found"));
|
||||
sender.sendMessage(LibsMsg.CANNOT_FIND_PLAYER.get(args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "/undisguiseplayer <Name>"));
|
||||
sender.sendMessage(LibsMsg.UNDISG_PLAYER_HELP.get());
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -29,24 +30,20 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender.getName().equals("CONSOLE")) {
|
||||
sender.sendMessage(
|
||||
TranslateType.MESSAGE.get(ChatColor.RED + "You may not use this command from the console!"));
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender.hasPermission("libsdisguises.undisguiseradius")) {
|
||||
int radius = maxRadius;
|
||||
if (args.length > 0) {
|
||||
if (!isNumeric(args[0])) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Error! " + ChatColor.GREEN + "%s" + ChatColor.RED + " is not a " + "number!"),
|
||||
args[0]));
|
||||
sender.sendMessage(LibsMsg.NOT_NUMBER.get(args[0]));
|
||||
return true;
|
||||
}
|
||||
radius = Integer.parseInt(args[0]);
|
||||
if (radius > maxRadius) {
|
||||
sender.sendMessage(String.format(TranslateType.MESSAGE.get(
|
||||
ChatColor.RED + "Limited radius to %s" + "! Don't want to make too much lag right?"),
|
||||
maxRadius));
|
||||
sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius));
|
||||
radius = maxRadius;
|
||||
}
|
||||
}
|
||||
@@ -61,11 +58,10 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
|
||||
disguisedEntitys++;
|
||||
}
|
||||
}
|
||||
sender.sendMessage(
|
||||
String.format(TranslateType.MESSAGE.get(ChatColor.RED + "Successfully undisguised %s entities!"),
|
||||
disguisedEntitys));
|
||||
|
||||
sender.sendMessage(LibsMsg.UNDISRADIUS.get(disguisedEntitys));
|
||||
} else {
|
||||
sender.sendMessage(TranslateType.MESSAGE.get(ChatColor.RED + "You are forbidden to use this command."));
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user