mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 04:35:21 +01:00
Starting to rename fplayer --> uplayer since we will need an mplayer.
This commit is contained in:
parent
e30c652759
commit
19f9834210
@ -12,14 +12,14 @@ public class Const
|
||||
// MStore Collection Names
|
||||
public static final String COLLECTION_BASENAME = "factions";
|
||||
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_PLAYER = COLLECTION_BASENAME_+"player";
|
||||
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
|
||||
|
||||
public static final String ASPECT_ID = "factions";
|
||||
|
||||
// Defautlt faction ids
|
||||
|
@ -11,7 +11,7 @@ import java.util.Set;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
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.UConf;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
@ -174,7 +174,7 @@ public enum FPerm
|
||||
|
||||
if (testSubject instanceof CommandSender)
|
||||
{
|
||||
rpSubject = FPlayer.get(testSubject);
|
||||
rpSubject = UPlayer.get(testSubject);
|
||||
}
|
||||
else if (testSubject instanceof RelationParticipator)
|
||||
{
|
||||
@ -190,11 +190,11 @@ public enum FPerm
|
||||
// TODO: Create better description messages like: "You must at least be officer".
|
||||
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());
|
||||
if (Perm.ADMIN.has(fplayer.getPlayer()))
|
||||
{
|
||||
@ -218,11 +218,11 @@ public enum FPerm
|
||||
{
|
||||
if (informIfNot)
|
||||
{
|
||||
FPlayer notify = null;
|
||||
UPlayer notify = null;
|
||||
if (testSubject instanceof CommandSender)
|
||||
notify = FPlayer.get(testSubject);
|
||||
else if (testSubject instanceof FPlayer)
|
||||
notify = (FPlayer)testSubject;
|
||||
notify = UPlayer.get(testSubject);
|
||||
else if (testSubject instanceof UPlayer)
|
||||
notify = (UPlayer)testSubject;
|
||||
if (notify != null)
|
||||
notify.msg("<b>This territory owned by your faction has restricted access.");
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import java.io.Serializable;
|
||||
|
||||
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.mcore.Predictate;
|
||||
|
||||
@ -35,7 +35,7 @@ public class FactionEqualsPredictate implements Predictate<CommandSender>, Seria
|
||||
@Override
|
||||
public boolean apply(CommandSender sender)
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(sender);
|
||||
UPlayer fplayer = UPlayer.get(sender);
|
||||
return this.factionId.equals(fplayer.getFactionId());
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,11 @@ public class FactionListComparator implements Comparator<Faction>
|
||||
if (ret != 0) return ret;
|
||||
|
||||
// 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;
|
||||
|
||||
// Players Total
|
||||
ret = f2.getFPlayers().size() - f1.getFPlayers().size();
|
||||
ret = f2.getUPlayers().size() - f1.getUPlayers().size();
|
||||
if (ret != 0) return ret;
|
||||
|
||||
// Tie by Id
|
||||
|
@ -21,7 +21,7 @@ import com.massivecraft.factions.chat.tag.ChatTagTitle;
|
||||
import com.massivecraft.factions.cmd.*;
|
||||
import com.massivecraft.factions.entity.Board;
|
||||
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.MConfColl;
|
||||
import com.massivecraft.factions.integration.LWCFeatures;
|
||||
@ -103,11 +103,11 @@ public class Factions extends MPlugin
|
||||
this.databaseInitialized = false;
|
||||
|
||||
MConfColl.get().init();
|
||||
FPlayerColls.get().init();
|
||||
UPlayerColls.get().init();
|
||||
FactionColls.get().init();
|
||||
BoardColls.get().init();
|
||||
|
||||
FactionColls.get().reindexFPlayers();
|
||||
FactionColls.get().reindexUPlayers();
|
||||
|
||||
this.databaseInitialized = true;
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util.Set;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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.FactionColls;
|
||||
|
||||
@ -78,9 +78,9 @@ public class TerritoryAccess
|
||||
|
||||
|
||||
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(FPlayer fplayer) { this.removeFPlayer(fplayer.getId()); }
|
||||
public void removeFPlayer(UPlayer fplayer) { this.removeFPlayer(fplayer.getId()); }
|
||||
|
||||
public boolean toggleFPlayer(String fplayerID)
|
||||
{
|
||||
@ -92,7 +92,7 @@ public class TerritoryAccess
|
||||
this.addFPlayer(fplayerID);
|
||||
return true;
|
||||
}
|
||||
public boolean toggleFPlayer(FPlayer fplayer)
|
||||
public boolean toggleFPlayer(UPlayer fplayer)
|
||||
{
|
||||
return this.toggleFPlayer(fplayer.getId());
|
||||
}
|
||||
@ -103,9 +103,9 @@ public class TerritoryAccess
|
||||
if (testSubject instanceof String)
|
||||
return hostFactionId.equals((String)testSubject);
|
||||
else if (testSubject instanceof CommandSender)
|
||||
return hostFactionId.equals(FPlayer.get(testSubject).getFactionId());
|
||||
else if (testSubject instanceof FPlayer)
|
||||
return hostFactionId.equals(((FPlayer)testSubject).getFactionId());
|
||||
return hostFactionId.equals(UPlayer.get(testSubject).getFactionId());
|
||||
else if (testSubject instanceof UPlayer)
|
||||
return hostFactionId.equals(((UPlayer)testSubject).getFactionId());
|
||||
else if (testSubject instanceof Faction)
|
||||
return hostFactionId.equals(((Faction)testSubject).getId());
|
||||
return false;
|
||||
@ -158,14 +158,14 @@ public class TerritoryAccess
|
||||
public boolean subjectHasAccess(Object testSubject)
|
||||
{
|
||||
if (testSubject instanceof Player)
|
||||
return fPlayerHasAccess(FPlayer.get(testSubject));
|
||||
else if (testSubject instanceof FPlayer)
|
||||
return fPlayerHasAccess((FPlayer)testSubject);
|
||||
return fPlayerHasAccess(UPlayer.get(testSubject));
|
||||
else if (testSubject instanceof UPlayer)
|
||||
return fPlayerHasAccess((UPlayer)testSubject);
|
||||
else if (testSubject instanceof Faction)
|
||||
return factionHasAccess((Faction)testSubject);
|
||||
return false;
|
||||
}
|
||||
public boolean fPlayerHasAccess(FPlayer fplayer)
|
||||
public boolean fPlayerHasAccess(UPlayer fplayer)
|
||||
{
|
||||
if (factionHasAccess(fplayer.getFactionId())) return true;
|
||||
return fplayerIds.contains(fplayer.getId());
|
||||
|
@ -8,7 +8,7 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
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.
|
||||
@ -102,7 +102,7 @@ public class ChatFormatter
|
||||
// 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
|
||||
StringBuffer ret = new StringBuffer();
|
||||
@ -159,7 +159,7 @@ public class ChatFormatter
|
||||
// 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);
|
||||
if (ret == null) return null;
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.massivecraft.factions.chat;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
|
||||
public interface ChatModifier
|
||||
{
|
||||
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 unregister();
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.massivecraft.factions.chat;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public interface ChatTag
|
||||
{
|
||||
public String getId();
|
||||
public String getReplacement(FPlayer fsender, FPlayer frecipient);
|
||||
public String getReplacement(UPlayer fsender, UPlayer frecipient);
|
||||
public boolean register();
|
||||
public boolean unregister();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.modifier;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatModifierLc extends ChatModifierAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatModifierLc extends ChatModifierAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||
public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return subject.toLowerCase();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.modifier;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
|
||||
public class ChatModifierLp extends ChatModifierAbstract
|
||||
@ -19,7 +19,7 @@ public class ChatModifierLp extends ChatModifierAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||
public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
if (subject.equals("")) return subject;
|
||||
return " "+subject;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.modifier;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class ChatModifierParse extends ChatModifierAbstract
|
||||
@ -19,7 +19,7 @@ public class ChatModifierParse extends ChatModifierAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||
public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return Txt.parse(subject);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.modifier;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatModifierRp extends ChatModifierAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatModifierRp extends ChatModifierAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||
public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
if (subject.equals("")) return subject;
|
||||
return subject+" ";
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.modifier;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatModifierUc extends ChatModifierAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatModifierUc extends ChatModifierAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||
public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return subject.toUpperCase();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.modifier;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class ChatModifierUcf extends ChatModifierAbstract
|
||||
@ -19,7 +19,7 @@ public class ChatModifierUcf extends ChatModifierAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||
public String getModified(String subject, UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return Txt.upperCaseFirst(subject);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.tag;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatTagRelcolor extends ChatTagAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatTagRelcolor extends ChatTagAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
if (fsender == null) return "";
|
||||
if (frecipient == null) return "";
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.tag;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class ChatTagRole extends ChatTagAbstract
|
||||
@ -19,7 +19,7 @@ public class ChatTagRole extends ChatTagAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return Txt.upperCaseFirst(fsender.getRole().toString().toLowerCase());
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.tag;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatTagRoleprefix extends ChatTagAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatTagRoleprefix extends ChatTagAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return fsender.getRole().getPrefix();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.tag;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatTagTag extends ChatTagAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatTagTag extends ChatTagAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
if (!fsender.hasFaction()) return "";
|
||||
return fsender.getFaction().getTag();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.tag;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatTagTagforce extends ChatTagAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatTagTagforce extends ChatTagAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return fsender.getFaction().getTag();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.chat.tag;
|
||||
|
||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class ChatTagTitle extends ChatTagAbstract
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class ChatTagTitle extends ChatTagAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
||||
{
|
||||
return fsender.getTitle();
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Perm;
|
||||
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.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
|
||||
@ -73,7 +73,7 @@ public class CmdFactionsAccess extends FCommand
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(fme), fme);
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(fme), fme);
|
||||
if (targetPlayer == null) return;
|
||||
added = territory.toggleFPlayer(targetPlayer);
|
||||
target = "Player \""+targetPlayer.getName()+"\"";
|
||||
|
@ -5,8 +5,8 @@ import java.util.ArrayList;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
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
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsDemote extends FCommand
|
||||
@ -25,7 +25,7 @@ public class CmdFactionsDemote extends FCommand
|
||||
@Override
|
||||
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.getFaction() != myFaction)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
@ -53,24 +53,24 @@ public class CmdFactionsDisband extends FCommand
|
||||
|
||||
// Merged Apply and Inform
|
||||
|
||||
// Send FPlayerLeaveEvent for each player in the faction
|
||||
for (FPlayer fplayer : faction.getFPlayers())
|
||||
// Run event for each player in the faction
|
||||
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();
|
||||
}
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayerColls.get().get(fme).getAllOnline())
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(fme).getAllOnline())
|
||||
{
|
||||
String who = fme.describeTo(fplayer);
|
||||
if (fplayer.getFaction() == faction)
|
||||
String who = fme.describeTo(uplayer);
|
||||
if (uplayer.getFaction() == faction)
|
||||
{
|
||||
fplayer.msg("<h>%s<i> disbanded your faction.", who);
|
||||
uplayer.msg("<h>%s<i> disbanded your faction.", who);
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.FactionsEventHomeTeleport;
|
||||
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)
|
||||
continue;
|
||||
|
||||
FPlayer fp = FPlayer.get(p);
|
||||
UPlayer fp = UPlayer.get(p);
|
||||
if (fme.getRelationTo(fp) != Rel.ENEMY)
|
||||
continue;
|
||||
|
||||
|
@ -3,8 +3,8 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.event.FactionsEventInvitedChange;
|
||||
import com.massivecraft.mcore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
@ -27,16 +27,16 @@ public class CmdFactionsInvite extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
FPlayer fplayer = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
if (fplayer == null) return;
|
||||
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
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;
|
||||
|
||||
// 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));
|
||||
return;
|
||||
}
|
||||
@ -45,24 +45,24 @@ public class CmdFactionsInvite extends FCommand
|
||||
if ( ! FPerm.INVITE.has(sender, myFaction, true)) return;
|
||||
|
||||
// Event
|
||||
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, fplayer, myFaction, newInvited);
|
||||
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, myFaction, newInvited);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newInvited = event.isNewInvited();
|
||||
|
||||
// Apply
|
||||
myFaction.setInvited(fplayer, newInvited);
|
||||
myFaction.setInvited(uplayer, newInvited);
|
||||
|
||||
// Inform
|
||||
if (newInvited)
|
||||
{
|
||||
fplayer.msg("%s<i> invited you to %s", fme.describeTo(fplayer, true), myFaction.describeTo(fplayer));
|
||||
myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), fplayer.describeTo(myFaction));
|
||||
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), uplayer.describeTo(myFaction));
|
||||
}
|
||||
else
|
||||
{
|
||||
fplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(fplayer), myFaction.describeTo(fplayer));
|
||||
myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), fplayer.describeTo(myFaction));
|
||||
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), uplayer.describeTo(myFaction));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
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.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
@ -31,10 +31,10 @@ public class CmdFactionsJoin extends FCommand
|
||||
Faction faction = this.arg(0, ARFaction.get(sender));
|
||||
if (faction == null) return;
|
||||
|
||||
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender), fme);
|
||||
if (fplayer == null) return;
|
||||
UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), fme);
|
||||
if (uplayer == null) return;
|
||||
|
||||
boolean samePlayer = fplayer == fme;
|
||||
boolean samePlayer = uplayer == fme;
|
||||
|
||||
// Validate
|
||||
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
|
||||
@ -43,36 +43,36 @@ public class CmdFactionsJoin extends FCommand
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.");
|
||||
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;
|
||||
}
|
||||
@ -85,24 +85,24 @@ public class CmdFactionsJoin extends FCommand
|
||||
// Inform
|
||||
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));
|
||||
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme));
|
||||
faction.msg("<i>%s joined your faction.", uplayer.describeTo(faction, true));
|
||||
fme.msg("<i>%s successfully joined %s.", uplayer.describeTo(fme, true), faction.getTag(fme));
|
||||
|
||||
// Apply
|
||||
fplayer.resetFactionData();
|
||||
fplayer.setFaction(faction);
|
||||
uplayer.resetFactionData();
|
||||
uplayer.setFaction(faction);
|
||||
|
||||
faction.setInvited(fplayer, false);
|
||||
faction.setInvited(uplayer, false);
|
||||
|
||||
// Derplog
|
||||
if (MConf.get().logFactionJoin)
|
||||
{
|
||||
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
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
@ -30,58 +30,58 @@ public class CmdFactionsKick extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Arg
|
||||
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||
if (fplayer == null) return;
|
||||
UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender));
|
||||
if (uplayer == null) return;
|
||||
|
||||
// Validate
|
||||
if (fme == fplayer)
|
||||
if (fme == uplayer)
|
||||
{
|
||||
msg("<b>You cannot kick yourself.");
|
||||
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
|
||||
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.");
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
|
||||
// FPerm
|
||||
Faction fplayerFaction = fplayer.getFaction();
|
||||
if (!FPerm.KICK.has(sender, fplayerFaction)) return;
|
||||
Faction uplayerFaction = uplayer.getFaction();
|
||||
if (!FPerm.KICK.has(sender, uplayerFaction)) return;
|
||||
|
||||
// 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();
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
// Inform
|
||||
fplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(fplayerFaction, true), fplayer.describeTo(fplayerFaction, true));
|
||||
fplayer.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(fplayer, true), fplayerFaction.describeTo(fplayer));
|
||||
if (fplayerFaction != myFaction)
|
||||
uplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(uplayerFaction, true), uplayer.describeTo(uplayerFaction, true));
|
||||
uplayer.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer));
|
||||
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)
|
||||
{
|
||||
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
|
||||
if (fplayer.getRole() == Rel.LEADER)
|
||||
if (uplayer.getRole() == Rel.LEADER)
|
||||
{
|
||||
fplayerFaction.promoteNewLeader();
|
||||
uplayerFaction.promoteNewLeader();
|
||||
}
|
||||
fplayerFaction.setInvited(fplayer, false);
|
||||
fplayer.resetFactionData();
|
||||
uplayerFaction.setInvited(uplayer, false);
|
||||
uplayer.resetFactionData();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
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.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
||||
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
||||
@ -28,15 +28,15 @@ public class CmdFactionsLeader extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
FPlayer newLeader = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (newLeader == null) return;
|
||||
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(sender), myFaction);
|
||||
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))
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
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));
|
||||
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,13 +53,13 @@ public class CmdFactionsList extends FCommand
|
||||
{
|
||||
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;
|
||||
}
|
||||
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
||||
faction.getTag(fme),
|
||||
faction.getFPlayersWhereOnline(true).size(),
|
||||
faction.getFPlayers().size(),
|
||||
faction.getUPlayersWhereOnline(true).size(),
|
||||
faction.getUPlayers().size(),
|
||||
faction.getLandCount(),
|
||||
faction.getPowerRounded(),
|
||||
faction.getPowerMaxRounded())
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
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.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.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -40,7 +40,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
||||
Faction from = this.arg(1, ARFaction.get(sender));
|
||||
if (from == null) return;
|
||||
|
||||
FPlayer to = this.arg(2, ARFPlayer.getStartAny(sender));
|
||||
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
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.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.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -37,7 +37,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
FPlayer from = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||
UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender));
|
||||
if (from == null) return;
|
||||
|
||||
Faction to = this.arg(2, ARFaction.get(sender));
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -38,7 +38,7 @@ public class CmdFactionsMoneyWithdraw extends FCommand
|
||||
Faction from = this.arg(1, ARFaction.get(sender), myFaction);
|
||||
if (from == null) return;
|
||||
|
||||
FPlayer to = fme;
|
||||
UPlayer to = fme;
|
||||
|
||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||
|
||||
|
@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -22,7 +22,7 @@ public class CmdFactionsOfficer extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (you == null) return;
|
||||
|
||||
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsPower extends FCommand
|
||||
@ -20,7 +20,7 @@ public class CmdFactionsPower extends FCommand
|
||||
@Override
|
||||
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 != fme && ! Perm.POWER_ANY.has(sender, true)) return;
|
||||
|
@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
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.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
@ -45,7 +45,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender));
|
||||
if (targetPlayer == null) return;
|
||||
|
||||
targetPlayer.setPowerBoost(targetPower);
|
||||
|
@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsPromote extends FCommand
|
||||
@ -25,7 +25,7 @@ public class CmdFactionsPromote extends FCommand
|
||||
@Override
|
||||
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.getFaction() != myFaction)
|
||||
|
@ -7,7 +7,7 @@ import java.util.Map;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
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.integration.Econ;
|
||||
import com.massivecraft.factions.FFlag;
|
||||
@ -35,10 +35,10 @@ public class CmdFactionsShow extends FCommand
|
||||
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
Collection<FPlayer> leaders = faction.getFPlayersWhereRole(Rel.LEADER);
|
||||
Collection<FPlayer> officers = faction.getFPlayersWhereRole(Rel.OFFICER);
|
||||
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER);
|
||||
Collection<FPlayer> recruits = faction.getFPlayersWhereRole(Rel.RECRUIT);
|
||||
Collection<UPlayer> leaders = faction.getUPlayersWhereRole(Rel.LEADER);
|
||||
Collection<UPlayer> officers = faction.getUPlayersWhereRole(Rel.OFFICER);
|
||||
Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
|
||||
Collection<UPlayer> recruits = faction.getUPlayersWhereRole(Rel.RECRUIT);
|
||||
|
||||
msg(Txt.titleize(faction.getTag(fme)));
|
||||
msg("<a>Description: <i>%s", faction.getDescription());
|
||||
@ -101,7 +101,7 @@ public class CmdFactionsShow extends FCommand
|
||||
List<String> memberOnlineNames = 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()))
|
||||
{
|
||||
@ -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()))
|
||||
{
|
||||
@ -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()))
|
||||
{
|
||||
@ -137,7 +137,7 @@ public class CmdFactionsShow extends FCommand
|
||||
}
|
||||
}
|
||||
|
||||
for (FPlayer follower : recruits)
|
||||
for (UPlayer follower : recruits)
|
||||
{
|
||||
if (follower.isOnline())
|
||||
{
|
||||
|
@ -3,9 +3,9 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.Perm;
|
||||
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.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.event.FactionsEventTitleChange;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.mcore.cmd.arg.ARString;
|
||||
@ -28,7 +28,7 @@ public class CmdFactionsTitle extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (you == null) return;
|
||||
|
||||
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
||||
|
@ -1,20 +1,20 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
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.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public abstract class FCommand extends MCommand
|
||||
{
|
||||
public FPlayer fme;
|
||||
public UPlayer fme;
|
||||
public Faction myFaction;
|
||||
|
||||
@Override
|
||||
public void fixSenderVars()
|
||||
{
|
||||
this.fme = FPlayer.get(this.sender);
|
||||
this.fme = UPlayer.get(this.sender);
|
||||
this.myFaction = this.fme.getFaction();
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ public abstract class FCommand extends MCommand
|
||||
// COMMONLY USED LOGIC
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean canIAdministerYou(FPlayer i, FPlayer you)
|
||||
public boolean canIAdministerYou(UPlayer i, UPlayer you)
|
||||
{
|
||||
if ( ! i.getFaction().equals(you.getFaction()))
|
||||
{
|
||||
|
@ -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)); }
|
||||
|
||||
}
|
@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
@ -47,11 +47,11 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
||||
result.setResult(this.getColl().getBestTagMatch(str));
|
||||
if (result.hasResult()) return result;
|
||||
|
||||
// FPlayer Name Exact
|
||||
FPlayer fplayer = FPlayerColls.get().get(this.getColl()).get(str);
|
||||
if (fplayer != null)
|
||||
// UPlayer Name Exact
|
||||
UPlayer uplayer = UPlayerColls.get().get(this.getColl()).get(str);
|
||||
if (uplayer != null)
|
||||
{
|
||||
result.setResult(fplayer.getFaction());
|
||||
result.setResult(uplayer.getFaction());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
22
src/com/massivecraft/factions/cmd/arg/ARUPlayer.java
Normal file
22
src/com/massivecraft/factions/cmd/arg/ARUPlayer.java
Normal 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)); }
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd.req;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
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.req.ReqAbstract;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
@ -33,8 +33,8 @@ public class ReqRoleIsAtLeast extends ReqAbstract
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MCommand command)
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(sender);
|
||||
return fplayer.getRole().isAtLeast(this.rel);
|
||||
UPlayer uplayer = UPlayer.get(sender);
|
||||
return uplayer.getRole().isAtLeast(this.rel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -350,9 +350,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
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)
|
||||
@ -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;
|
||||
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)
|
||||
@ -694,9 +694,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
}
|
||||
|
||||
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)
|
||||
@ -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.
|
||||
// TODO: Take a moment and reflect upon the consequenses eeeeeeh...
|
||||
// TODO: This one may be to slow after all :/ Thus I must maintain an index.
|
||||
|
||||
protected transient List<FPlayer> fplayers = null;
|
||||
public void reindexFPlayers()
|
||||
protected transient List<UPlayer> uplayers = null;
|
||||
public void reindexUPlayers()
|
||||
{
|
||||
this.fplayers = new ArrayList<FPlayer>();
|
||||
this.uplayers = new ArrayList<UPlayer>();
|
||||
|
||||
String factionId = this.getId();
|
||||
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;
|
||||
this.fplayers.add(fplayer);
|
||||
if (!MUtil.equals(factionId, uplayer.getFactionId())) continue;
|
||||
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();
|
||||
Iterator<FPlayer> iter = ret.iterator();
|
||||
List<UPlayer> ret = this.getUPlayers();
|
||||
Iterator<UPlayer> iter = ret.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
FPlayer fplayer = iter.next();
|
||||
if (fplayer.isOnline() != online)
|
||||
UPlayer uplayer = iter.next();
|
||||
if (uplayer.isOnline() != online)
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
@ -774,14 +770,14 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<FPlayer> getFPlayersWhereRole(Rel role)
|
||||
public List<UPlayer> getUPlayersWhereRole(Rel role)
|
||||
{
|
||||
List<FPlayer> ret = this.getFPlayers();
|
||||
Iterator<FPlayer> iter = ret.iterator();
|
||||
List<UPlayer> ret = this.getUPlayers();
|
||||
Iterator<UPlayer> iter = ret.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
FPlayer fplayer = iter.next();
|
||||
if (fplayer.getRole() != role)
|
||||
UPlayer uplayer = iter.next();
|
||||
if (uplayer.getRole() != role)
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
@ -789,16 +785,16 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
return ret;
|
||||
}
|
||||
|
||||
public FPlayer getLeader()
|
||||
public UPlayer getLeader()
|
||||
{
|
||||
List<FPlayer> ret = this.getFPlayers();
|
||||
Iterator<FPlayer> iter = ret.iterator();
|
||||
List<UPlayer> ret = this.getUPlayers();
|
||||
Iterator<UPlayer> iter = ret.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
FPlayer fplayer = iter.next();
|
||||
if (fplayer.getRole() == Rel.LEADER)
|
||||
UPlayer uplayer = iter.next();
|
||||
if (uplayer.getRole() == Rel.LEADER)
|
||||
{
|
||||
return fplayer;
|
||||
return uplayer;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -809,9 +805,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
List<CommandSender> ret = new ArrayList<CommandSender>();
|
||||
for (CommandSender player : SenderUtil.getOnlineSenders())
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
if (!MUtil.equals(fplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (fplayer.getFaction() != this) continue;
|
||||
UPlayer uplayer = UPlayer.get(player);
|
||||
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (uplayer.getFaction() != this) continue;
|
||||
ret.add(player);
|
||||
}
|
||||
return ret;
|
||||
@ -822,9 +818,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
List<Player> ret = new ArrayList<Player>();
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
if (!MUtil.equals(fplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (fplayer.getFaction() != this) continue;
|
||||
UPlayer uplayer = UPlayer.get(player);
|
||||
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (uplayer.getFaction() != this) continue;
|
||||
ret.add(player);
|
||||
}
|
||||
return ret;
|
||||
@ -836,13 +832,13 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
if ( ! this.isNormal()) 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
|
||||
List<FPlayer> replacements = this.getFPlayersWhereRole(Rel.OFFICER);
|
||||
List<UPlayer> replacements = this.getUPlayersWhereRole(Rel.OFFICER);
|
||||
if (replacements == null || replacements.isEmpty())
|
||||
{
|
||||
replacements = this.getFPlayersWhereRole(Rel.MEMBER);
|
||||
replacements = this.getUPlayersWhereRole(Rel.MEMBER);
|
||||
}
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -76,8 +76,8 @@ public class FactionColl extends Coll<Faction>
|
||||
// Clean the board
|
||||
BoardColls.get().getForUniverse(universe).clean();
|
||||
|
||||
// Clean the fplayers
|
||||
FPlayerColls.get().getForUniverse(universe).clean();
|
||||
// Clean the uplayers
|
||||
UPlayerColls.get().getForUniverse(universe).clean();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class FactionColl extends Coll<Faction>
|
||||
{
|
||||
for (Faction faction : this.getAll())
|
||||
{
|
||||
faction.reindexFPlayers();
|
||||
faction.reindexUPlayers();
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,10 +193,10 @@ public class FactionColl extends Coll<Faction>
|
||||
int landCount = faction.getLandCount();
|
||||
if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0)
|
||||
{
|
||||
List<FPlayer> players = faction.getFPlayers();
|
||||
List<UPlayer> players = faction.getUPlayers();
|
||||
int playerCount = players.size();
|
||||
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");
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class FactionColls extends Colls<FactionColl, Faction>
|
||||
// INDEX
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void reindexFPlayers()
|
||||
public void reindexUPlayers()
|
||||
{
|
||||
for (FactionColl coll : this.getColls())
|
||||
{
|
||||
|
@ -34,15 +34,15 @@ import com.massivecraft.mcore.util.TimeUnit;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
|
||||
public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipator
|
||||
public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// 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
|
||||
public FPlayer load(FPlayer that)
|
||||
public UPlayer load(UPlayer that)
|
||||
{
|
||||
this.setFactionId(that.factionId);
|
||||
this.setRole(that.role);
|
||||
@ -151,7 +151,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
// -------------------------------------------- //
|
||||
|
||||
// GSON need this noarg constructor.
|
||||
public FPlayer()
|
||||
public UPlayer()
|
||||
{
|
||||
this.resetFactionData(false);
|
||||
//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 faction = FactionColls.get().get(this).get(factionId);
|
||||
|
||||
oldFaction.fplayers.remove(this);
|
||||
faction.fplayers.add(this);
|
||||
oldFaction.uplayers.remove(this);
|
||||
faction.uplayers.add(this);
|
||||
|
||||
// Mark as changed
|
||||
this.changed();
|
||||
@ -418,7 +418,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
if (online)
|
||||
{
|
||||
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
|
||||
@ -564,9 +564,9 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
{
|
||||
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);
|
||||
|
||||
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.");
|
||||
return;
|
||||
@ -682,7 +682,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
if (membershipChangeEvent.isCancelled()) return;
|
||||
|
||||
// Am I the last one in the faction?
|
||||
if (myFaction.getFPlayers().size() == 1)
|
||||
if (myFaction.getUPlayers().size() == 1)
|
||||
{
|
||||
// Transfer all money
|
||||
if (Econ.isEnabled(this))
|
||||
@ -693,9 +693,9 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
|
||||
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)
|
||||
@ -706,12 +706,12 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
|
||||
this.resetFactionData();
|
||||
|
||||
if (myFaction.isNormal() && !permanent && myFaction.getFPlayers().isEmpty())
|
||||
if (myFaction.isNormal() && !permanent && myFaction.getUPlayers().isEmpty())
|
||||
{
|
||||
// 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();
|
||||
@ -751,7 +751,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -837,10 +837,10 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
}
|
||||
|
||||
// announce success
|
||||
Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>();
|
||||
informTheseFPlayers.add(this);
|
||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||
for (FPlayer fp : informTheseFPlayers)
|
||||
Set<UPlayer> informTheseUPlayers = new HashSet<UPlayer>();
|
||||
informTheseUPlayers.add(this);
|
||||
informTheseUPlayers.addAll(forFaction.getUPlayersWhereOnline(true));
|
||||
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));
|
||||
}
|
@ -8,15 +8,15 @@ import com.massivecraft.mcore.store.MStore;
|
||||
import com.massivecraft.mcore.store.SenderColl;
|
||||
import com.massivecraft.mcore.util.TimeUnit;
|
||||
|
||||
public class FPlayerColl extends SenderColl<FPlayer>
|
||||
public class UPlayerColl extends SenderColl<UPlayer>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// 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
|
||||
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);
|
||||
|
||||
@ -34,15 +34,15 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
|
||||
// ... update the index.
|
||||
Faction faction = entity.getFaction();
|
||||
faction.fplayers.add(entity);
|
||||
faction.uplayers.add(entity);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@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 inited ...
|
||||
@ -50,7 +50,7 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
|
||||
// ... update the index.
|
||||
Faction faction = ret.getFaction();
|
||||
faction.fplayers.remove(ret);
|
||||
faction.uplayers.remove(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -61,12 +61,12 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
|
||||
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());
|
||||
fplayer.resetFactionData(false);
|
||||
Factions.get().log("Reset faction data (invalid faction) for player "+uplayer.getName());
|
||||
uplayer.resetFactionData(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,31 +77,31 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
long now = System.currentTimeMillis();
|
||||
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 (fplayer.isOnline()) continue;
|
||||
if (uplayer.isOnline()) continue;
|
||||
if (now - lastPlayed <= toleranceMillis) continue;
|
||||
|
||||
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 (fplayer.getRole() == Rel.LEADER)
|
||||
if (uplayer.getRole() == Rel.LEADER)
|
||||
{
|
||||
Faction faction = fplayer.getFaction();
|
||||
Faction faction = uplayer.getFaction();
|
||||
if (faction != null)
|
||||
{
|
||||
fplayer.getFaction().promoteNewLeader();
|
||||
uplayer.getFaction().promoteNewLeader();
|
||||
}
|
||||
}
|
||||
|
||||
fplayer.leave(false);
|
||||
fplayer.detach();
|
||||
uplayer.leave(false);
|
||||
uplayer.detach();
|
||||
}
|
||||
}
|
||||
}
|
@ -19,23 +19,23 @@ import com.massivecraft.mcore.util.MUtil;
|
||||
import com.massivecraft.mcore.util.SenderUtil;
|
||||
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
||||
|
||||
public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
|
||||
public class UPlayerColls extends Colls<UPlayerColl, UPlayer>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static FPlayerColls i = new FPlayerColls();
|
||||
public static FPlayerColls get() { return i; }
|
||||
private static UPlayerColls i = new UPlayerColls();
|
||||
public static UPlayerColls get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE: COLLS
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public FPlayerColl createColl(String collName)
|
||||
public UPlayerColl createColl(String collName)
|
||||
{
|
||||
return new FPlayerColl(collName);
|
||||
return new UPlayerColl(collName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,11 +47,11 @@ public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
|
||||
@Override
|
||||
public String getBasename()
|
||||
{
|
||||
return Const.COLLECTION_BASENAME_PLAYER;
|
||||
return Const.COLLECTION_BASENAME_UPLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FPlayerColl get(Object o)
|
||||
public UPlayerColl get(Object o)
|
||||
{
|
||||
if (o == null) return null;
|
||||
|
||||
@ -93,17 +93,17 @@ public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
|
||||
if ( ! oldFile.exists()) return;
|
||||
|
||||
// Read the file content through GSON.
|
||||
Type type = new TypeToken<Map<String, FPlayer>>(){}.getType();
|
||||
Map<String, FPlayer> id2fplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
||||
Type type = new TypeToken<Map<String, UPlayer>>(){}.getType();
|
||||
Map<String, UPlayer> id2fplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
||||
|
||||
// The Coll
|
||||
FPlayerColl coll = this.getForUniverse(MCore.DEFAULT);
|
||||
UPlayerColl coll = this.getForUniverse(MCore.DEFAULT);
|
||||
|
||||
// Set the data
|
||||
for (Entry<String, FPlayer> entry : id2fplayer.entrySet())
|
||||
for (Entry<String, UPlayer> entry : id2fplayer.entrySet())
|
||||
{
|
||||
String playerId = entry.getKey();
|
||||
FPlayer fplayer = entry.getValue();
|
||||
UPlayer fplayer = entry.getValue();
|
||||
coll.attach(fplayer, playerId);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.event.MCoreEvent;
|
||||
|
||||
public abstract class FactionsEventAbstractSender extends MCoreEvent
|
||||
@ -13,7 +13,7 @@ public abstract class FactionsEventAbstractSender extends MCoreEvent
|
||||
|
||||
private final CommandSender sender;
|
||||
public CommandSender getSender() { return this.sender; }
|
||||
public FPlayer getFSender() { return FPlayer.get(this.sender); }
|
||||
public UPlayer getFSender() { return UPlayer.get(this.sender); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
|
||||
public class FactionsEventInvitedChange extends FactionsEventAbstractSender
|
||||
@ -20,8 +20,8 @@ public class FactionsEventInvitedChange extends FactionsEventAbstractSender
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final FPlayer fplayer;
|
||||
public FPlayer getFPlayer() { return this.fplayer; }
|
||||
private final UPlayer fplayer;
|
||||
public UPlayer getFPlayer() { return this.fplayer; }
|
||||
|
||||
private final Faction faction;
|
||||
public Faction getFaction() { return this.faction; }
|
||||
@ -34,7 +34,7 @@ public class FactionsEventInvitedChange extends FactionsEventAbstractSender
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventInvitedChange(CommandSender sender, FPlayer fplayer, Faction faction, boolean newInvited)
|
||||
public FactionsEventInvitedChange(CommandSender sender, UPlayer fplayer, Faction faction, boolean newInvited)
|
||||
{
|
||||
super(sender);
|
||||
this.fplayer = fplayer;
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
|
||||
public class FactionsEventMembershipChange extends FactionsEventAbstractSender
|
||||
@ -27,8 +27,8 @@ public class FactionsEventMembershipChange extends FactionsEventAbstractSender
|
||||
super.setCancelled(cancelled);
|
||||
}
|
||||
|
||||
private final FPlayer fplayer;
|
||||
public FPlayer getFPlayer() { return this.fplayer; }
|
||||
private final UPlayer fplayer;
|
||||
public UPlayer getFPlayer() { return this.fplayer; }
|
||||
|
||||
private final Faction newFaction;
|
||||
public Faction getNewFaction() { return this.newFaction; }
|
||||
@ -40,7 +40,7 @@ public class FactionsEventMembershipChange extends FactionsEventAbstractSender
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventMembershipChange(CommandSender sender, FPlayer fplayer, Faction newFaction, MembershipChangeReason reason)
|
||||
public FactionsEventMembershipChange(CommandSender sender, UPlayer fplayer, Faction newFaction, MembershipChangeReason reason)
|
||||
{
|
||||
super(sender);
|
||||
this.fplayer = fplayer;
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class FactionsEventPowerChange extends FactionsEventAbstractSender
|
||||
{
|
||||
@ -19,8 +19,8 @@ public class FactionsEventPowerChange extends FactionsEventAbstractSender
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final FPlayer fplayer;
|
||||
public FPlayer getFPlayer() { return this.fplayer; }
|
||||
private final UPlayer fplayer;
|
||||
public UPlayer getFPlayer() { return this.fplayer; }
|
||||
|
||||
private final PowerChangeReason reason;
|
||||
public PowerChangeReason getReason() { return this.reason; }
|
||||
@ -33,7 +33,7 @@ public class FactionsEventPowerChange extends FactionsEventAbstractSender
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventPowerChange(CommandSender sender, FPlayer fplayer, PowerChangeReason reason, double newPower)
|
||||
public FactionsEventPowerChange(CommandSender sender, UPlayer fplayer, PowerChangeReason reason, double newPower)
|
||||
{
|
||||
super(sender);
|
||||
this.fplayer = fplayer;
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
|
||||
public class FactionsEventTitleChange extends FactionsEventAbstractSender
|
||||
{
|
||||
@ -19,8 +19,8 @@ public class FactionsEventTitleChange extends FactionsEventAbstractSender
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final FPlayer fplayer;
|
||||
public FPlayer getFPlayer() { return this.fplayer; }
|
||||
private final UPlayer fplayer;
|
||||
public UPlayer getFPlayer() { return this.fplayer; }
|
||||
|
||||
private String newTitle;
|
||||
public String getNewTitle() { return this.newTitle; }
|
||||
@ -30,7 +30,7 @@ public class FactionsEventTitleChange extends FactionsEventAbstractSender
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventTitleChange(CommandSender sender, FPlayer fplayer, String newTitle)
|
||||
public FactionsEventTitleChange(CommandSender sender, UPlayer fplayer, String newTitle)
|
||||
{
|
||||
super(sender);
|
||||
this.fplayer = fplayer;
|
||||
|
@ -8,7 +8,7 @@ import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.EconomyParticipator;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
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.util.RelationUtil;
|
||||
import com.massivecraft.mcore.money.Money;
|
||||
@ -30,7 +30,7 @@ public class Econ
|
||||
// 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 (cost == 0D) return true;
|
||||
@ -64,7 +64,7 @@ public class Econ
|
||||
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))
|
||||
{
|
||||
@ -84,7 +84,7 @@ public class Econ
|
||||
if (fI == null) return true;
|
||||
|
||||
// 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.
|
||||
if (i == you) return true;
|
||||
@ -167,21 +167,21 @@ public class Econ
|
||||
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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
fplayers.addAll(((Faction)ep).getFPlayers());
|
||||
fplayers.addAll(((Faction)ep).getUPlayers());
|
||||
}
|
||||
|
||||
return fplayers;
|
||||
@ -189,35 +189,35 @@ public class Econ
|
||||
|
||||
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(from));
|
||||
recipients.addAll(getFplayers(to));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import com.griefcraft.lwc.LWC;
|
||||
import com.griefcraft.lwc.LWCPlugin;
|
||||
import com.griefcraft.model.Protection;
|
||||
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.mcore.ps.PS;
|
||||
|
||||
@ -48,8 +48,8 @@ public class LWCFeatures
|
||||
{
|
||||
for (Protection protection : getProtectionsInChunk(chunkPs))
|
||||
{
|
||||
FPlayer owner = FPlayer.get(protection.getOwner());
|
||||
if (faction.getFPlayers().contains(owner)) continue;
|
||||
UPlayer owner = UPlayer.get(protection.getOwner());
|
||||
if (faction.getUPlayers().contains(owner)) continue;
|
||||
protection.remove();
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
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.util.HealthBarUtil;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
@ -72,7 +72,7 @@ public class SpoutFeatures
|
||||
|
||||
for (Player player : fromPlayers)
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
||||
Faction faction = fplayer.getFaction();
|
||||
|
||||
@ -137,13 +137,13 @@ public class SpoutFeatures
|
||||
|
||||
for (Player player : fromPlayers)
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
||||
Faction faction = fplayer.getFaction();
|
||||
|
||||
for (Player playerTo : toPlayers)
|
||||
{
|
||||
FPlayer fplayerTo = FPlayer.get(playerTo);
|
||||
UPlayer fplayerTo = UPlayer.get(playerTo);
|
||||
SpoutPlayer splayerTo = SpoutManager.getPlayer(playerTo);
|
||||
Faction factionTo = fplayerTo.getFaction();
|
||||
|
||||
@ -178,7 +178,7 @@ public class SpoutFeatures
|
||||
}, 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;
|
||||
|
||||
@ -220,9 +220,9 @@ public class SpoutFeatures
|
||||
{
|
||||
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();
|
||||
if (player != null)
|
||||
{
|
||||
@ -252,7 +252,7 @@ public class SpoutFeatures
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
if (chunk == null)
|
||||
{
|
||||
mainListener.updateTerritoryDisplay(fplayer, false);
|
||||
@ -265,7 +265,7 @@ public class SpoutFeatures
|
||||
}
|
||||
|
||||
// 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;
|
||||
return mainListener.updateTerritoryDisplay(player, true);
|
||||
@ -280,7 +280,7 @@ public class SpoutFeatures
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
if (chunk == null || fplayer.getCurrentChunk().equals(chunk))
|
||||
{
|
||||
mainListener.updateAccessInfo(fplayer);
|
||||
@ -289,13 +289,13 @@ public class SpoutFeatures
|
||||
}
|
||||
|
||||
// update owner list for specified player
|
||||
public static boolean updateAccessInfo(FPlayer player)
|
||||
public static boolean updateAccessInfo(UPlayer player)
|
||||
{
|
||||
if ( ! isEnabled()) return false;
|
||||
return mainListener.updateAccessInfo(player);
|
||||
}
|
||||
|
||||
public static void playerDisconnect(FPlayer player)
|
||||
public static void playerDisconnect(UPlayer player)
|
||||
{
|
||||
if ( ! isEnabled()) return;
|
||||
mainListener.removeTerritoryLabels(player.getName());
|
||||
|
@ -12,7 +12,7 @@ import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.TerritoryAccess;
|
||||
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.mcore.ps.PS;
|
||||
|
||||
@ -28,7 +28,7 @@ public class SpoutMainListener implements Listener
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
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(null, me);
|
||||
@ -46,7 +46,7 @@ public class SpoutMainListener implements Listener
|
||||
// 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();
|
||||
if (p == null)
|
||||
@ -61,7 +61,7 @@ public class SpoutMainListener implements Listener
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean updateAccessInfo(FPlayer player)
|
||||
public boolean updateAccessInfo(UPlayer player)
|
||||
{
|
||||
Player p = player.getPlayer();
|
||||
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();
|
||||
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 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;
|
||||
|
||||
|
@ -23,7 +23,7 @@ import com.dthielke.herochat.MessageFormatSupplier;
|
||||
import com.dthielke.herochat.MessageNotFoundException;
|
||||
import com.dthielke.herochat.util.Messaging;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
|
||||
public abstract class FactionsChannelAbstract implements Channel
|
||||
@ -211,13 +211,13 @@ public abstract class FactionsChannelAbstract implements Channel
|
||||
{
|
||||
Set<Player> ret = new HashSet<Player>();
|
||||
|
||||
FPlayer fpsender = FPlayer.get(sender);
|
||||
UPlayer fpsender = UPlayer.get(sender);
|
||||
Faction faction = fpsender.getFaction();
|
||||
String universe = fpsender.getUniverse();
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
FPlayer frecipient = FPlayer.get(player);
|
||||
UPlayer frecipient = UPlayer.get(player);
|
||||
if (!frecipient.getUniverse().equals(universe)) continue;
|
||||
if (!this.getTargetRelations().contains(faction.getRelationTo(frecipient))) continue;
|
||||
ret.add(player);
|
||||
|
@ -10,7 +10,7 @@ import com.dthielke.herochat.ChannelChatEvent;
|
||||
import com.dthielke.herochat.Herochat;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.chat.ChatFormatter;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ public class HerochatEngine implements Listener
|
||||
String format = event.getFormat();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.chat.ChatFormatter;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
|
||||
public class FactionsListenerChat implements Listener
|
||||
@ -96,7 +96,7 @@ public class FactionsListenerChat implements Listener
|
||||
// ... then parse tags a.k.a. "format the format".
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Rel;
|
||||
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.MConf;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
@ -89,7 +89,7 @@ public class FactionsListenerMain implements Listener
|
||||
{
|
||||
// If a player dies ...
|
||||
Player player = event.getEntity();
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
|
||||
// ... and powerloss can happen here ...
|
||||
Faction faction = BoardColls.get().getFactionAt(PS.valueOf(player));
|
||||
@ -169,7 +169,7 @@ public class FactionsListenerMain implements Listener
|
||||
Entity edefender = event.getEntity();
|
||||
if (!(edefender instanceof Player)) return true;
|
||||
Player defender = (Player)edefender;
|
||||
FPlayer fdefender = FPlayer.get(edefender);
|
||||
UPlayer fdefender = UPlayer.get(edefender);
|
||||
|
||||
// ... and the attacker is someone else ...
|
||||
Entity eattacker = event.getDamager();
|
||||
@ -190,7 +190,7 @@ public class FactionsListenerMain implements Listener
|
||||
{
|
||||
if (notify)
|
||||
{
|
||||
FPlayer attacker = FPlayer.get(eattacker);
|
||||
UPlayer attacker = UPlayer.get(eattacker);
|
||||
attacker.msg("<i>PVP is disabled in %s.", defenderPsFaction.describeTo(attacker));
|
||||
}
|
||||
return false;
|
||||
@ -201,7 +201,7 @@ public class FactionsListenerMain implements Listener
|
||||
// ... and if the attacker is a player ...
|
||||
if (!(eattacker instanceof Player)) return true;
|
||||
Player attacker = (Player)eattacker;
|
||||
FPlayer fattacker = FPlayer.get(attacker);
|
||||
UPlayer fattacker = UPlayer.get(attacker);
|
||||
|
||||
// ... does this player bypass all protection? ...
|
||||
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 ...
|
||||
Player player = event.getPlayer();
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
|
||||
// ... and if the if player was banned (not just kicked) ...
|
||||
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 ...
|
||||
Player player = event.getPlayer();
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
|
||||
// ... and the player does not have adminmode ...
|
||||
if (fplayer.isUsingAdminMode()) return;
|
||||
@ -508,7 +508,7 @@ public class FactionsListenerMain implements Listener
|
||||
String name = player.getName();
|
||||
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
||||
|
||||
FPlayer me = FPlayer.get(player);
|
||||
UPlayer me = UPlayer.get(player);
|
||||
if (me.isUsingAdminMode()) return true;
|
||||
|
||||
Faction factionHere = BoardColls.get().getFactionAt(ps);
|
||||
|
@ -17,7 +17,7 @@ import com.massivecraft.factions.Const;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.TerritoryAccess;
|
||||
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.integration.SpoutFeatures;
|
||||
import com.massivecraft.mcore.event.MCorePlayerLeaveEvent;
|
||||
@ -32,7 +32,7 @@ public class TodoFactionsPlayerListener implements Listener
|
||||
{
|
||||
// If a player is joining the server ...
|
||||
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 ...
|
||||
fplayer.recalculatePower(false);
|
||||
@ -51,7 +51,7 @@ public class TodoFactionsPlayerListener implements Listener
|
||||
public void onPlayerLeave(MCorePlayerLeaveEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
|
||||
// Recalculate the power before the player leaves.
|
||||
// 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 ...
|
||||
Player player = event.getPlayer();
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
|
||||
PS chunkFrom = fplayer.getCurrentChunk();
|
||||
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
|
||||
@ -145,7 +145,7 @@ public class TodoFactionsPlayerListener implements Listener
|
||||
String name = player.getName();
|
||||
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
||||
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
UPlayer fplayer = UPlayer.get(player);
|
||||
if (fplayer.isUsingAdminMode()) return true;
|
||||
|
||||
return FPerm.BUILD.has(fplayer, ps, !justCheck);
|
||||
@ -156,7 +156,7 @@ public class TodoFactionsPlayerListener implements Listener
|
||||
String name = player.getName();
|
||||
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
||||
|
||||
FPlayer me = FPlayer.get(player);
|
||||
UPlayer me = UPlayer.get(player);
|
||||
if (me.isUsingAdminMode()) return true;
|
||||
|
||||
PS ps = PS.valueOf(block);
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.massivecraft.factions.task;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.entity.FPlayerColl;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayerColl;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.mcore.ModuloRepeatTask;
|
||||
import com.massivecraft.mcore.util.TimeUnit;
|
||||
|
||||
@ -34,7 +34,7 @@ public class AutoLeaveTask extends ModuloRepeatTask
|
||||
@Override
|
||||
public void invoke()
|
||||
{
|
||||
for (FPlayerColl coll : FPlayerColls.get().getColls())
|
||||
for (UPlayerColl coll : UPlayerColls.get().getColls())
|
||||
{
|
||||
coll.autoLeaveOnInactivityRoutine();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.ChatColor;
|
||||
import com.massivecraft.factions.FFlag;
|
||||
import com.massivecraft.factions.Rel;
|
||||
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.MConf;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
@ -29,7 +29,7 @@ public class RelationUtil
|
||||
|
||||
if (that instanceof Faction)
|
||||
{
|
||||
if (me instanceof FPlayer && myFaction == thatFaction)
|
||||
if (me instanceof UPlayer && myFaction == thatFaction)
|
||||
{
|
||||
ret = "your faction";
|
||||
}
|
||||
@ -38,9 +38,9 @@ public class RelationUtil
|
||||
ret = thatFaction.getTag();
|
||||
}
|
||||
}
|
||||
else if (that instanceof FPlayer)
|
||||
else if (that instanceof UPlayer)
|
||||
{
|
||||
FPlayer fplayerthat = (FPlayer) that;
|
||||
UPlayer fplayerthat = (UPlayer) that;
|
||||
if (that == me)
|
||||
{
|
||||
ret = "you";
|
||||
@ -98,9 +98,9 @@ public class RelationUtil
|
||||
ret = Rel.MEMBER;
|
||||
// Do officer and leader check
|
||||
//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);
|
||||
}
|
||||
}
|
||||
@ -119,9 +119,9 @@ public class RelationUtil
|
||||
return (Faction) rp;
|
||||
}
|
||||
|
||||
if (rp instanceof FPlayer)
|
||||
if (rp instanceof UPlayer)
|
||||
{
|
||||
return ((FPlayer) rp).getFaction();
|
||||
return ((UPlayer) rp).getFaction();
|
||||
}
|
||||
|
||||
// ERROR
|
||||
|
Loading…
Reference in New Issue
Block a user