mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-02-15 11:01:25 +01:00
Fix bug with custom-prefixes
This commit is contained in:
parent
cee4918526
commit
6191af39d8
@ -186,6 +186,12 @@
|
|||||||
<version>5.6.7</version>
|
<version>5.6.7</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cnaude.mineversechat</groupId>
|
||||||
|
<artifactId>MineverseChat</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cnaude.jobs</groupId>
|
<groupId>com.cnaude.jobs</groupId>
|
||||||
<artifactId>Jobs</artifactId>
|
<artifactId>Jobs</artifactId>
|
||||||
|
7
pom.xml
7
pom.xml
@ -142,6 +142,13 @@
|
|||||||
<version>5.6.7</version>
|
<version>5.6.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MineverseChat -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cnaude.mineversechat</groupId>
|
||||||
|
<artifactId>MineverseChat</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Jobs -->
|
<!-- Jobs -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cnaude.jobs</groupId>
|
<groupId>com.cnaude.jobs</groupId>
|
||||||
|
@ -50,7 +50,6 @@ import java.text.Collator;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.botsko.prism.actionlibs.QueryParameters;
|
import me.botsko.prism.actionlibs.QueryParameters;
|
||||||
import me.botsko.prism.events.BlockStateChange;
|
import me.botsko.prism.events.BlockStateChange;
|
||||||
@ -686,11 +685,12 @@ public final class PurpleBot {
|
|||||||
for (String s : config.getStringList("custom-prefixes")) {
|
for (String s : config.getStringList("custom-prefixes")) {
|
||||||
String pair[] = s.split(" ", 2);
|
String pair[] = s.split(" ", 2);
|
||||||
if (pair.length > 0) {
|
if (pair.length > 0) {
|
||||||
String token = ChatColor.translateAlternateColorCodes('&', pair[1]);
|
userPrefixes.put(pair[0], ChatColor.translateAlternateColorCodes('&', pair[1]));
|
||||||
userPrefixes.put(pair[0], token);
|
|
||||||
plugin.logDebug("CustomPrefix: " + pair[0] + " => " + token);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (String key : userPrefixes.keySet()) {
|
||||||
|
plugin.logDebug(" CustomPrefix: " + key + " => " + userPrefixes.get(key));
|
||||||
|
}
|
||||||
defaultCustomPrefix = ChatColor.translateAlternateColorCodes('&', config.getString("custom-prefix-default", "[IRC]"));
|
defaultCustomPrefix = ChatColor.translateAlternateColorCodes('&', config.getString("custom-prefix-default", "[IRC]"));
|
||||||
|
|
||||||
for (String s : config.getStringList("replace-first-occurrences")) {
|
for (String s : config.getStringList("replace-first-occurrences")) {
|
||||||
@ -2307,7 +2307,7 @@ public final class PurpleBot {
|
|||||||
if (user.getNick().equalsIgnoreCase(key) || checkUserMask(user, key)) {
|
if (user.getNick().equalsIgnoreCase(key) || checkUserMask(user, key)) {
|
||||||
CaseInsensitiveMap cm = firstOccurrenceReplacements.get(key);
|
CaseInsensitiveMap cm = firstOccurrenceReplacements.get(key);
|
||||||
for (Object obj : cm.keySet()) {
|
for (Object obj : cm.keySet()) {
|
||||||
message = message.replaceFirst((String)obj, ChatColor.translateAlternateColorCodes('&',(String)cm.get(obj)));
|
message = message.replaceFirst((String) obj, ChatColor.translateAlternateColorCodes('&', (String) cm.get(obj)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class ChatTokenizer {
|
|||||||
plugin.logDebug("customPrefix before: " + customPrefix);
|
plugin.logDebug("customPrefix before: " + customPrefix);
|
||||||
if (!ircBot.userPrefixes.isEmpty()) {
|
if (!ircBot.userPrefixes.isEmpty()) {
|
||||||
for (String key : ircBot.userPrefixes.keySet()) {
|
for (String key : ircBot.userPrefixes.keySet()) {
|
||||||
if (ircBot.userPrefixes.containsKey(user.getNick()) || ircBot.checkUserMask(user, key)) {
|
if (key.equalsIgnoreCase(user.getNick()) || ircBot.checkUserMask(user, key)) {
|
||||||
customPrefix = ircBot.userPrefixes.get(key);
|
customPrefix = ircBot.userPrefixes.get(key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user