From ac2c7c705ced5925c57d70cfbfed494218446f33 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 25 Apr 2013 12:18:39 +0200 Subject: [PATCH] Just started adding in the universe toggle. --- src/com/massivecraft/factions/chat/tag/ChatTagName.java | 2 ++ .../massivecraft/factions/chat/tag/ChatTagNameforce.java | 6 +++++- src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java | 4 +++- src/com/massivecraft/factions/chat/tag/ChatTagRole.java | 5 ++++- .../massivecraft/factions/chat/tag/ChatTagRoleprefix.java | 5 ++++- src/com/massivecraft/factions/chat/tag/ChatTagTitle.java | 3 +++ src/com/massivecraft/factions/entity/UConf.java | 6 ++++++ 7 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagName.java b/src/com/massivecraft/factions/chat/tag/ChatTagName.java index 018df592..bea21e44 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagName.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagName.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.Faction; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; public class ChatTagName extends ChatTagAbstract @@ -21,6 +22,7 @@ public class ChatTagName extends ChatTagAbstract @Override public String getReplacement(UPlayer fsender, UPlayer frecipient) { + if (!UConf.get(fsender).enabled) return ""; Faction faction = fsender.getFaction(); if (faction.isNone()) return ""; return faction.getName(); diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java b/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java index 35e6e89d..3d98f5a2 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java @@ -1,6 +1,8 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; +import com.massivecraft.factions.entity.Faction; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; public class ChatTagNameforce extends ChatTagAbstract @@ -20,7 +22,9 @@ public class ChatTagNameforce extends ChatTagAbstract @Override public String getReplacement(UPlayer fsender, UPlayer frecipient) { - return fsender.getFaction().getName(); + if (!UConf.get(fsender).enabled) return ""; + Faction faction = fsender.getFaction(); + return faction.getName(); } } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java index 16daab85..60773283 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; public class ChatTagRelcolor extends ChatTagAbstract @@ -20,7 +21,8 @@ public class ChatTagRelcolor extends ChatTagAbstract @Override public String getReplacement(UPlayer fsender, UPlayer frecipient) { - if (fsender == null) return ""; + if (!UConf.get(fsender).enabled) return ""; + if (frecipient == null) return ""; return frecipient.getRelationTo(fsender).getColor().toString(); diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRole.java b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java index 6d5f4e39..76e7cb5a 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRole.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.mcore.util.Txt; @@ -20,7 +21,9 @@ public class ChatTagRole extends ChatTagAbstract @Override public String getReplacement(UPlayer fsender, UPlayer frecipient) - { + { + if (!UConf.get(fsender).enabled) return ""; + return Txt.upperCaseFirst(fsender.getRole().toString().toLowerCase()); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java b/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java index 6299683b..f3e631fe 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; public class ChatTagRoleprefix extends ChatTagAbstract @@ -19,7 +20,9 @@ public class ChatTagRoleprefix extends ChatTagAbstract @Override public String getReplacement(UPlayer fsender, UPlayer frecipient) - { + { + if (!UConf.get(fsender).enabled) return ""; + return fsender.getRole().getPrefix(); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java index 06a5cde6..8e5c605b 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; public class ChatTagTitle extends ChatTagAbstract @@ -20,6 +21,8 @@ public class ChatTagTitle extends ChatTagAbstract @Override public String getReplacement(UPlayer fsender, UPlayer frecipient) { + if (!UConf.get(fsender).enabled) return ""; + if (!fsender.hasTitle()) return ""; return fsender.getTitle(); } diff --git a/src/com/massivecraft/factions/entity/UConf.java b/src/com/massivecraft/factions/entity/UConf.java index cf5d9a60..41e6ad94 100644 --- a/src/com/massivecraft/factions/entity/UConf.java +++ b/src/com/massivecraft/factions/entity/UConf.java @@ -24,6 +24,12 @@ public class UConf extends Entity return UConfColls.get().get2(oid); } + // -------------------------------------------- // + // UNIVERSE ENABLE SWITCH + // -------------------------------------------- // + + public boolean enabled = true; + // -------------------------------------------- // // SPECIAL FACTION IDS // -------------------------------------------- //