Possible duplicate non blocking space fix.

This commit is contained in:
cnaude 2019-02-17 18:20:35 -07:00
parent 15a2a3cea0
commit 015870f3c7
3 changed files with 20 additions and 7 deletions

View File

@ -49,11 +49,11 @@
</snapshots>
</repository>
<!-- Vault -->
<!-- Vault
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
</repository> -->
<!--
<repository>
@ -154,7 +154,7 @@
<artifactId>pircbotx-shaded</artifactId>
<version>2.1.8</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>

View File

@ -98,6 +98,8 @@ import java.util.TreeMap;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils;
import org.bukkit.ChatColor;
@ -318,10 +320,18 @@ public class PurpleIRC extends JavaPlugin {
}
}
getServer().getPluginManager().registerEvents(new IRCMessageListener(this), this);
if (getServer().getVersion().contains("MC: 1.12") || getServer().getVersion().contains("MC: 1.13")) {
getServer().getPluginManager().registerEvents(new GamePlayerPlayerAdvancementDoneListener(this), this);
} else {
getServer().getPluginManager().registerEvents(new GamePlayerPlayerAchievementAwardedListener(this), this);
Pattern p = Pattern.compile("^MC: [0-9]\\.([0-9]+).*");
Matcher m = p.matcher(getServer().getVersion());
if (m.find()) {
int x = Integer.parseInt(m.group(1));
if (x >= 12) {
logInfo("Registering GamePlayerPlayerAdvancementDoneListener because version >= 1.12");
getServer().getPluginManager().registerEvents(new GamePlayerPlayerAdvancementDoneListener(this), this);
} else {
logInfo("Registering GamePlayerPlayerAchievementAwardedListener because version < 1.12");
getServer().getPluginManager().registerEvents(new GamePlayerPlayerAchievementAwardedListener(this), this);
}
logInfo("Pattern mismatch!: " + getServer().getVersion());
}
getServer().getPluginManager().registerEvents(new GamePlayerGameModeChangeListener(this), this);
getServer().getPluginManager().registerEvents(new GamePlayerChatListener(this), this);

View File

@ -1228,6 +1228,9 @@ public class ChatTokenizer {
}
public String addZeroWidthSpace(String s) {
if (s.contains("\u200B")) {
return s;
}
if (s.length() > 1) {
String a = s.substring(0, 1);
String b = s.substring(1);