Skip to content

Commit

Permalink
format: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
DHCPCD9 committed Jul 10, 2024
1 parent c347fcc commit d163918
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/elytrium/limbohub/LimboHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 12 additions & 8 deletions src/main/java/net/elytrium/limbohub/entities/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)))
);
}
}

Expand All @@ -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
Expand All @@ -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");
}

Expand Down

0 comments on commit d163918

Please sign in to comment.