mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 01:49:49 -05:00
Merge branch 'master' of https://github.com/Ghost-chu/QuickShop-Reremake
Conflicts: pom.xml Former-commit-id: e26164300220a1b9e775b9ef7bb0637278a3ec31
This commit is contained in:
commit
f352518f12
4 files changed
+5
-24
No files matched your search
@@ -68,7 +68,6 @@ public class ContainerShop implements Shop {
|
||||
private double price;
|
||||
private ShopType shopType;
|
||||
private boolean unlimited;
|
||||
private boolean isDeleted;
|
||||
|
||||
private ContainerShop(@NotNull ContainerShop s) {
|
||||
this.displayItem = s.displayItem;
|
||||
@@ -399,7 +398,6 @@ public class ContainerShop implements Shop {
|
||||
if (isLoaded) {
|
||||
this.onUnload();
|
||||
}
|
||||
isDeleted=true;
|
||||
// Delete the display item
|
||||
if (this.getDisplayItem() != null) {
|
||||
this.getDisplayItem().remove();
|
||||
@@ -877,11 +875,6 @@ public class ContainerShop implements Shop {
|
||||
return Util.canBeShop(this.getLocation().getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return isDeleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable DisplayItem getDisplay() {
|
||||
return this.displayItem;
|
||||
|
||||
@@ -303,12 +303,6 @@ public interface Shop {
|
||||
*/
|
||||
boolean isValid();
|
||||
|
||||
/**
|
||||
* Shop is deleted
|
||||
*
|
||||
* @return true if deleted
|
||||
*/
|
||||
boolean isDeleted();
|
||||
|
||||
/**
|
||||
* Get the shop display entity
|
||||
|
||||
@@ -49,7 +49,6 @@ public class VirtualDisplayItem extends DisplayItem {
|
||||
|
||||
private static ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
private volatile boolean isDisplay;
|
||||
private volatile boolean isLoaded;
|
||||
//counter for ensuring ID is unique
|
||||
private static final AtomicInteger counter = new AtomicInteger(0);
|
||||
//server main version (1_13_R2->13)
|
||||
@@ -92,11 +91,6 @@ public class VirtualDisplayItem extends DisplayItem {
|
||||
//is really full chunk data
|
||||
boolean isFull = event.getPacket().getBooleans().read(0);
|
||||
|
||||
//if shop has deleted, unregister myself to ensure will be collected by GC
|
||||
if (!shop.isDeleted()) {
|
||||
unload();
|
||||
return;
|
||||
}
|
||||
if (!shop.isLoaded() || !isDisplay || !isFull || !Util.isLoaded(shop.getLocation())) {
|
||||
return;
|
||||
}
|
||||
@@ -104,8 +98,8 @@ public class VirtualDisplayItem extends DisplayItem {
|
||||
int x = event.getPacket().getIntegers().read(0);
|
||||
//chunk z
|
||||
int z = event.getPacket().getIntegers().read(1);
|
||||
|
||||
|
||||
//check later to prevent deadlock
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,()->{
|
||||
World world = shop.getLocation().getWorld();
|
||||
Chunk chunk = shop.getLocation().getChunk();
|
||||
if (world.getName().equals(event.getPlayer().getWorld().getName())
|
||||
@@ -114,8 +108,8 @@ public class VirtualDisplayItem extends DisplayItem {
|
||||
packetSenders.add(event.getPlayer().getUniqueId());
|
||||
sendFakeItem(event.getPlayer());
|
||||
}
|
||||
}
|
||||
};
|
||||
},1);
|
||||
}};
|
||||
}
|
||||
protocolManager.addPacketListener(packetAdapter);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user