Allow item/item trades still.

This commit is contained in:
KHobbits 2013-03-08 12:34:11 +00:00
parent 6436baf7a4
commit 6d552281d4
2 changed files with 4 additions and 10 deletions

View file

@ -164,7 +164,6 @@ public class MetaItemStack
{ {
List<String> pages = pager.getPages(split[1]); List<String> pages = pager.getPages(split[1]);
meta.setPages(pages); meta.setPages(pages);
stack.setItemMeta(meta); stack.setItemMeta(meta);
} }
else else
@ -397,8 +396,6 @@ public class MetaItemStack
stack.setItemMeta(pmeta); stack.setItemMeta(pmeta);
resetPotionMeta(); resetPotionMeta();
} }
} }
} }
@ -479,6 +476,7 @@ public class MetaItemStack
{ {
return null; return null;
} }
final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
if (user != null && !user.isAuthorized("essentials.enchant." + enchantmentName)) if (user != null && !user.isAuthorized("essentials.enchant." + enchantmentName))
{ {
@ -490,12 +488,7 @@ public class MetaItemStack
private boolean hasMetaPermission(final CommandSender sender, final String metaPerm, final boolean graceful, final IEssentials ess) throws Exception private boolean hasMetaPermission(final CommandSender sender, final String metaPerm, final boolean graceful, final IEssentials ess) throws Exception
{ {
final User user = ess.getUser(sender); final User user = ess.getUser(sender);
if (user == null) if (user == null || user.isAuthorized("essentials.itemspawn.meta-" + metaPerm))
{
return true;
}
if (user.isAuthorized("essentials.itemspawn.meta-" + metaPerm))
{ {
return true; return true;
} }

View file

@ -2,6 +2,7 @@ package com.earth2me.essentials.signs;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.*; import com.earth2me.essentials.*;
import com.earth2me.essentials.Trade.TradeType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
//TODO: TL exceptions //TODO: TL exceptions
@ -20,7 +21,7 @@ public class SignTrade extends EssentialsSign
validateTrade(sign, 2, true, ess); validateTrade(sign, 2, true, ess);
final Trade trade = getTrade(sign, 2, true, true, ess); final Trade trade = getTrade(sign, 2, true, true, ess);
final Trade charge = getTrade(sign, 1, true, false, ess); final Trade charge = getTrade(sign, 1, true, false, ess);
if (trade.getType() == charge.getType()) { if (trade.getType() == charge.getType() && (trade.getType() != TradeType.ITEM || trade.getItemStack().getType().equals(charge.getItemStack().getType()))) {
throw new SignException("You cannot trade for the same item type."); throw new SignException("You cannot trade for the same item type.");
} }
trade.isAffordableFor(player); trade.isAffordableFor(player);