Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion multichat/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>xyz.olivermartin.multichat</groupId>
<artifactId>multichat</artifactId>
<version>1.9-snapshot.20.4.27.1</version>
<version>1.9-snapshot.20.4.29</version>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion multichat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>xyz.olivermartin.multichat</groupId>
<artifactId>multichat</artifactId>
<version>1.9-snapshot.20.4.27.1</version>
<version>1.9-snapshot.20.4.29</version>

<repositories>

Expand Down
Binary file added multichat/releases/1.9/multichat-1.9-beta.2.jar
Binary file not shown.
Binary file added multichat/releases/1.9/multichat-1.9-beta.3.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:chat")) {

ev.setCancelled(true);

DebugManager.log("{multichat:chat} Got a plugin message");

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
Expand Down Expand Up @@ -244,6 +246,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:nick")) {

ev.setCancelled(true);

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
DataInputStream in = new DataInputStream(stream);

Expand Down Expand Up @@ -282,6 +286,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:prefix")) {

ev.setCancelled(true);

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
DataInputStream in = new DataInputStream(stream);

Expand Down Expand Up @@ -320,6 +326,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:suffix")) {

ev.setCancelled(true);

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
DataInputStream in = new DataInputStream(stream);

Expand Down Expand Up @@ -358,6 +366,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:dn")) {

ev.setCancelled(true);

DebugManager.log("[multichat:dn] Got an incoming channel message!");

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
Expand Down Expand Up @@ -398,6 +408,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:world")) {

ev.setCancelled(true);

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
DataInputStream in = new DataInputStream(stream);

Expand Down Expand Up @@ -442,6 +454,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:pxe")) {

ev.setCancelled(true);

DebugManager.log("[multichat:pxe] Got an incoming pexecute message!");

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
Expand All @@ -461,6 +475,8 @@ public static void onPluginMessage(PluginMessageEvent ev) {

if (ev.getTag().equals("multichat:ppxe")) {

ev.setCancelled(true);

DebugManager.log("[multichat:ppxe] Got an incoming pexecute message (for a player)!");

ByteArrayInputStream stream = new ByteArrayInputStream(ev.getData());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Queue;
import java.util.UUID;
Expand All @@ -16,8 +17,12 @@ public boolean isForceMultiChatFormat() {
return MultiChatLocal.getInstance().getConfigManager().getLocalConfig().isForceMultiChatFormat();
}

public boolean isGlobalChatServer() {
return MultiChatLocal.getInstance().getDataStore().globalChatServer;
public boolean isOverrideMultiChatFormat() {
return MultiChatLocal.getInstance().getConfigManager().getLocalConfig().isOverrideAllMultiChatFormatting();
}

public synchronized boolean isGlobalChatServer() {
return MultiChatLocal.getInstance().getDataStore().isGlobalChatServer();
}

public boolean isSetLocalFormat() {
Expand All @@ -35,12 +40,18 @@ public String getSelectedChatChannel(UUID uuid) {

String channel;

if (store.playerChannels.containsKey(uuid)) {
channel = store.playerChannels.get(uuid);
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Got selected player channel as " + channel);
} else {
channel = "global";
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player was not in channel map, so using global...");
Map<UUID,String> playerChannels = store.getPlayerChannels();

synchronized(playerChannels) {

if (playerChannels.containsKey(uuid)) {
channel = playerChannels.get(uuid);
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Got selected player channel as " + channel);
} else {
channel = "global";
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player was not in channel map, so using global...");
}

}

return channel;
Expand All @@ -49,16 +60,22 @@ public String getSelectedChatChannel(UUID uuid) {

public void queueChatChannel(String playerName, String channel) {

if (MultiChatLocal.getInstance().getDataStore().chatQueues.containsKey(playerName.toLowerCase())) {
Map<String, Queue<String>> chatQueues = MultiChatLocal.getInstance().getDataStore().getChatQueues();

Queue<String> chatQueue = MultiChatLocal.getInstance().getDataStore().chatQueues.get(playerName.toLowerCase());
chatQueue.add(channel);
synchronized (chatQueues) {

} else {
if (chatQueues.containsKey(playerName.toLowerCase())) {

Queue<String> chatQueue = new LinkedList<String>();
chatQueue.add(channel);
MultiChatLocal.getInstance().getDataStore().chatQueues.put(playerName.toLowerCase(), chatQueue);
Queue<String> chatQueue = chatQueues.get(playerName.toLowerCase());
chatQueue.add(channel);

} else {

Queue<String> chatQueue = new LinkedList<String>();
chatQueue.add(channel);
chatQueues.put(playerName.toLowerCase(), chatQueue);

}

}

Expand All @@ -67,51 +84,42 @@ public void queueChatChannel(String playerName, String channel) {
private String getChannelFromChatQueue(MultiChatLocalPlayer player, boolean pollQueue) {

LocalDataStore store = MultiChatLocal.getInstance().getDataStore();

Map<String, Queue<String>> chatQueues = store.getChatQueues();
String channel;

if (store.chatQueues.containsKey(player.getName().toLowerCase())) {

// Hack for /global /local direct messaging...
synchronized (chatQueues) {

MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player in chat queue...");
if (chatQueues.containsKey(player.getName().toLowerCase())) {

String tempChannel;
// Hack for /global /local direct messaging...

if (pollQueue) {
tempChannel = store.chatQueues.get(player.getName().toLowerCase()).poll();
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player in chat queue...");

if (store.chatQueues.get(player.getName().toLowerCase()).size() < 1) {
store.chatQueues.remove(player.getName().toLowerCase());
}
String tempChannel;

} else {
tempChannel = store.chatQueues.get(player.getName().toLowerCase()).peek();
}
if (pollQueue) {
tempChannel = chatQueues.get(player.getName().toLowerCase()).poll();

MultiChatLocal.getInstance().getConsoleLogger().debug("What did we get from the chat queue? Is it null?: " + (tempChannel==null));
if (chatQueues.get(player.getName().toLowerCase()).size() < 1) {
chatQueues.remove(player.getName().toLowerCase());
}

MultiChatLocal.getInstance().getConsoleLogger().debug("It was: " + tempChannel);
} else {
tempChannel = chatQueues.get(player.getName().toLowerCase()).peek();
}

channel = tempChannel;
MultiChatLocal.getInstance().getConsoleLogger().debug("What did we get from the chat queue? Is it null?: " + (tempChannel==null));

/*if (tempChannel.startsWith("!SINGLE L MESSAGE!")) {
MultiChatLocal.getInstance().getConsoleLogger().debug("It was: " + tempChannel);

MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] This is a local (direct) message");
channel = "local";
channel = tempChannel;

} else {

MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] This is a global (direct) message");
channel = "global";

}*/

} else {
// Get normally selected channel
channel = getSelectedChatChannel(player.getUniqueId());

// Get normally selected channel

channel = getSelectedChatChannel(player.getUniqueId());
}

}

Expand Down Expand Up @@ -149,7 +157,7 @@ public String getChannelFormat(String channel) {
if (!config.isOverrideGlobalFormat()) {

// If we aren't overriding then use the main global format
format = MultiChatLocal.getInstance().getDataStore().globalChatFormat;
format = MultiChatLocal.getInstance().getDataStore().getGlobalChatFormat();

} else {

Expand All @@ -169,22 +177,27 @@ public String getChannelFormat(String channel) {
public boolean canChatInColour(UUID uuid) {

LocalDataStore store = MultiChatLocal.getInstance().getDataStore();
Map<UUID, Boolean> colourMap = store.getColourMap();

if (store.colourMap.containsKey(uuid)) {
synchronized (colourMap) {

MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player is in the colour map!");
if (colourMap.containsKey(uuid)) {

boolean colour = store.colourMap.get(uuid);
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player is in the colour map!");

MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Can they use colours? --> " + colour);
boolean colour = colourMap.get(uuid);

return colour;
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Can they use colours? --> " + colour);

} else {
return colour;

} else {

MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player was NOT in the colour map! That probably isn't good!");
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Player was NOT in the colour map! That probably isn't good!");

return false;
return false;

}

}

Expand Down Expand Up @@ -214,6 +227,9 @@ public String processMultiChatConfigPlaceholders(MultiChatLocalPlayer player, St
value = processExternalPlaceholders(player, value);
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Processed with external placeholders to get: " + value);

value = translateColourCodes(value);
MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] Translated colour codes to get: " + value);

MultiChatLocal.getInstance().getConsoleLogger().debug("[LocalChatManager] MESSAGE = : " + message);

if (message.contains(key)) {
Expand All @@ -229,10 +245,16 @@ public String processMultiChatConfigPlaceholders(MultiChatLocalPlayer player, St

public Optional<LocalPseudoChannel> getChannelObject(String channelName) {

if (MultiChatLocal.getInstance().getDataStore().channelObjects.containsKey(channelName)) {
return Optional.of(MultiChatLocal.getInstance().getDataStore().channelObjects.get(channelName));
} else {
return Optional.empty();
Map<String, LocalPseudoChannel> channelObjects = MultiChatLocal.getInstance().getDataStore().getChannelObjects();

synchronized (channelObjects) {

if (channelObjects.containsKey(channelName)) {
return Optional.of(channelObjects.get(channelName));
} else {
return Optional.empty();
}

}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package xyz.olivermartin.multichat.local.common.listeners;

import java.util.Map;
import java.util.UUID;

import xyz.olivermartin.multichat.local.common.MultiChatLocal;
import xyz.olivermartin.multichat.local.common.MultiChatLocalPlayer;

Expand All @@ -11,12 +14,18 @@ protected void handleLoginEvent(MultiChatLocalPlayer player) {

MultiChatLocal.getInstance().getNameManager().registerPlayer(player.getUniqueId(), player.getName());

if (!MultiChatLocal.getInstance().getDataStore().playerChannels.containsKey(player.getUniqueId())) {
MultiChatLocal.getInstance().getDataStore().playerChannels.put(player.getUniqueId(), "global");
Map<UUID, String> playerChannels = MultiChatLocal.getInstance().getDataStore().getPlayerChannels();
synchronized (playerChannels) {
if (!playerChannels.containsKey(player.getUniqueId())) {
playerChannels.put(player.getUniqueId(), "global");
}
}

if (!MultiChatLocal.getInstance().getDataStore().colourMap.containsKey(player.getUniqueId())) {
MultiChatLocal.getInstance().getDataStore().colourMap.put(player.getUniqueId(), false);
Map<UUID, Boolean> colourMap = MultiChatLocal.getInstance().getDataStore().getColourMap();
synchronized (colourMap) {
if (!colourMap.containsKey(player.getUniqueId())) {
colourMap.put(player.getUniqueId(), false);
}
}

MultiChatLocal.getInstance().getProxyCommunicationManager().updatePlayerMeta(player.getUniqueId());
Expand All @@ -26,8 +35,16 @@ protected void handleLoginEvent(MultiChatLocalPlayer player) {
protected void handleLogoutEvent(MultiChatLocalPlayer player) {

MultiChatLocal.getInstance().getNameManager().unregisterPlayer(player.getUniqueId());
MultiChatLocal.getInstance().getDataStore().playerChannels.remove(player.getUniqueId());
MultiChatLocal.getInstance().getDataStore().colourMap.remove(player.getUniqueId());

Map<UUID, String> playerChannels = MultiChatLocal.getInstance().getDataStore().getPlayerChannels();
synchronized (playerChannels) {
playerChannels.remove(player.getUniqueId());
}

Map<UUID, Boolean> colourMap = MultiChatLocal.getInstance().getDataStore().getColourMap();
synchronized (colourMap) {
colourMap.remove(player.getUniqueId());
}

}

Expand Down
Loading