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> </snapshots>
</repository> </repository>
<!-- Vault --> <!-- Vault
<repository> <repository>
<id>vault-repo</id> <id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url> <url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository> </repository> -->
<!-- <!--
<repository> <repository>

View File

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

View File

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