removeShopItem() now fails silently.
This commit is contained in:
parent
d22b1c305f
commit
11b8302a87
Binary file not shown.
@ -2828,7 +2828,7 @@ public class GenericFunctions {
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
if (GenericFunctions.isBankSign(s)) {
|
||||
if (GenericFunctions.isBankSign(s) && !p.isOp()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -718,36 +718,40 @@ public class WorldShop {
|
||||
}
|
||||
|
||||
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) {
|
||||
Collection<Entity> nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3);
|
||||
for (int i=0;i<nearby.size();i++) {
|
||||
Entity e = Iterables.get(nearby, i);
|
||||
if (e.getType()==EntityType.DROPPED_ITEM) {
|
||||
TwosideKeeper.log("Found a drop.",5);
|
||||
Item it = (Item)e;
|
||||
|
||||
ItemStack checkdrop = shop.GetItem().clone();
|
||||
checkdrop = Artifact.convert(checkdrop);
|
||||
checkdrop.removeEnchantment(Enchantment.LUCK);
|
||||
ItemMeta m = checkdrop.getItemMeta();
|
||||
List<String> lore = new ArrayList<String>();
|
||||
if (m.hasLore()) {
|
||||
lore = m.getLore();
|
||||
}
|
||||
lore.add("WorldShop Display Item");
|
||||
m.setLore(lore);
|
||||
checkdrop.setItemMeta(m);
|
||||
|
||||
TwosideKeeper.log("Comparing item "+it.getItemStack().toString()+" to "+checkdrop.toString(),5);
|
||||
if (it.getItemStack().isSimilar(checkdrop) &&
|
||||
Artifact.isArtifact(it.getItemStack())) {
|
||||
TwosideKeeper.log("Same type.",5);
|
||||
e.remove();
|
||||
e.setCustomNameVisible(false);
|
||||
e.setCustomName(null);
|
||||
if (isWorldShopSign(s)) {
|
||||
Collection<Entity> nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3);
|
||||
for (int i=0;i<nearby.size();i++) {
|
||||
Entity e = Iterables.get(nearby, i);
|
||||
if (e.getType()==EntityType.DROPPED_ITEM) {
|
||||
TwosideKeeper.log("Found a drop.",5);
|
||||
Item it = (Item)e;
|
||||
|
||||
ItemStack checkdrop = shop.GetItem().clone();
|
||||
checkdrop = Artifact.convert(checkdrop);
|
||||
checkdrop.removeEnchantment(Enchantment.LUCK);
|
||||
ItemMeta m = checkdrop.getItemMeta();
|
||||
List<String> lore = new ArrayList<String>();
|
||||
if (m.hasLore()) {
|
||||
lore = m.getLore();
|
||||
}
|
||||
lore.add("WorldShop Display Item");
|
||||
m.setLore(lore);
|
||||
checkdrop.setItemMeta(m);
|
||||
|
||||
TwosideKeeper.log("Comparing item "+it.getItemStack().toString()+" to "+checkdrop.toString(),5);
|
||||
if (it.getItemStack().isSimilar(checkdrop) &&
|
||||
Artifact.isArtifact(it.getItemStack())) {
|
||||
TwosideKeeper.log("Same type.",5);
|
||||
e.remove();
|
||||
e.setCustomNameVisible(false);
|
||||
e.setCustomName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user