Changed the basecommand to throw a DisguiseParseException instead of IllegalArguementException
This commit is contained in:
@@ -27,13 +27,14 @@ public class DisguiseCommand extends BaseDisguiseCommand {
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, args, getPermissions(sender));
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
} catch (DisguiseParseException ex) {
|
||||
if (ex.getMessage() != null) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
} else {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
if (DisguiseConfig.isNameOfPlayerShownAboveDisguise()) {
|
||||
if (disguise.getWatcher() instanceof LivingWatcher) {
|
||||
|
@@ -8,7 +8,6 @@ import me.libraryaddict.disguise.DisguiseListener;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -31,13 +30,14 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, args, getPermissions(sender));
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
} catch (DisguiseParseException ex) {
|
||||
if (ex.getMessage() != null) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
} else {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
listener.setDisguiseEntity(sender.getName(), disguise);
|
||||
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseEntityExpire()
|
||||
|
@@ -9,7 +9,6 @@ import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -44,13 +43,14 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, newArgs, map);
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
} catch (DisguiseParseException ex) {
|
||||
if (ex.getMessage() != null) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
} else {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) {
|
||||
sender.sendMessage(ChatColor.RED
|
||||
|
@@ -11,7 +11,6 @@ import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
import me.libraryaddict.disguise.utilities.ClassGetter;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -100,13 +99,14 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, newArgs, map);
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
} catch (DisguiseParseException ex) {
|
||||
if (ex.getMessage() != null) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
} else {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return true;
|
||||
} // Time to use it!
|
||||
int disguisedEntitys = 0;
|
||||
int miscDisguises = 0;
|
||||
|
Reference in New Issue
Block a user