mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-08 19:51:05 +00:00
UUID of hologram and shop item should be unique
This commit is contained in:
parent
8f2d2540ba
commit
e47fc9765d
@ -16,11 +16,12 @@ public class ArmorStandWrapper {
|
|||||||
private final Class<?> packetPlayOutEntityTeleportClass = Utils.getNMSClass("PacketPlayOutEntityTeleport");
|
private final Class<?> packetPlayOutEntityTeleportClass = Utils.getNMSClass("PacketPlayOutEntityTeleport");
|
||||||
private final Class<?> dataWatcherClass = Utils.getNMSClass("DataWatcher");
|
private final Class<?> dataWatcherClass = Utils.getNMSClass("DataWatcher");
|
||||||
|
|
||||||
|
private final UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
private ShopChest plugin;
|
private ShopChest plugin;
|
||||||
private Object entity;
|
private Object entity;
|
||||||
private Location location;
|
private Location location;
|
||||||
private String customName;
|
private String customName;
|
||||||
private UUID uuid;
|
|
||||||
private int entityId = -1;
|
private int entityId = -1;
|
||||||
|
|
||||||
public ArmorStandWrapper(ShopChest plugin, Location location, String customName, boolean interactable) {
|
public ArmorStandWrapper(ShopChest plugin, Location location, String customName, boolean interactable) {
|
||||||
@ -34,7 +35,7 @@ public class ArmorStandWrapper {
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
Object dataWatcher = Utils.createDataWatcher(customName, null);
|
Object dataWatcher = Utils.createDataWatcher(customName, null);
|
||||||
entityId = Utils.getFreeEntityId();
|
entityId = Utils.getFreeEntityId();
|
||||||
Utils.sendPacket(plugin, Utils.createPacketSpawnEntity(plugin, entityId, UUID.randomUUID(), location, EntityType.ARMOR_STAND), player);
|
Utils.sendPacket(plugin, Utils.createPacketSpawnEntity(plugin, entityId, uuid, location, EntityType.ARMOR_STAND), player);
|
||||||
Utils.sendPacket(plugin, packetPlayOutEntityMetadataClass.getConstructor(int.class, dataWatcherClass, boolean.class)
|
Utils.sendPacket(plugin, packetPlayOutEntityMetadataClass.getConstructor(int.class, dataWatcherClass, boolean.class)
|
||||||
.newInstance(entityId, dataWatcher, true), player);
|
.newInstance(entityId, dataWatcher, true), player);
|
||||||
} else if (entityId != -1) {
|
} else if (entityId != -1) {
|
||||||
|
@ -21,6 +21,7 @@ public class ShopItem {
|
|||||||
private final Set<UUID> viewers = Collections.newSetFromMap(new ConcurrentHashMap<UUID, Boolean>());
|
private final Set<UUID> viewers = Collections.newSetFromMap(new ConcurrentHashMap<UUID, Boolean>());
|
||||||
private final ItemStack itemStack;
|
private final ItemStack itemStack;
|
||||||
private final Location location;
|
private final Location location;
|
||||||
|
private final UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
private int entityId = -1;
|
private int entityId = -1;
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ public class ShopItem {
|
|||||||
Object nmsItemStack = craftItemStackClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, itemStack);
|
Object nmsItemStack = craftItemStackClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, itemStack);
|
||||||
Object dataWatcher = Utils.createDataWatcher(null, nmsItemStack);
|
Object dataWatcher = Utils.createDataWatcher(null, nmsItemStack);
|
||||||
entityId = Utils.getFreeEntityId();
|
entityId = Utils.getFreeEntityId();
|
||||||
Utils.sendPacket(plugin, Utils.createPacketSpawnEntity(plugin, entityId, UUID.randomUUID(), location, EntityType.DROPPED_ITEM), p);
|
Utils.sendPacket(plugin, Utils.createPacketSpawnEntity(plugin, entityId, uuid, location, EntityType.DROPPED_ITEM), p);
|
||||||
Utils.sendPacket(plugin, packetPlayOutEntityMetadataClass.getConstructor(int.class, dataWatcherClass, boolean.class).newInstance(entityId, dataWatcher, true), p);
|
Utils.sendPacket(plugin, packetPlayOutEntityMetadataClass.getConstructor(int.class, dataWatcherClass, boolean.class).newInstance(entityId, dataWatcher, true), p);
|
||||||
if (Utils.getMajorVersion() < 14) {
|
if (Utils.getMajorVersion() < 14) {
|
||||||
Utils.sendPacket(plugin, packetPlayOutEntityVelocityClass.getConstructor(int.class, double.class, double.class, double.class).newInstance(entityId, 0D, 0D, 0D), p);
|
Utils.sendPacket(plugin, packetPlayOutEntityVelocityClass.getConstructor(int.class, double.class, double.class, double.class).newInstance(entityId, 0D, 0D, 0D), p);
|
||||||
|
Loading…
Reference in New Issue
Block a user