Strip invalid chars from kit names

This may possibly block some kits from working that previous worked, if the kit name contained unusual letters
This commit is contained in:
KHobbits 2012-05-19 17:41:52 +01:00
parent fee3d7c0d3
commit bc798977b5
3 changed files with 5 additions and 4 deletions

View File

@ -594,7 +594,7 @@ public abstract class UserData extends PlayerExtension implements IConf
public void setBanReason(String reason) public void setBanReason(String reason)
{ {
config.setProperty("ban.reason", reason); config.setProperty("ban.reason", Util.sanitizeString(reason));
config.save(); config.save();
} }

View File

@ -25,12 +25,12 @@ public class Commandkit extends EssentialsCommand
else if (args.length > 1 && user.isAuthorized("essentials.kit.others")) else if (args.length > 1 && user.isAuthorized("essentials.kit.others"))
{ {
final User userTo = getPlayer(server, args, 1, true); final User userTo = getPlayer(server, args, 1, true);
final String kitName = args[0].toLowerCase(Locale.ENGLISH); final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH));
giveKit(userTo, user, kitName); giveKit(userTo, user, kitName);
} }
else else
{ {
final String kitName = args[0].toLowerCase(Locale.ENGLISH); final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH));
giveKit(user, user, kitName); giveKit(user, user, kitName);
} }
} }

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server; import org.bukkit.Server;
@ -20,7 +21,7 @@ public class Commandsetjail extends EssentialsCommand
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
ess.getJails().setJail(args[0], user.getLocation()); ess.getJails().setJail(args[0], user.getLocation());
user.sendMessage(_("jailSet", args[0])); user.sendMessage(_("jailSet", Util.sanitizeString(args[0])));
} }
} }