mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Merge pull request #18 from cakoyo/master
[WIP] Performance improvements & Fixes potential issues Former-commit-id: fd83a0d8369f3086cd6b44b1c6ed01e026239703
This commit is contained in:
commit
26fc611de7
5 files changed
+12
-10
No files matched your search
@@ -18,7 +18,7 @@ public class ChatListener implements Listener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onChat(final AsyncPlayerChatEvent e) {
|
||||
if (!plugin.getShopManager().getActions().containsKey(e.getPlayer().getUniqueId())) {
|
||||
plugin.log(plugin.getShopManager().getActions().toString());
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onChunkUnload(ChunkUnloadEvent e) {
|
||||
Chunk c = e.getChunk();
|
||||
HashMap<Location, Shop> inChunk = plugin.getShopManager().getShops(c);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class DisplayProtectionListener implements Listener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||
for (int i = 0; i<event.getInventory().getContents().length; i++) {
|
||||
try {
|
||||
@@ -37,7 +37,7 @@ public class DisplayProtectionListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
try {
|
||||
if (itemStackCheck(event.getCurrentItem()) || itemStackCheck(event.getCursor())) {
|
||||
@@ -54,8 +54,8 @@ public class DisplayProtectionListener implements Listener {
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void onInventoryPickupItem(InventoryPickupItemEvent event) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onInventoryPickupItem(InventoryPickupItemEvent event) {
|
||||
try {
|
||||
ItemStack is = event.getItem().getItemStack();
|
||||
if (itemStackCheck(is)) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class LockListener implements Listener {
|
||||
/**
|
||||
* Handles hopper placement
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
Block b = e.getBlock();
|
||||
try {
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.lang.reflect.Method;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -47,9 +49,9 @@ import net.md_5.bungee.api.chat.TextComponent;
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Util {
|
||||
private static HashSet<Material> blacklist = new HashSet<Material>();
|
||||
private static HashSet<Material> shoppables = new HashSet<Material>();
|
||||
private static Map<Material, Entry<Double,Double>> restrictedPrices = new HashMap<Material, Entry<Double,Double>>();
|
||||
private static final EnumSet<Material> blacklist = EnumSet.noneOf(Material.class);
|
||||
private static final EnumSet<Material> shoppables = EnumSet.noneOf(Material.class);
|
||||
private static final EnumMap<Material, Entry<Double,Double>> restrictedPrices = new EnumMap<Material, Entry<Double,Double>>(Material.class);
|
||||
private static QuickShop plugin;
|
||||
private static Method storageContents;
|
||||
|
||||
|
||||
Reference in new issue
Block a user