Maybe made nicknames auto sync
This commit is contained in:
parent
e6e1073958
commit
fa79491088
|
|
@ -163,4 +163,11 @@ public class ChatUser {
|
||||||
this.isMuted = muted;
|
this.isMuted = muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reloadDisplayName() {
|
||||||
|
name = Queries.getDisplayName(uuid);
|
||||||
|
if (name == null) {
|
||||||
|
name = Utility.getDisplayName(uuid, "");
|
||||||
|
}
|
||||||
|
setDisplayName(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.alttd.velocitychat.listeners;
|
package com.alttd.velocitychat.listeners;
|
||||||
|
|
||||||
|
import com.alttd.chat.managers.ChatUserManager;
|
||||||
|
import com.alttd.chat.objects.ChatUser;
|
||||||
import com.alttd.velocitychat.VelocityChat;
|
import com.alttd.velocitychat.VelocityChat;
|
||||||
import com.alttd.chat.database.Queries;
|
import com.alttd.chat.database.Queries;
|
||||||
import com.alttd.chat.objects.channels.CustomChannel;
|
import com.alttd.chat.objects.channels.CustomChannel;
|
||||||
|
|
@ -15,6 +17,8 @@ import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PluginMessageListener {
|
public class PluginMessageListener {
|
||||||
|
|
@ -72,6 +76,22 @@ public class PluginMessageListener {
|
||||||
serverConnection);
|
serverConnection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "NickNameAccepted": {
|
||||||
|
try {
|
||||||
|
short len = in.readShort();
|
||||||
|
byte[] msgbytes = new byte[len];
|
||||||
|
in.readFully(msgbytes);
|
||||||
|
|
||||||
|
DataInputStream msgin = new DataInputStream(new ByteArrayInputStream(msgbytes));
|
||||||
|
UUID uuid = UUID.fromString(msgin.readUTF());
|
||||||
|
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
||||||
|
chatUser.reloadDisplayName();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
||||||
ProxyServer proxy = VelocityChat.getPlugin().getProxy();
|
ProxyServer proxy = VelocityChat.getPlugin().getProxy();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user