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();
checkdrop = Artifact.convert(checkdrop); ItemStack checkdrop = shop.GetItem().clone();
checkdrop.removeEnchantment(Enchantment.LUCK); checkdrop = Artifact.convert(checkdrop);
ItemMeta m = checkdrop.getItemMeta(); checkdrop.removeEnchantment(Enchantment.LUCK);
List<String> lore = new ArrayList<String>(); ItemMeta m = checkdrop.getItemMeta();
if (m.hasLore()) { List<String> lore = new ArrayList<String>();
lore = m.getLore(); if (m.hasLore()) {
} lore = m.getLore();
lore.add("WorldShop Display Item"); }
m.setLore(lore); lore.add("WorldShop Display Item");
checkdrop.setItemMeta(m); m.setLore(lore);
checkdrop.setItemMeta(m);
TwosideKeeper.log("Comparing item "+it.getItemStack().toString()+" to "+checkdrop.toString(),5);
if (it.getItemStack().isSimilar(checkdrop) && TwosideKeeper.log("Comparing item "+it.getItemStack().toString()+" to "+checkdrop.toString(),5);
Artifact.isArtifact(it.getItemStack())) { if (it.getItemStack().isSimilar(checkdrop) &&
TwosideKeeper.log("Same type.",5); Artifact.isArtifact(it.getItemStack())) {
e.remove(); TwosideKeeper.log("Same type.",5);
e.setCustomNameVisible(false); e.remove();
e.setCustomName(null); e.setCustomNameVisible(false);
e.setCustomName(null);
}
} }
} }
} }