From 61e87304953eba02cbae419eaeb7fa306b84bcc5 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Mon, 22 Apr 2013 13:03:21 +0200 Subject: [PATCH] Quickfixed everything easy. --- .../factions/chat/ChatFormatter.java | 12 ++++++---- .../factions/chat/ChatModifier.java | 4 +++- .../massivecraft/factions/chat/ChatTag.java | 4 +++- .../chat/modifier/ChatModifierLc.java | 3 ++- .../chat/modifier/ChatModifierLp.java | 3 ++- .../chat/modifier/ChatModifierParse.java | 3 ++- .../chat/modifier/ChatModifierRp.java | 3 ++- .../chat/modifier/ChatModifierUc.java | 3 ++- .../chat/modifier/ChatModifierUcf.java | 3 ++- .../factions/chat/tag/ChatTagRelcolor.java | 9 +------- .../factions/chat/tag/ChatTagRole.java | 4 +--- .../factions/chat/tag/ChatTagRoleprefix.java | 4 +--- .../factions/chat/tag/ChatTagTag.java | 4 +--- .../factions/chat/tag/ChatTagTagforce.java | 6 ++--- .../factions/chat/tag/ChatTagTitle.java | 6 ++--- .../factions/cmd/CmdFactionsAccess.java | 4 ++-- .../factions/cmd/CmdFactionsAutoClaim.java | 2 +- .../factions/cmd/CmdFactionsCapeAbstract.java | 2 +- .../factions/cmd/CmdFactionsClaim.java | 2 +- .../factions/cmd/CmdFactionsCreate.java | 15 +++++++----- .../factions/cmd/CmdFactionsDemote.java | 2 +- .../factions/cmd/CmdFactionsDisband.java | 10 ++++---- .../factions/cmd/CmdFactionsFlag.java | 2 +- .../factions/cmd/CmdFactionsHome.java | 3 +-- .../factions/cmd/CmdFactionsInvite.java | 2 +- .../factions/cmd/CmdFactionsJoin.java | 4 ++-- .../factions/cmd/CmdFactionsKick.java | 6 ++--- .../factions/cmd/CmdFactionsLeader.java | 8 +++---- .../factions/cmd/CmdFactionsList.java | 6 ++--- .../factions/cmd/CmdFactionsMoneyBalance.java | 2 +- .../factions/cmd/CmdFactionsMoneyDeposit.java | 2 +- .../cmd/CmdFactionsMoneyTransferFf.java | 4 ++-- .../cmd/CmdFactionsMoneyTransferFp.java | 4 ++-- .../cmd/CmdFactionsMoneyTransferPf.java | 4 ++-- .../cmd/CmdFactionsMoneyWithdraw.java | 11 +++++---- .../factions/cmd/CmdFactionsOfficer.java | 2 +- .../factions/cmd/CmdFactionsOpen.java | 10 -------- .../factions/cmd/CmdFactionsPerm.java | 2 +- .../factions/cmd/CmdFactionsPower.java | 2 +- .../factions/cmd/CmdFactionsPowerBoost.java | 4 ++-- .../factions/cmd/CmdFactionsPromote.java | 2 +- .../cmd/CmdFactionsRelationAbstract.java | 2 +- .../factions/cmd/CmdFactionsSethome.java | 2 +- .../factions/cmd/CmdFactionsShow.java | 2 +- .../factions/cmd/CmdFactionsTag.java | 5 ++-- .../factions/cmd/CmdFactionsTitle.java | 2 +- .../massivecraft/factions/cmd/FCommand.java | 3 +-- .../factions/cmd/arg/ARFPlayer.java | 14 ++++------- .../factions/cmd/arg/ARFaction.java | 23 ++++++++++++++----- .../factions/event/FactionsEventCreate.java | 16 +++++++------ .../integration/herochat/HerochatEngine.java | 4 +++- .../listeners/FactionsListenerChat.java | 5 ++-- 52 files changed, 134 insertions(+), 132 deletions(-) diff --git a/src/com/massivecraft/factions/chat/ChatFormatter.java b/src/com/massivecraft/factions/chat/ChatFormatter.java index a293d661..372872fd 100644 --- a/src/com/massivecraft/factions/chat/ChatFormatter.java +++ b/src/com/massivecraft/factions/chat/ChatFormatter.java @@ -8,6 +8,8 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.massivecraft.factions.entity.FPlayer; + /** * The ChatFormater is a system offered by factions for tag parsing. * @@ -100,7 +102,7 @@ public class ChatFormatter // FORMAT // -------------------------------------------- // - public static String format(String msg, String senderId, String sendeeId, String recipientId) + public static String format(String msg, FPlayer fsender, FPlayer frecipient) { // We build the return value in this string buffer StringBuffer ret = new StringBuffer(); @@ -135,7 +137,7 @@ public class ChatFormatter } else { - replacement = compute(tag, modifierIds, senderId, sendeeId, recipientId); + replacement = compute(tag, modifierIds, fsender, frecipient); if (replacement == null) { // If a tag or modifier returns null it's the same as opting out. @@ -157,9 +159,9 @@ public class ChatFormatter // TAG COMPUTE // -------------------------------------------- // - public static String compute(ChatTag tag, List modifierIds, String senderId, String sendeeId, String recipientId) + public static String compute(ChatTag tag, List modifierIds, FPlayer fsender, FPlayer frecipient) { - String ret = tag.getReplacement(senderId, sendeeId, recipientId); + String ret = tag.getReplacement(fsender, frecipient); if (ret == null) return null; for (String modifierId : modifierIds) @@ -170,7 +172,7 @@ public class ChatFormatter // Modify and ignore change if null. // Modifier can't get or return null. - String modified = modifier.getModified(ret, senderId, sendeeId, recipientId); + String modified = modifier.getModified(ret, fsender, frecipient); if (modified == null) continue; ret = modified; diff --git a/src/com/massivecraft/factions/chat/ChatModifier.java b/src/com/massivecraft/factions/chat/ChatModifier.java index a106626f..2170ad2c 100644 --- a/src/com/massivecraft/factions/chat/ChatModifier.java +++ b/src/com/massivecraft/factions/chat/ChatModifier.java @@ -1,10 +1,12 @@ package com.massivecraft.factions.chat; +import com.massivecraft.factions.entity.FPlayer; + public interface ChatModifier { public String getId(); - public String getModified(String subject, String senderId, String sendeeId, String recipientId); + public String getModified(String subject, FPlayer fsender, FPlayer frecipient); public boolean register(); public boolean unregister(); } diff --git a/src/com/massivecraft/factions/chat/ChatTag.java b/src/com/massivecraft/factions/chat/ChatTag.java index a7e62c62..1f4dfa2a 100644 --- a/src/com/massivecraft/factions/chat/ChatTag.java +++ b/src/com/massivecraft/factions/chat/ChatTag.java @@ -1,9 +1,11 @@ package com.massivecraft.factions.chat; +import com.massivecraft.factions.entity.FPlayer; + public interface ChatTag { public String getId(); - public String getReplacement(String senderId, String sendeeId, String recipientId); + public String getReplacement(FPlayer fsender, FPlayer frecipient); public boolean register(); public boolean unregister(); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java index 495f06a0..3e3bad56 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.modifier; import com.massivecraft.factions.chat.ChatModifierAbstract; +import com.massivecraft.factions.entity.FPlayer; public class ChatModifierLc extends ChatModifierAbstract { @@ -17,7 +18,7 @@ public class ChatModifierLc extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, String senderId, String sendeeId, String recipientId) + public String getModified(String subject, FPlayer fsender, FPlayer frecipient) { return subject.toLowerCase(); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java index 492d54ae..6ebb63fa 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.modifier; import com.massivecraft.factions.chat.ChatModifierAbstract; +import com.massivecraft.factions.entity.FPlayer; public class ChatModifierLp extends ChatModifierAbstract @@ -18,7 +19,7 @@ public class ChatModifierLp extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, String senderId, String sendeeId, String recipientId) + public String getModified(String subject, FPlayer fsender, FPlayer frecipient) { if (subject.equals("")) return subject; return " "+subject; diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java index 63f286c8..875d4b62 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.modifier; import com.massivecraft.factions.chat.ChatModifierAbstract; +import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.mcore.util.Txt; public class ChatModifierParse extends ChatModifierAbstract @@ -18,7 +19,7 @@ public class ChatModifierParse extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, String senderId, String sendeeId, String recipientId) + public String getModified(String subject, FPlayer fsender, FPlayer frecipient) { return Txt.parse(subject); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java index 30642ad5..718dd140 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.modifier; import com.massivecraft.factions.chat.ChatModifierAbstract; +import com.massivecraft.factions.entity.FPlayer; public class ChatModifierRp extends ChatModifierAbstract { @@ -17,7 +18,7 @@ public class ChatModifierRp extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, String senderId, String sendeeId, String recipientId) + public String getModified(String subject, FPlayer fsender, FPlayer frecipient) { if (subject.equals("")) return subject; return subject+" "; diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java index d560ccab..1bc9e05a 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.modifier; import com.massivecraft.factions.chat.ChatModifierAbstract; +import com.massivecraft.factions.entity.FPlayer; public class ChatModifierUc extends ChatModifierAbstract { @@ -17,7 +18,7 @@ public class ChatModifierUc extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, String senderId, String sendeeId, String recipientId) + public String getModified(String subject, FPlayer fsender, FPlayer frecipient) { return subject.toUpperCase(); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java index e3293639..e69610a7 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.chat.modifier; import com.massivecraft.factions.chat.ChatModifierAbstract; +import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.mcore.util.Txt; public class ChatModifierUcf extends ChatModifierAbstract @@ -18,7 +19,7 @@ public class ChatModifierUcf extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, String senderId, String sendeeId, String recipientId) + public String getModified(String subject, FPlayer fsender, FPlayer frecipient) { return Txt.upperCaseFirst(subject); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java index a0438310..b5eabfd1 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; public class ChatTagRelcolor extends ChatTagAbstract { @@ -19,14 +18,8 @@ public class ChatTagRelcolor extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) + public String getReplacement(FPlayer fsender, FPlayer frecipient) { - if (senderId == null) return ""; - if (recipientId == null) return ""; - - FPlayer fsender = FPlayerColl.get().get(senderId); - FPlayer frecipient = FPlayerColl.get().get(recipientId); - if (fsender == null) return ""; if (frecipient == null) return ""; diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRole.java b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java index cb1b00af..c5d1ca41 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRole.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; import com.massivecraft.mcore.util.Txt; public class ChatTagRole extends ChatTagAbstract @@ -20,9 +19,8 @@ public class ChatTagRole extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) + public String getReplacement(FPlayer fsender, FPlayer frecipient) { - FPlayer fsender = FPlayerColl.get().get(senderId); 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 01b532bb..33523a6f 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; public class ChatTagRoleprefix extends ChatTagAbstract { @@ -19,9 +18,8 @@ public class ChatTagRoleprefix extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) + public String getReplacement(FPlayer fsender, FPlayer frecipient) { - FPlayer fsender = FPlayerColl.get().get(senderId); return fsender.getRole().getPrefix(); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagTag.java b/src/com/massivecraft/factions/chat/tag/ChatTagTag.java index ac0bd6c0..15210f9c 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagTag.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTag.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; public class ChatTagTag extends ChatTagAbstract { @@ -19,9 +18,8 @@ public class ChatTagTag extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) + public String getReplacement(FPlayer fsender, FPlayer frecipient) { - FPlayer fsender = FPlayerColl.get().get(senderId); if (!fsender.hasFaction()) return ""; return fsender.getFaction().getTag(); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagTagforce.java b/src/com/massivecraft/factions/chat/tag/ChatTagTagforce.java index a413a9df..e072482c 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagTagforce.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTagforce.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; public class ChatTagTagforce extends ChatTagAbstract { @@ -19,9 +18,8 @@ public class ChatTagTagforce extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) - { - FPlayer fsender = FPlayerColl.get().get(senderId); + public String getReplacement(FPlayer fsender, FPlayer frecipient) + { return fsender.getFaction().getTag(); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java index ff9036ba..dca73f6c 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag; import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; public class ChatTagTitle extends ChatTagAbstract { @@ -19,9 +18,8 @@ public class ChatTagTitle extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(String senderId, String sendeeId, String recipientId) - { - FPlayer fsender = FPlayerColl.get().get(sendeeId); + public String getReplacement(FPlayer fsender, FPlayer frecipient) + { return fsender.getTitle(); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java b/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java index 69a0cc1d..7134218f 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java @@ -73,14 +73,14 @@ public class CmdFactionsAccess extends FCommand if (doPlayer) { - FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(), fme); + FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(fme), fme); if (targetPlayer == null) return; added = territory.toggleFPlayer(targetPlayer); target = "Player \""+targetPlayer.getName()+"\""; } else { - Faction targetFaction = this.arg(1, ARFaction.get(), myFaction); + Faction targetFaction = this.arg(1, ARFaction.get(myFaction), myFaction); if (targetFaction == null) return; added = territory.toggleFaction(targetFaction); target = "Faction \""+targetFaction.getTag()+"\""; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java index a35d263d..9d4ae392 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java @@ -23,7 +23,7 @@ public class CmdFactionsAutoClaim extends FCommand @Override public void perform() { - Faction forFaction = this.arg(0, ARFaction.get(), myFaction); + Faction forFaction = this.arg(0, ARFaction.get(myFaction), myFaction); if (forFaction == null || forFaction == fme.getAutoClaimFor()) { fme.setAutoClaimFor(null); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java b/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java index d5e1645e..92612144 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java @@ -30,7 +30,7 @@ public abstract class CmdFactionsCapeAbstract extends FCommand return false; } - this.capeFaction = this.arg(this.requiredArgs.size(), ARFaction.get(), this.myFaction); + this.capeFaction = this.arg(this.requiredArgs.size(), ARFaction.get(myFaction), myFaction); if (this.capeFaction == null) return false; // Do we have permission to manage the cape of that faction? diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java index 58b1eb8e..c48b28b8 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java @@ -28,7 +28,7 @@ public class CmdFactionsClaim extends FCommand @Override public void perform() { - final Faction forFaction = this.arg(0, ARFaction.get()); + final Faction forFaction = this.arg(0, ARFaction.get(me)); if (forFaction == null) return; Integer radius = this.arg(1, ARInteger.get(), 1); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java b/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java index 94507aa2..c0e0c419 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java @@ -6,9 +6,10 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; +import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColl; +import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.event.FactionsEventCreate; import com.massivecraft.factions.event.FactionsEventMembershipChange; @@ -39,7 +40,9 @@ public class CmdFactionsCreate extends FCommand return; } - if (FactionColl.get().isTagTaken(newTag)) + FactionColl coll = FactionColls.get().get(fme); + + if (coll.isTagTaken(newTag)) { msg("That tag is already in use."); return; @@ -53,15 +56,15 @@ public class CmdFactionsCreate extends FCommand } // Pre-Generate Id - String factionId = FactionColl.get().getIdStrategy().generate(FactionColl.get()); + String factionId = coll.getIdStrategy().generate(coll); // Event - FactionsEventCreate createEvent = new FactionsEventCreate(sender, newTag, factionId); + FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newTag); createEvent.run(); if (createEvent.isCancelled()) return; // Apply - Faction faction = FactionColl.get().create(factionId); + Faction faction = coll.create(factionId); faction.setTag(newTag); fme.setRole(Rel.LEADER); @@ -72,7 +75,7 @@ public class CmdFactionsCreate extends FCommand // NOTE: join event cannot be cancelled or you'll have an empty faction // Inform - for (FPlayer follower : FPlayerColl.get().getAllOnline()) + for (FPlayer follower : FPlayerColls.get().get(fme).getAllOnline()) { follower.msg("%s created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java b/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java index 44a92ca6..ad56ad9e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java @@ -25,7 +25,7 @@ public class CmdFactionsDemote extends FCommand @Override public void perform() { - FPlayer you = this.arg(0, ARFPlayer.getStartAny()); + FPlayer you = this.arg(0, ARFPlayer.getStartAny(fme)); if (you == null) return; if (you.getFaction() != myFaction) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java index 54d1f8c7..607d43d1 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java @@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; +import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.FactionColl; +import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.event.FactionsEventDisband; import com.massivecraft.factions.event.FactionsEventMembershipChange; @@ -33,7 +33,7 @@ public class CmdFactionsDisband extends FCommand public void perform() { // Args - Faction faction = this.arg(0, ARFaction.get(), myFaction); + Faction faction = this.arg(0, ARFaction.get(fme), myFaction); if (faction == null) return; // FPerm @@ -56,12 +56,12 @@ public class CmdFactionsDisband extends FCommand // Send FPlayerLeaveEvent for each player in the faction for (FPlayer fplayer : faction.getFPlayers()) { - FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fplayer, FactionColl.get().getNone(), MembershipChangeReason.DISBAND); + FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND); membershipChangeEvent.run(); } // Inform all players - for (FPlayer fplayer : FPlayerColl.get().getAllOnline()) + for (FPlayer fplayer : FPlayerColls.get().get(fme).getAllOnline()) { String who = fme.describeTo(fplayer); if (fplayer.getFaction() == faction) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java b/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java index fb61a060..c53dc41a 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java @@ -26,7 +26,7 @@ public class CmdFactionsFlag extends FCommand @Override public void perform() { - Faction faction = this.arg(0, ARFaction.get(), myFaction); + Faction faction = this.arg(0, ARFaction.get(sender), myFaction); if (faction == null) return; if ( ! this.argIsSet(1)) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java index e9046ef3..099fef3d 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java @@ -12,7 +12,6 @@ import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.event.FactionsEventHomeTeleport; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -100,7 +99,7 @@ public class CmdFactionsHome extends FCommand if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w) continue; - FPlayer fp = FPlayerColl.get().get(p); + FPlayer fp = FPlayer.get(p); if (fme.getRelationTo(fp) != Rel.ENEMY) continue; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java b/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java index 428a41ff..17d55fbf 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java @@ -27,7 +27,7 @@ public class CmdFactionsInvite extends FCommand public void perform() { // Args - FPlayer fplayer = this.arg(0, ARFPlayer.getStartAny()); + FPlayer fplayer = this.arg(0, ARFPlayer.getStartAny(sender)); if (fplayer == null) return; Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(fplayer)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java index 8355f90c..25dc5ea1 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java @@ -28,10 +28,10 @@ public class CmdFactionsJoin extends FCommand public void perform() { // Args - Faction faction = this.arg(0, ARFaction.get()); + Faction faction = this.arg(0, ARFaction.get(sender)); if (faction == null) return; - FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(), fme); + FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender), fme); if (fplayer == null) return; boolean samePlayer = fplayer == fme; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java index 16032f3b..61c577dc 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java @@ -8,7 +8,7 @@ import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.FactionColl; +import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; @@ -30,7 +30,7 @@ public class CmdFactionsKick extends FCommand public void perform() { // Arg - FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny()); + FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender)); if (fplayer == null) return; // Validate @@ -58,7 +58,7 @@ public class CmdFactionsKick extends FCommand if (!FPerm.KICK.has(sender, fplayerFaction)) return; // Event - FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, fplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK); + FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(fplayer).getNone(), MembershipChangeReason.KICK); event.run(); if (event.isCancelled()) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java index 84fc9c74..6350874d 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java @@ -5,7 +5,7 @@ import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; +import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; @@ -28,10 +28,10 @@ public class CmdFactionsLeader extends FCommand @Override public void perform() { - FPlayer newLeader = this.arg(0, ARFPlayer.getStartAny()); + FPlayer newLeader = this.arg(0, ARFPlayer.getStartAny(sender)); if (newLeader == null) return; - Faction targetFaction = this.arg(1, ARFaction.get(), myFaction); + Faction targetFaction = this.arg(1, ARFaction.get(sender), myFaction); if (targetFaction == null) return; FPlayer targetFactionCurrentLeader = targetFaction.getLeader(); @@ -90,7 +90,7 @@ public class CmdFactionsLeader extends FCommand msg("You have promoted %s to the position of faction leader.", newLeader.describeTo(fme, true)); // Inform all players - for (FPlayer fplayer : FPlayerColl.get().getAllOnline()) + for (FPlayer fplayer : FPlayerColls.get().get(sender).getAllOnline()) { fplayer.msg("%s gave %s the leadership of %s.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(fme, fplayer, true), newLeader.describeTo(fplayer), targetFaction.describeTo(fplayer)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsList.java b/src/com/massivecraft/factions/cmd/CmdFactionsList.java index 751af4a2..bbc13a68 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsList.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsList.java @@ -6,7 +6,7 @@ import java.util.List; import com.massivecraft.factions.FactionListComparator; import com.massivecraft.factions.Perm; import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.FactionColl; +import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.mcore.cmd.arg.ARInteger; import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.util.Txt; @@ -33,7 +33,7 @@ public class CmdFactionsList extends FCommand // Create Messages List lines = new ArrayList(); - ArrayList factionList = new ArrayList(FactionColl.get().getAll(null, FactionListComparator.get())); + ArrayList factionList = new ArrayList(FactionColls.get().get(sender).getAll(null, FactionListComparator.get())); final int pageheight = 9; @@ -53,7 +53,7 @@ public class CmdFactionsList extends FCommand { if (faction.isNone()) { - lines.add(Txt.parse("Factionless %d online", FactionColl.get().getNone().getFPlayersWhereOnline(true).size())); + lines.add(Txt.parse("Factionless %d online", FactionColls.get().get(sender).getNone().getFPlayersWhereOnline(true).size())); continue; } lines.add(Txt.parse("%s %d/%d online, %d/%d/%d", diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java index 5861ac7b..ed77bb21 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java @@ -22,7 +22,7 @@ public class CmdFactionsMoneyBalance extends FCommand @Override public void perform() { - Faction faction = this.arg(0, ARFaction.get(), myFaction); + Faction faction = this.arg(0, ARFaction.get(sender), myFaction); if (faction == null) return; if (faction != myFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java index 87284a08..121c61a3 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java @@ -35,7 +35,7 @@ public class CmdFactionsMoneyDeposit extends FCommand Double amount = this.arg(0, ARDouble.get()); if (amount == null) return; - Faction faction = this.arg(1, ARFaction.get(), myFaction); + Faction faction = this.arg(1, ARFaction.get(sender), myFaction); if (faction == null) return; boolean success = Econ.transferMoney(fme, fme, faction, amount); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java index 012a5405..9869c081 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java @@ -35,10 +35,10 @@ public class CmdFactionsMoneyTransferFf extends FCommand Double amount = this.arg(0, ARDouble.get()); if (amount == null) return; - Faction from = this.arg(1, ARFaction.get()); + Faction from = this.arg(1, ARFaction.get(sender)); if (from == null) return; - Faction to = this.arg(2, ARFaction.get()); + Faction to = this.arg(2, ARFaction.get(sender)); if (to == null) return; boolean success = Econ.transferMoney(fme, from, to, amount); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java index 8014bcca..07fad45a 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java @@ -37,10 +37,10 @@ public class CmdFactionsMoneyTransferFp extends FCommand Double amount = this.arg(0, ARDouble.get()); if (amount == null) return; - Faction from = this.arg(1, ARFaction.get()); + Faction from = this.arg(1, ARFaction.get(sender)); if (from == null) return; - FPlayer to = this.arg(2, ARFPlayer.getStartAny()); + FPlayer to = this.arg(2, ARFPlayer.getStartAny(sender)); if (to == null) return; boolean success = Econ.transferMoney(fme, from, to, amount); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java index 4be31f55..c93143b3 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java @@ -37,10 +37,10 @@ public class CmdFactionsMoneyTransferPf extends FCommand Double amount = this.arg(0, ARDouble.get()); if (amount == null) return; - FPlayer from = this.arg(1, ARFPlayer.getStartAny()); + FPlayer from = this.arg(1, ARFPlayer.getStartAny(sender)); if (from == null) return; - Faction to = this.arg(2, ARFaction.get()); + Faction to = this.arg(2, ARFaction.get(sender)); if (to == null) return; boolean success = Econ.transferMoney(fme, from, to, amount); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java index 9c97192b..2860e160 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; +import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.Factions; @@ -34,14 +35,16 @@ public class CmdFactionsMoneyWithdraw extends FCommand Double amount = this.arg(0, ARDouble.get()); if (amount == null) return; - Faction faction = this.arg(1, ARFaction.get(), myFaction); - if (faction == null) return; + Faction from = this.arg(1, ARFaction.get(sender), myFaction); + if (from == null) return; - boolean success = Econ.transferMoney(fme, faction, fme, amount); + FPlayer to = fme; + + boolean success = Econ.transferMoney(fme, from, to, amount); if (success && MConf.get().logMoneyTransactions) { - Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Money.format(faction, amount), faction.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Money.format(from, amount), from.describeTo(null)))); } } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java b/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java index 0d383e00..f853f6ed 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java @@ -22,7 +22,7 @@ public class CmdFactionsOfficer extends FCommand @Override public void perform() { - FPlayer you = this.arg(0, ARFPlayer.getStartAny()); + FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender)); if (you == null) return; boolean permAny = Perm.OFFICER_ANY.has(sender, false); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java index f7f3bdab..6f0cd53e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java @@ -3,8 +3,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; -import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.event.FactionsEventOpenChange; import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -40,14 +38,6 @@ public class CmdFactionsOpen extends FCommand // Inform String descTarget = myFaction.isOpen() ? "open" : "closed"; myFaction.msg("%s changed the faction to %s.", fme.describeTo(myFaction, true), descTarget); - for (Faction faction : FactionColl.get().getAll()) - { - if (faction == myFaction) - { - continue; - } - faction.msg("The faction %s is now %s", myFaction.getTag(faction), descTarget); - } } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java index 92a409b8..4cdab8f4 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java @@ -29,7 +29,7 @@ public class CmdFactionsPerm extends FCommand @Override public void perform() { - Faction faction = this.arg(0, ARFaction.get(), myFaction); + Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction); if (faction == null) return; if ( ! this.argIsSet(1)) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPower.java b/src/com/massivecraft/factions/cmd/CmdFactionsPower.java index 1aae69f3..4c191b79 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPower.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPower.java @@ -20,7 +20,7 @@ public class CmdFactionsPower extends FCommand @Override public void perform() { - FPlayer target = this.arg(0, ARFPlayer.getStartAny(), fme); + FPlayer target = this.arg(0, ARFPlayer.getStartAny(fme), fme); if (target == null) return; if (target != fme && ! Perm.POWER_ANY.has(sender, true)) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java b/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java index 191ec84a..5462b742 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java @@ -45,7 +45,7 @@ public class CmdFactionsPowerBoost extends FCommand if (doPlayer) { - FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny()); + FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(sender)); if (targetPlayer == null) return; targetPlayer.setPowerBoost(targetPower); @@ -53,7 +53,7 @@ public class CmdFactionsPowerBoost extends FCommand } else { - Faction targetFaction = this.arg(1, ARFaction.get()); + Faction targetFaction = this.arg(1, ARFaction.get(sender)); if (targetFaction == null) return; targetFaction.setPowerBoost(targetPower); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java b/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java index 5bc47287..767e6058 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java @@ -25,7 +25,7 @@ public class CmdFactionsPromote extends FCommand @Override public void perform() { - FPlayer you = this.arg(0, ARFPlayer.getStartAny()); + FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender)); if (you == null) return; if (you.getFaction() != myFaction) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java index e04b56fb..ba801b35 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java @@ -27,7 +27,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand public void perform() { // Args - Faction otherFaction = this.arg(0, ARFaction.get()); + Faction otherFaction = this.arg(0, ARFaction.get(sender)); if (otherFaction == null) return; Rel newRelation = targetRelation; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java b/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java index e3e232c8..a70272d8 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java @@ -34,7 +34,7 @@ public class CmdFactionsSethome extends FCommand } // Args - Faction faction = this.arg(0, ARFaction.get(), myFaction); + Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction); if (faction == null) return; PS newHome = PS.valueOf(me.getLocation()); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java index 3cb8bcad..c108d987 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java @@ -32,7 +32,7 @@ public class CmdFactionsShow extends FCommand @Override public void perform() { - Faction faction = this.arg(0, ARFaction.get(), myFaction); + Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction); if (faction == null) return; Collection leaders = faction.getFPlayersWhereRole(Rel.LEADER); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsTag.java b/src/com/massivecraft/factions/cmd/CmdFactionsTag.java index de10d6b2..38de86a1 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsTag.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsTag.java @@ -8,6 +8,7 @@ import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColl; +import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.event.FactionsEventTagChange; import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.util.MiscUtil; @@ -33,7 +34,7 @@ public class CmdFactionsTag extends FCommand String newTag = this.arg(0); // TODO does not first test cover selfcase? - if (FactionColl.get().isTagTaken(newTag) && ! MiscUtil.getComparisonString(newTag).equals(myFaction.getComparisonTag())) + if (FactionColls.get().get(myFaction).isTagTaken(newTag) && ! MiscUtil.getComparisonString(newTag).equals(myFaction.getComparisonTag())) { msg("That tag is already taken"); return; @@ -59,7 +60,7 @@ public class CmdFactionsTag extends FCommand // Inform myFaction.msg("%s changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction)); - for (Faction faction : FactionColl.get().getAll()) + for (Faction faction : FactionColls.get().get(myFaction).getAll()) { if (faction == myFaction) { diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java index d742ccf3..0f4de9b4 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java @@ -28,7 +28,7 @@ public class CmdFactionsTitle extends FCommand public void perform() { // Args - FPlayer you = this.arg(0, ARFPlayer.getStartAny()); + FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender)); if (you == null) return; String newTitle = this.argConcatFrom(1, ARString.get(), ""); diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index 87efe518..18f7936c 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Rel; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; import com.massivecraft.factions.entity.Faction; import com.massivecraft.mcore.cmd.MCommand; import com.massivecraft.mcore.util.Txt; @@ -15,7 +14,7 @@ public abstract class FCommand extends MCommand @Override public void fixSenderVars() { - this.fme = FPlayerColl.get().get(this.sender); + this.fme = FPlayer.get(this.sender); this.myFaction = this.fme.getFaction(); } diff --git a/src/com/massivecraft/factions/cmd/arg/ARFPlayer.java b/src/com/massivecraft/factions/cmd/arg/ARFPlayer.java index 32b2ce94..c0dae209 100644 --- a/src/com/massivecraft/factions/cmd/arg/ARFPlayer.java +++ b/src/com/massivecraft/factions/cmd/arg/ARFPlayer.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd.arg; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; +import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.mcore.cmd.arg.ARSenderEntity; import com.massivecraft.mcore.cmd.arg.ArgReader; @@ -11,16 +11,12 @@ public class ARFPlayer // INSTANCE // -------------------------------------------- // - private static ArgReader fullAny = ARSenderEntity.getFullAny(FPlayerColl.get()); - public static ArgReader getFullAny() { return fullAny; } + public static ArgReader getFullAny(Object o) { return ARSenderEntity.getFullAny(FPlayerColls.get().get(o)); } - private static ArgReader startAny = ARSenderEntity.getStartAny(FPlayerColl.get()); - public static ArgReader getStartAny() { return startAny; } + public static ArgReader getStartAny(Object o) { return ARSenderEntity.getStartAny(FPlayerColls.get().get(o)); } - private static ArgReader fullOnline = ARSenderEntity.getFullOnline(FPlayerColl.get()); - public static ArgReader getFullOnline() { return fullOnline; } + public static ArgReader getFullOnline(Object o) { return ARSenderEntity.getFullOnline(FPlayerColls.get().get(o)); } - private static ArgReader startOnline = ARSenderEntity.getStartOnline(FPlayerColl.get()); - public static ArgReader getStartOnline() { return startOnline; } + public static ArgReader getStartOnline(Object o) { return ARSenderEntity.getStartOnline(FPlayerColls.get().get(o)); } } diff --git a/src/com/massivecraft/factions/cmd/arg/ARFaction.java b/src/com/massivecraft/factions/cmd/arg/ARFaction.java index f66ddc78..62c99cc3 100644 --- a/src/com/massivecraft/factions/cmd/arg/ARFaction.java +++ b/src/com/massivecraft/factions/cmd/arg/ARFaction.java @@ -3,9 +3,10 @@ package com.massivecraft.factions.cmd.arg; import org.bukkit.command.CommandSender; import com.massivecraft.factions.entity.FPlayer; -import com.massivecraft.factions.entity.FPlayerColl; +import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColl; +import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.mcore.cmd.arg.ArgReaderAbstract; import com.massivecraft.mcore.cmd.arg.ArgResult; import com.massivecraft.mcore.util.Txt; @@ -16,8 +17,18 @@ public class ARFaction extends ArgReaderAbstract // INSTANCE & CONSTRUCT // -------------------------------------------- // - private static ARFaction i = new ARFaction(); - public static ARFaction get() { return i; } + public static ARFaction get(Object o) { return new ARFaction(FactionColls.get().get(o)); } + private ARFaction(FactionColl coll) + { + this.coll = coll; + } + + // -------------------------------------------- // + // FIELDS + // -------------------------------------------- // + + private final FactionColl coll; + public FactionColl getColl() { return this.coll;} // -------------------------------------------- // // OVERRIDE @@ -29,15 +40,15 @@ public class ARFaction extends ArgReaderAbstract ArgResult result = new ArgResult(); // Faction Tag Exact - result.setResult(FactionColl.get().getByTag(str)); + result.setResult(this.getColl().getByTag(str)); if (result.hasResult()) return result; // Faction Tag Match - result.setResult(FactionColl.get().getBestTagMatch(str)); + result.setResult(this.getColl().getBestTagMatch(str)); if (result.hasResult()) return result; // FPlayer Name Exact - FPlayer fplayer = FPlayerColl.get().get(str); + FPlayer fplayer = FPlayerColls.get().get(this.getColl()).get(str); if (fplayer != null) { result.setResult(fplayer.getFaction()); diff --git a/src/com/massivecraft/factions/event/FactionsEventCreate.java b/src/com/massivecraft/factions/event/FactionsEventCreate.java index 6f667257..329b1ce6 100644 --- a/src/com/massivecraft/factions/event/FactionsEventCreate.java +++ b/src/com/massivecraft/factions/event/FactionsEventCreate.java @@ -17,23 +17,25 @@ public class FactionsEventCreate extends FactionsEventAbstractSender // FIELDS // -------------------------------------------- // - // TODO: How do we know what universe? Should we perhaps actually create the faction? + private final String universe; + public final String getUniverse() { return this.universe; } - private String factionTag; - public String getFactionTag() { return this.factionTag; } + private final String factionId; + public final String getFactionId() { return this.factionId; } - private String factionId; - public String getFactionId() { return this.factionId; } + private final String factionTag; + public final String getFactionTag() { return this.factionTag; } // -------------------------------------------- // // CONSTRUCT // -------------------------------------------- // - public FactionsEventCreate(CommandSender sender, String factionTag, String factionId) + public FactionsEventCreate(CommandSender sender, String universe, String factionId, String factionTag) { super(sender); - this.factionTag = factionTag; + this.universe = universe; this.factionId = factionId; + this.factionTag = factionTag; } } \ No newline at end of file diff --git a/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java b/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java index 13d41f31..a0cc6190 100644 --- a/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java +++ b/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java @@ -10,6 +10,7 @@ import com.dthielke.herochat.ChannelChatEvent; import com.dthielke.herochat.Herochat; import com.massivecraft.factions.Factions; import com.massivecraft.factions.chat.ChatFormatter; +import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.MConf; @@ -52,7 +53,8 @@ public class HerochatEngine implements Listener String format = event.getFormat(); format = format.replaceAll("&r", "§r"); - format = ChatFormatter.format(format, event.getSender().getName(), null, null); + + format = ChatFormatter.format(format, FPlayer.get(event.getSender().getPlayer()), null); event.setFormat(format); } diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerChat.java b/src/com/massivecraft/factions/listeners/FactionsListenerChat.java index 8fd23887..13a38e85 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerChat.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerChat.java @@ -8,8 +8,8 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; import com.massivecraft.factions.Factions; import com.massivecraft.factions.chat.ChatFormatter; +import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.MConf; -import com.massivecraft.mcore.util.SenderUtil; public class FactionsListenerChat implements Listener { @@ -95,7 +95,8 @@ public class FactionsListenerChat implements Listener // ... then parse tags a.k.a. "format the format". String format = event.getFormat(); - format = ChatFormatter.format(format, SenderUtil.getSenderId(event.getPlayer()), null, null); + + format = ChatFormatter.format(format, FPlayer.get(event.getPlayer()), null); event.setFormat(format); }