Skip to content

Commit 1b26ea9

Browse files
committed
Migrate spigot chat item for the one spigot user.
1 parent 6de772e commit 1b26ea9

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

bukkit/src/main/java/dev/kitteh/factions/config/file/MainConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ public class Spigot {
930930
private boolean tagPadBefore = false;
931931
private boolean tagPadAfter = true;
932932
private String tagFormat = "%s§f";
933+
private String tagNoFaction = "§6[§ano-faction§6]§r";
933934
private boolean alwaysShowChatTag = true;
934935

935936
public boolean isTagHandledByAnotherPlugin() {
@@ -968,6 +969,10 @@ public String getTagFormat() {
968969
return tagFormat;
969970
}
970971

972+
public String getTagNoFaction() {
973+
return tagNoFaction;
974+
}
975+
971976
public boolean isAlwaysShowChatTag() {
972977
return alwaysShowChatTag;
973978
}

bukkit/src/main/java/dev/kitteh/factions/listener/ListenSpigotChat.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import dev.kitteh.factions.plugin.AbstractFactionsPlugin;
1313
import dev.kitteh.factions.tagresolver.FPlayerResolver;
1414
import dev.kitteh.factions.tagresolver.FactionResolver;
15-
import dev.kitteh.factions.util.TL;
15+
import dev.kitteh.factions.util.Mini;
1616
import dev.kitteh.factions.util.TextUtil;
1717
import dev.kitteh.factions.util.WorldUtil;
1818
import net.kyori.adventure.text.Component;
@@ -135,7 +135,7 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
135135
if (!chatConf.getTagReplaceString().isEmpty() && eventFormat.contains(chatConf.getTagReplaceString())) {
136136
// we're using the "replace" method of inserting the faction tags
137137
if (eventFormat.contains("[FACTION_TITLE]")) {
138-
eventFormat = eventFormat.replace("[FACTION_TITLE]", me.titleLegacy());
138+
eventFormat = eventFormat.replace("[FACTION_TITLE]", Mini.toLegacy(me.title()));
139139
}
140140
InsertIndex = eventFormat.indexOf(chatConf.getTagReplaceString());
141141
eventFormat = eventFormat.replace(chatConf.getTagReplaceString(), "");
@@ -183,10 +183,14 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
183183
}
184184

185185
private String chatTagLegacy(FPlayer me) {
186-
return me.hasFaction() ? String.format(FactionsPlugin.instance().conf().factions().chat().spigot().getTagFormat(), me.role().getPrefix() + (me.hasFaction() ? me.faction().tag() : "")) : TL.NOFACTION_PREFIX.toString();
186+
return me.hasFaction() ?
187+
String.format(FactionsPlugin.instance().conf().factions().chat().spigot().getTagFormat(), me.role().getPrefix() + (me.hasFaction() ? me.faction().tag() : "")) :
188+
FactionsPlugin.instance().conf().factions().chat().spigot().getTagNoFaction();
187189
}
188190

189191
private String chatTagLegacy(FPlayer me, FPlayer participator) {
190-
return me.hasFaction() ? TextUtil.getLegacyString(me.relationTo(participator).color()) + chatTagLegacy(me) : TL.NOFACTION_PREFIX.toString();
192+
return me.hasFaction() ?
193+
TextUtil.getLegacyString(me.relationTo(participator).color()) + chatTagLegacy(me) :
194+
FactionsPlugin.instance().conf().factions().chat().spigot().getTagNoFaction();
191195
}
192196
}

0 commit comments

Comments
 (0)