Starting to rename fplayer --> uplayer since we will need an mplayer.

This commit is contained in:
Olof Larsson 2013-04-22 17:59:51 +02:00
parent e30c652759
commit 19f9834210
67 changed files with 407 additions and 411 deletions

View File

@ -12,14 +12,14 @@ public class Const
// MStore Collection Names // MStore Collection Names
public static final String COLLECTION_BASENAME = "factions"; public static final String COLLECTION_BASENAME = "factions";
public static final String COLLECTION_BASENAME_ = COLLECTION_BASENAME+"_"; public static final String COLLECTION_BASENAME_ = COLLECTION_BASENAME+"_";
public static final String COLLECTION_BASENAME_MCONF = COLLECTION_BASENAME_+"mconf";
public static final String COLLECTION_BASENAME_UCONF = COLLECTION_BASENAME_+"uconf";
public static final String COLLECTION_BASENAME_BOARD = COLLECTION_BASENAME_+"board"; public static final String COLLECTION_BASENAME_BOARD = COLLECTION_BASENAME_+"board";
public static final String COLLECTION_BASENAME_PLAYER = COLLECTION_BASENAME_+"player";
public static final String COLLECTION_BASENAME_FACTION = COLLECTION_BASENAME_+"faction"; public static final String COLLECTION_BASENAME_FACTION = COLLECTION_BASENAME_+"faction";
public static final String COLLECTION_BASENAME_UPLAYER = COLLECTION_BASENAME_+"uplayer";
public static final String COLLECTION_BASENAME_MPLAYER = COLLECTION_BASENAME_+"mplayer";
public static final String COLLECTION_BASENAME_UCONF = COLLECTION_BASENAME_+"uconf";
public static final String COLLECTION_BASENAME_MCONF = COLLECTION_BASENAME_+"mconf";
// Aspect Ids // Aspect Ids
public static final String ASPECT_ID = "factions"; public static final String ASPECT_ID = "factions";
// Defautlt faction ids // Defautlt faction ids

View File

@ -11,7 +11,7 @@ import java.util.Set;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.mcore.ps.PS;
@ -174,7 +174,7 @@ public enum FPerm
if (testSubject instanceof CommandSender) if (testSubject instanceof CommandSender)
{ {
rpSubject = FPlayer.get(testSubject); rpSubject = UPlayer.get(testSubject);
} }
else if (testSubject instanceof RelationParticipator) else if (testSubject instanceof RelationParticipator)
{ {
@ -190,11 +190,11 @@ public enum FPerm
// TODO: Create better description messages like: "You must at least be officer". // TODO: Create better description messages like: "You must at least be officer".
boolean ret = hostFaction.getPermittedRelations(this).contains(rel); boolean ret = hostFaction.getPermittedRelations(this).contains(rel);
if (rpSubject instanceof FPlayer && ret == false && ((FPlayer)rpSubject).isUsingAdminMode()) ret = true; if (rpSubject instanceof UPlayer && ret == false && ((UPlayer)rpSubject).isUsingAdminMode()) ret = true;
if (!ret && informIfNot && rpSubject instanceof FPlayer) if (!ret && informIfNot && rpSubject instanceof UPlayer)
{ {
FPlayer fplayer = (FPlayer)rpSubject; UPlayer fplayer = (UPlayer)rpSubject;
fplayer.msg(errorpattern, hostFaction.describeTo(fplayer, true), this.getDescription()); fplayer.msg(errorpattern, hostFaction.describeTo(fplayer, true), this.getDescription());
if (Perm.ADMIN.has(fplayer.getPlayer())) if (Perm.ADMIN.has(fplayer.getPlayer()))
{ {
@ -218,11 +218,11 @@ public enum FPerm
{ {
if (informIfNot) if (informIfNot)
{ {
FPlayer notify = null; UPlayer notify = null;
if (testSubject instanceof CommandSender) if (testSubject instanceof CommandSender)
notify = FPlayer.get(testSubject); notify = UPlayer.get(testSubject);
else if (testSubject instanceof FPlayer) else if (testSubject instanceof UPlayer)
notify = (FPlayer)testSubject; notify = (UPlayer)testSubject;
if (notify != null) if (notify != null)
notify.msg("<b>This territory owned by your faction has restricted access."); notify.msg("<b>This territory owned by your faction has restricted access.");
} }

View File

@ -4,7 +4,7 @@ import java.io.Serializable;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.Predictate; import com.massivecraft.mcore.Predictate;
@ -35,7 +35,7 @@ public class FactionEqualsPredictate implements Predictate<CommandSender>, Seria
@Override @Override
public boolean apply(CommandSender sender) public boolean apply(CommandSender sender)
{ {
FPlayer fplayer = FPlayer.get(sender); UPlayer fplayer = UPlayer.get(sender);
return this.factionId.equals(fplayer.getFactionId()); return this.factionId.equals(fplayer.getFactionId());
} }

View File

@ -36,11 +36,11 @@ public class FactionListComparator implements Comparator<Faction>
if (ret != 0) return ret; if (ret != 0) return ret;
// Players Online // Players Online
ret = f2.getFPlayersWhereOnline(true).size() - f1.getFPlayersWhereOnline(true).size(); ret = f2.getUPlayersWhereOnline(true).size() - f1.getUPlayersWhereOnline(true).size();
if (ret != 0) return ret; if (ret != 0) return ret;
// Players Total // Players Total
ret = f2.getFPlayers().size() - f1.getFPlayers().size(); ret = f2.getUPlayers().size() - f1.getUPlayers().size();
if (ret != 0) return ret; if (ret != 0) return ret;
// Tie by Id // Tie by Id

View File

@ -21,7 +21,7 @@ import com.massivecraft.factions.chat.tag.ChatTagTitle;
import com.massivecraft.factions.cmd.*; import com.massivecraft.factions.cmd.*;
import com.massivecraft.factions.entity.Board; import com.massivecraft.factions.entity.Board;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MConfColl; import com.massivecraft.factions.entity.MConfColl;
import com.massivecraft.factions.integration.LWCFeatures; import com.massivecraft.factions.integration.LWCFeatures;
@ -103,11 +103,11 @@ public class Factions extends MPlugin
this.databaseInitialized = false; this.databaseInitialized = false;
MConfColl.get().init(); MConfColl.get().init();
FPlayerColls.get().init(); UPlayerColls.get().init();
FactionColls.get().init(); FactionColls.get().init();
BoardColls.get().init(); BoardColls.get().init();
FactionColls.get().reindexFPlayers(); FactionColls.get().reindexUPlayers();
this.databaseInitialized = true; this.databaseInitialized = true;

View File

@ -6,7 +6,7 @@ import java.util.Set;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
@ -78,9 +78,9 @@ public class TerritoryAccess
public void addFPlayer(String fplayerID) { this.getFPlayerIds().add(fplayerID); } public void addFPlayer(String fplayerID) { this.getFPlayerIds().add(fplayerID); }
public void addFPlayer(FPlayer fplayer) { this.addFPlayer(fplayer.getId()); } public void addFPlayer(UPlayer fplayer) { this.addFPlayer(fplayer.getId()); }
public void removeFPlayer(String fplayerID) { this.getFPlayerIds().remove(fplayerID); } public void removeFPlayer(String fplayerID) { this.getFPlayerIds().remove(fplayerID); }
public void removeFPlayer(FPlayer fplayer) { this.removeFPlayer(fplayer.getId()); } public void removeFPlayer(UPlayer fplayer) { this.removeFPlayer(fplayer.getId()); }
public boolean toggleFPlayer(String fplayerID) public boolean toggleFPlayer(String fplayerID)
{ {
@ -92,7 +92,7 @@ public class TerritoryAccess
this.addFPlayer(fplayerID); this.addFPlayer(fplayerID);
return true; return true;
} }
public boolean toggleFPlayer(FPlayer fplayer) public boolean toggleFPlayer(UPlayer fplayer)
{ {
return this.toggleFPlayer(fplayer.getId()); return this.toggleFPlayer(fplayer.getId());
} }
@ -103,9 +103,9 @@ public class TerritoryAccess
if (testSubject instanceof String) if (testSubject instanceof String)
return hostFactionId.equals((String)testSubject); return hostFactionId.equals((String)testSubject);
else if (testSubject instanceof CommandSender) else if (testSubject instanceof CommandSender)
return hostFactionId.equals(FPlayer.get(testSubject).getFactionId()); return hostFactionId.equals(UPlayer.get(testSubject).getFactionId());
else if (testSubject instanceof FPlayer) else if (testSubject instanceof UPlayer)
return hostFactionId.equals(((FPlayer)testSubject).getFactionId()); return hostFactionId.equals(((UPlayer)testSubject).getFactionId());
else if (testSubject instanceof Faction) else if (testSubject instanceof Faction)
return hostFactionId.equals(((Faction)testSubject).getId()); return hostFactionId.equals(((Faction)testSubject).getId());
return false; return false;
@ -158,14 +158,14 @@ public class TerritoryAccess
public boolean subjectHasAccess(Object testSubject) public boolean subjectHasAccess(Object testSubject)
{ {
if (testSubject instanceof Player) if (testSubject instanceof Player)
return fPlayerHasAccess(FPlayer.get(testSubject)); return fPlayerHasAccess(UPlayer.get(testSubject));
else if (testSubject instanceof FPlayer) else if (testSubject instanceof UPlayer)
return fPlayerHasAccess((FPlayer)testSubject); return fPlayerHasAccess((UPlayer)testSubject);
else if (testSubject instanceof Faction) else if (testSubject instanceof Faction)
return factionHasAccess((Faction)testSubject); return factionHasAccess((Faction)testSubject);
return false; return false;
} }
public boolean fPlayerHasAccess(FPlayer fplayer) public boolean fPlayerHasAccess(UPlayer fplayer)
{ {
if (factionHasAccess(fplayer.getFactionId())) return true; if (factionHasAccess(fplayer.getFactionId())) return true;
return fplayerIds.contains(fplayer.getId()); return fplayerIds.contains(fplayer.getId());

View File

@ -8,7 +8,7 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
/** /**
* The ChatFormater is a system offered by factions for tag parsing. * The ChatFormater is a system offered by factions for tag parsing.
@ -102,7 +102,7 @@ public class ChatFormatter
// FORMAT // FORMAT
// -------------------------------------------- // // -------------------------------------------- //
public static String format(String msg, FPlayer fsender, FPlayer frecipient) public static String format(String msg, UPlayer fsender, UPlayer frecipient)
{ {
// We build the return value in this string buffer // We build the return value in this string buffer
StringBuffer ret = new StringBuffer(); StringBuffer ret = new StringBuffer();
@ -159,7 +159,7 @@ public class ChatFormatter
// TAG COMPUTE // TAG COMPUTE
// -------------------------------------------- // // -------------------------------------------- //
public static String compute(ChatTag tag, List<String> modifierIds, FPlayer fsender, FPlayer frecipient) public static String compute(ChatTag tag, List<String> modifierIds, UPlayer fsender, UPlayer frecipient)
{ {
String ret = tag.getReplacement(fsender, frecipient); String ret = tag.getReplacement(fsender, frecipient);
if (ret == null) return null; if (ret == null) return null;

View File

@ -1,12 +1,12 @@
package com.massivecraft.factions.chat; package com.massivecraft.factions.chat;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public interface ChatModifier public interface ChatModifier
{ {
public String getId(); public String getId();
public String getModified(String subject, FPlayer fsender, FPlayer frecipient); public String getModified(String subject, UPlayer fsender, UPlayer frecipient);
public boolean register(); public boolean register();
public boolean unregister(); public boolean unregister();
} }

View File

@ -1,11 +1,11 @@
package com.massivecraft.factions.chat; package com.massivecraft.factions.chat;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public interface ChatTag public interface ChatTag
{ {
public String getId(); public String getId();
public String getReplacement(FPlayer fsender, FPlayer frecipient); public String getReplacement(UPlayer fsender, UPlayer frecipient);
public boolean register(); public boolean register();
public boolean unregister(); public boolean unregister();
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.modifier; package com.massivecraft.factions.chat.modifier;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatModifierLc extends ChatModifierAbstract public class ChatModifierLc extends ChatModifierAbstract
{ {
@ -18,7 +18,7 @@ public class ChatModifierLc extends ChatModifierAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getModified(String subject, FPlayer fsender, FPlayer frecipient) public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
{ {
return subject.toLowerCase(); return subject.toLowerCase();
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.modifier; package com.massivecraft.factions.chat.modifier;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatModifierLp extends ChatModifierAbstract public class ChatModifierLp extends ChatModifierAbstract
@ -19,7 +19,7 @@ public class ChatModifierLp extends ChatModifierAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getModified(String subject, FPlayer fsender, FPlayer frecipient) public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
{ {
if (subject.equals("")) return subject; if (subject.equals("")) return subject;
return " "+subject; return " "+subject;

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.modifier; package com.massivecraft.factions.chat.modifier;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.util.Txt;
public class ChatModifierParse extends ChatModifierAbstract public class ChatModifierParse extends ChatModifierAbstract
@ -19,7 +19,7 @@ public class ChatModifierParse extends ChatModifierAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getModified(String subject, FPlayer fsender, FPlayer frecipient) public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
{ {
return Txt.parse(subject); return Txt.parse(subject);
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.modifier; package com.massivecraft.factions.chat.modifier;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatModifierRp extends ChatModifierAbstract public class ChatModifierRp extends ChatModifierAbstract
{ {
@ -18,7 +18,7 @@ public class ChatModifierRp extends ChatModifierAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getModified(String subject, FPlayer fsender, FPlayer frecipient) public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
{ {
if (subject.equals("")) return subject; if (subject.equals("")) return subject;
return subject+" "; return subject+" ";

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.modifier; package com.massivecraft.factions.chat.modifier;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatModifierUc extends ChatModifierAbstract public class ChatModifierUc extends ChatModifierAbstract
{ {
@ -18,7 +18,7 @@ public class ChatModifierUc extends ChatModifierAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getModified(String subject, FPlayer fsender, FPlayer frecipient) public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
{ {
return subject.toUpperCase(); return subject.toUpperCase();
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.modifier; package com.massivecraft.factions.chat.modifier;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.util.Txt;
public class ChatModifierUcf extends ChatModifierAbstract public class ChatModifierUcf extends ChatModifierAbstract
@ -19,7 +19,7 @@ public class ChatModifierUcf extends ChatModifierAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getModified(String subject, FPlayer fsender, FPlayer frecipient) public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
{ {
return Txt.upperCaseFirst(subject); return Txt.upperCaseFirst(subject);
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.tag; package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatTagRelcolor extends ChatTagAbstract public class ChatTagRelcolor extends ChatTagAbstract
{ {
@ -18,7 +18,7 @@ public class ChatTagRelcolor extends ChatTagAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getReplacement(FPlayer fsender, FPlayer frecipient) public String getReplacement(UPlayer fsender, UPlayer frecipient)
{ {
if (fsender == null) return ""; if (fsender == null) return "";
if (frecipient == null) return ""; if (frecipient == null) return "";

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.tag; package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.util.Txt;
public class ChatTagRole extends ChatTagAbstract public class ChatTagRole extends ChatTagAbstract
@ -19,7 +19,7 @@ public class ChatTagRole extends ChatTagAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getReplacement(FPlayer fsender, FPlayer frecipient) public String getReplacement(UPlayer fsender, UPlayer frecipient)
{ {
return Txt.upperCaseFirst(fsender.getRole().toString().toLowerCase()); return Txt.upperCaseFirst(fsender.getRole().toString().toLowerCase());
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.tag; package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatTagRoleprefix extends ChatTagAbstract public class ChatTagRoleprefix extends ChatTagAbstract
{ {
@ -18,7 +18,7 @@ public class ChatTagRoleprefix extends ChatTagAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getReplacement(FPlayer fsender, FPlayer frecipient) public String getReplacement(UPlayer fsender, UPlayer frecipient)
{ {
return fsender.getRole().getPrefix(); return fsender.getRole().getPrefix();
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.tag; package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatTagTag extends ChatTagAbstract public class ChatTagTag extends ChatTagAbstract
{ {
@ -18,7 +18,7 @@ public class ChatTagTag extends ChatTagAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getReplacement(FPlayer fsender, FPlayer frecipient) public String getReplacement(UPlayer fsender, UPlayer frecipient)
{ {
if (!fsender.hasFaction()) return ""; if (!fsender.hasFaction()) return "";
return fsender.getFaction().getTag(); return fsender.getFaction().getTag();

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.tag; package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatTagTagforce extends ChatTagAbstract public class ChatTagTagforce extends ChatTagAbstract
{ {
@ -18,7 +18,7 @@ public class ChatTagTagforce extends ChatTagAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getReplacement(FPlayer fsender, FPlayer frecipient) public String getReplacement(UPlayer fsender, UPlayer frecipient)
{ {
return fsender.getFaction().getTag(); return fsender.getFaction().getTag();
} }

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.chat.tag; package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class ChatTagTitle extends ChatTagAbstract public class ChatTagTitle extends ChatTagAbstract
{ {
@ -18,7 +18,7 @@ public class ChatTagTitle extends ChatTagAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public String getReplacement(FPlayer fsender, FPlayer frecipient) public String getReplacement(UPlayer fsender, UPlayer frecipient)
{ {
return fsender.getTitle(); return fsender.getTitle();
} }

View File

@ -3,10 +3,10 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
@ -73,7 +73,7 @@ public class CmdFactionsAccess extends FCommand
if (doPlayer) if (doPlayer)
{ {
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(fme), fme); UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(fme), fme);
if (targetPlayer == null) return; if (targetPlayer == null) return;
added = territory.toggleFPlayer(targetPlayer); added = territory.toggleFPlayer(targetPlayer);
target = "Player \""+targetPlayer.getName()+"\""; target = "Player \""+targetPlayer.getName()+"\"";

View File

@ -5,8 +5,8 @@ import java.util.ArrayList;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
@ -75,7 +75,7 @@ public class CmdFactionsCreate extends FCommand
// NOTE: join event cannot be cancelled or you'll have an empty faction // NOTE: join event cannot be cancelled or you'll have an empty faction
// Inform // Inform
for (FPlayer follower : FPlayerColls.get().get(fme).getAllOnline()) for (UPlayer follower : UPlayerColls.get().get(fme).getAllOnline())
{ {
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower)); follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower));
} }

View File

@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsDemote extends FCommand public class CmdFactionsDemote extends FCommand
@ -25,7 +25,7 @@ public class CmdFactionsDemote extends FCommand
@Override @Override
public void perform() public void perform()
{ {
FPlayer you = this.arg(0, ARFPlayer.getStartAny(fme)); UPlayer you = this.arg(0, ARUPlayer.getStartAny(fme));
if (you == null) return; if (you == null) return;
if (you.getFaction() != myFaction) if (you.getFaction() != myFaction)

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
@ -53,24 +53,24 @@ public class CmdFactionsDisband extends FCommand
// Merged Apply and Inform // Merged Apply and Inform
// Send FPlayerLeaveEvent for each player in the faction // Run event for each player in the faction
for (FPlayer fplayer : faction.getFPlayers()) for (UPlayer uplayer : faction.getUPlayers())
{ {
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND); FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, uplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND);
membershipChangeEvent.run(); membershipChangeEvent.run();
} }
// Inform all players // Inform all players
for (FPlayer fplayer : FPlayerColls.get().get(fme).getAllOnline()) for (UPlayer uplayer : UPlayerColls.get().get(fme).getAllOnline())
{ {
String who = fme.describeTo(fplayer); String who = fme.describeTo(uplayer);
if (fplayer.getFaction() == faction) if (uplayer.getFaction() == faction)
{ {
fplayer.msg("<h>%s<i> disbanded your faction.", who); uplayer.msg("<h>%s<i> disbanded your faction.", who);
} }
else else
{ {
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer)); uplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(uplayer));
} }
} }

View File

@ -11,7 +11,7 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventHomeTeleport; import com.massivecraft.factions.event.FactionsEventHomeTeleport;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -99,7 +99,7 @@ public class CmdFactionsHome extends FCommand
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w) if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w)
continue; continue;
FPlayer fp = FPlayer.get(p); UPlayer fp = UPlayer.get(p);
if (fme.getRelationTo(fp) != Rel.ENEMY) if (fme.getRelationTo(fp) != Rel.ENEMY)
continue; continue;

View File

@ -3,8 +3,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.event.FactionsEventInvitedChange; import com.massivecraft.factions.event.FactionsEventInvitedChange;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -27,16 +27,16 @@ public class CmdFactionsInvite extends FCommand
public void perform() public void perform()
{ {
// Args // Args
FPlayer fplayer = this.arg(0, ARFPlayer.getStartAny(sender)); UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
if (fplayer == null) return; if (uplayer == null) return;
Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(fplayer)); Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(uplayer));
if (newInvited == null) return; if (newInvited == null) return;
// Allready member? // Allready member?
if (fplayer.getFaction() == myFaction) if (uplayer.getFaction() == myFaction)
{ {
msg("%s<i> is already a member of %s", fplayer.getName(), myFaction.getTag()); msg("%s<i> is already a member of %s", uplayer.getName(), myFaction.getTag());
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false)); msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
return; return;
} }
@ -45,24 +45,24 @@ public class CmdFactionsInvite extends FCommand
if ( ! FPerm.INVITE.has(sender, myFaction, true)) return; if ( ! FPerm.INVITE.has(sender, myFaction, true)) return;
// Event // Event
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, fplayer, myFaction, newInvited); FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, myFaction, newInvited);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newInvited = event.isNewInvited(); newInvited = event.isNewInvited();
// Apply // Apply
myFaction.setInvited(fplayer, newInvited); myFaction.setInvited(uplayer, newInvited);
// Inform // Inform
if (newInvited) if (newInvited)
{ {
fplayer.msg("%s<i> invited you to %s", fme.describeTo(fplayer, true), myFaction.describeTo(fplayer)); uplayer.msg("%s<i> invited you to %s", fme.describeTo(uplayer, true), myFaction.describeTo(uplayer));
myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), fplayer.describeTo(myFaction)); myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), uplayer.describeTo(myFaction));
} }
else else
{ {
fplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(fplayer), myFaction.describeTo(fplayer)); uplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(uplayer), myFaction.describeTo(uplayer));
myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), fplayer.describeTo(myFaction)); myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), uplayer.describeTo(myFaction));
} }
} }

View File

@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
@ -31,10 +31,10 @@ public class CmdFactionsJoin extends FCommand
Faction faction = this.arg(0, ARFaction.get(sender)); Faction faction = this.arg(0, ARFaction.get(sender));
if (faction == null) return; if (faction == null) return;
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender), fme); UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), fme);
if (fplayer == null) return; if (uplayer == null) return;
boolean samePlayer = fplayer == fme; boolean samePlayer = uplayer == fme;
// Validate // Validate
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false)) if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
@ -43,36 +43,36 @@ public class CmdFactionsJoin extends FCommand
return; return;
} }
if (faction == fplayer.getFaction()) if (faction == uplayer.getFaction())
{ {
msg("<b>%s %s already a member of %s", fplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme)); msg("<b>%s %s already a member of %s", uplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme));
return; return;
} }
if (UConf.get(faction).factionMemberLimit > 0 && faction.getFPlayers().size() >= UConf.get(faction).factionMemberLimit) if (UConf.get(faction).factionMemberLimit > 0 && faction.getUPlayers().size() >= UConf.get(faction).factionMemberLimit)
{ {
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getTag(fme), UConf.get(faction).factionMemberLimit, fplayer.describeTo(fme, false)); msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getTag(fme), UConf.get(faction).factionMemberLimit, uplayer.describeTo(fme, false));
return; return;
} }
if (fplayer.hasFaction()) if (uplayer.hasFaction())
{ {
msg("<b>%s must leave %s current faction first.", fplayer.describeTo(fme, true), (samePlayer ? "your" : "their")); msg("<b>%s must leave %s current faction first.", uplayer.describeTo(fme, true), (samePlayer ? "your" : "their"));
return; return;
} }
if (!UConf.get(faction).canLeaveWithNegativePower && fplayer.getPower() < 0) if (!UConf.get(faction).canLeaveWithNegativePower && uplayer.getPower() < 0)
{ {
msg("<b>%s cannot join a faction with a negative power level.", fplayer.describeTo(fme, true)); msg("<b>%s cannot join a faction with a negative power level.", uplayer.describeTo(fme, true));
return; return;
} }
if( ! (faction.isOpen() || faction.isInvited(fplayer) || fme.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false))) if( ! (faction.isOpen() || faction.isInvited(uplayer) || fme.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
{ {
msg("<i>This faction requires invitation."); msg("<i>This faction requires invitation.");
if (samePlayer) if (samePlayer)
{ {
faction.msg("%s<i> tried to join your faction.", fplayer.describeTo(faction, true)); faction.msg("%s<i> tried to join your faction.", uplayer.describeTo(faction, true));
} }
return; return;
} }
@ -85,24 +85,24 @@ public class CmdFactionsJoin extends FCommand
// Inform // Inform
if (!samePlayer) if (!samePlayer)
{ {
fplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(fplayer, true), faction.getTag(fplayer)); uplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(uplayer, true), faction.getTag(uplayer));
} }
faction.msg("<i>%s joined your faction.", fplayer.describeTo(faction, true)); faction.msg("<i>%s joined your faction.", uplayer.describeTo(faction, true));
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme)); fme.msg("<i>%s successfully joined %s.", uplayer.describeTo(fme, true), faction.getTag(fme));
// Apply // Apply
fplayer.resetFactionData(); uplayer.resetFactionData();
fplayer.setFaction(faction); uplayer.setFaction(faction);
faction.setInvited(fplayer, false); faction.setInvited(uplayer, false);
// Derplog // Derplog
if (MConf.get().logFactionJoin) if (MConf.get().logFactionJoin)
{ {
if (samePlayer) if (samePlayer)
Factions.get().log("%s joined the faction %s.", fplayer.getName(), faction.getTag()); Factions.get().log("%s joined the faction %s.", uplayer.getName(), faction.getTag());
else else
Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), fplayer.getName(), faction.getTag()); Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), uplayer.getName(), faction.getTag());
} }
} }
} }

View File

@ -4,8 +4,8 @@ import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
@ -30,58 +30,58 @@ public class CmdFactionsKick extends FCommand
public void perform() public void perform()
{ {
// Arg // Arg
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender)); UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender));
if (fplayer == null) return; if (uplayer == null) return;
// Validate // Validate
if (fme == fplayer) if (fme == uplayer)
{ {
msg("<b>You cannot kick yourself."); msg("<b>You cannot kick yourself.");
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false)); msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
return; return;
} }
if (fplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || fme.isUsingAdminMode())) if (uplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || fme.isUsingAdminMode()))
{ {
msg("<b>The leader can not be kicked."); msg("<b>The leader can not be kicked.");
return; return;
} }
if ( ! UConf.get(fplayer).canLeaveWithNegativePower && fplayer.getPower() < 0) if ( ! UConf.get(uplayer).canLeaveWithNegativePower && uplayer.getPower() < 0)
{ {
msg("<b>You cannot kick that member until their power is positive."); msg("<b>You cannot kick that member until their power is positive.");
return; return;
} }
// FPerm // FPerm
Faction fplayerFaction = fplayer.getFaction(); Faction uplayerFaction = uplayer.getFaction();
if (!FPerm.KICK.has(sender, fplayerFaction)) return; if (!FPerm.KICK.has(sender, uplayerFaction)) return;
// Event // Event
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(fplayer).getNone(), MembershipChangeReason.KICK); FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, uplayer, FactionColls.get().get(uplayer).getNone(), MembershipChangeReason.KICK);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
// Inform // Inform
fplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(fplayerFaction, true), fplayer.describeTo(fplayerFaction, true)); uplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(uplayerFaction, true), uplayer.describeTo(uplayerFaction, true));
fplayer.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(fplayer, true), fplayerFaction.describeTo(fplayer)); uplayer.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer));
if (fplayerFaction != myFaction) if (uplayerFaction != myFaction)
{ {
fme.msg("<i>You kicked %s<i> from the faction %s<i>!", fplayer.describeTo(fme), fplayerFaction.describeTo(fme)); fme.msg("<i>You kicked %s<i> from the faction %s<i>!", uplayer.describeTo(fme), uplayerFaction.describeTo(fme));
} }
if (MConf.get().logFactionKick) if (MConf.get().logFactionKick)
{ {
Factions.get().log(fme.getDisplayName() + " kicked " + fplayer.getName() + " from the faction " + fplayerFaction.getTag()); Factions.get().log(fme.getDisplayName() + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getTag());
} }
// Apply // Apply
if (fplayer.getRole() == Rel.LEADER) if (uplayer.getRole() == Rel.LEADER)
{ {
fplayerFaction.promoteNewLeader(); uplayerFaction.promoteNewLeader();
} }
fplayerFaction.setInvited(fplayer, false); uplayerFaction.setInvited(uplayer, false);
fplayer.resetFactionData(); uplayer.resetFactionData();
} }
} }

View File

@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
@ -28,15 +28,15 @@ public class CmdFactionsLeader extends FCommand
@Override @Override
public void perform() public void perform()
{ {
FPlayer newLeader = this.arg(0, ARFPlayer.getStartAny(sender)); UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
if (newLeader == null) return; if (newLeader == null) return;
Faction targetFaction = this.arg(1, ARFaction.get(sender), myFaction); Faction targetFaction = this.arg(1, ARFaction.get(sender), myFaction);
if (targetFaction == null) return; if (targetFaction == null) return;
FPlayer targetFactionCurrentLeader = targetFaction.getLeader(); UPlayer targetFactionCurrentLeader = targetFaction.getLeader();
// We now have fplayer and the target faction // We now have uplayer and the target faction
if (this.senderIsConsole || fme.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false)) if (this.senderIsConsole || fme.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
{ {
// Do whatever you wish // Do whatever you wish
@ -63,7 +63,7 @@ public class CmdFactionsLeader extends FCommand
} }
} }
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction // only run event when newLeader isn't actually in the faction
if (newLeader.getFaction() != targetFaction) if (newLeader.getFaction() != targetFaction)
{ {
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER); FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER);
@ -90,9 +90,9 @@ public class CmdFactionsLeader extends FCommand
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(fme, true)); msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(fme, true));
// Inform all players // Inform all players
for (FPlayer fplayer : FPlayerColls.get().get(sender).getAllOnline()) for (UPlayer uplayer : UPlayerColls.get().get(sender).getAllOnline())
{ {
fplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(fme, fplayer, true), newLeader.describeTo(fplayer), targetFaction.describeTo(fplayer)); uplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(fme, uplayer, true), newLeader.describeTo(uplayer), targetFaction.describeTo(uplayer));
} }
} }
} }

View File

@ -53,13 +53,13 @@ public class CmdFactionsList extends FCommand
{ {
if (faction.isNone()) if (faction.isNone())
{ {
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColls.get().get(sender).getNone().getFPlayersWhereOnline(true).size())); lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColls.get().get(sender).getNone().getUPlayersWhereOnline(true).size()));
continue; continue;
} }
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d", lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
faction.getTag(fme), faction.getTag(fme),
faction.getFPlayersWhereOnline(true).size(), faction.getUPlayersWhereOnline(true).size(),
faction.getFPlayers().size(), faction.getUPlayers().size(),
faction.getLandCount(), faction.getLandCount(),
faction.getPowerRounded(), faction.getPowerRounded(),
faction.getPowerMaxRounded()) faction.getPowerMaxRounded())

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
@ -40,7 +40,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
Faction from = this.arg(1, ARFaction.get(sender)); Faction from = this.arg(1, ARFaction.get(sender));
if (from == null) return; if (from == null) return;
FPlayer to = this.arg(2, ARFPlayer.getStartAny(sender)); UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
if (to == null) return; if (to == null) return;
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(fme, from, to, amount);

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
@ -37,7 +37,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return; if (amount == null) return;
FPlayer from = this.arg(1, ARFPlayer.getStartAny(sender)); UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender));
if (from == null) return; if (from == null) return;
Faction to = this.arg(2, ARFaction.get(sender)); Faction to = this.arg(2, ARFaction.get(sender));

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
@ -38,7 +38,7 @@ public class CmdFactionsMoneyWithdraw extends FCommand
Faction from = this.arg(1, ARFaction.get(sender), myFaction); Faction from = this.arg(1, ARFaction.get(sender), myFaction);
if (from == null) return; if (from == null) return;
FPlayer to = fme; UPlayer to = fme;
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(fme, from, to, amount);

View File

@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -22,7 +22,7 @@ public class CmdFactionsOfficer extends FCommand
@Override @Override
public void perform() public void perform()
{ {
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender)); UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
if (you == null) return; if (you == null) return;
boolean permAny = Perm.OFFICER_ANY.has(sender, false); boolean permAny = Perm.OFFICER_ANY.has(sender, false);

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsPower extends FCommand public class CmdFactionsPower extends FCommand
@ -20,7 +20,7 @@ public class CmdFactionsPower extends FCommand
@Override @Override
public void perform() public void perform()
{ {
FPlayer target = this.arg(0, ARFPlayer.getStartAny(fme), fme); UPlayer target = this.arg(0, ARUPlayer.getStartAny(fme), fme);
if (target == null) return; if (target == null) return;
if (target != fme && ! Perm.POWER_ANY.has(sender, true)) return; if (target != fme && ! Perm.POWER_ANY.has(sender, true)) return;

View File

@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARDouble; import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -45,7 +45,7 @@ public class CmdFactionsPowerBoost extends FCommand
if (doPlayer) if (doPlayer)
{ {
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(sender)); UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender));
if (targetPlayer == null) return; if (targetPlayer == null) return;
targetPlayer.setPowerBoost(targetPower); targetPlayer.setPowerBoost(targetPower);

View File

@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsPromote extends FCommand public class CmdFactionsPromote extends FCommand
@ -25,7 +25,7 @@ public class CmdFactionsPromote extends FCommand
@Override @Override
public void perform() public void perform()
{ {
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender)); UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
if (you == null) return; if (you == null) return;
if (you.getFaction() != myFaction) if (you.getFaction() != myFaction)

View File

@ -7,7 +7,7 @@ import java.util.Map;
import com.massivecraft.factions.ConfServer; import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.FFlag; import com.massivecraft.factions.FFlag;
@ -35,10 +35,10 @@ public class CmdFactionsShow extends FCommand
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction); Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
if (faction == null) return; if (faction == null) return;
Collection<FPlayer> leaders = faction.getFPlayersWhereRole(Rel.LEADER); Collection<UPlayer> leaders = faction.getUPlayersWhereRole(Rel.LEADER);
Collection<FPlayer> officers = faction.getFPlayersWhereRole(Rel.OFFICER); Collection<UPlayer> officers = faction.getUPlayersWhereRole(Rel.OFFICER);
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER); Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
Collection<FPlayer> recruits = faction.getFPlayersWhereRole(Rel.RECRUIT); Collection<UPlayer> recruits = faction.getUPlayersWhereRole(Rel.RECRUIT);
msg(Txt.titleize(faction.getTag(fme))); msg(Txt.titleize(faction.getTag(fme)));
msg("<a>Description: <i>%s", faction.getDescription()); msg("<a>Description: <i>%s", faction.getDescription());
@ -101,7 +101,7 @@ public class CmdFactionsShow extends FCommand
List<String> memberOnlineNames = new ArrayList<String>(); List<String> memberOnlineNames = new ArrayList<String>();
List<String> memberOfflineNames = new ArrayList<String>(); List<String> memberOfflineNames = new ArrayList<String>();
for (FPlayer follower : leaders) for (UPlayer follower : leaders)
{ {
if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
{ {
@ -113,7 +113,7 @@ public class CmdFactionsShow extends FCommand
} }
} }
for (FPlayer follower : officers) for (UPlayer follower : officers)
{ {
if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
{ {
@ -125,7 +125,7 @@ public class CmdFactionsShow extends FCommand
} }
} }
for (FPlayer follower : normals) for (UPlayer follower : normals)
{ {
if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
{ {
@ -137,7 +137,7 @@ public class CmdFactionsShow extends FCommand
} }
} }
for (FPlayer follower : recruits) for (UPlayer follower : recruits)
{ {
if (follower.isOnline()) if (follower.isOnline())
{ {

View File

@ -3,9 +3,9 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer; import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.event.FactionsEventTitleChange; import com.massivecraft.factions.event.FactionsEventTitleChange;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.cmd.arg.ARString; import com.massivecraft.mcore.cmd.arg.ARString;
@ -28,7 +28,7 @@ public class CmdFactionsTitle extends FCommand
public void perform() public void perform()
{ {
// Args // Args
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender)); UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
if (you == null) return; if (you == null) return;
String newTitle = this.argConcatFrom(1, ARString.get(), ""); String newTitle = this.argConcatFrom(1, ARString.get(), "");

View File

@ -1,20 +1,20 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.MCommand; import com.massivecraft.mcore.cmd.MCommand;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.util.Txt;
public abstract class FCommand extends MCommand public abstract class FCommand extends MCommand
{ {
public FPlayer fme; public UPlayer fme;
public Faction myFaction; public Faction myFaction;
@Override @Override
public void fixSenderVars() public void fixSenderVars()
{ {
this.fme = FPlayer.get(this.sender); this.fme = UPlayer.get(this.sender);
this.myFaction = this.fme.getFaction(); this.myFaction = this.fme.getFaction();
} }
@ -22,7 +22,7 @@ public abstract class FCommand extends MCommand
// COMMONLY USED LOGIC // COMMONLY USED LOGIC
// -------------------------------------------- // // -------------------------------------------- //
public boolean canIAdministerYou(FPlayer i, FPlayer you) public boolean canIAdministerYou(UPlayer i, UPlayer you)
{ {
if ( ! i.getFaction().equals(you.getFaction())) if ( ! i.getFaction().equals(you.getFaction()))
{ {

View File

@ -1,22 +0,0 @@
package com.massivecraft.factions.cmd.arg;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColls;
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
import com.massivecraft.mcore.cmd.arg.ArgReader;
public class ARFPlayer
{
// -------------------------------------------- //
// INSTANCE
// -------------------------------------------- //
public static ArgReader<FPlayer> getFullAny(Object o) { return ARSenderEntity.getFullAny(FPlayerColls.get().get(o)); }
public static ArgReader<FPlayer> getStartAny(Object o) { return ARSenderEntity.getStartAny(FPlayerColls.get().get(o)); }
public static ArgReader<FPlayer> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(FPlayerColls.get().get(o)); }
public static ArgReader<FPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(FPlayerColls.get().get(o)); }
}

View File

@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd.arg;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
@ -47,11 +47,11 @@ public class ARFaction extends ArgReaderAbstract<Faction>
result.setResult(this.getColl().getBestTagMatch(str)); result.setResult(this.getColl().getBestTagMatch(str));
if (result.hasResult()) return result; if (result.hasResult()) return result;
// FPlayer Name Exact // UPlayer Name Exact
FPlayer fplayer = FPlayerColls.get().get(this.getColl()).get(str); UPlayer uplayer = UPlayerColls.get().get(this.getColl()).get(str);
if (fplayer != null) if (uplayer != null)
{ {
result.setResult(fplayer.getFaction()); result.setResult(uplayer.getFaction());
return result; return result;
} }

View File

@ -0,0 +1,22 @@
package com.massivecraft.factions.cmd.arg;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
import com.massivecraft.mcore.cmd.arg.ArgReader;
public class ARUPlayer
{
// -------------------------------------------- //
// INSTANCE
// -------------------------------------------- //
public static ArgReader<UPlayer> getFullAny(Object o) { return ARSenderEntity.getFullAny(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getStartAny(Object o) { return ARSenderEntity.getStartAny(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(UPlayerColls.get().get(o)); }
}

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd.req;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.MCommand; import com.massivecraft.mcore.cmd.MCommand;
import com.massivecraft.mcore.cmd.req.ReqAbstract; import com.massivecraft.mcore.cmd.req.ReqAbstract;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.util.Txt;
@ -33,8 +33,8 @@ public class ReqRoleIsAtLeast extends ReqAbstract
@Override @Override
public boolean apply(CommandSender sender, MCommand command) public boolean apply(CommandSender sender, MCommand command)
{ {
FPlayer fplayer = FPlayer.get(sender); UPlayer uplayer = UPlayer.get(sender);
return fplayer.getRole().isAtLeast(this.rel); return uplayer.getRole().isAtLeast(this.rel);
} }
@Override @Override

View File

@ -350,9 +350,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
return this.getInvitedPlayerIds().contains(playerId); return this.getInvitedPlayerIds().contains(playerId);
} }
public boolean isInvited(FPlayer fplayer) public boolean isInvited(UPlayer uplayer)
{ {
return this.isInvited(fplayer.getId()); return this.isInvited(uplayer.getId());
} }
public boolean setInvited(String playerId, boolean invited) public boolean setInvited(String playerId, boolean invited)
@ -372,9 +372,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
} }
public void setInvited(FPlayer fplayer, boolean invited) public void setInvited(UPlayer uplayer, boolean invited)
{ {
this.setInvited(fplayer.getId(), invited); this.setInvited(uplayer.getId(), invited);
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -673,9 +673,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
} }
double ret = 0; double ret = 0;
for (FPlayer fplayer : this.getFPlayers()) for (UPlayer uplayer : this.getUPlayers())
{ {
ret += fplayer.getPower(); ret += uplayer.getPower();
} }
if (UConf.get(this).powerFactionMax > 0 && ret > UConf.get(this).powerFactionMax) if (UConf.get(this).powerFactionMax > 0 && ret > UConf.get(this).powerFactionMax)
@ -694,9 +694,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
} }
double ret = 0; double ret = 0;
for (FPlayer fplayer : this.getFPlayers()) for (UPlayer uplayer : this.getUPlayers())
{ {
ret += fplayer.getPowerMax(); ret += uplayer.getPowerMax();
} }
if (UConf.get(this).powerFactionMax > 0 && ret > UConf.get(this).powerFactionMax) if (UConf.get(this).powerFactionMax > 0 && ret > UConf.get(this).powerFactionMax)
@ -732,41 +732,37 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
} }
// -------------------------------------------- // // -------------------------------------------- //
// FOREIGN KEYS: FPLAYERS // FOREIGN KEY: UPLAYER
// -------------------------------------------- // // -------------------------------------------- //
// TODO: With this approach null must be used as default always. protected transient List<UPlayer> uplayers = null;
// TODO: Take a moment and reflect upon the consequenses eeeeeeh... public void reindexUPlayers()
// TODO: This one may be to slow after all :/ Thus I must maintain an index.
protected transient List<FPlayer> fplayers = null;
public void reindexFPlayers()
{ {
this.fplayers = new ArrayList<FPlayer>(); this.uplayers = new ArrayList<UPlayer>();
String factionId = this.getId(); String factionId = this.getId();
if (factionId == null) return; if (factionId == null) return;
for (FPlayer fplayer : FPlayerColls.get().get(this).getAll()) for (UPlayer uplayer : UPlayerColls.get().get(this).getAll())
{ {
if (!MUtil.equals(factionId, fplayer.getFactionId())) continue; if (!MUtil.equals(factionId, uplayer.getFactionId())) continue;
this.fplayers.add(fplayer); this.uplayers.add(uplayer);
} }
} }
public List<FPlayer> getFPlayers() public List<UPlayer> getUPlayers()
{ {
return new ArrayList<FPlayer>(this.fplayers); return new ArrayList<UPlayer>(this.uplayers);
} }
public List<FPlayer> getFPlayersWhereOnline(boolean online) public List<UPlayer> getUPlayersWhereOnline(boolean online)
{ {
List<FPlayer> ret = this.getFPlayers(); List<UPlayer> ret = this.getUPlayers();
Iterator<FPlayer> iter = ret.iterator(); Iterator<UPlayer> iter = ret.iterator();
while (iter.hasNext()) while (iter.hasNext())
{ {
FPlayer fplayer = iter.next(); UPlayer uplayer = iter.next();
if (fplayer.isOnline() != online) if (uplayer.isOnline() != online)
{ {
iter.remove(); iter.remove();
} }
@ -774,14 +770,14 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
return ret; return ret;
} }
public List<FPlayer> getFPlayersWhereRole(Rel role) public List<UPlayer> getUPlayersWhereRole(Rel role)
{ {
List<FPlayer> ret = this.getFPlayers(); List<UPlayer> ret = this.getUPlayers();
Iterator<FPlayer> iter = ret.iterator(); Iterator<UPlayer> iter = ret.iterator();
while (iter.hasNext()) while (iter.hasNext())
{ {
FPlayer fplayer = iter.next(); UPlayer uplayer = iter.next();
if (fplayer.getRole() != role) if (uplayer.getRole() != role)
{ {
iter.remove(); iter.remove();
} }
@ -789,16 +785,16 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
return ret; return ret;
} }
public FPlayer getLeader() public UPlayer getLeader()
{ {
List<FPlayer> ret = this.getFPlayers(); List<UPlayer> ret = this.getUPlayers();
Iterator<FPlayer> iter = ret.iterator(); Iterator<UPlayer> iter = ret.iterator();
while (iter.hasNext()) while (iter.hasNext())
{ {
FPlayer fplayer = iter.next(); UPlayer uplayer = iter.next();
if (fplayer.getRole() == Rel.LEADER) if (uplayer.getRole() == Rel.LEADER)
{ {
return fplayer; return uplayer;
} }
} }
return null; return null;
@ -809,9 +805,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
List<CommandSender> ret = new ArrayList<CommandSender>(); List<CommandSender> ret = new ArrayList<CommandSender>();
for (CommandSender player : SenderUtil.getOnlineSenders()) for (CommandSender player : SenderUtil.getOnlineSenders())
{ {
FPlayer fplayer = FPlayer.get(player); UPlayer uplayer = UPlayer.get(player);
if (!MUtil.equals(fplayer.getUniverse(), this.getUniverse())) continue; if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
if (fplayer.getFaction() != this) continue; if (uplayer.getFaction() != this) continue;
ret.add(player); ret.add(player);
} }
return ret; return ret;
@ -822,9 +818,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
List<Player> ret = new ArrayList<Player>(); List<Player> ret = new ArrayList<Player>();
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
FPlayer fplayer = FPlayer.get(player); UPlayer uplayer = UPlayer.get(player);
if (!MUtil.equals(fplayer.getUniverse(), this.getUniverse())) continue; if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
if (fplayer.getFaction() != this) continue; if (uplayer.getFaction() != this) continue;
ret.add(player); ret.add(player);
} }
return ret; return ret;
@ -836,13 +832,13 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
if ( ! this.isNormal()) return; if ( ! this.isNormal()) return;
if (this.getFlag(FFlag.PERMANENT) && ConfServer.permanentFactionsDisableLeaderPromotion) return; if (this.getFlag(FFlag.PERMANENT) && ConfServer.permanentFactionsDisableLeaderPromotion) return;
FPlayer oldLeader = this.getLeader(); UPlayer oldLeader = this.getLeader();
// get list of officers, or list of normal members if there are no officers // get list of officers, or list of normal members if there are no officers
List<FPlayer> replacements = this.getFPlayersWhereRole(Rel.OFFICER); List<UPlayer> replacements = this.getUPlayersWhereRole(Rel.OFFICER);
if (replacements == null || replacements.isEmpty()) if (replacements == null || replacements.isEmpty())
{ {
replacements = this.getFPlayersWhereRole(Rel.MEMBER); replacements = this.getUPlayersWhereRole(Rel.MEMBER);
} }
if (replacements == null || replacements.isEmpty()) if (replacements == null || replacements.isEmpty())
@ -862,9 +858,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
Factions.get().log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left."); Factions.get().log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left.");
} }
for (FPlayer fplayer : FPlayerColls.get().get(this).getAllOnline()) for (UPlayer uplayer : UPlayerColls.get().get(this).getAllOnline())
{ {
fplayer.msg("The faction %s<i> was disbanded.", this.getTag(fplayer)); uplayer.msg("The faction %s<i> was disbanded.", this.getTag(uplayer));
} }
this.detach(); this.detach();

View File

@ -76,8 +76,8 @@ public class FactionColl extends Coll<Faction>
// Clean the board // Clean the board
BoardColls.get().getForUniverse(universe).clean(); BoardColls.get().getForUniverse(universe).clean();
// Clean the fplayers // Clean the uplayers
FPlayerColls.get().getForUniverse(universe).clean(); UPlayerColls.get().getForUniverse(universe).clean();
return ret; return ret;
} }
@ -90,7 +90,7 @@ public class FactionColl extends Coll<Faction>
{ {
for (Faction faction : this.getAll()) for (Faction faction : this.getAll())
{ {
faction.reindexFPlayers(); faction.reindexUPlayers();
} }
} }
@ -193,10 +193,10 @@ public class FactionColl extends Coll<Faction>
int landCount = faction.getLandCount(); int landCount = faction.getLandCount();
if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0) if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0)
{ {
List<FPlayer> players = faction.getFPlayers(); List<UPlayer> players = faction.getUPlayers();
int playerCount = players.size(); int playerCount = players.size();
double reward = ConfServer.econLandReward * landCount / playerCount; double reward = ConfServer.econLandReward * landCount / playerCount;
for (FPlayer player : players) for (UPlayer player : players)
{ {
Econ.modifyMoney(player, reward, "own " + landCount + " faction land divided among " + playerCount + " members"); Econ.modifyMoney(player, reward, "own " + landCount + " faction land divided among " + playerCount + " members");
} }

View File

@ -115,7 +115,7 @@ public class FactionColls extends Colls<FactionColl, Faction>
// INDEX // INDEX
// -------------------------------------------- // // -------------------------------------------- //
public void reindexFPlayers() public void reindexUPlayers()
{ {
for (FactionColl coll : this.getColls()) for (FactionColl coll : this.getColls())
{ {

View File

@ -34,15 +34,15 @@ import com.massivecraft.mcore.util.TimeUnit;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.util.Txt;
public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipator public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
{ {
// -------------------------------------------- // // -------------------------------------------- //
// META // META
// -------------------------------------------- // // -------------------------------------------- //
public static FPlayer get(Object oid) public static UPlayer get(Object oid)
{ {
return FPlayerColls.get().get2(oid); return UPlayerColls.get().get2(oid);
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -50,7 +50,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public FPlayer load(FPlayer that) public UPlayer load(UPlayer that)
{ {
this.setFactionId(that.factionId); this.setFactionId(that.factionId);
this.setRole(that.role); this.setRole(that.role);
@ -151,7 +151,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
// -------------------------------------------- // // -------------------------------------------- //
// GSON need this noarg constructor. // GSON need this noarg constructor.
public FPlayer() public UPlayer()
{ {
this.resetFactionData(false); this.resetFactionData(false);
//this.power = ConfServer.powerStarting; //this.power = ConfServer.powerStarting;
@ -238,8 +238,8 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
Faction oldFaction = FactionColls.get().get(this).get(oldFactionId); Faction oldFaction = FactionColls.get().get(this).get(oldFactionId);
Faction faction = FactionColls.get().get(this).get(factionId); Faction faction = FactionColls.get().get(this).get(factionId);
oldFaction.fplayers.remove(this); oldFaction.uplayers.remove(this);
faction.fplayers.add(this); faction.uplayers.add(this);
// Mark as changed // Mark as changed
this.changed(); this.changed();
@ -418,7 +418,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
if (online) if (online)
{ {
Player thisPlayer = this.getPlayer(); Player thisPlayer = this.getPlayer();
online = (thisPlayer != null && !thisPlayer.isDead() && FPlayer.get(thisPlayer) == this); online = (thisPlayer != null && !thisPlayer.isDead() && UPlayer.get(thisPlayer) == this);
} }
// Cache and prepare // Cache and prepare
@ -564,9 +564,9 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
{ {
return this.getColorTo(faction)+this.getNameAndTitle(); return this.getColorTo(faction)+this.getNameAndTitle();
} }
public String getNameAndTitle(FPlayer fplayer) public String getNameAndTitle(UPlayer uplayer)
{ {
return this.getColorTo(fplayer)+this.getNameAndTitle(); return this.getColorTo(uplayer)+this.getNameAndTitle();
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -664,7 +664,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
boolean permanent = myFaction.getFlag(FFlag.PERMANENT); boolean permanent = myFaction.getFlag(FFlag.PERMANENT);
if (!permanent && this.getRole() == Rel.LEADER && myFaction.getFPlayers().size() > 1) if (!permanent && this.getRole() == Rel.LEADER && myFaction.getUPlayers().size() > 1)
{ {
msg("<b>You must give the leader role to someone else first."); msg("<b>You must give the leader role to someone else first.");
return; return;
@ -682,7 +682,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
if (membershipChangeEvent.isCancelled()) return; if (membershipChangeEvent.isCancelled()) return;
// Am I the last one in the faction? // Am I the last one in the faction?
if (myFaction.getFPlayers().size() == 1) if (myFaction.getUPlayers().size() == 1)
{ {
// Transfer all money // Transfer all money
if (Econ.isEnabled(this)) if (Econ.isEnabled(this))
@ -693,9 +693,9 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
if (myFaction.isNormal()) if (myFaction.isNormal())
{ {
for (FPlayer fplayer : myFaction.getFPlayersWhereOnline(true)) for (UPlayer uplayer : myFaction.getUPlayersWhereOnline(true))
{ {
fplayer.msg("%s<i> left %s<i>.", this.describeTo(fplayer, true), myFaction.describeTo(fplayer)); uplayer.msg("%s<i> left %s<i>.", this.describeTo(uplayer, true), myFaction.describeTo(uplayer));
} }
if (MConf.get().logFactionLeave) if (MConf.get().logFactionLeave)
@ -706,12 +706,12 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
this.resetFactionData(); this.resetFactionData();
if (myFaction.isNormal() && !permanent && myFaction.getFPlayers().isEmpty()) if (myFaction.isNormal() && !permanent && myFaction.getUPlayers().isEmpty())
{ {
// Remove this faction // Remove this faction
for (FPlayer fplayer : FPlayerColls.get().get(this).getAllOnline()) for (UPlayer uplayer : UPlayerColls.get().get(this).getAllOnline())
{ {
fplayer.msg("<i>%s<i> was disbanded.", myFaction.describeTo(fplayer, true)); uplayer.msg("<i>%s<i> was disbanded.", myFaction.describeTo(uplayer, true));
} }
myFaction.detach(); myFaction.detach();
@ -751,7 +751,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
{ {
return false; return false;
} }
else if (forFaction.getFPlayers().size() < ConfServer.claimsRequireMinFactionMembers) else if (forFaction.getUPlayers().size() < ConfServer.claimsRequireMinFactionMembers)
{ {
error = Txt.parse("Factions must have at least <h>%s<b> members to claim land.", ConfServer.claimsRequireMinFactionMembers); error = Txt.parse("Factions must have at least <h>%s<b> members to claim land.", ConfServer.claimsRequireMinFactionMembers);
} }
@ -837,10 +837,10 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
} }
// announce success // announce success
Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>(); Set<UPlayer> informTheseUPlayers = new HashSet<UPlayer>();
informTheseFPlayers.add(this); informTheseUPlayers.add(this);
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true)); informTheseUPlayers.addAll(forFaction.getUPlayersWhereOnline(true));
for (FPlayer fp : informTheseFPlayers) for (UPlayer fp : informTheseUPlayers)
{ {
fp.msg("<h>%s<i> claimed land for <h>%s<i> from <h>%s<i>.", this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp)); fp.msg("<h>%s<i> claimed land for <h>%s<i> from <h>%s<i>.", this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
} }

View File

@ -8,15 +8,15 @@ import com.massivecraft.mcore.store.MStore;
import com.massivecraft.mcore.store.SenderColl; import com.massivecraft.mcore.store.SenderColl;
import com.massivecraft.mcore.util.TimeUnit; import com.massivecraft.mcore.util.TimeUnit;
public class FPlayerColl extends SenderColl<FPlayer> public class UPlayerColl extends SenderColl<UPlayer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public FPlayerColl(String name) public UPlayerColl(String name)
{ {
super(name, FPlayer.class, MStore.getDb(ConfServer.dburi), Factions.get()); super(name, UPlayer.class, MStore.getDb(ConfServer.dburi), Factions.get());
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -24,7 +24,7 @@ public class FPlayerColl extends SenderColl<FPlayer>
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
protected synchronized String attach(FPlayer entity, Object oid, boolean noteChange) protected synchronized String attach(UPlayer entity, Object oid, boolean noteChange)
{ {
String ret = super.attach(entity, oid, noteChange); String ret = super.attach(entity, oid, noteChange);
@ -34,15 +34,15 @@ public class FPlayerColl extends SenderColl<FPlayer>
// ... update the index. // ... update the index.
Faction faction = entity.getFaction(); Faction faction = entity.getFaction();
faction.fplayers.add(entity); faction.uplayers.add(entity);
return ret; return ret;
} }
@Override @Override
public FPlayer detachId(Object oid) public UPlayer detachId(Object oid)
{ {
FPlayer ret = super.detachId(oid); UPlayer ret = super.detachId(oid);
if (ret == null) return null; if (ret == null) return null;
// If inited ... // If inited ...
@ -50,7 +50,7 @@ public class FPlayerColl extends SenderColl<FPlayer>
// ... update the index. // ... update the index.
Faction faction = ret.getFaction(); Faction faction = ret.getFaction();
faction.fplayers.remove(ret); faction.uplayers.remove(ret);
return ret; return ret;
} }
@ -61,12 +61,12 @@ public class FPlayerColl extends SenderColl<FPlayer>
public void clean() public void clean()
{ {
for (FPlayer fplayer : this.getAll()) for (UPlayer uplayer : this.getAll())
{ {
if (FactionColls.get().get(this).containsId(fplayer.getFactionId())) continue; if (FactionColls.get().get(this).containsId(uplayer.getFactionId())) continue;
Factions.get().log("Reset faction data (invalid faction) for player "+fplayer.getName()); Factions.get().log("Reset faction data (invalid faction) for player "+uplayer.getName());
fplayer.resetFactionData(false); uplayer.resetFactionData(false);
} }
} }
@ -77,31 +77,31 @@ public class FPlayerColl extends SenderColl<FPlayer>
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
double toleranceMillis = ConfServer.autoLeaveAfterDaysOfInactivity * TimeUnit.MILLIS_PER_DAY; double toleranceMillis = ConfServer.autoLeaveAfterDaysOfInactivity * TimeUnit.MILLIS_PER_DAY;
for (FPlayer fplayer : this.getAll()) for (UPlayer uplayer : this.getAll())
{ {
Long lastPlayed = Mixin.getLastPlayed(fplayer.getId()); Long lastPlayed = Mixin.getLastPlayed(uplayer.getId());
if (lastPlayed == null) continue; if (lastPlayed == null) continue;
if (fplayer.isOnline()) continue; if (uplayer.isOnline()) continue;
if (now - lastPlayed <= toleranceMillis) continue; if (now - lastPlayed <= toleranceMillis) continue;
if (MConf.get().logFactionLeave || MConf.get().logFactionKick) if (MConf.get().logFactionLeave || MConf.get().logFactionKick)
{ {
Factions.get().log("Player "+fplayer.getName()+" was auto-removed due to inactivity."); Factions.get().log("Player "+uplayer.getName()+" was auto-removed due to inactivity.");
} }
// if player is faction leader, sort out the faction since he's going away // if player is faction leader, sort out the faction since he's going away
if (fplayer.getRole() == Rel.LEADER) if (uplayer.getRole() == Rel.LEADER)
{ {
Faction faction = fplayer.getFaction(); Faction faction = uplayer.getFaction();
if (faction != null) if (faction != null)
{ {
fplayer.getFaction().promoteNewLeader(); uplayer.getFaction().promoteNewLeader();
} }
} }
fplayer.leave(false); uplayer.leave(false);
fplayer.detach(); uplayer.detach();
} }
} }
} }

View File

@ -19,23 +19,23 @@ import com.massivecraft.mcore.util.MUtil;
import com.massivecraft.mcore.util.SenderUtil; import com.massivecraft.mcore.util.SenderUtil;
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken; import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
public class FPlayerColls extends Colls<FPlayerColl, FPlayer> public class UPlayerColls extends Colls<UPlayerColl, UPlayer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static FPlayerColls i = new FPlayerColls(); private static UPlayerColls i = new UPlayerColls();
public static FPlayerColls get() { return i; } public static UPlayerColls get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE: COLLS // OVERRIDE: COLLS
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public FPlayerColl createColl(String collName) public UPlayerColl createColl(String collName)
{ {
return new FPlayerColl(collName); return new UPlayerColl(collName);
} }
@Override @Override
@ -47,11 +47,11 @@ public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
@Override @Override
public String getBasename() public String getBasename()
{ {
return Const.COLLECTION_BASENAME_PLAYER; return Const.COLLECTION_BASENAME_UPLAYER;
} }
@Override @Override
public FPlayerColl get(Object o) public UPlayerColl get(Object o)
{ {
if (o == null) return null; if (o == null) return null;
@ -93,17 +93,17 @@ public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
if ( ! oldFile.exists()) return; if ( ! oldFile.exists()) return;
// Read the file content through GSON. // Read the file content through GSON.
Type type = new TypeToken<Map<String, FPlayer>>(){}.getType(); Type type = new TypeToken<Map<String, UPlayer>>(){}.getType();
Map<String, FPlayer> id2fplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type); Map<String, UPlayer> id2fplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
// The Coll // The Coll
FPlayerColl coll = this.getForUniverse(MCore.DEFAULT); UPlayerColl coll = this.getForUniverse(MCore.DEFAULT);
// Set the data // Set the data
for (Entry<String, FPlayer> entry : id2fplayer.entrySet()) for (Entry<String, UPlayer> entry : id2fplayer.entrySet())
{ {
String playerId = entry.getKey(); String playerId = entry.getKey();
FPlayer fplayer = entry.getValue(); UPlayer fplayer = entry.getValue();
coll.attach(fplayer, playerId); coll.attach(fplayer, playerId);
} }

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.event.MCoreEvent; import com.massivecraft.mcore.event.MCoreEvent;
public abstract class FactionsEventAbstractSender extends MCoreEvent public abstract class FactionsEventAbstractSender extends MCoreEvent
@ -13,7 +13,7 @@ public abstract class FactionsEventAbstractSender extends MCoreEvent
private final CommandSender sender; private final CommandSender sender;
public CommandSender getSender() { return this.sender; } public CommandSender getSender() { return this.sender; }
public FPlayer getFSender() { return FPlayer.get(this.sender); } public UPlayer getFSender() { return UPlayer.get(this.sender); }
// -------------------------------------------- // // -------------------------------------------- //
// CONSTRUCT // CONSTRUCT

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
public class FactionsEventInvitedChange extends FactionsEventAbstractSender public class FactionsEventInvitedChange extends FactionsEventAbstractSender
@ -20,8 +20,8 @@ public class FactionsEventInvitedChange extends FactionsEventAbstractSender
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
private final FPlayer fplayer; private final UPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; } public UPlayer getFPlayer() { return this.fplayer; }
private final Faction faction; private final Faction faction;
public Faction getFaction() { return this.faction; } public Faction getFaction() { return this.faction; }
@ -34,7 +34,7 @@ public class FactionsEventInvitedChange extends FactionsEventAbstractSender
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public FactionsEventInvitedChange(CommandSender sender, FPlayer fplayer, Faction faction, boolean newInvited) public FactionsEventInvitedChange(CommandSender sender, UPlayer fplayer, Faction faction, boolean newInvited)
{ {
super(sender); super(sender);
this.fplayer = fplayer; this.fplayer = fplayer;

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
public class FactionsEventMembershipChange extends FactionsEventAbstractSender public class FactionsEventMembershipChange extends FactionsEventAbstractSender
@ -27,8 +27,8 @@ public class FactionsEventMembershipChange extends FactionsEventAbstractSender
super.setCancelled(cancelled); super.setCancelled(cancelled);
} }
private final FPlayer fplayer; private final UPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; } public UPlayer getFPlayer() { return this.fplayer; }
private final Faction newFaction; private final Faction newFaction;
public Faction getNewFaction() { return this.newFaction; } public Faction getNewFaction() { return this.newFaction; }
@ -40,7 +40,7 @@ public class FactionsEventMembershipChange extends FactionsEventAbstractSender
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public FactionsEventMembershipChange(CommandSender sender, FPlayer fplayer, Faction newFaction, MembershipChangeReason reason) public FactionsEventMembershipChange(CommandSender sender, UPlayer fplayer, Faction newFaction, MembershipChangeReason reason)
{ {
super(sender); super(sender);
this.fplayer = fplayer; this.fplayer = fplayer;

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class FactionsEventPowerChange extends FactionsEventAbstractSender public class FactionsEventPowerChange extends FactionsEventAbstractSender
{ {
@ -19,8 +19,8 @@ public class FactionsEventPowerChange extends FactionsEventAbstractSender
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
private final FPlayer fplayer; private final UPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; } public UPlayer getFPlayer() { return this.fplayer; }
private final PowerChangeReason reason; private final PowerChangeReason reason;
public PowerChangeReason getReason() { return this.reason; } public PowerChangeReason getReason() { return this.reason; }
@ -33,7 +33,7 @@ public class FactionsEventPowerChange extends FactionsEventAbstractSender
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public FactionsEventPowerChange(CommandSender sender, FPlayer fplayer, PowerChangeReason reason, double newPower) public FactionsEventPowerChange(CommandSender sender, UPlayer fplayer, PowerChangeReason reason, double newPower)
{ {
super(sender); super(sender);
this.fplayer = fplayer; this.fplayer = fplayer;

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
public class FactionsEventTitleChange extends FactionsEventAbstractSender public class FactionsEventTitleChange extends FactionsEventAbstractSender
{ {
@ -19,8 +19,8 @@ public class FactionsEventTitleChange extends FactionsEventAbstractSender
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
private final FPlayer fplayer; private final UPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; } public UPlayer getFPlayer() { return this.fplayer; }
private String newTitle; private String newTitle;
public String getNewTitle() { return this.newTitle; } public String getNewTitle() { return this.newTitle; }
@ -30,7 +30,7 @@ public class FactionsEventTitleChange extends FactionsEventAbstractSender
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public FactionsEventTitleChange(CommandSender sender, FPlayer fplayer, String newTitle) public FactionsEventTitleChange(CommandSender sender, UPlayer fplayer, String newTitle)
{ {
super(sender); super(sender);
this.fplayer = fplayer; this.fplayer = fplayer;

View File

@ -8,7 +8,7 @@ import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.EconomyParticipator; import com.massivecraft.factions.EconomyParticipator;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.util.RelationUtil; import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.mcore.money.Money; import com.massivecraft.mcore.money.Money;
@ -30,7 +30,7 @@ public class Econ
// UTIL // UTIL
// -------------------------------------------- // // -------------------------------------------- //
public static boolean payForAction(double cost, FPlayer fsender, String actionDescription) public static boolean payForAction(double cost, UPlayer fsender, String actionDescription)
{ {
if (!isEnabled(fsender)) return true; if (!isEnabled(fsender)) return true;
if (cost == 0D) return true; if (cost == 0D) return true;
@ -64,7 +64,7 @@ public class Econ
Money.add(universe, ConfServer.econUniverseAccount, delta); Money.add(universe, ConfServer.econUniverseAccount, delta);
} }
public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) public static void sendBalanceInfo(UPlayer to, EconomyParticipator about)
{ {
if (!isEnabled(to)) if (!isEnabled(to))
{ {
@ -84,7 +84,7 @@ public class Econ
if (fI == null) return true; if (fI == null) return true;
// Bypassing players can do any kind of transaction // Bypassing players can do any kind of transaction
if (i instanceof FPlayer && ((FPlayer)i).isUsingAdminMode()) return true; if (i instanceof UPlayer && ((UPlayer)i).isUsingAdminMode()) return true;
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again. // You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
if (i == you) return true; if (i == you) return true;
@ -167,21 +167,21 @@ public class Econ
return false; return false;
} }
public static Set<FPlayer> getFplayers(EconomyParticipator ep) public static Set<UPlayer> getFplayers(EconomyParticipator ep)
{ {
Set<FPlayer> fplayers = new HashSet<FPlayer>(); Set<UPlayer> fplayers = new HashSet<UPlayer>();
if (ep == null) if (ep == null)
{ {
// Add nothing // Add nothing
} }
else if (ep instanceof FPlayer) else if (ep instanceof UPlayer)
{ {
fplayers.add((FPlayer)ep); fplayers.add((UPlayer)ep);
} }
else if (ep instanceof Faction) else if (ep instanceof Faction)
{ {
fplayers.addAll(((Faction)ep).getFPlayers()); fplayers.addAll(((Faction)ep).getUPlayers());
} }
return fplayers; return fplayers;
@ -189,35 +189,35 @@ public class Econ
public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount) public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount)
{ {
Set<FPlayer> recipients = new HashSet<FPlayer>(); Set<UPlayer> recipients = new HashSet<UPlayer>();
recipients.addAll(getFplayers(invoker)); recipients.addAll(getFplayers(invoker));
recipients.addAll(getFplayers(from)); recipients.addAll(getFplayers(from));
recipients.addAll(getFplayers(to)); recipients.addAll(getFplayers(to));
if (invoker == null) if (invoker == null)
{ {
for (FPlayer recipient : recipients) for (UPlayer recipient : recipients)
{ {
recipient.msg("<h>%s<i> was transfered from <h>%s<i> to <h>%s<i>.", Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient)); recipient.msg("<h>%s<i> was transfered from <h>%s<i> to <h>%s<i>.", Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient));
} }
} }
else if (invoker == from) else if (invoker == from)
{ {
for (FPlayer recipient : recipients) for (UPlayer recipient : recipients)
{ {
recipient.msg("<h>%s<i> <h>gave %s<i> to <h>%s<i>.", from.describeTo(recipient, true), Money.format(from, amount), to.describeTo(recipient)); recipient.msg("<h>%s<i> <h>gave %s<i> to <h>%s<i>.", from.describeTo(recipient, true), Money.format(from, amount), to.describeTo(recipient));
} }
} }
else if (invoker == to) else if (invoker == to)
{ {
for (FPlayer recipient : recipients) for (UPlayer recipient : recipients)
{ {
recipient.msg("<h>%s<i> <h>took %s<i> from <h>%s<i>.", to.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient)); recipient.msg("<h>%s<i> <h>took %s<i> from <h>%s<i>.", to.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient));
} }
} }
else else
{ {
for (FPlayer recipient : recipients) for (UPlayer recipient : recipients)
{ {
recipient.msg("<h>%s<i> transfered <h>%s<i> from <h>%s<i> to <h>%s<i>.", invoker.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient)); recipient.msg("<h>%s<i> transfered <h>%s<i> from <h>%s<i> to <h>%s<i>.", invoker.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient));
} }

View File

@ -14,7 +14,7 @@ import com.griefcraft.lwc.LWC;
import com.griefcraft.lwc.LWCPlugin; import com.griefcraft.lwc.LWCPlugin;
import com.griefcraft.model.Protection; import com.griefcraft.model.Protection;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.mcore.ps.PS;
@ -48,8 +48,8 @@ public class LWCFeatures
{ {
for (Protection protection : getProtectionsInChunk(chunkPs)) for (Protection protection : getProtectionsInChunk(chunkPs))
{ {
FPlayer owner = FPlayer.get(protection.getOwner()); UPlayer owner = UPlayer.get(protection.getOwner());
if (faction.getFPlayers().contains(owner)) continue; if (faction.getUPlayers().contains(owner)) continue;
protection.remove(); protection.remove();
} }
} }

View File

@ -12,7 +12,7 @@ import org.bukkit.ChatColor;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.util.HealthBarUtil; import com.massivecraft.factions.util.HealthBarUtil;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.mcore.ps.PS;
@ -72,7 +72,7 @@ public class SpoutFeatures
for (Player player : fromPlayers) for (Player player : fromPlayers)
{ {
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
SpoutPlayer splayer = SpoutManager.getPlayer(player); SpoutPlayer splayer = SpoutManager.getPlayer(player);
Faction faction = fplayer.getFaction(); Faction faction = fplayer.getFaction();
@ -137,13 +137,13 @@ public class SpoutFeatures
for (Player player : fromPlayers) for (Player player : fromPlayers)
{ {
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
SpoutPlayer splayer = SpoutManager.getPlayer(player); SpoutPlayer splayer = SpoutManager.getPlayer(player);
Faction faction = fplayer.getFaction(); Faction faction = fplayer.getFaction();
for (Player playerTo : toPlayers) for (Player playerTo : toPlayers)
{ {
FPlayer fplayerTo = FPlayer.get(playerTo); UPlayer fplayerTo = UPlayer.get(playerTo);
SpoutPlayer splayerTo = SpoutManager.getPlayer(playerTo); SpoutPlayer splayerTo = SpoutManager.getPlayer(playerTo);
Faction factionTo = fplayerTo.getFaction(); Faction factionTo = fplayerTo.getFaction();
@ -178,7 +178,7 @@ public class SpoutFeatures
}, 5); }, 5);
} }
public static String generateTitle(Player player, FPlayer fplayer, Faction faction, ChatColor relationColor) public static String generateTitle(Player player, UPlayer fplayer, Faction faction, ChatColor relationColor)
{ {
String ret = null; String ret = null;
@ -220,9 +220,9 @@ public class SpoutFeatures
{ {
ret.add((Player)o); ret.add((Player)o);
} }
else if (o instanceof FPlayer) else if (o instanceof UPlayer)
{ {
FPlayer fplayer = (FPlayer)o; UPlayer fplayer = (UPlayer)o;
Player player = fplayer.getPlayer(); Player player = fplayer.getPlayer();
if (player != null) if (player != null)
{ {
@ -252,7 +252,7 @@ public class SpoutFeatures
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
if (chunk == null) if (chunk == null)
{ {
mainListener.updateTerritoryDisplay(fplayer, false); mainListener.updateTerritoryDisplay(fplayer, false);
@ -265,7 +265,7 @@ public class SpoutFeatures
} }
// update displayed current territory for specified player; returns false if unsuccessful // update displayed current territory for specified player; returns false if unsuccessful
public static boolean updateTerritoryDisplay(FPlayer player) public static boolean updateTerritoryDisplay(UPlayer player)
{ {
if ( ! isEnabled()) return false; if ( ! isEnabled()) return false;
return mainListener.updateTerritoryDisplay(player, true); return mainListener.updateTerritoryDisplay(player, true);
@ -280,7 +280,7 @@ public class SpoutFeatures
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
if (chunk == null || fplayer.getCurrentChunk().equals(chunk)) if (chunk == null || fplayer.getCurrentChunk().equals(chunk))
{ {
mainListener.updateAccessInfo(fplayer); mainListener.updateAccessInfo(fplayer);
@ -289,13 +289,13 @@ public class SpoutFeatures
} }
// update owner list for specified player // update owner list for specified player
public static boolean updateAccessInfo(FPlayer player) public static boolean updateAccessInfo(UPlayer player)
{ {
if ( ! isEnabled()) return false; if ( ! isEnabled()) return false;
return mainListener.updateAccessInfo(player); return mainListener.updateAccessInfo(player);
} }
public static void playerDisconnect(FPlayer player) public static void playerDisconnect(UPlayer player)
{ {
if ( ! isEnabled()) return; if ( ! isEnabled()) return;
mainListener.removeTerritoryLabels(player.getName()); mainListener.removeTerritoryLabels(player.getName());

View File

@ -12,7 +12,7 @@ import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.mcore.ps.PS;
@ -28,7 +28,7 @@ public class SpoutMainListener implements Listener
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) public void onSpoutCraftEnable(SpoutCraftEnableEvent event)
{ {
final FPlayer me = FPlayer.get(event.getPlayer()); final UPlayer me = UPlayer.get(event.getPlayer());
SpoutFeatures.updateTitle(me, null); SpoutFeatures.updateTitle(me, null);
SpoutFeatures.updateTitle(null, me); SpoutFeatures.updateTitle(null, me);
@ -46,7 +46,7 @@ public class SpoutMainListener implements Listener
// private final static int SCREEN_HEIGHT = 240; // private final static int SCREEN_HEIGHT = 240;
public boolean updateTerritoryDisplay(FPlayer player, boolean notify) public boolean updateTerritoryDisplay(UPlayer player, boolean notify)
{ {
Player p = player.getPlayer(); Player p = player.getPlayer();
if (p == null) if (p == null)
@ -61,7 +61,7 @@ public class SpoutMainListener implements Listener
return true; return true;
} }
public boolean updateAccessInfo(FPlayer player) public boolean updateAccessInfo(UPlayer player)
{ {
Player p = player.getPlayer(); Player p = player.getPlayer();
if (p == null) if (p == null)
@ -86,7 +86,7 @@ public class SpoutMainListener implements Listener
} }
private void doLabels(FPlayer player, SpoutPlayer sPlayer, boolean notify) private void doLabels(UPlayer player, SpoutPlayer sPlayer, boolean notify)
{ {
PS here = player.getCurrentChunk(); PS here = player.getCurrentChunk();
Faction factionHere = BoardColls.get().getFactionAt(here); Faction factionHere = BoardColls.get().getFactionAt(here);
@ -159,7 +159,7 @@ public class SpoutMainListener implements Listener
private static final Color accessGrantedColor = new Color(0.2f, 1.0f, 0.2f); private static final Color accessGrantedColor = new Color(0.2f, 1.0f, 0.2f);
private static final Color accessDeniedColor = new Color(1.0f, 0.2f, 0.2f); private static final Color accessDeniedColor = new Color(1.0f, 0.2f, 0.2f);
private void doAccessInfo(FPlayer player, SpoutPlayer sPlayer, PS here) private void doAccessInfo(UPlayer player, SpoutPlayer sPlayer, PS here)
{ {
if (ConfServer.spoutTerritoryDisplayPosition <= 0 || ConfServer.spoutTerritoryDisplaySize <= 0 || ! ConfServer.spoutTerritoryAccessShow) return; if (ConfServer.spoutTerritoryDisplayPosition <= 0 || ConfServer.spoutTerritoryDisplaySize <= 0 || ! ConfServer.spoutTerritoryAccessShow) return;

View File

@ -23,7 +23,7 @@ import com.dthielke.herochat.MessageFormatSupplier;
import com.dthielke.herochat.MessageNotFoundException; import com.dthielke.herochat.MessageNotFoundException;
import com.dthielke.herochat.util.Messaging; import com.dthielke.herochat.util.Messaging;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
public abstract class FactionsChannelAbstract implements Channel public abstract class FactionsChannelAbstract implements Channel
@ -211,13 +211,13 @@ public abstract class FactionsChannelAbstract implements Channel
{ {
Set<Player> ret = new HashSet<Player>(); Set<Player> ret = new HashSet<Player>();
FPlayer fpsender = FPlayer.get(sender); UPlayer fpsender = UPlayer.get(sender);
Faction faction = fpsender.getFaction(); Faction faction = fpsender.getFaction();
String universe = fpsender.getUniverse(); String universe = fpsender.getUniverse();
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
FPlayer frecipient = FPlayer.get(player); UPlayer frecipient = UPlayer.get(player);
if (!frecipient.getUniverse().equals(universe)) continue; if (!frecipient.getUniverse().equals(universe)) continue;
if (!this.getTargetRelations().contains(faction.getRelationTo(frecipient))) continue; if (!this.getTargetRelations().contains(faction.getRelationTo(frecipient))) continue;
ret.add(player); ret.add(player);

View File

@ -10,7 +10,7 @@ import com.dthielke.herochat.ChannelChatEvent;
import com.dthielke.herochat.Herochat; import com.dthielke.herochat.Herochat;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.chat.ChatFormatter; import com.massivecraft.factions.chat.ChatFormatter;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
@ -54,7 +54,7 @@ public class HerochatEngine implements Listener
String format = event.getFormat(); String format = event.getFormat();
format = format.replaceAll("&r", "§r"); format = format.replaceAll("&r", "§r");
format = ChatFormatter.format(format, FPlayer.get(event.getSender().getPlayer()), null); format = ChatFormatter.format(format, UPlayer.get(event.getSender().getPlayer()), null);
event.setFormat(format); event.setFormat(format);
} }

View File

@ -8,7 +8,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.chat.ChatFormatter; import com.massivecraft.factions.chat.ChatFormatter;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
public class FactionsListenerChat implements Listener public class FactionsListenerChat implements Listener
@ -96,7 +96,7 @@ public class FactionsListenerChat implements Listener
// ... then parse tags a.k.a. "format the format". // ... then parse tags a.k.a. "format the format".
String format = event.getFormat(); String format = event.getFormat();
format = ChatFormatter.format(format, FPlayer.get(event.getPlayer()), null); format = ChatFormatter.format(format, UPlayer.get(event.getPlayer()), null);
event.setFormat(format); event.setFormat(format);
} }

View File

@ -50,7 +50,7 @@ import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
@ -89,7 +89,7 @@ public class FactionsListenerMain implements Listener
{ {
// If a player dies ... // If a player dies ...
Player player = event.getEntity(); Player player = event.getEntity();
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
// ... and powerloss can happen here ... // ... and powerloss can happen here ...
Faction faction = BoardColls.get().getFactionAt(PS.valueOf(player)); Faction faction = BoardColls.get().getFactionAt(PS.valueOf(player));
@ -169,7 +169,7 @@ public class FactionsListenerMain implements Listener
Entity edefender = event.getEntity(); Entity edefender = event.getEntity();
if (!(edefender instanceof Player)) return true; if (!(edefender instanceof Player)) return true;
Player defender = (Player)edefender; Player defender = (Player)edefender;
FPlayer fdefender = FPlayer.get(edefender); UPlayer fdefender = UPlayer.get(edefender);
// ... and the attacker is someone else ... // ... and the attacker is someone else ...
Entity eattacker = event.getDamager(); Entity eattacker = event.getDamager();
@ -190,7 +190,7 @@ public class FactionsListenerMain implements Listener
{ {
if (notify) if (notify)
{ {
FPlayer attacker = FPlayer.get(eattacker); UPlayer attacker = UPlayer.get(eattacker);
attacker.msg("<i>PVP is disabled in %s.", defenderPsFaction.describeTo(attacker)); attacker.msg("<i>PVP is disabled in %s.", defenderPsFaction.describeTo(attacker));
} }
return false; return false;
@ -201,7 +201,7 @@ public class FactionsListenerMain implements Listener
// ... and if the attacker is a player ... // ... and if the attacker is a player ...
if (!(eattacker instanceof Player)) return true; if (!(eattacker instanceof Player)) return true;
Player attacker = (Player)eattacker; Player attacker = (Player)eattacker;
FPlayer fattacker = FPlayer.get(attacker); UPlayer fattacker = UPlayer.get(attacker);
// ... does this player bypass all protection? ... // ... does this player bypass all protection? ...
if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) return true; if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) return true;
@ -292,7 +292,7 @@ public class FactionsListenerMain implements Listener
{ {
// If a player was kicked from the server ... // If a player was kicked from the server ...
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
// ... and if the if player was banned (not just kicked) ... // ... and if the if player was banned (not just kicked) ...
if (!event.getReason().equals("Banned by admin.")) return; if (!event.getReason().equals("Banned by admin.")) return;
@ -331,7 +331,7 @@ public class FactionsListenerMain implements Listener
{ {
// If a player is trying to run a command ... // If a player is trying to run a command ...
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
// ... and the player does not have adminmode ... // ... and the player does not have adminmode ...
if (fplayer.isUsingAdminMode()) return; if (fplayer.isUsingAdminMode()) return;
@ -508,7 +508,7 @@ public class FactionsListenerMain implements Listener
String name = player.getName(); String name = player.getName();
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true; if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
FPlayer me = FPlayer.get(player); UPlayer me = UPlayer.get(player);
if (me.isUsingAdminMode()) return true; if (me.isUsingAdminMode()) return true;
Faction factionHere = BoardColls.get().getFactionAt(ps); Faction factionHere = BoardColls.get().getFactionAt(ps);

View File

@ -17,7 +17,7 @@ import com.massivecraft.factions.Const;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.event.MCorePlayerLeaveEvent; import com.massivecraft.mcore.event.MCorePlayerLeaveEvent;
@ -32,7 +32,7 @@ public class TodoFactionsPlayerListener implements Listener
{ {
// If a player is joining the server ... // If a player is joining the server ...
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
// ... recalculate their power as if they were offline since last recalculation ... // ... recalculate their power as if they were offline since last recalculation ...
fplayer.recalculatePower(false); fplayer.recalculatePower(false);
@ -51,7 +51,7 @@ public class TodoFactionsPlayerListener implements Listener
public void onPlayerLeave(MCorePlayerLeaveEvent event) public void onPlayerLeave(MCorePlayerLeaveEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
// Recalculate the power before the player leaves. // Recalculate the power before the player leaves.
// This is required since we recalculate as if the player were offline when they log back in. // This is required since we recalculate as if the player were offline when they log back in.
@ -69,7 +69,7 @@ public class TodoFactionsPlayerListener implements Listener
// ... update the stored current chunk ... // ... update the stored current chunk ...
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
PS chunkFrom = fplayer.getCurrentChunk(); PS chunkFrom = fplayer.getCurrentChunk();
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true); PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
@ -145,7 +145,7 @@ public class TodoFactionsPlayerListener implements Listener
String name = player.getName(); String name = player.getName();
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true; if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
FPlayer fplayer = FPlayer.get(player); UPlayer fplayer = UPlayer.get(player);
if (fplayer.isUsingAdminMode()) return true; if (fplayer.isUsingAdminMode()) return true;
return FPerm.BUILD.has(fplayer, ps, !justCheck); return FPerm.BUILD.has(fplayer, ps, !justCheck);
@ -156,7 +156,7 @@ public class TodoFactionsPlayerListener implements Listener
String name = player.getName(); String name = player.getName();
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true; if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
FPlayer me = FPlayer.get(player); UPlayer me = UPlayer.get(player);
if (me.isUsingAdminMode()) return true; if (me.isUsingAdminMode()) return true;
PS ps = PS.valueOf(block); PS ps = PS.valueOf(block);

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.task; package com.massivecraft.factions.task;
import com.massivecraft.factions.ConfServer; import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.entity.FPlayerColl; import com.massivecraft.factions.entity.UPlayerColl;
import com.massivecraft.factions.entity.FPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.mcore.ModuloRepeatTask; import com.massivecraft.mcore.ModuloRepeatTask;
import com.massivecraft.mcore.util.TimeUnit; import com.massivecraft.mcore.util.TimeUnit;
@ -34,7 +34,7 @@ public class AutoLeaveTask extends ModuloRepeatTask
@Override @Override
public void invoke() public void invoke()
{ {
for (FPlayerColl coll : FPlayerColls.get().getColls()) for (UPlayerColl coll : UPlayerColls.get().getColls())
{ {
coll.autoLeaveOnInactivityRoutine(); coll.autoLeaveOnInactivityRoutine();
} }

View File

@ -5,7 +5,7 @@ import org.bukkit.ChatColor;
import com.massivecraft.factions.FFlag; import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.RelationParticipator; import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.util.Txt;
@ -29,7 +29,7 @@ public class RelationUtil
if (that instanceof Faction) if (that instanceof Faction)
{ {
if (me instanceof FPlayer && myFaction == thatFaction) if (me instanceof UPlayer && myFaction == thatFaction)
{ {
ret = "your faction"; ret = "your faction";
} }
@ -38,9 +38,9 @@ public class RelationUtil
ret = thatFaction.getTag(); ret = thatFaction.getTag();
} }
} }
else if (that instanceof FPlayer) else if (that instanceof UPlayer)
{ {
FPlayer fplayerthat = (FPlayer) that; UPlayer fplayerthat = (UPlayer) that;
if (that == me) if (that == me)
{ {
ret = "you"; ret = "you";
@ -98,9 +98,9 @@ public class RelationUtil
ret = Rel.MEMBER; ret = Rel.MEMBER;
// Do officer and leader check // Do officer and leader check
//P.p.log("getRelationOfThatToMe the factions are the same for "+that.getClass().getSimpleName()+" and observer "+me.getClass().getSimpleName()); //P.p.log("getRelationOfThatToMe the factions are the same for "+that.getClass().getSimpleName()+" and observer "+me.getClass().getSimpleName());
if (that instanceof FPlayer) if (that instanceof UPlayer)
{ {
ret = ((FPlayer)that).getRole(); ret = ((UPlayer)that).getRole();
//P.p.log("getRelationOfThatToMe it was a player and role is "+ret); //P.p.log("getRelationOfThatToMe it was a player and role is "+ret);
} }
} }
@ -119,9 +119,9 @@ public class RelationUtil
return (Faction) rp; return (Faction) rp;
} }
if (rp instanceof FPlayer) if (rp instanceof UPlayer)
{ {
return ((FPlayer) rp).getFaction(); return ((UPlayer) rp).getFaction();
} }
// ERROR // ERROR