Fix yaml issue with /kit

This commit is contained in:
KHobbits 2012-08-10 02:26:23 +01:00
parent e198b61eae
commit 8aab57e86b
3 changed files with 11 additions and 5 deletions

View File

@ -79,6 +79,7 @@ public class Kit
throw new Exception(_("kitError2"));
}
try
{
return (List<String>)kit.get("items");

View File

@ -26,12 +26,12 @@ public class Commandkit extends EssentialsCommand
else if (args.length > 1 && user.isAuthorized("essentials.kit.others"))
{
final User userTo = getPlayer(server, args, 1, true);
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH));
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim();
giveKit(userTo, user, kitName);
}
else
{
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH));
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim();
giveKit(user, user, kitName);
}
}
@ -60,6 +60,11 @@ public class Commandkit extends EssentialsCommand
private void giveKit(User userTo, User userFrom, String kitName) throws Exception
{
if (kitName.isEmpty())
{
throw new Exception(_("kitError2"));
}
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
if (!userFrom.isAuthorized("essentials.kit." + kitName))

View File

@ -19,7 +19,7 @@ public class SignKit extends EssentialsSign
{
validateTrade(sign, 3, ess);
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH);
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH).trim();
if (kitName.isEmpty())
{
@ -48,7 +48,7 @@ public class SignKit extends EssentialsSign
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
{
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH);
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH).trim();
final String group = sign.getLine(2);
if ((!group.isEmpty() && ("§2Everyone".equals(group) || player.inGroup(group)))
|| (group.isEmpty() && (player.isAuthorized("essentials.kit." + kitName))))