From 5e481d412056166fda2367caaf5ae3131afdc2bc Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 18 Apr 2013 15:31:05 +0200 Subject: [PATCH] Only handle faction tags. No standard ones. --- src/com/massivecraft/factions/ConfServer.java | 2 +- src/com/massivecraft/factions/Factions.java | 59 ++++++++++++++----- ...tionRelcolor.java => ChatTagRelcolor.java} | 8 +-- ...atTagFactionRole.java => ChatTagRole.java} | 8 +-- ...Roleprefix.java => ChatTagRoleprefix.java} | 8 +-- .../factions/chat/tag/ChatTagSendee.java | 26 -------- .../factions/chat/tag/ChatTagSendeeId.java | 26 -------- .../factions/chat/tag/ChatTagSender.java | 26 -------- .../factions/chat/tag/ChatTagSenderId.java | 26 -------- ...ChatTagFactionTag.java => ChatTagTag.java} | 8 +-- ...tionTagforce.java => ChatTagTagforce.java} | 8 +-- ...TagFactionTitle.java => ChatTagTitle.java} | 8 +-- 12 files changed, 69 insertions(+), 144 deletions(-) rename src/com/massivecraft/factions/chat/tag/{ChatTagFactionRelcolor.java => ChatTagRelcolor.java} (74%) rename src/com/massivecraft/factions/chat/tag/{ChatTagFactionRole.java => ChatTagRole.java} (73%) rename src/com/massivecraft/factions/chat/tag/{ChatTagFactionRoleprefix.java => ChatTagRoleprefix.java} (68%) delete mode 100644 src/com/massivecraft/factions/chat/tag/ChatTagSendee.java delete mode 100644 src/com/massivecraft/factions/chat/tag/ChatTagSendeeId.java delete mode 100644 src/com/massivecraft/factions/chat/tag/ChatTagSender.java delete mode 100644 src/com/massivecraft/factions/chat/tag/ChatTagSenderId.java rename src/com/massivecraft/factions/chat/tag/{ChatTagFactionTag.java => ChatTagTag.java} (72%) rename src/com/massivecraft/factions/chat/tag/{ChatTagFactionTagforce.java => ChatTagTagforce.java} (69%) rename src/com/massivecraft/factions/chat/tag/{ChatTagFactionTitle.java => ChatTagTitle.java} (70%) diff --git a/src/com/massivecraft/factions/ConfServer.java b/src/com/massivecraft/factions/ConfServer.java index c44c3b5d..fc37ccbd 100644 --- a/src/com/massivecraft/factions/ConfServer.java +++ b/src/com/massivecraft/factions/ConfServer.java @@ -109,7 +109,7 @@ public class ConfServer extends SimpleConfig // We offer a simple standard way to set the format public static boolean chatSetFormat = false; public static EventPriority chatSetFormatAt = EventPriority.LOWEST; - public static String chatSetFormatTo = "<{faction_relcolor}§l{faction_roleprefix}§r{faction_relcolor}{faction_tag_pr}§f%s> %s"; + public static String chatSetFormatTo = "<§l{factions_roleprefix}§r{factions_relcolor}{factions_tag|rp}§f%1$s> %2$s"; // We offer a simple standard way to parse the chat tags public static boolean chatParseTags = true; diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index 7c323de3..2ac3ed3a 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -6,6 +6,18 @@ import com.massivecraft.factions.adapters.FFlagAdapter; import com.massivecraft.factions.adapters.FPermAdapter; import com.massivecraft.factions.adapters.RelAdapter; import com.massivecraft.factions.adapters.TerritoryAccessAdapter; +import com.massivecraft.factions.chat.modifier.ChatModifierLc; +import com.massivecraft.factions.chat.modifier.ChatModifierLp; +import com.massivecraft.factions.chat.modifier.ChatModifierParse; +import com.massivecraft.factions.chat.modifier.ChatModifierRp; +import com.massivecraft.factions.chat.modifier.ChatModifierUc; +import com.massivecraft.factions.chat.modifier.ChatModifierUcf; +import com.massivecraft.factions.chat.tag.ChatTagRelcolor; +import com.massivecraft.factions.chat.tag.ChatTagRole; +import com.massivecraft.factions.chat.tag.ChatTagRoleprefix; +import com.massivecraft.factions.chat.tag.ChatTagTag; +import com.massivecraft.factions.chat.tag.ChatTagTagforce; +import com.massivecraft.factions.chat.tag.ChatTagTitle; import com.massivecraft.factions.cmd.*; import com.massivecraft.factions.integration.herochat.HerochatFeatures; import com.massivecraft.factions.integration.Econ; @@ -67,21 +79,7 @@ public class Factions extends MPlugin this.outerCmdFactions = new CmdFactions(); this.outerCmdFactions.register(this); - SpoutFeatures.setup(); - Econ.setup(); - HerochatFeatures.setup(); - LWCFeatures.setup(); - - if (ConfServer.worldGuardChecking) - { - Worldguard.init(this); - } - - // Schedule recurring non-tps-dependent tasks - AutoLeaveTask.get().schedule(this); - EconLandRewardTask.get().schedule(this); - - // Register Event Handlers + // Setup Listeners FactionsListenerMain.get().setup(); FactionsListenerChat.get().setup(); FactionsListenerExploit.get().setup(); @@ -93,6 +91,37 @@ public class Factions extends MPlugin this.entityListener = new TodoFactionsEntityListener(); getServer().getPluginManager().registerEvents(this.entityListener, this); + // Schedule recurring non-tps-dependent tasks + AutoLeaveTask.get().schedule(this); + EconLandRewardTask.get().schedule(this); + + // Register built in chat modifiers + ChatModifierLc.get().register(); + ChatModifierLp.get().register(); + ChatModifierParse.get().register(); + ChatModifierRp.get().register(); + ChatModifierUc.get().register(); + ChatModifierUcf.get().register(); + + // Register built in chat tags + ChatTagRelcolor.get().register(); + ChatTagRole.get().register(); + ChatTagRoleprefix.get().register(); + ChatTagTag.get().register(); + ChatTagTagforce.get().register(); + ChatTagTitle.get().register(); + + // Integrate + SpoutFeatures.setup(); + Econ.setup(); + HerochatFeatures.setup(); + LWCFeatures.setup(); + + if (ConfServer.worldGuardChecking) + { + Worldguard.init(this); + } + postEnable(); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagFactionRelcolor.java b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java similarity index 74% rename from src/com/massivecraft/factions/chat/tag/ChatTagFactionRelcolor.java rename to src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java index 79e74fcb..9d3ec3c5 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagFactionRelcolor.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java @@ -4,15 +4,15 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.chat.ChatTagAbstract; -public class ChatTagFactionRelcolor extends ChatTagAbstract +public class ChatTagRelcolor extends ChatTagAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // - private ChatTagFactionRelcolor() { super("factions_relcolor"); } - private static ChatTagFactionRelcolor i = new ChatTagFactionRelcolor(); - public static ChatTagFactionRelcolor get() { return i; } + private ChatTagRelcolor() { super("factions_relcolor"); } + private static ChatTagRelcolor i = new ChatTagRelcolor(); + public static ChatTagRelcolor get() { return i; } // -------------------------------------------- // // OVERRIDE diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagFactionRole.java b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java similarity index 73% rename from src/com/massivecraft/factions/chat/tag/ChatTagFactionRole.java rename to src/com/massivecraft/factions/chat/tag/ChatTagRole.java index 27fecd3f..80bdc7b4 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagFactionRole.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java @@ -5,15 +5,15 @@ import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.mcore.util.Txt; -public class ChatTagFactionRole extends ChatTagAbstract +public class ChatTagRole extends ChatTagAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // - private ChatTagFactionRole() { super("factions_role"); } - private static ChatTagFactionRole i = new ChatTagFactionRole(); - public static ChatTagFactionRole get() { return i; } + private ChatTagRole() { super("factions_role"); } + private static ChatTagRole i = new ChatTagRole(); + public static ChatTagRole get() { return i; } // -------------------------------------------- // // OVERRIDE diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagFactionRoleprefix.java b/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java similarity index 68% rename from src/com/massivecraft/factions/chat/tag/ChatTagFactionRoleprefix.java rename to src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java index e1aee863..8573effd 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagFactionRoleprefix.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java @@ -4,15 +4,15 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.chat.ChatTagAbstract; -public class ChatTagFactionRoleprefix extends ChatTagAbstract +public class ChatTagRoleprefix extends ChatTagAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // - private ChatTagFactionRoleprefix() { super("factions_roleprefix"); } - private static ChatTagFactionRoleprefix i = new ChatTagFactionRoleprefix(); - public static ChatTagFactionRoleprefix get() { return i; } + private ChatTagRoleprefix() { super("factions_roleprefix"); } + private static ChatTagRoleprefix i = new ChatTagRoleprefix(); + public static ChatTagRoleprefix get() { return i; } // -------------------------------------------- // // OVERRIDE diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagSendee.java b/src/com/massivecraft/factions/chat/tag/ChatTagSendee.java deleted file mode 100644 index 9b7a8e8e..00000000 --- a/src/com/massivecraft/factions/chat/tag/ChatTagSendee.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.massivecraft.factions.chat.tag; - -import com.massivecraft.factions.chat.ChatTagAbstract; -import com.massivecraft.mcore.mixin.Mixin; - -public class ChatTagSendee extends ChatTagAbstract -{ - // -------------------------------------------- // - // INSTANCE & CONSTRUCT - // -------------------------------------------- // - - private ChatTagSendee() { super("sendee"); } - private static ChatTagSendee i = new ChatTagSendee(); - public static ChatTagSendee get() { return i; } - - // -------------------------------------------- // - // OVERRIDE - // -------------------------------------------- // - - @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) - { - return Mixin.getDisplayName(sendeeId); - } - -} diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagSendeeId.java b/src/com/massivecraft/factions/chat/tag/ChatTagSendeeId.java deleted file mode 100644 index 5e038663..00000000 --- a/src/com/massivecraft/factions/chat/tag/ChatTagSendeeId.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.massivecraft.factions.chat.tag; - -import com.massivecraft.factions.chat.ChatTagAbstract; -import com.massivecraft.mcore.mixin.Mixin; - -public class ChatTagSendeeId extends ChatTagAbstract -{ - // -------------------------------------------- // - // INSTANCE & CONSTRUCT - // -------------------------------------------- // - - private ChatTagSendeeId() { super("sendeeid"); } - private static ChatTagSendeeId i = new ChatTagSendeeId(); - public static ChatTagSendeeId get() { return i; } - - // -------------------------------------------- // - // OVERRIDE - // -------------------------------------------- // - - @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) - { - return Mixin.tryFix(sendeeId); - } - -} diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagSender.java b/src/com/massivecraft/factions/chat/tag/ChatTagSender.java deleted file mode 100644 index 3aefb1c3..00000000 --- a/src/com/massivecraft/factions/chat/tag/ChatTagSender.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.massivecraft.factions.chat.tag; - -import com.massivecraft.factions.chat.ChatTagAbstract; -import com.massivecraft.mcore.mixin.Mixin; - -public class ChatTagSender extends ChatTagAbstract -{ - // -------------------------------------------- // - // INSTANCE & CONSTRUCT - // -------------------------------------------- // - - private ChatTagSender() { super("sender"); } - private static ChatTagSender i = new ChatTagSender(); - public static ChatTagSender get() { return i; } - - // -------------------------------------------- // - // OVERRIDE - // -------------------------------------------- // - - @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) - { - return Mixin.getDisplayName(senderId); - } - -} diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagSenderId.java b/src/com/massivecraft/factions/chat/tag/ChatTagSenderId.java deleted file mode 100644 index bdcfeabf..00000000 --- a/src/com/massivecraft/factions/chat/tag/ChatTagSenderId.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.massivecraft.factions.chat.tag; - -import com.massivecraft.factions.chat.ChatTagAbstract; -import com.massivecraft.mcore.mixin.Mixin; - -public class ChatTagSenderId extends ChatTagAbstract -{ - // -------------------------------------------- // - // INSTANCE & CONSTRUCT - // -------------------------------------------- // - - private ChatTagSenderId() { super("senderid"); } - private static ChatTagSenderId i = new ChatTagSenderId(); - public static ChatTagSenderId get() { return i; } - - // -------------------------------------------- // - // OVERRIDE - // -------------------------------------------- // - - @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) - { - return Mixin.tryFix(senderId); - } - -} diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagFactionTag.java b/src/com/massivecraft/factions/chat/tag/ChatTagTag.java similarity index 72% rename from src/com/massivecraft/factions/chat/tag/ChatTagFactionTag.java rename to src/com/massivecraft/factions/chat/tag/ChatTagTag.java index b2ff5d6a..24716e85 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagFactionTag.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTag.java @@ -4,15 +4,15 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.chat.ChatTagAbstract; -public class ChatTagFactionTag extends ChatTagAbstract +public class ChatTagTag extends ChatTagAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // - private ChatTagFactionTag() { super("factions_tag"); } - private static ChatTagFactionTag i = new ChatTagFactionTag(); - public static ChatTagFactionTag get() { return i; } + private ChatTagTag() { super("factions_tag"); } + private static ChatTagTag i = new ChatTagTag(); + public static ChatTagTag get() { return i; } // -------------------------------------------- // // OVERRIDE diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagFactionTagforce.java b/src/com/massivecraft/factions/chat/tag/ChatTagTagforce.java similarity index 69% rename from src/com/massivecraft/factions/chat/tag/ChatTagFactionTagforce.java rename to src/com/massivecraft/factions/chat/tag/ChatTagTagforce.java index 822708f7..0cdcec92 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagFactionTagforce.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTagforce.java @@ -4,15 +4,15 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.chat.ChatTagAbstract; -public class ChatTagFactionTagforce extends ChatTagAbstract +public class ChatTagTagforce extends ChatTagAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // - private ChatTagFactionTagforce() { super("factions_tagforce"); } - private static ChatTagFactionTagforce i = new ChatTagFactionTagforce(); - public static ChatTagFactionTagforce get() { return i; } + private ChatTagTagforce() { super("factions_tagforce"); } + private static ChatTagTagforce i = new ChatTagTagforce(); + public static ChatTagTagforce get() { return i; } // -------------------------------------------- // // OVERRIDE diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagFactionTitle.java b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java similarity index 70% rename from src/com/massivecraft/factions/chat/tag/ChatTagFactionTitle.java rename to src/com/massivecraft/factions/chat/tag/ChatTagTitle.java index adbf1f2d..a759fc23 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagFactionTitle.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java @@ -4,15 +4,15 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.chat.ChatTagAbstract; -public class ChatTagFactionTitle extends ChatTagAbstract +public class ChatTagTitle extends ChatTagAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // - private ChatTagFactionTitle() { super("factions_title"); } - private static ChatTagFactionTitle i = new ChatTagFactionTitle(); - public static ChatTagFactionTitle get() { return i; } + private ChatTagTitle() { super("factions_title"); } + private static ChatTagTitle i = new ChatTagTitle(); + public static ChatTagTitle get() { return i; } // -------------------------------------------- // // OVERRIDE