diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java index afbe94a2..199ca694 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java @@ -21,11 +21,11 @@ import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager; import com.hibiscusmc.hmccosmetics.user.manager.UserWardrobeManager; import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils; import com.hibiscusmc.hmccosmetics.util.MessagesUtil; -import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import lombok.Getter; import me.lojosho.hibiscuscommons.hooks.Hooks; import me.lojosho.hibiscuscommons.util.InventoryUtils; +import me.lojosho.hibiscuscommons.util.ServerUtils; import me.lojosho.hibiscuscommons.util.packets.PacketManager; import org.bukkit.Bukkit; import org.bukkit.Color; @@ -270,7 +270,7 @@ public class CosmeticUser { } } if (items.isEmpty() || getEntity() == null) return; - PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), items, HMCCPacketManager.getViewers(getEntity().getLocation())); + PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), items, ServerUtils.getViewers(getEntity())); MessagesUtil.sendDebugMessages("updateCosmetic (All) - end - " + items.size()); } @@ -540,9 +540,9 @@ public class CosmeticUser { EquipmentSlot equipmentSlot = HMCCInventoryUtils.getEquipmentSlot(slot); if (equipmentSlot == null) return; if (getPlayer() != null) { - PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), equipmentSlot, getPlayer().getInventory().getItem(equipmentSlot), HMCCPacketManager.getViewers(getEntity().getLocation())); + PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), equipmentSlot, getPlayer().getInventory().getItem(equipmentSlot), ServerUtils.getViewers(getEntity())); } else { - HMCCPacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, HMCCPacketManager.getViewers(getEntity().getLocation())); + HMCCPacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, ServerUtils.getViewers(getEntity())); } } @@ -651,7 +651,7 @@ public class CosmeticUser { if (!isBalloonSpawned()) respawnBalloon(); CosmeticBalloonType balloonType = (CosmeticBalloonType) getCosmetic(CosmeticSlot.BALLOON); getBalloonManager().addPlayerToModel(this, balloonType); - List viewer = HMCCPacketManager.getViewers(getEntity().getLocation()); + List viewer = ServerUtils.getViewers(getEntity()); HMCCPacketManager.sendLeashPacket(getBalloonManager().getPufferfishBalloonId(), getPlayer().getEntityId(), viewer); } if (hasCosmeticInSlot(CosmeticSlot.BACKPACK)) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEntity.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEntity.java index 0d781ad5..1cbf94a4 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEntity.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEntity.java @@ -8,6 +8,7 @@ import com.hibiscusmc.hmccosmetics.util.MessagesUtil; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import lombok.Getter; import lombok.Setter; +import me.lojosho.hibiscuscommons.util.ServerUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -43,12 +44,12 @@ public class UserEntity { if (System.currentTimeMillis() - viewerLastUpdate <= 1000) return List.of(); //Prevents mass refreshes ArrayList newPlayers = new ArrayList<>(); ArrayList removePlayers = new ArrayList<>(); - List players = HMCCPacketManager.getViewers(location); Player ownerPlayer = Bukkit.getPlayer(owner); if (ownerPlayer == null) { MessagesUtil.sendDebugMessages("Owner is null (refreshViewers), returning empty list"); return List.of(); } + List players = ServerUtils.getViewers(ownerPlayer); for (Player player : players) { CosmeticUser user = CosmeticUsers.getUser(player); diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java index 876e63ae..794ba4bd 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java @@ -18,6 +18,7 @@ import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerRelEnt import me.lojosho.hibiscuscommons.util.packets.PacketManager; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.EquipmentSlot;