removeShopItem() now fails silently.

This commit is contained in:
sigonasr2 2016-07-29 20:37:17 -05:00
parent d22b1c305f
commit 11b8302a87
3 changed files with 32 additions and 28 deletions

Binary file not shown.

View File

@ -2828,7 +2828,7 @@ public class GenericFunctions {
return false; return false;
} }
} else } else
if (GenericFunctions.isBankSign(s)) { if (GenericFunctions.isBankSign(s) && !p.isOp()) {
return false; return false;
} else { } else {
return true; return true;

View File

@ -718,36 +718,40 @@ public class WorldShop {
} }
public static void removeShopItem(Sign s) { public static void removeShopItem(Sign s) {
removeShopItem(s, TwosideKeeper.TwosideShops.LoadWorldShopData(s)); if (isWorldShopSign(s)) {
removeShopItem(s, TwosideKeeper.TwosideShops.LoadWorldShopData(s));
}
} }
public static void removeShopItem(Sign s, WorldShop shop) { public static void removeShopItem(Sign s, WorldShop shop) {
Collection<Entity> nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3); if (isWorldShopSign(s)) {
for (int i=0;i<nearby.size();i++) { Collection<Entity> nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3);
Entity e = Iterables.get(nearby, i); for (int i=0;i<nearby.size();i++) {
if (e.getType()==EntityType.DROPPED_ITEM) { Entity e = Iterables.get(nearby, i);
TwosideKeeper.log("Found a drop.",5); if (e.getType()==EntityType.DROPPED_ITEM) {
Item it = (Item)e; TwosideKeeper.log("Found a drop.",5);
Item it = (Item)e;
ItemStack checkdrop = shop.GetItem().clone(); ItemStack checkdrop = shop.GetItem().clone();
checkdrop = Artifact.convert(checkdrop); checkdrop = Artifact.convert(checkdrop);
checkdrop.removeEnchantment(Enchantment.LUCK); checkdrop.removeEnchantment(Enchantment.LUCK);
ItemMeta m = checkdrop.getItemMeta(); ItemMeta m = checkdrop.getItemMeta();
List<String> lore = new ArrayList<String>(); List<String> lore = new ArrayList<String>();
if (m.hasLore()) { if (m.hasLore()) {
lore = m.getLore(); lore = m.getLore();
} }
lore.add("WorldShop Display Item"); lore.add("WorldShop Display Item");
m.setLore(lore); m.setLore(lore);
checkdrop.setItemMeta(m); checkdrop.setItemMeta(m);
TwosideKeeper.log("Comparing item "+it.getItemStack().toString()+" to "+checkdrop.toString(),5); TwosideKeeper.log("Comparing item "+it.getItemStack().toString()+" to "+checkdrop.toString(),5);
if (it.getItemStack().isSimilar(checkdrop) && if (it.getItemStack().isSimilar(checkdrop) &&
Artifact.isArtifact(it.getItemStack())) { Artifact.isArtifact(it.getItemStack())) {
TwosideKeeper.log("Same type.",5); TwosideKeeper.log("Same type.",5);
e.remove(); e.remove();
e.setCustomNameVisible(false); e.setCustomNameVisible(false);
e.setCustomName(null); e.setCustomName(null);
}
} }
} }
} }