diff --git a/src/main/java/net/elytrium/limbohub/LimboHub.java b/src/main/java/net/elytrium/limbohub/LimboHub.java index 3658a9a..08f0c3b 100644 --- a/src/main/java/net/elytrium/limbohub/LimboHub.java +++ b/src/main/java/net/elytrium/limbohub/LimboHub.java @@ -321,7 +321,7 @@ public void reload() { Settings.IMP.MAIN.NPCS.forEach(data -> { NPC npc = new NPC( data.DISPLAY_NAME.isBlank() ? null : data.DISPLAY_NAME, data.X, data.Y, - data.Z, (float) data.YAW, (float) data.PITCH, data.LOAD_SKIN ? data.SKIN_DATA : null, data.ACTION, data.COOLDOWN, server + data.Z, (float) data.YAW, (float) data.PITCH, data.LOAD_SKIN ? data.SKIN_DATA : null, data.ACTION, data.COOLDOWN, this.server ); this.npcs.put(npc.getEntityId(), npc); diff --git a/src/main/java/net/elytrium/limbohub/entities/NPC.java b/src/main/java/net/elytrium/limbohub/entities/NPC.java index a993d24..68aca7e 100644 --- a/src/main/java/net/elytrium/limbohub/entities/NPC.java +++ b/src/main/java/net/elytrium/limbohub/entities/NPC.java @@ -21,14 +21,16 @@ import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.util.GameProfile; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItemPacket; import com.velocitypowered.proxy.protocol.packet.RemovePlayerInfoPacket; import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket; +import java.nio.charset.StandardCharsets; +import java.util.EnumSet; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import net.elytrium.limboapi.api.player.LimboPlayer; import net.elytrium.limbohub.LimboHub; import net.elytrium.limbohub.Settings; @@ -136,7 +138,9 @@ public void spawn(LimboPlayer player) { if (this.displayName != null) { player.writePacketAndFlush(new SpawnEntity(this.entityId + 1, UUID.randomUUID(), ArmorStand::getEntityType, this.positionX, this.positionY - 0.175, this.positionZ, this.pitch, this.yaw, this.yaw, 0)); - player.writePacketAndFlush(new SetEntityMetadata(this.entityId + 1, version -> ArmorStand.buildHologramMetadata(version, processPlaceholders(this.displayName)))); + player.writePacketAndFlush( + new SetEntityMetadata(this.entityId + 1, version -> ArmorStand.buildHologramMetadata(version, this.processPlaceholders(this.displayName))) + ); } } @@ -147,7 +151,7 @@ private Component processPlaceholders(String text) { StringBuilder result = new StringBuilder(); int lastEnd = 0; - for (int _i = 0; matcher.find(); _i++) { + for (; matcher.find(); ) { result.append(text, lastEnd, matcher.start()); // Extract the text after the colon @@ -161,7 +165,7 @@ private Component processPlaceholders(String text) { int playerCount = server.getPlayersConnected().size(); result.append(playerCount); - }else{ + } else { result.append("LIMBOHUBHUB:SERVER_NOT_FOUND"); }