Renamed partycommand and made party chat work from galaxy to proxy
This commit is contained in:
parent
4f4f48e847
commit
2acebc6c16
|
|
@ -34,7 +34,6 @@ public class ChatImplementation implements ChatAPI{
|
||||||
|
|
||||||
ChatUserManager.initialize(); // loads all the users from the db and adds them.
|
ChatUserManager.initialize(); // loads all the users from the db and adds them.
|
||||||
RegexManager.initialize(); // load the filters and regexes from config
|
RegexManager.initialize(); // load the filters and regexes from config
|
||||||
PartyManager.initialize(); // load the parties from the db and add the previously loaded users to them
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatAPI get() {
|
public static ChatAPI get() {
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,6 @@ public class PartyManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadParties() {
|
public static void loadParties() {
|
||||||
//Queries.loadParties();
|
Queries.loadParties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ public class ChatPlugin extends JavaPlugin {
|
||||||
registerCommand("unignore", new Unignore());
|
registerCommand("unignore", new Unignore());
|
||||||
registerCommand("muteserver", new MuteServer());
|
registerCommand("muteserver", new MuteServer());
|
||||||
registerCommand("spy", new Spy());
|
registerCommand("spy", new Spy());
|
||||||
registerCommand("chatparty", new ChatParty());
|
// registerCommand("chatparty", new ChatParty());
|
||||||
registerCommand("pc", new PartyChat());
|
registerCommand("p", new PartyChat());
|
||||||
for (Channel channel : Channel.getChannels()) {
|
for (Channel channel : Channel.getChannels()) {
|
||||||
if (!(channel instanceof CustomChannel customChannel)) continue;
|
if (!(channel instanceof CustomChannel customChannel)) continue;
|
||||||
this.getServer().getCommandMap().register(channel.getChannelName().toLowerCase(), new ChatChannel(customChannel));
|
this.getServer().getCommandMap().register(channel.getChannelName().toLowerCase(), new ChatChannel(customChannel));
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,9 @@ public class ChatParty implements CommandExecutor, TabCompleter {
|
||||||
if (party.getPartyUsers().size() > 0) {
|
if (party.getPartyUsers().size() > 0) {
|
||||||
UUID uuid = party.setNewOwner();
|
UUID uuid = party.setNewOwner();
|
||||||
sender.sendMessage(Utility.parseMiniMessage("<dark_aqua>Since you own this chat party a new party owner will be chosen.<dark_aqua>"));
|
sender.sendMessage(Utility.parseMiniMessage("<dark_aqua>Since you own this chat party a new party owner will be chosen.<dark_aqua>"));
|
||||||
ChatPlugin.getInstance().getChatHandler().partyMessage(party, player, "<dark_aqua>" +
|
// ChatPlugin.getInstance().getChatHandler().partyMessage(party, player, "<dark_aqua>" +
|
||||||
player.getName() +
|
// player.getName() +
|
||||||
" left the chat party, the new party owner is " + party.getPartyUser(uuid).getPlayerName());
|
// " left the chat party, the new party owner is " + party.getPartyUser(uuid).getPlayerName());
|
||||||
} else {
|
} else {
|
||||||
party.delete();
|
party.delete();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,6 @@ public class PartyChat implements CommandExecutor {
|
||||||
if(!(sender instanceof Player player)) { // must be a player
|
if(!(sender instanceof Player player)) { // must be a player
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Party party = PartyManager.getParty(player.getUniqueId());
|
|
||||||
if (party == null) {
|
|
||||||
sender.sendMessage(Utility.parseMiniMessage("<red>You are not in a party. For more info do <gold>/party</gold>.</red>"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args.length == 0) {
|
if(args.length == 0) {
|
||||||
// TODO: 08/08/2021 lock into party chat
|
// TODO: 08/08/2021 lock into party chat
|
||||||
|
|
@ -36,7 +31,7 @@ public class PartyChat implements CommandExecutor {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ChatPlugin.getInstance().getChatHandler().partyMessage(party, player, message);
|
ChatPlugin.getInstance().getChatHandler().partyMessage(player, message); //TODO send over proxy
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,43 +164,53 @@ public class ChatHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void partyMessage(Party party, Player player, String message) {
|
public void partyMessage(Player player, String message) {
|
||||||
if (isMuted(player, message, "[" + party.getPartyName() + " Muted] ")) return;
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
|
out.writeUTF("party");
|
||||||
|
out.writeUTF(player.getUniqueId().toString());
|
||||||
|
out.writeUTF(message);
|
||||||
|
out.writeUTF(GsonComponentSerializer.gson().serialize(
|
||||||
|
itemComponent(player.getInventory().getItemInMainHand())
|
||||||
|
));
|
||||||
|
player.sendPluginMessage(plugin, Config.MESSAGECHANNEL, out.toByteArray());
|
||||||
|
|
||||||
ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
|
||||||
Component senderName = user.getDisplayName();
|
|
||||||
|
|
||||||
String updatedMessage = RegexManager.replaceText(player.getName(), player.getUniqueId(), message);
|
// if (isMuted(player, message, "[" + party.getPartyName() + " Muted] ")) return;
|
||||||
if(updatedMessage == null) {
|
//
|
||||||
GalaxyUtility.sendBlockedNotification("Party Language", player, message, "");
|
// ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
||||||
return; // the message was blocked
|
// Component senderName = user.getDisplayName();
|
||||||
}
|
//
|
||||||
|
// String updatedMessage = RegexManager.replaceText(player.getName(), player.getUniqueId(), message);
|
||||||
if(!player.hasPermission("chat.format")) {
|
// if(updatedMessage == null) {
|
||||||
updatedMessage = Utility.stripTokens(updatedMessage);
|
// GalaxyUtility.sendBlockedNotification("Party Language", player, message, "");
|
||||||
}
|
// return; // the message was blocked
|
||||||
|
// }
|
||||||
if(updatedMessage.contains("[i]")) updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
//
|
||||||
|
// if(!player.hasPermission("chat.format")) {
|
||||||
updatedMessage = Utility.formatText(updatedMessage);
|
// updatedMessage = Utility.stripTokens(updatedMessage);
|
||||||
|
// }
|
||||||
List<Template> templates = new ArrayList<>(List.of(
|
//
|
||||||
Template.template("sender", senderName),
|
// if(updatedMessage.contains("[i]")) updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
||||||
Template.template("sendername", senderName),
|
//
|
||||||
Template.template("partyname", party.getPartyName()),
|
// updatedMessage = Utility.formatText(updatedMessage);
|
||||||
Template.template("message", updatedMessage),
|
//
|
||||||
Template.template("server", Bukkit.getServerName()),
|
// List<Template> templates = new ArrayList<>(List.of(
|
||||||
Template.template("[i]", itemComponent(player.getInventory().getItemInMainHand()))));
|
// Template.template("sender", senderName),
|
||||||
|
// Template.template("sendername", senderName),
|
||||||
Component component = Utility.parseMiniMessage(Config.PARTY_FORMAT, templates);
|
// Template.template("partyname", party.getPartyName()),
|
||||||
// sendPartyMessage(player, party.getPartyId(), component);
|
// Template.template("message", updatedMessage),
|
||||||
|
// Template.template("server", Bukkit.getServerName()),
|
||||||
Component spyMessage = Utility.parseMiniMessage(Config.PARTY_SPY, templates);
|
// Template.template("[i]", itemComponent(player.getInventory().getItemInMainHand()))));
|
||||||
for(Player pl : Bukkit.getOnlinePlayers()) {
|
//
|
||||||
if(pl.hasPermission(Config.SPYPERMISSION) && !party.getPartyUsersUuid().contains(pl.getUniqueId())) {
|
// Component component = Utility.parseMiniMessage(Config.PARTY_FORMAT, templates);
|
||||||
pl.sendMessage(spyMessage);
|
//// sendPartyMessage(player, party.getPartyId(), component);
|
||||||
}
|
//
|
||||||
}
|
// Component spyMessage = Utility.parseMiniMessage(Config.PARTY_SPY, templates);
|
||||||
|
// for(Player pl : Bukkit.getOnlinePlayers()) {
|
||||||
|
// if(pl.hasPermission(Config.SPYPERMISSION) && !party.getPartyUsersUuid().contains(pl.getUniqueId())) {
|
||||||
|
// pl.sendMessage(spyMessage);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendChatChannelMessage(CustomChannel chatChannel, UUID uuid, Component component) {
|
private void sendChatChannelMessage(CustomChannel chatChannel, UUID uuid, Component component) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,5 @@ commands:
|
||||||
permission: command.chat.mute-server
|
permission: command.chat.mute-server
|
||||||
spy:
|
spy:
|
||||||
permission: command.chat.togglespy
|
permission: command.chat.togglespy
|
||||||
chatparty:
|
p:
|
||||||
permission: command.chat.chatparty
|
permission: command.chat.p
|
||||||
pc:
|
|
||||||
permission: command.chat.pc
|
|
||||||
|
|
@ -3,10 +3,11 @@ package com.alttd.velocitychat;
|
||||||
import com.alttd.chat.ChatAPI;
|
import com.alttd.chat.ChatAPI;
|
||||||
import com.alttd.chat.ChatImplementation;
|
import com.alttd.chat.ChatImplementation;
|
||||||
import com.alttd.chat.managers.ChatUserManager;
|
import com.alttd.chat.managers.ChatUserManager;
|
||||||
|
import com.alttd.chat.managers.PartyManager;
|
||||||
import com.alttd.chat.objects.ChatUser;
|
import com.alttd.chat.objects.ChatUser;
|
||||||
import com.alttd.chat.util.Utility;
|
|
||||||
import com.alttd.velocitychat.commands.GlobalAdminChat;
|
import com.alttd.velocitychat.commands.GlobalAdminChat;
|
||||||
import com.alttd.velocitychat.commands.MailCommand;
|
import com.alttd.velocitychat.commands.MailCommand;
|
||||||
|
import com.alttd.velocitychat.commands.PartyCommand;
|
||||||
import com.alttd.velocitychat.commands.Reload;
|
import com.alttd.velocitychat.commands.Reload;
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.alttd.chat.database.DatabaseConnection;
|
import com.alttd.chat.database.DatabaseConnection;
|
||||||
|
|
@ -65,6 +66,7 @@ public class VelocityChat {
|
||||||
|
|
||||||
chatAPI = new ChatImplementation();
|
chatAPI = new ChatImplementation();
|
||||||
DatabaseConnection.initialize();
|
DatabaseConnection.initialize();
|
||||||
|
PartyManager.initialize(); // load the parties from the db and add the previously loaded users to them
|
||||||
|
|
||||||
serverHandler = new ServerHandler();
|
serverHandler = new ServerHandler();
|
||||||
chatHandler = new ChatHandler();
|
chatHandler = new ChatHandler();
|
||||||
|
|
@ -112,6 +114,7 @@ public class VelocityChat {
|
||||||
new GlobalAdminChat(server);
|
new GlobalAdminChat(server);
|
||||||
new Reload(server);
|
new Reload(server);
|
||||||
new MailCommand(server);
|
new MailCommand(server);
|
||||||
|
server.getCommandManager().register("party", new PartyCommand());
|
||||||
// all (proxy)commands go here
|
// all (proxy)commands go here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Party implements SimpleCommand {
|
public class PartyCommand implements SimpleCommand {
|
||||||
private final List<SubCommand> subCommands;
|
private final List<SubCommand> subCommands;
|
||||||
|
|
||||||
public Party() {
|
public PartyCommand() {
|
||||||
subCommands = Arrays.asList(
|
subCommands = Arrays.asList(
|
||||||
new Help(this),
|
new Help(this),
|
||||||
new Create(),
|
new Create(),
|
||||||
|
|
@ -29,6 +29,7 @@ public class Party implements SimpleCommand {
|
||||||
new Owner(),
|
new Owner(),
|
||||||
new Password(),
|
new Password(),
|
||||||
new Remove());
|
new Remove());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.alttd.velocitychat.commands.partysubcommands;
|
package com.alttd.velocitychat.commands.partysubcommands;
|
||||||
|
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.alttd.velocitychat.commands.Party;
|
import com.alttd.velocitychat.commands.PartyCommand;
|
||||||
import com.alttd.velocitychat.commands.SubCommand;
|
import com.alttd.velocitychat.commands.SubCommand;
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
|
|
||||||
|
|
@ -10,9 +10,9 @@ import java.util.List;
|
||||||
|
|
||||||
public class Help implements SubCommand {
|
public class Help implements SubCommand {
|
||||||
|
|
||||||
private final Party partyCommand;
|
private final PartyCommand partyCommand;
|
||||||
|
|
||||||
public Help(Party partyCommand)
|
public Help(PartyCommand partyCommand)
|
||||||
{
|
{
|
||||||
this.partyCommand = partyCommand;
|
this.partyCommand = partyCommand;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class Leave implements SubCommand {
|
||||||
Utility.parseMiniMessage(Config.OWNER_LEFT_PARTY, List.of(
|
Utility.parseMiniMessage(Config.OWNER_LEFT_PARTY, List.of(
|
||||||
Template.template("old_owner", player.getUsername()),
|
Template.template("old_owner", player.getUsername()),
|
||||||
Template.template("new_owner", party.getPartyUser(uuid).getPlayerName())
|
Template.template("new_owner", party.getPartyUser(uuid).getPlayerName())
|
||||||
)));
|
)), null);
|
||||||
} else {
|
} else {
|
||||||
party.delete();
|
party.delete();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class Owner implements SubCommand {
|
||||||
Utility.parseMiniMessage(Config.NEW_PARTY_OWNER, List.of(
|
Utility.parseMiniMessage(Config.NEW_PARTY_OWNER, List.of(
|
||||||
Template.template("old_owner", player.getUsername()),
|
Template.template("old_owner", player.getUsername()),
|
||||||
Template.template("new_owner", partyUser.getPlayerName())
|
Template.template("new_owner", partyUser.getPlayerName())
|
||||||
)));
|
)), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -84,24 +85,52 @@ public class ChatHandler {
|
||||||
// player2.sendMessage(receiverMessage);
|
// player2.sendMessage(receiverMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPartyMessage(Party party, Component message)
|
public static void sendBlockedNotification(String prefix, Player player, String input, String target, ServerConnection serverConnection) {
|
||||||
|
List<Template> templates = new ArrayList<>(List.of(
|
||||||
|
Template.template("prefix", prefix),
|
||||||
|
Template.template("displayname", Utility.getDisplayName(player.getUniqueId(), player.getUsername())),
|
||||||
|
Template.template("target", (target.isEmpty() ? " tried to say: " : " -> " + target + ": ")),
|
||||||
|
Template.template("input", input)
|
||||||
|
));
|
||||||
|
Component blockedNotification = Utility.parseMiniMessage(Config.NOTIFICATIONFORMAT, templates);
|
||||||
|
|
||||||
|
serverConnection.getServer().getPlayersConnected().forEach(pl ->{
|
||||||
|
if (pl.hasPermission("chat.alert-blocked")) {
|
||||||
|
pl.sendMessage(blockedNotification);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
player.sendMessage(Utility.parseMiniMessage("<red>The language you used in your message is not allowed, " +
|
||||||
|
"this constitutes as your only warning. Any further attempts at bypassing the filter will result in staff intervention.</red>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendPartyMessage(Party party, Component message, @Nullable List<UUID> ignoredPlayers)
|
||||||
{
|
{
|
||||||
VelocityChat.getPlugin().getProxy().getAllPlayers().stream()
|
VelocityChat.getPlugin().getProxy().getAllPlayers().stream()
|
||||||
.filter(pl -> {
|
.filter(pl -> {
|
||||||
UUID uuid = pl.getUniqueId();
|
UUID uuid = pl.getUniqueId();
|
||||||
|
if (ignoredPlayers != null && ignoredPlayers.contains(uuid))
|
||||||
|
return false;
|
||||||
return party.getPartyUsers().stream().anyMatch(pu -> pu.getUuid().equals(uuid));
|
return party.getPartyUsers().stream().anyMatch(pu -> pu.getUuid().equals(uuid));
|
||||||
}).forEach(pl -> {
|
}).forEach(pl -> {
|
||||||
pl.sendMessage(message);
|
pl.sendMessage(message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPartyMessage(Party party, Player player, String message, ServerConnection serverConnection) {
|
public void sendPartyMessage(UUID uuid, String message, Component item, ServerConnection serverConnection) {
|
||||||
ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
Optional<Player> optionalPlayer = VelocityChat.getPlugin().getProxy().getPlayer(uuid);
|
||||||
|
if (optionalPlayer.isEmpty()) return;
|
||||||
|
Player player = optionalPlayer.get();
|
||||||
|
ChatUser user = ChatUserManager.getChatUser(uuid);
|
||||||
|
Party party = PartyManager.getParty(user.getPartyId());
|
||||||
|
if (party == null) {
|
||||||
|
player.sendMessage(Utility.parseMiniMessage(Config.NOT_IN_A_PARTY));
|
||||||
|
return;
|
||||||
|
}
|
||||||
Component senderName = user.getDisplayName();
|
Component senderName = user.getDisplayName();
|
||||||
|
|
||||||
String updatedMessage = RegexManager.replaceText(player.getUsername(), player.getUniqueId(), message);
|
String updatedMessage = RegexManager.replaceText(player.getUsername(), uuid, message);
|
||||||
if(updatedMessage == null) {
|
if(updatedMessage == null) {
|
||||||
// GalaxyUtility.sendBlockedNotification("Party Language", player, message, "");
|
sendBlockedNotification("Party Language", player, message, "", serverConnection);
|
||||||
return; // the message was blocked
|
return; // the message was blocked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,11 +148,11 @@ public class ChatHandler {
|
||||||
Template.template("partyname", party.getPartyName()),
|
Template.template("partyname", party.getPartyName()),
|
||||||
Template.template("message", updatedMessage),
|
Template.template("message", updatedMessage),
|
||||||
Template.template("server", serverConnection.getServer().getServerInfo().getName()),
|
Template.template("server", serverConnection.getServer().getServerInfo().getName()),
|
||||||
Template.template("[i]", "item")
|
Template.template("[i]", item)
|
||||||
));
|
));
|
||||||
|
|
||||||
Component partyMessage = Utility.parseMiniMessage(Config.PARTY_FORMAT, templates);
|
Component partyMessage = Utility.parseMiniMessage(Config.PARTY_FORMAT, templates);
|
||||||
sendPartyMessage(party, partyMessage);
|
sendPartyMessage(party, partyMessage, user.getIgnoredBy());
|
||||||
|
|
||||||
Component spyMessage = Utility.parseMiniMessage(Config.PARTY_SPY, templates);
|
Component spyMessage = Utility.parseMiniMessage(Config.PARTY_SPY, templates);
|
||||||
for(Player pl : serverConnection.getServer().getPlayersConnected()) {
|
for(Player pl : serverConnection.getServer().getPlayersConnected()) {
|
||||||
|
|
|
||||||
|
|
@ -28,61 +28,58 @@ public class PluginMessageListener {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPluginMessageEvent(PluginMessageEvent event){
|
public void onPluginMessageEvent(PluginMessageEvent event){
|
||||||
if(event.getIdentifier().equals(identifier)){
|
if (!event.getIdentifier().equals(identifier)) return;
|
||||||
event.setResult(PluginMessageEvent.ForwardResult.handled());
|
event.setResult(PluginMessageEvent.ForwardResult.handled());
|
||||||
|
|
||||||
if(event.getSource() instanceof Player){
|
if(event.getSource() instanceof Player) {
|
||||||
// if this happens there's an oopsie
|
ALogger.warn("Received plugin message from a player");
|
||||||
}
|
return;
|
||||||
if(event.getSource() instanceof ServerConnection){
|
}
|
||||||
// Read the data written to the message
|
if (!(event.getSource() instanceof ServerConnection serverConnection)) return;
|
||||||
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
|
// Read the data written to the message
|
||||||
String channel = in.readUTF();
|
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
|
||||||
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
String channel = in.readUTF();
|
||||||
switch (channel) {
|
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
||||||
case "globalchat":
|
switch (channel) {
|
||||||
VelocityChat.getPlugin().getServerHandler().sendGlobalChat(in.readUTF(), in.readUTF());
|
case "globalchat":
|
||||||
break;
|
VelocityChat.getPlugin().getServerHandler().sendGlobalChat(in.readUTF(), in.readUTF());
|
||||||
case "globaladminchat":
|
break;
|
||||||
VelocityChat.getPlugin().getChatHandler().globalAdminChat(in.readUTF());
|
case "globaladminchat":
|
||||||
break;
|
VelocityChat.getPlugin().getChatHandler().globalAdminChat(in.readUTF());
|
||||||
case "privatemessage":
|
break;
|
||||||
VelocityChat.getPlugin().getChatHandler().privateMessage(in.readUTF(), in.readUTF(), in.readUTF());
|
case "privatemessage":
|
||||||
break;
|
VelocityChat.getPlugin().getChatHandler().privateMessage(in.readUTF(), in.readUTF(), in.readUTF());
|
||||||
case "chatchannel": {
|
break;
|
||||||
String channelName = in.readUTF();
|
case "chatchannel": {
|
||||||
CustomChannel chatChannel = (CustomChannel) CustomChannel.getChatChannel(channelName);
|
String channelName = in.readUTF();
|
||||||
|
CustomChannel chatChannel = (CustomChannel) CustomChannel.getChatChannel(channelName);
|
||||||
|
|
||||||
if (chatChannel == null) {
|
if (chatChannel == null) {
|
||||||
ALogger.warn("Received non existent channel" + channelName +".");
|
ALogger.warn("Received non existent channel" + channelName +".");
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
ProxyServer proxy = VelocityChat.getPlugin().getProxy();
|
|
||||||
chatChannel.getServers().forEach(server -> proxy.getServer(server).ifPresent(registeredServer ->
|
|
||||||
registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), event.getData())));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "party": {
|
|
||||||
VelocityChat.getPlugin().getChatHandler().partyChat(in.readUTF(), UUID.fromString(in.readUTF()), GsonComponentSerializer.gson().deserialize(in.readUTF()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "tmppartyupdate": {
|
|
||||||
int id = Integer.parseInt(in.readUTF());
|
|
||||||
Queries.loadPartyUsers(id);
|
|
||||||
VelocityChat.getPlugin().getProxy().getAllServers().forEach(registeredServer -> registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), event.getData()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
|
||||||
ProxyServer proxy = VelocityChat.getPlugin().getProxy();
|
|
||||||
|
|
||||||
for (RegisteredServer registeredServer : proxy.getAllServers()) {
|
|
||||||
registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), event.getData());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProxyServer proxy = VelocityChat.getPlugin().getProxy();
|
||||||
|
chatChannel.getServers().forEach(server -> proxy.getServer(server).ifPresent(registeredServer ->
|
||||||
|
registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), event.getData())));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case "party": {
|
||||||
|
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(
|
||||||
|
UUID.fromString(in.readUTF()),
|
||||||
|
in.readUTF(),
|
||||||
|
GsonComponentSerializer.gson().deserialize(in.readUTF()),
|
||||||
|
serverConnection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
||||||
|
ProxyServer proxy = VelocityChat.getPlugin().getProxy();
|
||||||
|
|
||||||
|
for (RegisteredServer registeredServer : proxy.getAllServers()) {
|
||||||
|
registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), event.getData());
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user