diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/BKCommonLibListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/BKCommonLibListener.java deleted file mode 100644 index d639d8a2a..000000000 --- a/src/main/java/org/maxgamer/quickshop/Listeners/BKCommonLibListener.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.maxgamer.quickshop.Listeners; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Item; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.maxgamer.quickshop.Shop.DisplayItem; -import org.maxgamer.quickshop.Shop.DisplayItemStorage; -import org.maxgamer.quickshop.Util.Util; - -import com.bergerkiller.bukkit.common.events.EntityMoveEvent; - -public class BKCommonLibListener implements Listener { - public BKCommonLibListener() { - Bukkit.getPluginManager().registerEvents(this,Bukkit.getPluginManager().getPlugin("BKCommonLib")); - - } - @EventHandler - public void onEntityMove(EntityMoveEvent e) { - if(e.getEntityType()!=EntityType.DROPPED_ITEM) { //Only check we need - return; - } - Item item = (Item)e.getEntity(); - if(DisplayItem.checkShopItem(item.getItemStack())) { - if((e.getFromX()==e.getToX())&&(e.getFromZ()==e.getToZ())) //Spam - return; - if(e.getEntity().getLocation().getBlock().getType()==Material.WATER) { - e.getEntity().remove(); - return; - } - if(Util.canBeShop(e.getEntity().getLocation().clone().add(0, -1, 0).getBlock())) { - e.getEntity().teleport(DisplayItemStorage.getDisplayLocation(e.getEntity().getUniqueId())); - return; - }else { - e.getEntity().remove(); - return; - } - } - } -} diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index 1a675e258..8348ace12 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -91,7 +91,6 @@ public class QuickShop extends JavaPlugin { private boolean noopDisable; private boolean setupDBonEnableding = false; public String dbPrefix=""; - private Plugin BKCommonLibPlugin; public int getShopLimit(Player p) { int max = getConfig().getInt("limits.default"); for (Entry entry : limits.entrySet()) { @@ -163,14 +162,6 @@ public class QuickShop extends JavaPlugin { if(this.openInvPlugin!=null) getLogger().info("Successfully loaded OpenInv support!"); } - if(getConfig().getBoolean("plugin.BKCommonLib")) { - - this.BKCommonLibPlugin = Bukkit.getPluginManager().getPlugin("BKCommonLib"); - if(this.BKCommonLibPlugin!=null && Bukkit.getPluginManager().getPlugin("BKCommonLib").isEnabled()) { - new BKCommonLibListener(); - getLogger().info("Successfully loaded BKCommonLib support!"); - } - } if (getConfig().getInt("config-version") == 0) getConfig().set("config-version", 1); updateConfig(getConfig().getInt("config-version")); diff --git a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java index 58bebb5b6..e30a60e80 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java @@ -58,7 +58,6 @@ public class DisplayItem { boolean showFloatItem = true; if (plugin.getConfig().getBoolean("float.enable")) { // Enabled! Check start! - // Item boolean found_item = false; boolean found_lore = false; @@ -164,17 +163,7 @@ public class DisplayItem { return; } //Call Event for QSAPI - if(false){ - ShopDisplayItemSpawnEvent shopDisplayItemSpawnEvent_v2 = new ShopDisplayItemSpawnEvent(shop, iStack, true); - Bukkit.getPluginManager().callEvent(shopDisplayItemSpawnEvent_v2); - if (shopDisplayItemSpawnEvent_v2.isCancelled()) { - return; - } - //this.item = shop.getLocation().getWorld().dropItem(dispLoc, this.iStack); - //this.item.setVelocity(new Vector(0, 0.1, 0)); - - - }else { + ShopDisplayItemSpawnEvent shopDisplayItemSpawnEvent = new ShopDisplayItemSpawnEvent(shop, iStack); Bukkit.getPluginManager().callEvent(shopDisplayItemSpawnEvent); ShopDisplayItemSpawnEvent shopDisplayItemSpawnEvent_v2 = new ShopDisplayItemSpawnEvent(shop, iStack, false); @@ -183,7 +172,6 @@ public class DisplayItem { return; } this.item = shop.getLocation().getWorld().dropItem(dispLoc, this.iStack); - DisplayItemStorage.addDisplayItemShop(item.getUniqueId(), shop); this.item.setVelocity(new Vector(0, 0.1, 0)); try { this.safeGuard(this.item); @@ -193,7 +181,6 @@ public class DisplayItem { plugin.getLogger().log(Level.WARNING, "QuickShop version mismatch! This version of QuickShop is incompatible with this version of bukkit! Try update?"); } - } } /** @@ -243,8 +230,6 @@ public class DisplayItem { public boolean removeDupe() { if (shop.getLocation().getWorld() == null) return false; - // QuickShop qs = (QuickShop) - // Bukkit.getPluginManager().getPlugin("QuickShop"); Location displayLoc = shop.getLocation().getBlock().getRelative(0, 1, 0).getLocation(); boolean removed = false; Chunk c = displayLoc.getChunk(); @@ -263,7 +248,6 @@ public class DisplayItem { } } } - DisplayItemStorage.id2ShopMap.clear(); return removed; } @@ -275,7 +259,6 @@ public class DisplayItem { if (this.item == null) return; this.item.remove(); - DisplayItemStorage.removeDisplayItemByUUID(this.item.getUniqueId()); this.item = null; } diff --git a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItemStorage.java b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItemStorage.java deleted file mode 100644 index b31086926..000000000 --- a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItemStorage.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.maxgamer.quickshop.Shop; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Location; - -public class DisplayItemStorage { - static Map id2ShopMap = new HashMap<>(); - public Shop getDisplayItemShop(UUID uuid) { - return id2ShopMap.get(uuid); - } - public static void addDisplayItemShop(UUID uuid,Shop shop) { - id2ShopMap.put(uuid, shop); - } - public static Location getDisplayLocation(UUID uuid) { - Shop shop = id2ShopMap.get(uuid); - if(shop==null) - return null; - return shop.getLocation().clone().add(0.5, 1.2, 0.5); - } - public static UUID getShopDisplayItem(Shop shop) { - Set> set=id2ShopMap.entrySet(); - Iterator> it=set.iterator(); - while(it.hasNext()) { - Entry entry =(Entry)it.next(); - if(entry.getValue().equals(shop)) { - return entry.getKey(); - } - } - return null; - } - - public static void removeDisplayItemByShop(Shop shop) { - try { - Set> set = id2ShopMap.entrySet(); - Iterator> it = set.iterator(); - while (it.hasNext()) { - Entry entry = (Entry) it.next(); - if (entry.getValue().equals(shop)) { - id2ShopMap.remove(entry.getKey()); - } - } - } catch (Exception e) { - - } - } - public static void removeDisplayItemByUUID(UUID uuid) { - try { - id2ShopMap.remove(uuid); - }catch (Exception e) { - - } - } -} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8e2fafc17..3f715f4d3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -5,7 +5,7 @@ authors: [Netherfoam, Timtower, KaiNoMood, Ghost_chu, Mgazul] description: Economy Shops plugin #softdepend: [Herochat, Vault, Essentials, OpenInv] OLD Remove Herochat support. -softdepend: [Vault, WorldGuard, Essentials, OpenInv, Multiverse-Core, ProtocolLib, CoreProtect, BKCommonLib] +softdepend: [Vault, WorldGuard, Essentials, OpenInv, Multiverse-Core] api-version: 1.13