mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-03 22:21:20 +00:00
Allows switching of Town & Nation in the BothTag Format.
Bumped up to version 0.50 Added extra text to ChatConfig stating that %t and %n also work!
This commit is contained in:
1 parent
f868a8f7a7
commit
b2b81cffdb
3 files changed
+21
-10
No files matched your search
@@ -77,6 +77,7 @@
|
|||||||
town: '[tag_town]'
|
town: '[tag_town]'
|
||||||
nation: '[tag_nation]'
|
nation: '[tag_nation]'
|
||||||
# First %s is the nation tag, second is the town tag.
|
# First %s is the nation tag, second is the town tag.
|
||||||
|
# As of v0.50 , you can use %t & %n instead of %s and %s, this allows you to set the town first nation second or ignore the town/nation.
|
||||||
both: '[tag_both]'
|
both: '[tag_both]'
|
||||||
|
|
||||||
# Chat colours
|
# Chat colours
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.palmergames.bukkit.TownyChat;
|
package com.palmergames.bukkit.TownyChat;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import com.palmergames.bukkit.TownyChat.config.ChatSettings;
|
||||||
|
import com.palmergames.bukkit.TownyChat.listener.LocalTownyChatEvent;
|
||||||
|
import com.palmergames.bukkit.TownyChat.util.StringReplaceManager;
|
||||||
import com.palmergames.bukkit.towny.TownyFormatter;
|
import com.palmergames.bukkit.towny.TownyFormatter;
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
import com.palmergames.bukkit.towny.object.Nation;
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
import com.palmergames.bukkit.TownyChat.config.ChatSettings;
|
|
||||||
import com.palmergames.bukkit.TownyChat.listener.LocalTownyChatEvent;
|
import java.util.regex.Pattern;
|
||||||
import com.palmergames.bukkit.TownyChat.util.StringReplaceManager;
|
|
||||||
|
|
||||||
public class TownyChatFormatter {
|
public class TownyChatFormatter {
|
||||||
private static StringReplaceManager<LocalTownyChatEvent> replacer = new StringReplaceManager<LocalTownyChatEvent>();
|
private static StringReplaceManager<LocalTownyChatEvent> replacer = new StringReplaceManager<LocalTownyChatEvent>();
|
||||||
@@ -254,14 +254,24 @@ public class TownyChatFormatter {
|
|||||||
nTag = nation.getName();
|
nTag = nation.getName();
|
||||||
|
|
||||||
// Output depending on what tags are present
|
// Output depending on what tags are present
|
||||||
if ((!tTag.isEmpty()) && (!nTag.isEmpty()))
|
if ((!tTag.isEmpty()) && (!nTag.isEmpty())) {
|
||||||
return String.format(ChatSettings.getBothTags(), nTag, tTag);
|
if (ChatSettings.getBothTags().contains("%t") || ChatSettings.getBothTags().contains("%n")) {
|
||||||
|
// Then it contains %s & %s
|
||||||
|
// Small suttle change so that an issue is solved, it is documented in the config.
|
||||||
|
// But only after addition of this. (v0.50)
|
||||||
|
return ChatSettings.getBothTags().replace("%t", tTag).replace("%n", nTag);
|
||||||
|
} else {
|
||||||
|
return String.format(ChatSettings.getBothTags(), nTag, tTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!nTag.isEmpty())
|
if (!nTag.isEmpty()) {
|
||||||
return String.format(ChatSettings.getNationTag(), nTag);
|
return String.format(ChatSettings.getNationTag(), nTag);
|
||||||
|
}
|
||||||
|
|
||||||
if (!tTag.isEmpty())
|
if (!tTag.isEmpty()) {
|
||||||
return String.format(ChatSettings.getTownTag(), tTag);
|
return String.format(ChatSettings.getTownTag(), tTag);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (NotRegisteredException e) {
|
} catch (NotRegisteredException e) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: TownyChat
|
name: TownyChat
|
||||||
main: com.palmergames.bukkit.TownyChat.Chat
|
main: com.palmergames.bukkit.TownyChat.Chat
|
||||||
version: 0.49
|
version: 0.50
|
||||||
author: ElgarL, Shade, phrstbrn
|
author: ElgarL, Shade, phrstbrn
|
||||||
website: http://towny.palmergames.com/towny/townychat/
|
website: http://towny.palmergames.com/towny/townychat/
|
||||||
description: >
|
description: >
|
||||||
|
|||||||
Reference in new issue
Block a user