mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 00:17:58 +01:00
Update packets having a Chat component
This commit is contained in:
parent
8ef5a0b394
commit
76f9a059b5
@ -1,6 +1,7 @@
|
|||||||
package net.minestom.server.bossbar;
|
package net.minestom.server.bossbar;
|
||||||
|
|
||||||
import net.minestom.server.Viewable;
|
import net.minestom.server.Viewable;
|
||||||
|
import net.minestom.server.chat.Chat;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.network.packet.server.play.BossBarPacket;
|
import net.minestom.server.network.packet.server.play.BossBarPacket;
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ public class BossBar implements Viewable {
|
|||||||
BossBarPacket bossBarPacket = new BossBarPacket();
|
BossBarPacket bossBarPacket = new BossBarPacket();
|
||||||
bossBarPacket.uuid = uuid;
|
bossBarPacket.uuid = uuid;
|
||||||
bossBarPacket.action = BossBarPacket.Action.ADD;
|
bossBarPacket.action = BossBarPacket.Action.ADD;
|
||||||
bossBarPacket.title = title;
|
bossBarPacket.title = Chat.fromLegacyText(title);
|
||||||
bossBarPacket.health = progress;
|
bossBarPacket.health = progress;
|
||||||
bossBarPacket.color = color;
|
bossBarPacket.color = color;
|
||||||
bossBarPacket.division = division;
|
bossBarPacket.division = division;
|
||||||
@ -113,7 +114,7 @@ public class BossBar implements Viewable {
|
|||||||
BossBarPacket bossBarPacket = new BossBarPacket();
|
BossBarPacket bossBarPacket = new BossBarPacket();
|
||||||
bossBarPacket.uuid = uuid;
|
bossBarPacket.uuid = uuid;
|
||||||
bossBarPacket.action = BossBarPacket.Action.UPDATE_TITLE;
|
bossBarPacket.action = BossBarPacket.Action.UPDATE_TITLE;
|
||||||
bossBarPacket.title = title;
|
bossBarPacket.title = Chat.fromLegacyText(title);
|
||||||
sendPacketToViewers(bossBarPacket);
|
sendPacketToViewers(bossBarPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,8 +239,6 @@ public class Player extends LivingEntity {
|
|||||||
playerConnection.sendPacket(getPropertiesPacket()); // Send default properties
|
playerConnection.sendPacket(getPropertiesPacket()); // Send default properties
|
||||||
refreshHealth();
|
refreshHealth();
|
||||||
refreshAbilities();
|
refreshAbilities();
|
||||||
|
|
||||||
sendUpdateHealthPacket();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -733,7 +731,13 @@ public class Player extends LivingEntity {
|
|||||||
return food;
|
return food;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set and refresh client food bar
|
||||||
|
*
|
||||||
|
* @param food the new food value
|
||||||
|
*/
|
||||||
public void setFood(int food) {
|
public void setFood(int food) {
|
||||||
|
Check.argCondition(!MathUtils.isBetween(food, 0, 20), "Food needs to be between 0 and 20");
|
||||||
this.food = food;
|
this.food = food;
|
||||||
sendUpdateHealthPacket();
|
sendUpdateHealthPacket();
|
||||||
}
|
}
|
||||||
@ -742,7 +746,13 @@ public class Player extends LivingEntity {
|
|||||||
return foodSaturation;
|
return foodSaturation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set and refresh client food saturation
|
||||||
|
*
|
||||||
|
* @param foodSaturation the food saturation
|
||||||
|
*/
|
||||||
public void setFoodSaturation(float foodSaturation) {
|
public void setFoodSaturation(float foodSaturation) {
|
||||||
|
Check.argCondition(!MathUtils.isBetween(foodSaturation, 0, 5), "Food saturation has to be between 0 and 5");
|
||||||
this.foodSaturation = foodSaturation;
|
this.foodSaturation = foodSaturation;
|
||||||
sendUpdateHealthPacket();
|
sendUpdateHealthPacket();
|
||||||
}
|
}
|
||||||
@ -866,9 +876,10 @@ public class Player extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void refreshHealth() {
|
protected void refreshHealth() {
|
||||||
heal();
|
|
||||||
this.food = 20;
|
this.food = 20;
|
||||||
this.foodSaturation = 5;
|
this.foodSaturation = 5;
|
||||||
|
// refresh health and send health packet
|
||||||
|
heal();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendUpdateHealthPacket() {
|
protected void sendUpdateHealthPacket() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.minestom.server.network.packet.server.play;
|
package net.minestom.server.network.packet.server.play;
|
||||||
|
|
||||||
|
import net.kyori.text.Component;
|
||||||
import net.minestom.server.bossbar.BarColor;
|
import net.minestom.server.bossbar.BarColor;
|
||||||
import net.minestom.server.bossbar.BarDivision;
|
import net.minestom.server.bossbar.BarDivision;
|
||||||
import net.minestom.server.chat.Chat;
|
import net.minestom.server.chat.Chat;
|
||||||
@ -14,7 +15,7 @@ public class BossBarPacket implements ServerPacket {
|
|||||||
public UUID uuid;
|
public UUID uuid;
|
||||||
public Action action;
|
public Action action;
|
||||||
|
|
||||||
public String title;
|
public Component title;
|
||||||
public float health;
|
public float health;
|
||||||
public BarColor color;
|
public BarColor color;
|
||||||
public BarDivision division;
|
public BarDivision division;
|
||||||
@ -28,7 +29,7 @@ public class BossBarPacket implements ServerPacket {
|
|||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case ADD:
|
case ADD:
|
||||||
writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(title)));
|
writer.writeSizedString(Chat.toJsonString(title));
|
||||||
writer.writeFloat(health);
|
writer.writeFloat(health);
|
||||||
writer.writeVarInt(color.ordinal());
|
writer.writeVarInt(color.ordinal());
|
||||||
writer.writeVarInt(division.ordinal());
|
writer.writeVarInt(division.ordinal());
|
||||||
@ -41,7 +42,7 @@ public class BossBarPacket implements ServerPacket {
|
|||||||
writer.writeFloat(health);
|
writer.writeFloat(health);
|
||||||
break;
|
break;
|
||||||
case UPDATE_TITLE:
|
case UPDATE_TITLE:
|
||||||
writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(title)));
|
writer.writeSizedString(Chat.toJsonString(title));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STYLE:
|
case UPDATE_STYLE:
|
||||||
writer.writeVarInt(color.ordinal());
|
writer.writeVarInt(color.ordinal());
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minestom.server.network.packet.server.play;
|
package net.minestom.server.network.packet.server.play;
|
||||||
|
|
||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
import net.kyori.text.TextComponent;
|
|
||||||
import net.minestom.server.chat.Chat;
|
import net.minestom.server.chat.Chat;
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
@ -23,7 +22,8 @@ public class CombatEventPacket implements ServerPacket {
|
|||||||
private int playerID;
|
private int playerID;
|
||||||
private Component deathMessage;
|
private Component deathMessage;
|
||||||
|
|
||||||
private CombatEventPacket() {}
|
private CombatEventPacket() {
|
||||||
|
}
|
||||||
|
|
||||||
public static CombatEventPacket enter() {
|
public static CombatEventPacket enter() {
|
||||||
CombatEventPacket packet = new CombatEventPacket();
|
CombatEventPacket packet = new CombatEventPacket();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.minestom.server.network.packet.server.play;
|
package net.minestom.server.network.packet.server.play;
|
||||||
|
|
||||||
|
import net.kyori.text.Component;
|
||||||
import net.minestom.server.chat.Chat;
|
import net.minestom.server.chat.Chat;
|
||||||
import net.minestom.server.network.packet.PacketWriter;
|
import net.minestom.server.network.packet.PacketWriter;
|
||||||
import net.minestom.server.network.packet.server.ServerPacket;
|
import net.minestom.server.network.packet.server.ServerPacket;
|
||||||
@ -9,7 +10,7 @@ public class ScoreboardObjectivePacket implements ServerPacket {
|
|||||||
|
|
||||||
public String objectiveName;
|
public String objectiveName;
|
||||||
public byte mode;
|
public byte mode;
|
||||||
public String objectiveValue;
|
public Component objectiveValue;
|
||||||
public int type;
|
public int type;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -18,7 +19,7 @@ public class ScoreboardObjectivePacket implements ServerPacket {
|
|||||||
writer.writeByte(mode);
|
writer.writeByte(mode);
|
||||||
|
|
||||||
if (mode == 0 || mode == 2) {
|
if (mode == 0 || mode == 2) {
|
||||||
writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(objectiveValue)));
|
writer.writeSizedString(Chat.toJsonString(objectiveValue));
|
||||||
writer.writeVarInt(type);
|
writer.writeVarInt(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.minestom.server.network.packet.server.play;
|
package net.minestom.server.network.packet.server.play;
|
||||||
|
|
||||||
|
import net.kyori.text.Component;
|
||||||
import net.minestom.server.chat.Chat;
|
import net.minestom.server.chat.Chat;
|
||||||
import net.minestom.server.network.packet.PacketWriter;
|
import net.minestom.server.network.packet.PacketWriter;
|
||||||
import net.minestom.server.network.packet.server.ServerPacket;
|
import net.minestom.server.network.packet.server.ServerPacket;
|
||||||
@ -10,13 +11,13 @@ public class TeamsPacket implements ServerPacket {
|
|||||||
public String teamName;
|
public String teamName;
|
||||||
public Action action;
|
public Action action;
|
||||||
|
|
||||||
public String teamDisplayName;
|
public Component teamDisplayName;
|
||||||
public byte friendlyFlags;
|
public byte friendlyFlags;
|
||||||
public NameTagVisibility nameTagVisibility;
|
public NameTagVisibility nameTagVisibility;
|
||||||
public CollisionRule collisionRule;
|
public CollisionRule collisionRule;
|
||||||
public int teamColor;
|
public int teamColor;
|
||||||
public String teamPrefix;
|
public Component teamPrefix;
|
||||||
public String teamSuffix;
|
public Component teamSuffix;
|
||||||
public String[] entities;
|
public String[] entities;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -27,13 +28,13 @@ public class TeamsPacket implements ServerPacket {
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case CREATE_TEAM:
|
case CREATE_TEAM:
|
||||||
case UPDATE_TEAM_INFO:
|
case UPDATE_TEAM_INFO:
|
||||||
writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(teamDisplayName)));
|
writer.writeSizedString(Chat.toJsonString(teamDisplayName));
|
||||||
writer.writeByte(friendlyFlags);
|
writer.writeByte(friendlyFlags);
|
||||||
writer.writeSizedString(nameTagVisibility.getIdentifier());
|
writer.writeSizedString(nameTagVisibility.getIdentifier());
|
||||||
writer.writeSizedString(collisionRule.getIdentifier());
|
writer.writeSizedString(collisionRule.getIdentifier());
|
||||||
writer.writeVarInt(teamColor);
|
writer.writeVarInt(teamColor);
|
||||||
writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(teamPrefix)));
|
writer.writeSizedString(Chat.toJsonString(teamPrefix));
|
||||||
writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(teamSuffix)));
|
writer.writeSizedString(Chat.toJsonString(teamSuffix));
|
||||||
break;
|
break;
|
||||||
case REMOVE_TEAM:
|
case REMOVE_TEAM:
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.minestom.server.scoreboard;
|
package net.minestom.server.scoreboard;
|
||||||
|
|
||||||
import net.minestom.server.Viewable;
|
import net.minestom.server.Viewable;
|
||||||
|
import net.minestom.server.chat.Chat;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.network.packet.server.play.DisplayScoreboardPacket;
|
import net.minestom.server.network.packet.server.play.DisplayScoreboardPacket;
|
||||||
import net.minestom.server.network.packet.server.play.ScoreboardObjectivePacket;
|
import net.minestom.server.network.packet.server.play.ScoreboardObjectivePacket;
|
||||||
@ -34,7 +35,7 @@ public class BelowNameScoreboard implements Viewable {
|
|||||||
scoreboardObjectivePacket = new ScoreboardObjectivePacket();
|
scoreboardObjectivePacket = new ScoreboardObjectivePacket();
|
||||||
scoreboardObjectivePacket.objectiveName = objectiveName;
|
scoreboardObjectivePacket.objectiveName = objectiveName;
|
||||||
scoreboardObjectivePacket.mode = 0;
|
scoreboardObjectivePacket.mode = 0;
|
||||||
scoreboardObjectivePacket.objectiveValue = "test:" + objectiveName;
|
scoreboardObjectivePacket.objectiveValue = Chat.fromLegacyText(objectiveName);
|
||||||
scoreboardObjectivePacket.type = 0;
|
scoreboardObjectivePacket.type = 0;
|
||||||
|
|
||||||
displayScoreboardPacket = new DisplayScoreboardPacket();
|
displayScoreboardPacket = new DisplayScoreboardPacket();
|
||||||
|
@ -53,7 +53,7 @@ public class Sidebar implements Viewable {
|
|||||||
ScoreboardObjectivePacket scoreboardObjectivePacket = new ScoreboardObjectivePacket();
|
ScoreboardObjectivePacket scoreboardObjectivePacket = new ScoreboardObjectivePacket();
|
||||||
scoreboardObjectivePacket.objectiveName = objectiveName;
|
scoreboardObjectivePacket.objectiveName = objectiveName;
|
||||||
scoreboardObjectivePacket.mode = 2; // Update display text
|
scoreboardObjectivePacket.mode = 2; // Update display text
|
||||||
scoreboardObjectivePacket.objectiveValue = title;
|
scoreboardObjectivePacket.objectiveValue = Chat.fromLegacyText(title);
|
||||||
scoreboardObjectivePacket.type = 0;
|
scoreboardObjectivePacket.type = 0;
|
||||||
|
|
||||||
sendPacketToViewers(scoreboardObjectivePacket);
|
sendPacketToViewers(scoreboardObjectivePacket);
|
||||||
@ -131,7 +131,7 @@ public class Sidebar implements Viewable {
|
|||||||
ScoreboardObjectivePacket scoreboardObjectivePacket = new ScoreboardObjectivePacket();
|
ScoreboardObjectivePacket scoreboardObjectivePacket = new ScoreboardObjectivePacket();
|
||||||
scoreboardObjectivePacket.objectiveName = objectiveName;
|
scoreboardObjectivePacket.objectiveName = objectiveName;
|
||||||
scoreboardObjectivePacket.mode = 0; // Create scoreboard
|
scoreboardObjectivePacket.mode = 0; // Create scoreboard
|
||||||
scoreboardObjectivePacket.objectiveValue = title;
|
scoreboardObjectivePacket.objectiveValue = Chat.fromLegacyText(title);
|
||||||
scoreboardObjectivePacket.type = 0; // Type integer
|
scoreboardObjectivePacket.type = 0; // Type integer
|
||||||
|
|
||||||
DisplayScoreboardPacket displayScoreboardPacket = new DisplayScoreboardPacket();
|
DisplayScoreboardPacket displayScoreboardPacket = new DisplayScoreboardPacket();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.minestom.server.scoreboard;
|
package net.minestom.server.scoreboard;
|
||||||
|
|
||||||
|
import net.minestom.server.chat.Chat;
|
||||||
import net.minestom.server.network.packet.server.play.TeamsPacket;
|
import net.minestom.server.network.packet.server.play.TeamsPacket;
|
||||||
|
|
||||||
public class SidebarTeam {
|
public class SidebarTeam {
|
||||||
@ -26,13 +27,13 @@ public class SidebarTeam {
|
|||||||
TeamsPacket teamsPacket = new TeamsPacket();
|
TeamsPacket teamsPacket = new TeamsPacket();
|
||||||
teamsPacket.teamName = teamName;
|
teamsPacket.teamName = teamName;
|
||||||
teamsPacket.action = TeamsPacket.Action.CREATE_TEAM;
|
teamsPacket.action = TeamsPacket.Action.CREATE_TEAM;
|
||||||
teamsPacket.teamDisplayName = teamDisplayName;
|
teamsPacket.teamDisplayName = Chat.fromLegacyText(teamDisplayName);
|
||||||
teamsPacket.friendlyFlags = friendlyFlags;
|
teamsPacket.friendlyFlags = friendlyFlags;
|
||||||
teamsPacket.nameTagVisibility = nameTagVisibility;
|
teamsPacket.nameTagVisibility = nameTagVisibility;
|
||||||
teamsPacket.collisionRule = collisionRule;
|
teamsPacket.collisionRule = collisionRule;
|
||||||
teamsPacket.teamColor = teamColor;
|
teamsPacket.teamColor = teamColor;
|
||||||
teamsPacket.teamPrefix = prefix;
|
teamsPacket.teamPrefix = Chat.fromLegacyText(prefix);
|
||||||
teamsPacket.teamSuffix = suffix;
|
teamsPacket.teamSuffix = Chat.fromLegacyText(suffix);
|
||||||
teamsPacket.entities = new String[]{entityName};
|
teamsPacket.entities = new String[]{entityName};
|
||||||
return teamsPacket;
|
return teamsPacket;
|
||||||
}
|
}
|
||||||
@ -48,13 +49,13 @@ public class SidebarTeam {
|
|||||||
TeamsPacket teamsPacket = new TeamsPacket();
|
TeamsPacket teamsPacket = new TeamsPacket();
|
||||||
teamsPacket.teamName = teamName;
|
teamsPacket.teamName = teamName;
|
||||||
teamsPacket.action = TeamsPacket.Action.UPDATE_TEAM_INFO;
|
teamsPacket.action = TeamsPacket.Action.UPDATE_TEAM_INFO;
|
||||||
teamsPacket.teamDisplayName = teamDisplayName;
|
teamsPacket.teamDisplayName = Chat.fromLegacyText(teamDisplayName);
|
||||||
teamsPacket.friendlyFlags = friendlyFlags;
|
teamsPacket.friendlyFlags = friendlyFlags;
|
||||||
teamsPacket.nameTagVisibility = nameTagVisibility;
|
teamsPacket.nameTagVisibility = nameTagVisibility;
|
||||||
teamsPacket.collisionRule = collisionRule;
|
teamsPacket.collisionRule = collisionRule;
|
||||||
teamsPacket.teamColor = teamColor;
|
teamsPacket.teamColor = teamColor;
|
||||||
teamsPacket.teamPrefix = prefix;
|
teamsPacket.teamPrefix = Chat.fromLegacyText(prefix);
|
||||||
teamsPacket.teamSuffix = suffix;
|
teamsPacket.teamSuffix = Chat.fromLegacyText(suffix);
|
||||||
return teamsPacket;
|
return teamsPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package net.minestom.server.scoreboard;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.kyori.text.format.TextColor;
|
import net.kyori.text.format.TextColor;
|
||||||
|
import net.minestom.server.chat.Chat;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.network.packet.server.play.TeamsPacket;
|
import net.minestom.server.network.packet.server.play.TeamsPacket;
|
||||||
import net.minestom.server.utils.PacketUtils;
|
import net.minestom.server.utils.PacketUtils;
|
||||||
@ -32,13 +33,13 @@ public class Team {
|
|||||||
teamsCreationPacket = new TeamsPacket();
|
teamsCreationPacket = new TeamsPacket();
|
||||||
teamsCreationPacket.teamName = teamName;
|
teamsCreationPacket.teamName = teamName;
|
||||||
teamsCreationPacket.action = TeamsPacket.Action.CREATE_TEAM;
|
teamsCreationPacket.action = TeamsPacket.Action.CREATE_TEAM;
|
||||||
teamsCreationPacket.teamDisplayName = teamDisplayName;
|
teamsCreationPacket.teamDisplayName = Chat.fromLegacyText(teamDisplayName);
|
||||||
teamsCreationPacket.friendlyFlags = friendlyFlags;
|
teamsCreationPacket.friendlyFlags = friendlyFlags;
|
||||||
teamsCreationPacket.nameTagVisibility = nameTagVisibility;
|
teamsCreationPacket.nameTagVisibility = nameTagVisibility;
|
||||||
teamsCreationPacket.collisionRule = collisionRule;
|
teamsCreationPacket.collisionRule = collisionRule;
|
||||||
teamsCreationPacket.teamColor = teamColor.ordinal();
|
teamsCreationPacket.teamColor = teamColor.ordinal();
|
||||||
teamsCreationPacket.teamPrefix = prefix;
|
teamsCreationPacket.teamPrefix = Chat.fromLegacyText(prefix);
|
||||||
teamsCreationPacket.teamSuffix = suffix;
|
teamsCreationPacket.teamSuffix = Chat.fromLegacyText(suffix);
|
||||||
teamsCreationPacket.entities = entities;
|
teamsCreationPacket.entities = entities;
|
||||||
|
|
||||||
TeamsPacket destroyPacket = new TeamsPacket();
|
TeamsPacket destroyPacket = new TeamsPacket();
|
||||||
@ -91,7 +92,7 @@ public class Team {
|
|||||||
|
|
||||||
public void setTeamDisplayName(String teamDisplayName) {
|
public void setTeamDisplayName(String teamDisplayName) {
|
||||||
this.teamDisplayName = teamDisplayName;
|
this.teamDisplayName = teamDisplayName;
|
||||||
this.teamsCreationPacket.teamDisplayName = teamDisplayName;
|
this.teamsCreationPacket.teamDisplayName = Chat.fromLegacyText(teamDisplayName);
|
||||||
sendUpdatePacket();
|
sendUpdatePacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,13 +116,13 @@ public class Team {
|
|||||||
|
|
||||||
public void setPrefix(String prefix) {
|
public void setPrefix(String prefix) {
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
this.teamsCreationPacket.teamPrefix = prefix;
|
this.teamsCreationPacket.teamPrefix = Chat.fromLegacyText(prefix);
|
||||||
sendUpdatePacket();
|
sendUpdatePacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuffix(String suffix) {
|
public void setSuffix(String suffix) {
|
||||||
this.suffix = suffix;
|
this.suffix = suffix;
|
||||||
this.teamsCreationPacket.teamSuffix = suffix;
|
this.teamsCreationPacket.teamSuffix = Chat.fromLegacyText(suffix);
|
||||||
sendUpdatePacket();
|
sendUpdatePacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,13 +149,13 @@ public class Team {
|
|||||||
TeamsPacket updatePacket = new TeamsPacket();
|
TeamsPacket updatePacket = new TeamsPacket();
|
||||||
updatePacket.teamName = teamName;
|
updatePacket.teamName = teamName;
|
||||||
updatePacket.action = TeamsPacket.Action.UPDATE_TEAM_INFO;
|
updatePacket.action = TeamsPacket.Action.UPDATE_TEAM_INFO;
|
||||||
updatePacket.teamDisplayName = teamDisplayName;
|
updatePacket.teamDisplayName = Chat.fromLegacyText(teamDisplayName);
|
||||||
updatePacket.friendlyFlags = friendlyFlags;
|
updatePacket.friendlyFlags = friendlyFlags;
|
||||||
updatePacket.nameTagVisibility = nameTagVisibility;
|
updatePacket.nameTagVisibility = nameTagVisibility;
|
||||||
updatePacket.collisionRule = collisionRule;
|
updatePacket.collisionRule = collisionRule;
|
||||||
updatePacket.teamColor = teamColor.ordinal();
|
updatePacket.teamColor = teamColor.ordinal();
|
||||||
updatePacket.teamPrefix = prefix;
|
updatePacket.teamPrefix = Chat.fromLegacyText(prefix);
|
||||||
updatePacket.teamSuffix = suffix;
|
updatePacket.teamSuffix = Chat.fromLegacyText(suffix);
|
||||||
ByteBuf buffer = PacketUtils.writePacket(updatePacket);
|
ByteBuf buffer = PacketUtils.writePacket(updatePacket);
|
||||||
players.forEach(p -> p.getPlayerConnection().sendPacket(buffer));
|
players.forEach(p -> p.getPlayerConnection().sendPacket(buffer));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user