diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java index b80c992b..83f701c2 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java @@ -19,7 +19,7 @@ import com.hibiscusmc.hmccosmetics.gui.special.DyeMenu; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.user.CosmeticUsers; import com.hibiscusmc.hmccosmetics.util.MessagesUtil; -import com.hibiscusmc.hmccosmetics.util.ServerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils; import me.lojosho.hibiscuscommons.hooks.Hooks; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; @@ -114,11 +114,11 @@ public class CosmeticCommand implements CommandExecutor { HMCColorConfig.Colors colors = HMCColorContextKt.getHmcColor().getConfig().getColors().get(textColor); if (colors != null) { String hmccolor = colors.getBaseColor().getColor(); - if (hmccolor.contains("#")) color = ServerUtils.hex2Rgb(hmccolor); - else color = ServerUtils.rgbToRgb(hmccolor); + if (hmccolor.contains("#")) color = HMCCServerUtils.hex2Rgb(hmccolor); + else color = HMCCServerUtils.rgbToRgb(hmccolor); } } else { - color = ServerUtils.hex2Rgb(textColor); + color = HMCCServerUtils.hex2Rgb(textColor); } } } @@ -312,7 +312,7 @@ public class CosmeticCommand implements CommandExecutor { if (!silent) MessagesUtil.sendMessage(player, "invalid-color"); return true; } - Color color = ServerUtils.hex2Rgb(args[2]); + Color color = HMCCServerUtils.hex2Rgb(args[2]); if (color == null) { if (!silent) MessagesUtil.sendMessage(player, "invalid-color"); return true; diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticMainhandType.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticMainhandType.java index 0c22416e..b4dc3685 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticMainhandType.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticMainhandType.java @@ -2,7 +2,7 @@ package com.hibiscusmc.hmccosmetics.cosmetic.types; import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; -import com.hibiscusmc.hmccosmetics.util.PlayerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import me.lojosho.shaded.configurate.ConfigurationNode; import org.bukkit.entity.Player; @@ -18,6 +18,6 @@ public class CosmeticMainhandType extends Cosmetic { public void update(@NotNull CosmeticUser user) { Player player = user.getPlayer(); - HMCCPacketManager.equipmentSlotUpdate(player.getEntityId(), user, getSlot(), PlayerUtils.getNearbyPlayers(player)); + HMCCPacketManager.equipmentSlotUpdate(player.getEntityId(), user, getSlot(), HMCCPlayerUtils.getNearbyPlayers(player)); } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/gui/action/actions/ActionParticle.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/gui/action/actions/ActionParticle.java index 9706a926..4a3f0f1b 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/gui/action/actions/ActionParticle.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/gui/action/actions/ActionParticle.java @@ -3,7 +3,7 @@ package com.hibiscusmc.hmccosmetics.gui.action.actions; import com.hibiscusmc.hmccosmetics.gui.action.Action; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.util.MessagesUtil; -import com.hibiscusmc.hmccosmetics.util.ServerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import com.owen1212055.particlehelper.api.particle.types.BlockDataParticle; import com.owen1212055.particlehelper.api.particle.types.DestinationParticle; @@ -42,7 +42,7 @@ public class ActionParticle extends Action { return; } - particle = ServerUtils.addParticleValues(particle, rawString); + particle = HMCCServerUtils.addParticleValues(particle, rawString); Location location = user.getPlayer().getLocation(); for (Player player : HMCCPacketManager.getViewers(location)) { particle.compile().send(player, location); 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 c76e58e4..c42d2613 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java @@ -19,7 +19,7 @@ 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.PlayerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import lombok.Getter; import me.lojosho.hibiscuscommons.hooks.Hooks; @@ -204,7 +204,7 @@ public class CosmeticUser { updateCosmetic(cosmetic.getSlot()); } if (items.isEmpty()) return; - PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), items, PlayerUtils.getNearbyPlayers(getEntity().getLocation())); + PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), items, HMCCPlayerUtils.getNearbyPlayers(getEntity().getLocation())); MessagesUtil.sendDebugMessages("updateCosmetic (All) - end - " + items.size()); } @@ -401,7 +401,7 @@ public class CosmeticUser { public void despawnBalloon() { if (this.userBalloonManager == null) return; - List sentTo = PlayerUtils.getNearbyPlayers(getEntity().getLocation()); + List sentTo = HMCCPlayerUtils.getNearbyPlayers(getEntity().getLocation()); HMCCPacketManager.sendEntityDestroyPacket(userBalloonManager.getPufferfishBalloonId(), sentTo); @@ -427,9 +427,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), PlayerUtils.getNearbyPlayers(getEntity().getLocation())); + PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), equipmentSlot, getPlayer().getInventory().getItem(equipmentSlot), HMCCPlayerUtils.getNearbyPlayers(getEntity().getLocation())); } else { - HMCCPacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, PlayerUtils.getNearbyPlayers(getEntity().getLocation())); + HMCCPacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, HMCCPlayerUtils.getNearbyPlayers(getEntity().getLocation())); } } @@ -530,7 +530,7 @@ public class CosmeticUser { if (hasCosmeticInSlot(CosmeticSlot.BALLOON)) { CosmeticBalloonType balloonType = (CosmeticBalloonType) getCosmetic(CosmeticSlot.BALLOON); getBalloonManager().addPlayerToModel(this, balloonType); - List viewer = PlayerUtils.getNearbyPlayers(getEntity().getLocation()); + List viewer = HMCCPlayerUtils.getNearbyPlayers(getEntity().getLocation()); HMCCPacketManager.sendLeashPacket(getBalloonManager().getPufferfishBalloonId(), getPlayer().getEntityId(), viewer); } if (hasCosmeticInSlot(CosmeticSlot.BACKPACK) && isBackpackSpawned()) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUsers.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUsers.java index fd1ab196..a88203bf 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUsers.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUsers.java @@ -1,7 +1,7 @@ package com.hibiscusmc.hmccosmetics.user; import com.google.common.collect.HashBiMap; -import com.hibiscusmc.hmccosmetics.util.ServerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.jetbrains.annotations.Nullable; @@ -38,7 +38,7 @@ public class CosmeticUsers { @Nullable public static CosmeticUser getUser(int entityId) { - Entity entity = ServerUtils.getEntity(entityId); + Entity entity = HMCCServerUtils.getEntity(entityId); if (entity == null) return null; if (!(entity instanceof Player player)) return null; return COSMETIC_USERS.get(player.getUniqueId()); diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java index 4b23bad8..9e821942 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java @@ -2,7 +2,7 @@ package com.hibiscusmc.hmccosmetics.user.manager; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.user.CosmeticUsers; -import com.hibiscusmc.hmccosmetics.util.PlayerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import org.bukkit.Location; import org.bukkit.entity.EntityType; @@ -46,7 +46,7 @@ public class UserBalloonPufferfish extends UserEntity { if (System.currentTimeMillis() - getViewerLastUpdate() <= 1000) return List.of(); //Prevents mass refreshes ArrayList newPlayers = new ArrayList<>(); ArrayList removePlayers = new ArrayList<>(); - List players = PlayerUtils.getNearbyPlayers(location); + List players = HMCCPlayerUtils.getNearbyPlayers(location); for (Player player : players) { CosmeticUser user = CosmeticUsers.getUser(player); diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java index 2aade4b0..3131e566 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java @@ -3,6 +3,7 @@ package com.hibiscusmc.hmccosmetics.user.manager; import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin; import com.hibiscusmc.hmccosmetics.config.Settings; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; +import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils; import com.hibiscusmc.hmccosmetics.util.MessagesUtil; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import com.ticxo.playeranimator.api.model.player.PlayerModel; @@ -116,7 +117,7 @@ public class UserEmoteModel extends PlayerModel { HMCCPacketManager.sendCameraPacket(entityId, viewer); HMCCPacketManager.sendEntityDestroyPacket(armorStandId, viewer); if (this.originalGamemode != null) { - HMCCPacketManager.gamemodeChangePacket(player, com.hibiscusmc.hmccosmetics.util.ServerUtils.convertGamemode(this.originalGamemode)); + HMCCPacketManager.gamemodeChangePacket(player, HMCCServerUtils.convertGamemode(this.originalGamemode)); player.setGameMode(this.originalGamemode); } 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 7cd90b8a..07fd435d 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 @@ -3,7 +3,7 @@ package com.hibiscusmc.hmccosmetics.user.manager; import com.hibiscusmc.hmccosmetics.config.Settings; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.user.CosmeticUsers; -import com.hibiscusmc.hmccosmetics.util.PlayerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import lombok.Getter; import lombok.Setter; @@ -41,7 +41,7 @@ public class UserEntity { if (System.currentTimeMillis() - viewerLastUpdate <= 1000) return List.of(); //Prevents mass refreshes ArrayList newPlayers = new ArrayList<>(); ArrayList removePlayers = new ArrayList<>(); - List players = PlayerUtils.getNearbyPlayers(location); + List players = HMCCPlayerUtils.getNearbyPlayers(location); for (Player player : players) { CosmeticUser user = CosmeticUsers.getUser(player); diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserWardrobeManager.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserWardrobeManager.java index b2b341de..17a67dbc 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserWardrobeManager.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserWardrobeManager.java @@ -11,7 +11,7 @@ import com.hibiscusmc.hmccosmetics.gui.Menu; import com.hibiscusmc.hmccosmetics.gui.Menus; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.util.MessagesUtil; -import com.hibiscusmc.hmccosmetics.util.ServerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import lombok.Getter; import me.lojosho.hibiscuscommons.nms.NMSHandlers; @@ -227,11 +227,11 @@ public class UserWardrobeManager { if (WardrobeSettings.isForceExitGamemode()) { MessagesUtil.sendDebugMessages("Force Exit Gamemode " + WardrobeSettings.getExitGamemode()); player.setGameMode(WardrobeSettings.getExitGamemode()); - HMCCPacketManager.gamemodeChangePacket(player, ServerUtils.convertGamemode(WardrobeSettings.getExitGamemode())); // Success + HMCCPacketManager.gamemodeChangePacket(player, HMCCServerUtils.convertGamemode(WardrobeSettings.getExitGamemode())); // Success } else { MessagesUtil.sendDebugMessages("Original Gamemode " + this.originalGamemode); player.setGameMode(this.originalGamemode); - HMCCPacketManager.gamemodeChangePacket(player, ServerUtils.convertGamemode(this.originalGamemode)); // Success + HMCCPacketManager.gamemodeChangePacket(player, HMCCServerUtils.convertGamemode(this.originalGamemode)); // Success } user.showPlayer(); @@ -286,9 +286,9 @@ public class UserWardrobeManager { HMCCPacketManager.sendLookPacket(NPC_ID, location, viewer); user.hidePlayer(); int rotationSpeed = WardrobeSettings.getRotationSpeed(); - location.setYaw(ServerUtils.getNextYaw(yaw - 30, rotationSpeed)); + location.setYaw(HMCCServerUtils.getNextYaw(yaw - 30, rotationSpeed)); HMCCPacketManager.sendRotationPacket(NPC_ID, location, true, viewer); - int nextyaw = ServerUtils.getNextYaw(yaw, rotationSpeed); + int nextyaw = HMCCServerUtils.getNextYaw(yaw, rotationSpeed); data.set(nextyaw); for (CosmeticSlot slot : CosmeticSlot.values()) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/PlayerUtils.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/HMCCPlayerUtils.java similarity index 97% rename from common/src/main/java/com/hibiscusmc/hmccosmetics/util/PlayerUtils.java rename to common/src/main/java/com/hibiscusmc/hmccosmetics/util/HMCCPlayerUtils.java index 97448418..98b9216c 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/PlayerUtils.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/HMCCPlayerUtils.java @@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable; import java.util.List; -public class PlayerUtils { +public class HMCCPlayerUtils { @Nullable public static WrappedSignedProperty getSkin(Player player) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/ServerUtils.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/HMCCServerUtils.java similarity index 99% rename from common/src/main/java/com/hibiscusmc/hmccosmetics/util/ServerUtils.java rename to common/src/main/java/com/hibiscusmc/hmccosmetics/util/HMCCServerUtils.java index 69d08157..89736494 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/ServerUtils.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/HMCCServerUtils.java @@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable; import java.math.BigInteger; import java.util.Arrays; -public class ServerUtils { +public class HMCCServerUtils { private static String COLOR_CHAR = "&"; 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 bcab1d40..76201054 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 @@ -11,7 +11,7 @@ import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.user.CosmeticUsers; import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils; -import com.hibiscusmc.hmccosmetics.util.PlayerUtils; +import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils; import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerNamedEntitySpawn; import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerPlayerInfo; import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerRelEntityMove; @@ -301,7 +301,7 @@ public class HMCCPacketManager extends PacketManager { } WrappedGameProfile wrappedGameProfile = new WrappedGameProfile(uuid, name); - WrappedSignedProperty skinData = PlayerUtils.getSkin(skinnedPlayer); + WrappedSignedProperty skinData = HMCCPlayerUtils.getSkin(skinnedPlayer); if (skinData != null) wrappedGameProfile.getProperties().put("textures", skinData); // For sor some reason <1.19.2 handles it on the 0 field index, newer versions handles it on the 1 if (HMCCosmeticsAPI.getNMSVersion().contains("v1_18_R2") || HMCCosmeticsAPI.getNMSVersion().contains("v1_19_R1")) { @@ -435,7 +435,7 @@ public class HMCCPacketManager extends PacketManager { if (Settings.getViewDistance() <= 0) { viewers.addAll(location.getWorld().getPlayers()); } else { - viewers.addAll(PlayerUtils.getNearbyPlayers(location)); + viewers.addAll(HMCCPlayerUtils.getNearbyPlayers(location)); } return viewers; }