|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|