Display's fixes

Former-commit-id: 53d775624320b7ca630b2cfedd8ed2165da75419 [formerly ac2d47b5e233a759cd14b8cf87c254171f0695ae]
Former-commit-id: 449ec164c9f6d0e20af609883eade3164f442e98
This commit is contained in:
Ghost_chu committed 2019-06-18 10:06:19 +08:00
1 parent 42614a2644
commit 817f1566b1
3 files changed
+30 -23

No files matched your search

@@ -10,7 +10,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.Shop.Shop;
@@ -26,16 +25,16 @@ public class ChunkListener implements Listener {
HashMap<Location, Shop> inChunk = plugin.getShopManager().getShops(c);
if (inChunk == null || inChunk.isEmpty())
return;
new BukkitRunnable() {
@Override
public void run() {
for (Shop shop : inChunk.values()) {
shop.onLoad();
}
}
}.runTaskLater(plugin, 1); //Delay 1 tick, hope can fix the magic bug in 1.14 spigot build.
// new BukkitRunnable() {
//
// @Override
// public void run() {
for (Shop shop : inChunk.values()) {
shop.onLoad();
}
//
// }
// }.runTaskLater(plugin, 1); //Delay 1 tick, hope can fix the magic bug in 1.14 spigot build.
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@@ -44,13 +43,13 @@ public class ChunkListener implements Listener {
HashMap<Location, Shop> inChunk = plugin.getShopManager().getShops(c);
if (inChunk == null || inChunk.isEmpty())
return;
new BukkitRunnable() {
@Override
public void run() {
for (Shop shop : inChunk.values()) {
shop.onUnload();
}
}
}.runTaskLater(plugin, 1); //Delay 1 tick, hope can fix the magic bug in 1.14 spigot build.
// new BukkitRunnable() {
// @Override
// public void run() {
for (Shop shop : inChunk.values()) {
shop.onUnload();
}
// }
// }.runTaskLater(plugin, 1); //Delay 1 tick, hope can fix the magic bug in 1.14 spigot build.
}
}
@@ -733,10 +733,10 @@ public class ContainerShop implements Shop {
return;
}
if (!Util.isLoaded(this.getLocation())) {
Util.debugLog("Shop " + this.getLocation().toString() + " skipped to load: Target location not loaded.");
return;
}
// if (!Util.isLoaded(this.getLocation())) {
// Util.debugLog("Shop " + this.getLocation().toString() + " skipped to load: Target location not loaded.");
// return;
// }
if (!Util.canBeShop(this.getLocation().getBlock())) {
this.onUnload();
@@ -142,6 +142,10 @@ public interface DisplayItem {
for (String lore : lores) {
try {
ShopProtectionFlag shopProtectionFlag = gson.fromJson(lore, ShopProtectionFlag.class);
if (shopProtectionFlag == null)
continue;
if (shopProtectionFlag.getMark() == null)
continue;
if (shopProtectionFlag.getMark().equals("QuickShop DisplayItem"))
return true;
} catch (JsonSyntaxException e) {
@@ -170,6 +174,10 @@ public interface DisplayItem {
for (String lore : lores) {
try {
ShopProtectionFlag shopProtectionFlag = gson.fromJson(lore, ShopProtectionFlag.class);
if (shopProtectionFlag == null)
continue;
if (shopProtectionFlag.getMark() == null)
continue;
if (shopProtectionFlag.getShopLocation().equals(shop.getLocation().toString()))
return true;
} catch (JsonSyntaxException e) {