Fix alias too long issue

This commit is contained in:
boy0001 2015-01-04 15:43:36 +11:00
parent 55fe1c74c7
commit bbf5ba4488
2 changed files with 5 additions and 0 deletions

View File

@ -212,6 +212,10 @@ public class Set extends SubCommand {
return false; return false;
} }
final String alias = args[1]; final String alias = args[1];
if (alias.length() >= 50) {
PlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG);
return false;
}
for (final Plot p : PlotMain.getPlots(plr.getWorld()).values()) { for (final Plot p : PlotMain.getPlots(plr.getWorld()).values()) {
if (p.settings.getAlias().equalsIgnoreCase(alias)) { if (p.settings.getAlias().equalsIgnoreCase(alias)) {
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);

View File

@ -137,6 +137,7 @@ public enum C {
*/ */
ALIAS_SET_TO("&cPlot alias set to &6%alias%"), ALIAS_SET_TO("&cPlot alias set to &6%alias%"),
MISSING_ALIAS("&cYou need to specify an alias"), MISSING_ALIAS("&cYou need to specify an alias"),
ALIAS_TOO_LONG("&cThe alias must be < 50 characters in length"),
ALIAS_IS_TAKEN("&cThat alias is already taken"), ALIAS_IS_TAKEN("&cThat alias is already taken"),
/* /*
* Position * Position