Switched to Username only (no nicknames) till colors can be fixed (for party users)

This commit is contained in:
Teriuihi 2021-08-08 12:19:32 +02:00
parent 2cb843b68c
commit 67eccd389d
4 changed files with 16 additions and 13 deletions

View File

@ -177,10 +177,11 @@ public class Queries {
while (resultSet.next()) { while (resultSet.next()) {
int id = resultSet.getInt("party_id"); int id = resultSet.getInt("party_id");
UUID uuid = UUID.fromString(resultSet.getString("uuid")); UUID uuid = UUID.fromString(resultSet.getString("uuid"));
String displayName = resultSet.getString("nickname"); // String displayName = resultSet.getString("nickname");
if (displayName == null || displayName.isEmpty()) { // if (displayName == null || displayName.isEmpty()) {
displayName = resultSet.getString("Username"); // displayName = resultSet.getString("Username");
} // }
String displayName = resultSet.getString("Username"); // FIXME: 08/08/2021 only using display name till we can fix nickname colors
Party party = PartyManager.getParty(id); Party party = PartyManager.getParty(id);
if (party == null) { if (party == null) {

View File

@ -50,9 +50,5 @@ public class PartyManager {
public static void loadParties() { public static void loadParties() {
Queries.loadParties(); Queries.loadParties();
for (ChatUser chatUser : ChatUserManager.getChatUsers()) {
Party party = getParty(chatUser.getPartyId());
if (party != null) party.addUser(chatUser);
}
} }
} }

View File

@ -28,8 +28,11 @@ public class Party {
this.partyUsers.put(uuid, displayName); this.partyUsers.put(uuid, displayName);
} }
public void addUser(ChatUser partyUser) { public void addUser(ChatUser partyUser, String displayName) {
this.partyUsers.put(partyUser.getUuid(), PlainComponentSerializer.plain().serialize(partyUser.getDisplayName())); // this.partyUsers.put(partyUser.getUuid(), PlainComponentSerializer.plain().serialize(partyUser.getDisplayName()));
// partyUser.setPartyId(getPartyId());
// Queries.addPartyUser(partyUser);
this.partyUsers.put(partyUser.getUuid(), displayName);
partyUser.setPartyId(getPartyId()); partyUser.setPartyId(getPartyId());
Queries.addPartyUser(partyUser); Queries.addPartyUser(partyUser);
} }

View File

@ -44,7 +44,8 @@ public class PartyCommand implements CommandExecutor {
break; break;
} }
Party party = Queries.addParty(player.getUniqueId(), args[1], args[2]); Party party = Queries.addParty(player.getUniqueId(), args[1], args[2]);
party.addUser(ChatUserManager.getChatUser(player.getUniqueId())); // party.addUser(ChatUserManager.getChatUser(player.getUniqueId())); //Removed until we can get nicknames to translate to colors correctly
party.addUser(ChatUserManager.getChatUser(player.getUniqueId()), player.getName());
PartyManager.addParty(party); PartyManager.addParty(party);
sender.sendMessage(MiniMessage.get().parse("<green>You created a party called: '<gold>" + sender.sendMessage(MiniMessage.get().parse("<green>You created a party called: '<gold>" +
party.getPartyName() + "</gold>' with the password: '<gold>" + party.getPartyName() + "</gold>' with the password: '<gold>" +
@ -90,7 +91,8 @@ public class PartyCommand implements CommandExecutor {
break; break;
} }
party.addUser(ChatUserManager.getChatUser(player.getUniqueId())); // party.addUser(ChatUserManager.getChatUser(player.getUniqueId())); //Removed until we can get nicknames to translate to colors correctly
party.addUser(ChatUserManager.getChatUser(player.getUniqueId()), player.getName());
sender.sendMessage(MiniMessage.get().parse("<green>You joined " + party.getPartyName() + "!</green>")); sender.sendMessage(MiniMessage.get().parse("<green>You joined " + party.getPartyName() + "!</green>"));
} }
case "leave" -> { case "leave" -> {
@ -194,7 +196,8 @@ public class PartyCommand implements CommandExecutor {
INVITE("<gold>/party invite <username></gold>"), INVITE("<gold>/party invite <username></gold>"),
JOIN("<gold>/party join <party name> <password></gold>"), JOIN("<gold>/party join <party name> <password></gold>"),
LEAVE("<gold><hover:show_text:'<red>If the party owner leaves the server will choose a new party owner</red>'>/party leave</hover></gold>"), LEAVE("<gold><hover:show_text:'<red>If the party owner leaves the server will choose a new party owner</red>'>/party leave</hover></gold>"),
REMOVE("<gold>/party remove <username></gold>"); REMOVE("<gold>/party remove <username></gold>"),
INFO("<gold>/party info</gold>");
private final String message; private final String message;