mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Remove BKCommonLib support, it possible cause lag and it not we want see
on QSRR. Former-commit-id: 8fe08fd44d1f0c33a474f1cf32fc1a0310257ff4 [formerly 64437be98a47ea15c5b28f3c56a5006f21e85e61] Former-commit-id: 3cece8f5733e294bbda2d88bee5f2d534dfc12b1
This commit is contained in:
1 parent
82c86d2ee9
commit
a3ce3966cc
5 files changed
+2
-129
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<String, Integer> 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"));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<UUID,Shop> 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<Entry<UUID,Shop>> set=id2ShopMap.entrySet();
|
||||
Iterator<Entry<UUID, Shop>> it=set.iterator();
|
||||
while(it.hasNext()) {
|
||||
Entry<UUID, Shop> entry =(Entry<UUID, Shop>)it.next();
|
||||
if(entry.getValue().equals(shop)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void removeDisplayItemByShop(Shop shop) {
|
||||
try {
|
||||
Set<Entry<UUID, Shop>> set = id2ShopMap.entrySet();
|
||||
Iterator<Entry<UUID, Shop>> it = set.iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<UUID, Shop> entry = (Entry<UUID, Shop>) 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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user