Made RainbowName not use /username and teams

This commit is contained in:
blackilykat 2023-06-04 16:09:06 +02:00
parent 09749e3725
commit 914c9d9075

View file

@ -25,7 +25,6 @@ public class RainbowName {
@Getter @Setter private boolean enabled = false; @Getter @Setter private boolean enabled = false;
private String[] team;
@Getter @Setter private String displayName; @Getter @Setter private String displayName;
@ -90,24 +89,10 @@ public class RainbowName {
} }
public void enable () { public void enable () {
final String[] colorCodes = generateColorCodes(8);
client.getNetworkHandler().sendChatCommand("extras:username " + generateUsername(colorCodes));
team = generateTeamName();
CommandCore.INSTANCE.run("minecraft:team add " + String.join("", team));
CommandCore.INSTANCE.run("minecraft:execute as " + client.getNetworkHandler().getProfile().getId() + " run team join " + String.join("", team));
enabled = true; enabled = true;
} }
public void disable () { public void disable () {
client.getNetworkHandler().sendChatCommand("extras:username " + client.getSession().getUsername());
CommandCore.INSTANCE.run("minecraft:team remove " + String.join("", team));
team = null;
CommandCore.INSTANCE.run("essentials:nick " + client.getSession().getUsername() + " off"); CommandCore.INSTANCE.run("essentials:nick " + client.getSession().getUsername() + " off");
enabled = false; enabled = false;
@ -142,7 +127,6 @@ public class RainbowName {
hue = (hue + increment) % 360; hue = (hue + increment) % 360;
} }
CommandCore.INSTANCE.run("minecraft:team modify " + String.join("", team) + " prefix " + GsonComponentSerializer.gson().serialize(component));
CommandCore.INSTANCE.run("essentials:nick " + client.getSession().getUsername() + " " + essentialsNickname); CommandCore.INSTANCE.run("essentials:nick " + client.getSession().getUsername() + " " + essentialsNickname);
startHue = (startHue + increment) % 360; startHue = (startHue + increment) % 360;