Skip to content

Commit

Permalink
Merge pull request #82 from MultiChat/v1-8
Browse files Browse the repository at this point in the history
Version 1.8
  • Loading branch information
OllieMartin authored Apr 7, 2020
2 parents f70f7f5 + 884753e commit 62d7a94
Show file tree
Hide file tree
Showing 113 changed files with 5,974 additions and 1,050 deletions.
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.7.5</version>
<version>1.8</version>

<repositories>

Expand Down
Binary file added multichat/releases/1.8/multichat-1.8-alpha1.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha10.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha11.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha12.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha13.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha14.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha15.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha16.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha17.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha18.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha19.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha2.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha20.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha3.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha4.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha5.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha6.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha7.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha8.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-alpha9.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-beta-1.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-beta-2.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-beta-3.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-beta-4.jar
Binary file not shown.
Binary file added multichat/releases/1.8/multichat-1.8-pre-1.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.
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.
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.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static void sendPlayerChannelMessage(String playerName, String channel, C
@EventHandler
public static void onPluginMessage(PluginMessageEvent ev) {

if (! (ev.getTag().equals("multichat:comm") || ev.getTag().equals("multichat:chat") || ev.getTag().equals("multichat:prefix") || ev.getTag().equals("multichat:suffix") || ev.getTag().equals("multichat:dn") || ev.getTag().equals("multichat:world") || ev.getTag().equals("multichat:nick")) ) {
if (! (ev.getTag().equals("multichat:comm") || ev.getTag().equals("multichat:chat") || ev.getTag().equals("multichat:prefix") || ev.getTag().equals("multichat:suffix") || ev.getTag().equals("multichat:dn") || ev.getTag().equals("multichat:world") || ev.getTag().equals("multichat:nick") || ev.getTag().equals("multichat:pxe") || ev.getTag().equals("multichat:ppxe")) ) {
return;
}

Expand Down Expand Up @@ -227,12 +227,12 @@ public static void onPluginMessage(PluginMessageEvent ev) {

DebugManager.log("{multichat:chat} Got player successfully! Name = " + player.getName());

synchronized (player) {
//synchronized (player) {

DebugManager.log("{multichat:chat} Global Channel Available? = " + (Channel.getGlobalChannel() != null));
Channel.getGlobalChannel().sendMessage(player, message, format);
DebugManager.log("{multichat:chat} Global Channel Available? = " + (Channel.getGlobalChannel() != null));
Channel.getGlobalChannel().sendMessage(player, message, format);

}
//}

} catch (IOException e) {
DebugManager.log("{multichat:chat} ERROR READING PLUGIN MESSAGE");
Expand Down Expand Up @@ -440,5 +440,57 @@ public static void onPluginMessage(PluginMessageEvent ev) {
}

}


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

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

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

try {

String command = in.readUTF();
DebugManager.log("[multichat:pxe] Command is: " + command);
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), command);

} catch (IOException e) {
e.printStackTrace();
}

}

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

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

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

try {

String command = in.readUTF();
String playerRegex = in.readUTF();

DebugManager.log("[multichat:ppxe] Command is: " + command);
DebugManager.log("[multichat:ppxe] Player regex is: " + playerRegex);

for (ProxiedPlayer p : ProxyServer.getInstance().getPlayers()) {

if (p.getName().matches(playerRegex)) {

ProxyServer.getInstance().getPluginManager().dispatchCommand(p, command);

}

}

} catch (IOException e) {
e.printStackTrace();
}

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import net.md_5.bungee.api.chat.TextComponent;

public class ConsoleManager {

public static void log(String message) {
logToConsole(message);
}

public static void logDisplayMessage(String message) {
logToConsole(MessageManager.getMessage("console_display_prefix") + message);
}
Expand All @@ -23,25 +23,37 @@ public static void logChat(String message) {
logToConsole(MessageManager.getMessage("console_chat_prefix") + message);

}

public static void logModChat(String message) {

if (!MultiChat.logStaffChat) {
return;
}

logToConsole(MessageManager.getMessage("console_modchat_prefix") + message);

}

public static void logGroupChat(String message) {

if (!MultiChat.logGroupChat) {
return;
}

logToConsole(MessageManager.getMessage("console_groupchat_prefix") + message);

}

public static void logAdminChat(String message) {

if (!MultiChat.logStaffChat) {
return;
}

logToConsole(MessageManager.getMessage("console_adminchat_prefix") + message);

}

public static void logHelpMe(String message) {

logToConsole(MessageManager.getMessage("console_helpme_prefix") + message);
Expand All @@ -54,11 +66,15 @@ public static void logBasicChat(String prefix, String message) {
logToConsole(MessageManager.getMessage("console_chat_prefix") + prefix, message);

}

public static void logSocialSpy(String p1, String p2, String message) {


if (!MultiChat.logPMs) {
return;
}

logToConsole(MessageManager.getMessage("console_socialspy_prefix") + "(" + p1 + " -> " + p2 + ") " + message);

}

private static void logToConsole(String message, String unformattedMessage) {
Expand Down
111 changes: 64 additions & 47 deletions multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,66 +313,66 @@ public void onChat(ChatEvent event) {

if ((!event.isCancelled()) && (!event.isCommand())) {

if (ConfigManager.getInstance().getHandler("config.yml").getConfig().getBoolean("global") == true) {
//TODO? I removed these checks... I think thats good... if (ConfigManager.getInstance().getHandler("config.yml").getConfig().getBoolean("global") == true) {

if (!ConfigManager.getInstance().getHandler("config.yml").getConfig().getStringList("no_global").contains(player.getServer().getInfo().getName())) {
//TODO ? if (!ConfigManager.getInstance().getHandler("config.yml").getConfig().getStringList("no_global").contains(player.getServer().getInfo().getName())) {

if (ConfigManager.getInstance().getHandler("config.yml").getConfig().getBoolean("fetch_spigot_display_names") == true) {
BungeeComm.sendMessage(player.getName(), player.getServer().getInfo());
}

if ((!MultiChat.frozen) || (player.hasPermission("multichat.chat.always"))) {
if (ConfigManager.getInstance().getHandler("config.yml").getConfig().getBoolean("fetch_spigot_display_names") == true) {
BungeeComm.sendMessage(player.getName(), player.getServer().getInfo());
}

String message = event.getMessage();
if ((!MultiChat.frozen) || (player.hasPermission("multichat.chat.always"))) {

if (ChatControl.isMuted(player.getUniqueId(), "global_chat")) {
MessageManager.sendMessage(player, "mute_cannot_send_message");
event.setCancelled(true);
return;
}
String message = event.getMessage();

DebugManager.log(player.getName() + "- about to check for spam");
if (ChatControl.isMuted(player.getUniqueId(), "global_chat")) {
MessageManager.sendMessage(player, "mute_cannot_send_message");
event.setCancelled(true);
return;
}

if (ChatControl.handleSpam(player, message, "global_chat")) {
DebugManager.log(player.getName() + " - chat message being cancelled due to spam");
event.setCancelled(true);
return;
}
DebugManager.log(player.getName() + "- about to check for spam");

Optional<String> crm;
if (ChatControl.handleSpam(player, message, "global_chat")) {
DebugManager.log(player.getName() + " - chat message being cancelled due to spam");
event.setCancelled(true);
return;
}

crm = ChatControl.applyChatRules(message, "global_chat", player.getName());
Optional<String> crm;

if (crm.isPresent()) {
message = crm.get();
event.setMessage(message);
} else {
event.setCancelled(true);
return;
}

if (!player.hasPermission("multichat.chat.link")) {
message = ChatControl.replaceLinks(message);
event.setMessage(message);
}
crm = ChatControl.applyChatRules(message, "global_chat", player.getName());

// Let server know players channel preference
BungeeComm.sendPlayerChannelMessage(player.getName(), Channel.getChannel(player.getUniqueId()).getName(), Channel.getChannel(player.getUniqueId()), player.getServer().getInfo(), (player.hasPermission("multichat.chat.colour")||player.hasPermission("multichat.chat.color")));
if (crm.isPresent()) {
message = crm.get();
event.setMessage(message);
} else {
event.setCancelled(true);
return;
}

// Message passes through to spigot here
if (!player.hasPermission("multichat.chat.link")) {
message = ChatControl.replaceLinks(message);
event.setMessage(message);
}

if (hiddenStaff.contains(player.getUniqueId())) {
hiddenStaff.remove(player.getUniqueId());
}
// Let server know players channel preference
BungeeComm.sendPlayerChannelMessage(player.getName(), Channel.getChannel(player.getUniqueId()).getName(), Channel.getChannel(player.getUniqueId()), player.getServer().getInfo(), (player.hasPermission("multichat.chat.colour")||player.hasPermission("multichat.chat.color")));

} else {
MessageManager.sendMessage(player, "freezechat_frozen");
event.setCancelled(true);
}
// Message passes through to spigot here

if (hiddenStaff.contains(player.getUniqueId())) {
hiddenStaff.remove(player.getUniqueId());
}

} else {
MessageManager.sendMessage(player, "freezechat_frozen");
event.setCancelled(true);
}

}
//TODO ?}
//TODO? }
}

@EventHandler
Expand Down Expand Up @@ -428,17 +428,17 @@ public void onLogin(PostLoginEvent event) {
//ConsoleManager.log("Created new global chat entry for " + player.getName());

}

if (MultiChat.forceChannelOnJoin) {

boolean globalMode;
if (!MultiChat.defaultChannel.equalsIgnoreCase("local")) {
globalMode = true;
} else {
globalMode = false;
}
ChatModeManager.getInstance().registerPlayer(uuid, globalMode);

}

// Set player to appropriate channels
Expand All @@ -463,20 +463,37 @@ public void onLogin(PostLoginEvent event) {
String joinformat = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getString("serverjoin");
String silentformat = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getString("silentjoin");
String welcomeMessage = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getString("welcome_message");
String privateWelcomeMessage = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getString("private_welcome_message");

ChatManipulation chatman = new ChatManipulation();

joinformat = chatman.replaceJoinMsgVars(joinformat, player.getName());
silentformat = chatman.replaceJoinMsgVars(silentformat, player.getName());
welcomeMessage = chatman.replaceJoinMsgVars(welcomeMessage, player.getName());
privateWelcomeMessage = chatman.replaceJoinMsgVars(privateWelcomeMessage, player.getName());

boolean broadcastWelcome = true;
if (ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().contains("welcome")) {
broadcastWelcome = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getBoolean("welcome");
}

boolean privateWelcome = false;
if (ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().contains("private_welcome")) {
privateWelcome = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getBoolean("private_welcome");
}

for (ProxiedPlayer onlineplayer : ProxyServer.getInstance().getPlayers()) {

if (!player.hasPermission("multichat.staff.silentjoin")) {

if (firstJoin && ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getBoolean("welcome")) {
if (firstJoin && broadcastWelcome) {
onlineplayer.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', welcomeMessage)));
}

if (firstJoin && privateWelcome && onlineplayer.getName().equals(player.getName())) {
onlineplayer.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', privateWelcomeMessage)));
}

onlineplayer.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', joinformat)));

} else {
Expand Down
Loading

0 comments on commit 62d7a94

Please sign in to comment.