Loads of UPlayer --> MPlayer renames

This commit is contained in:
Olof Larsson 2014-09-17 13:29:58 +02:00
parent 529ae45ede
commit 0b60a5ad1a
43 changed files with 303 additions and 305 deletions

View File

@ -125,10 +125,10 @@ public enum FPerm
// HAS?
// -------------------------------------------- //
public String createDeniedMessage(MPlayer uplayer, Faction hostFaction)
public String createDeniedMessage(MPlayer mplayer, Faction hostFaction)
{
String ret = Txt.parse("%s<b> does not allow you to %s<b>.", hostFaction.describeTo(uplayer, true), this.getDescription());
if (Perm.ADMIN.has(uplayer.getPlayer()))
String ret = Txt.parse("%s<b> does not allow you to %s<b>.", hostFaction.describeTo(mplayer, true), this.getDescription());
if (Perm.ADMIN.has(mplayer.getPlayer()))
{
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false));
}
@ -141,39 +141,39 @@ public enum FPerm
return hostFaction.getPermittedRelations(this).contains(rel);
}
public boolean has(MPlayer uplayer, Faction hostFaction, boolean verboose)
public boolean has(MPlayer mplayer, Faction hostFaction, boolean verboose)
{
if (uplayer.isUsingAdminMode()) return true;
if (mplayer.isUsingAdminMode()) return true;
Rel rel = uplayer.getRelationTo(hostFaction);
Rel rel = mplayer.getRelationTo(hostFaction);
if (hostFaction.getPermittedRelations(this).contains(rel)) return true;
if (verboose) uplayer.sendMessage(this.createDeniedMessage(uplayer, hostFaction));
if (verboose) mplayer.sendMessage(this.createDeniedMessage(mplayer, hostFaction));
return false;
}
public boolean has(MPlayer uplayer, PS ps, boolean verboose)
public boolean has(MPlayer mplayer, PS ps, boolean verboose)
{
if (uplayer.isUsingAdminMode()) return true;
if (mplayer.isUsingAdminMode()) return true;
TerritoryAccess ta = BoardColl.get().getTerritoryAccessAt(ps);
Faction hostFaction = ta.getHostFaction(ps);
Faction hostFaction = ta.getHostFaction();
if (this.isTerritoryPerm())
{
Boolean hasTerritoryAccess = ta.hasTerritoryAccess(uplayer);
Boolean hasTerritoryAccess = ta.hasTerritoryAccess(mplayer);
if (hasTerritoryAccess != null)
{
if (verboose && !hasTerritoryAccess)
{
uplayer.sendMessage(this.createDeniedMessage(uplayer, hostFaction));
mplayer.sendMessage(this.createDeniedMessage(mplayer, hostFaction));
}
return hasTerritoryAccess;
}
}
return this.has(uplayer, hostFaction, verboose);
return this.has(mplayer, hostFaction, verboose);
}
// -------------------------------------------- //

View File

@ -35,8 +35,8 @@ public class FactionEqualsPredictate implements Predictate<CommandSender>, Seria
@Override
public boolean apply(CommandSender sender)
{
MPlayer uplayer = MPlayer.get(sender);
return this.factionId.equals(uplayer.getFactionId());
MPlayer mplayer = MPlayer.get(sender);
return this.factionId.equals(mplayer.getFactionId());
}
}

View File

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

View File

@ -117,7 +117,7 @@ public class Factions extends MassivePlugin
MPlayerColl.get().init();
FactionColl.get().init();
BoardColl.get().init();
FactionColl.get().reindexUPlayers();
FactionColl.get().reindexMPlayers();
this.databaseInitialized = true;
// Commands

View File

@ -94,12 +94,12 @@ public class TerritoryAccess
// FIELDS: UNIVERSED
// -------------------------------------------- //
public Faction getHostFaction(Object universe)
public Faction getHostFaction()
{
return FactionColl.get().get(this.getHostFactionId());
}
public LinkedHashSet<MPlayer> getGrantedUPlayers(Object universe)
public LinkedHashSet<MPlayer> getGrantedMPlayers()
{
LinkedHashSet<MPlayer> ret = new LinkedHashSet<MPlayer>();
for (String playerId : this.getPlayerIds())
@ -109,7 +109,7 @@ public class TerritoryAccess
return ret;
}
public LinkedHashSet<Faction> getGrantedFactions(Object universe)
public LinkedHashSet<Faction> getGrantedFactions()
{
LinkedHashSet<Faction> ret = new LinkedHashSet<Faction>();
for (String factionId : this.getFactionIds())
@ -200,11 +200,11 @@ public class TerritoryAccess
// true means elevated access
// false means decreased access
// null means standard access
public Boolean hasTerritoryAccess(MPlayer uplayer)
public Boolean hasTerritoryAccess(MPlayer mplayer)
{
if (this.getPlayerIds().contains(uplayer.getId())) return true;
if (this.getPlayerIds().contains(mplayer.getId())) return true;
String factionId = uplayer.getFactionId();
String factionId = mplayer.getFactionId();
if (this.getFactionIds().contains(factionId)) return true;
if (this.getHostFactionId().equals(factionId) && !this.isHostFactionAllowed()) return false;

View File

@ -43,7 +43,7 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
{
chunk = PS.valueOf(me).getChunk(true);
ta = BoardColl.get().getTerritoryAccessAt(chunk);
hostFaction = ta.getHostFaction(usender);
hostFaction = ta.getHostFaction();
this.innerPerform();
}
@ -55,8 +55,8 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
sendMessage(Txt.titleize("Access at " + chunk.toString(PSFormatHumanSpace.get())));
msg("<k>Host Faction: %s", hostFaction.describeTo(usender, true));
msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedUPlayers(usender), usender));
msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(usender), usender));
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), usender));
msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(), usender));
}
public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
@ -35,17 +35,17 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
public void innerPerform()
{
// Args
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
if (uplayer == null) return;
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
if (mplayer == null) return;
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(mplayer.getId()));
if (newValue == null) return;
// FPerm
if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
// Apply
ta = ta.withPlayerId(uplayer.getId(), newValue);
ta = ta.withPlayerId(mplayer.getId(), newValue);
BoardColl.get().setTerritoryAccessAt(chunk, ta);
// Inform

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -35,7 +35,7 @@ public class CmdFactionsDemote extends FCommand
@Override
public void perform()
{
MPlayer you = this.arg(0, ARUPlayer.getAny());
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
if (you.getFaction() != usenderFaction)

View File

@ -50,7 +50,7 @@ public class CmdFactionsDescription extends FCommand
usenderFaction.setDescription(newDescription);
// Inform
for (MPlayer follower : usenderFaction.getUPlayers())
for (MPlayer follower : usenderFaction.getMPlayers())
{
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
}

View File

@ -64,23 +64,23 @@ public class CmdFactionsDisband extends FCommand
// Merged Apply and Inform
// Run event for each player in the faction
for (MPlayer uplayer : faction.getUPlayers())
for (MPlayer mplayer : faction.getMPlayers())
{
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, uplayer, FactionColl.get().getNone(), MembershipChangeReason.DISBAND);
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.DISBAND);
membershipChangeEvent.run();
}
// Inform all players
for (MPlayer uplayer : MPlayerColl.get().getAllOnline())
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
{
String who = usender.describeTo(uplayer);
if (uplayer.getFaction() == faction)
String who = usender.describeTo(mplayer);
if (mplayer.getFaction() == faction)
{
uplayer.msg("<h>%s<i> disbanded your faction.", who);
mplayer.msg("<h>%s<i> disbanded your faction.", who);
}
else
{
uplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getName(uplayer));
mplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getName(mplayer));
}
}

View File

@ -145,7 +145,7 @@ public class CmdFactionsFaction extends FCommand
List<String> followerNamesOnline = new ArrayList<String>();
List<String> followerNamesOffline = new ArrayList<String>();
List<MPlayer> followers = faction.getUPlayers();
List<MPlayer> followers = faction.getMPlayers();
Collections.sort(followers, PlayerRoleComparator.get());
for (MPlayer follower : followers)

View File

@ -3,7 +3,7 @@ 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.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsInvitedChange;
@ -40,16 +40,16 @@ public class CmdFactionsInvite extends FCommand
public void perform()
{
// Args
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
if (uplayer == null) return;
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
if (mplayer == null) return;
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(mplayer));
if (newInvited == null) return;
// Allready member?
if (uplayer.getFaction() == usenderFaction)
if (mplayer.getFaction() == usenderFaction)
{
msg("%s<i> is already a member of %s", uplayer.getName(), usenderFaction.getName());
msg("%s<i> is already a member of %s", mplayer.getName(), usenderFaction.getName());
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
return;
}
@ -58,24 +58,24 @@ public class CmdFactionsInvite extends FCommand
if ( ! FPerm.INVITE.has(usender, usenderFaction, true)) return;
// Event
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, uplayer, usenderFaction, newInvited);
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, usenderFaction, newInvited);
event.run();
if (event.isCancelled()) return;
newInvited = event.isNewInvited();
// Apply
usenderFaction.setInvited(uplayer, newInvited);
usenderFaction.setInvited(mplayer, newInvited);
// Inform
if (newInvited)
{
uplayer.msg("%s<i> invited you to %s", usender.describeTo(uplayer, true), usenderFaction.describeTo(uplayer));
usenderFaction.msg("%s<i> invited %s<i> to your faction.", usender.describeTo(usenderFaction, true), uplayer.describeTo(usenderFaction));
mplayer.msg("%s<i> invited you to %s", usender.describeTo(mplayer, true), usenderFaction.describeTo(mplayer));
usenderFaction.msg("%s<i> invited %s<i> to your faction.", usender.describeTo(usenderFaction, true), mplayer.describeTo(usenderFaction));
}
else
{
uplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", usender.describeTo(uplayer), usenderFaction.describeTo(uplayer));
usenderFaction.msg("%s<i> revoked %s's<i> invitation.", usender.describeTo(usenderFaction), uplayer.describeTo(usenderFaction));
mplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", usender.describeTo(mplayer), usenderFaction.describeTo(mplayer));
usenderFaction.msg("%s<i> revoked %s's<i> invitation.", usender.describeTo(usenderFaction), mplayer.describeTo(usenderFaction));
}
}

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer;
@ -42,11 +42,11 @@ public class CmdFactionsJoin extends FCommand
Faction faction = this.arg(0, ARFaction.get());
if (faction == null) return;
MPlayer uplayer = this.arg(1, ARUPlayer.getAny(), usender);
if (uplayer == null) return;
Faction uplayerFaction = uplayer.getFaction();
MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), usender);
if (mplayer == null) return;
Faction mplayerFaction = mplayer.getFaction();
boolean samePlayer = uplayer == usender;
boolean samePlayer = mplayer == usender;
// Validate
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
@ -55,36 +55,36 @@ public class CmdFactionsJoin extends FCommand
return;
}
if (faction == uplayerFaction)
if (faction == mplayerFaction)
{
msg("<i>%s <i>%s already a member of %s<i>.", uplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
msg("<i>%s <i>%s already a member of %s<i>.", mplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
return;
}
if (MConf.get().factionMemberLimit > 0 && faction.getUPlayers().size() >= MConf.get().factionMemberLimit)
if (MConf.get().factionMemberLimit > 0 && faction.getMPlayers().size() >= MConf.get().factionMemberLimit)
{
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), MConf.get().factionMemberLimit, uplayer.describeTo(usender, false));
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), MConf.get().factionMemberLimit, mplayer.describeTo(usender, false));
return;
}
if (uplayerFaction.isNormal())
if (mplayerFaction.isNormal())
{
msg("<b>%s must leave %s current faction first.", uplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
msg("<b>%s must leave %s current faction first.", mplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
return;
}
if (!MConf.get().canLeaveWithNegativePower && uplayer.getPower() < 0)
if (!MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0)
{
msg("<b>%s cannot join a faction with a negative power level.", uplayer.describeTo(usender, true));
msg("<b>%s cannot join a faction with a negative power level.", mplayer.describeTo(usender, true));
return;
}
if( ! (faction.isOpen() || faction.isInvited(uplayer) || usender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
if( ! (faction.isOpen() || faction.isInvited(mplayer) || usender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
{
msg("<i>This faction requires invitation.");
if (samePlayer)
{
faction.msg("%s<i> tried to join your faction.", uplayer.describeTo(faction, true));
faction.msg("%s<i> tried to join your faction.", mplayer.describeTo(faction, true));
}
return;
}
@ -97,27 +97,27 @@ public class CmdFactionsJoin extends FCommand
// Inform
if (!samePlayer)
{
uplayer.msg("<i>%s <i>moved you into the faction %s<i>.", usender.describeTo(uplayer, true), faction.getName(uplayer));
mplayer.msg("<i>%s <i>moved you into the faction %s<i>.", usender.describeTo(mplayer, true), faction.getName(mplayer));
}
faction.msg("<i>%s <i>joined <lime>your faction<i>.", uplayer.describeTo(faction, true));
usender.msg("<i>%s <i>successfully joined %s<i>.", uplayer.describeTo(usender, true), faction.getName(usender));
faction.msg("<i>%s <i>joined <lime>your faction<i>.", mplayer.describeTo(faction, true));
usender.msg("<i>%s <i>successfully joined %s<i>.", mplayer.describeTo(usender, true), faction.getName(usender));
// Apply
uplayer.resetFactionData();
uplayer.setFaction(faction);
mplayer.resetFactionData();
mplayer.setFaction(faction);
faction.setInvited(uplayer, false);
faction.setInvited(mplayer, false);
// Derplog
if (MConf.get().logFactionJoin)
{
if (samePlayer)
{
Factions.get().log(Txt.parse("%s joined the faction %s.", uplayer.getName(), faction.getName()));
Factions.get().log(Txt.parse("%s joined the faction %s.", mplayer.getName(), faction.getName()));
}
else
{
Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", usender.getName(), uplayer.getName(), faction.getName()));
Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", usender.getName(), mplayer.getName(), faction.getName()));
}
}
}

View File

@ -4,7 +4,7 @@ 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.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
@ -40,58 +40,58 @@ public class CmdFactionsKick extends FCommand
public void perform()
{
// Arg
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
if (uplayer == null) return;
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
if (mplayer == null) return;
// Validate
if (usender == uplayer)
if (usender == mplayer)
{
msg("<b>You cannot kick yourself.");
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
return;
}
if (uplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
{
msg("<b>The leader can not be kicked.");
return;
}
if ( ! MConf.get().canLeaveWithNegativePower && uplayer.getPower() < 0)
if ( ! MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0)
{
msg("<b>You cannot kick that member until their power is positive.");
return;
}
// FPerm
Faction uplayerFaction = uplayer.getFaction();
if (!FPerm.KICK.has(usender, uplayerFaction, true)) return;
Faction mplayerFaction = mplayer.getFaction();
if (!FPerm.KICK.has(usender, mplayerFaction, true)) return;
// Event
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, uplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
event.run();
if (event.isCancelled()) return;
// Inform
uplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", usender.describeTo(uplayerFaction, true), uplayer.describeTo(uplayerFaction, true));
uplayer.msg("%s<i> kicked you from %s<i>! :O", usender.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer));
if (uplayerFaction != usenderFaction)
mplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", usender.describeTo(mplayerFaction, true), mplayer.describeTo(mplayerFaction, true));
mplayer.msg("%s<i> kicked you from %s<i>! :O", usender.describeTo(mplayer, true), mplayerFaction.describeTo(mplayer));
if (mplayerFaction != usenderFaction)
{
usender.msg("<i>You kicked %s<i> from the faction %s<i>!", uplayer.describeTo(usender), uplayerFaction.describeTo(usender));
usender.msg("<i>You kicked %s<i> from the faction %s<i>!", mplayer.describeTo(usender), mplayerFaction.describeTo(usender));
}
if (MConf.get().logFactionKick)
{
Factions.get().log(usender.getDisplayName(IdUtil.getConsole()) + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getName());
Factions.get().log(usender.getDisplayName(IdUtil.getConsole()) + " kicked " + mplayer.getName() + " from the faction " + mplayerFaction.getName());
}
// Apply
if (uplayer.getRole() == Rel.LEADER)
if (mplayer.getRole() == Rel.LEADER)
{
uplayerFaction.promoteNewLeader();
mplayerFaction.promoteNewLeader();
}
uplayerFaction.setInvited(uplayer, false);
uplayer.resetFactionData();
mplayerFaction.setInvited(mplayer, false);
mplayer.resetFactionData();
}
}

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
@ -38,7 +38,7 @@ public class CmdFactionsLeader extends FCommand
@Override
public void perform()
{
MPlayer newLeader = this.arg(0, ARUPlayer.getAny());
MPlayer newLeader = this.arg(0, ARMPlayer.getAny());
if (newLeader == null) return;
Faction targetFaction = this.arg(1, ARFaction.get(), usenderFaction);
@ -46,7 +46,7 @@ public class CmdFactionsLeader extends FCommand
MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
// We now have uplayer and the target faction
// We now have mplayer and the target faction
if (this.senderIsConsole || usender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
{
// Do whatever you wish
@ -100,9 +100,9 @@ public class CmdFactionsLeader extends FCommand
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(usender, true));
// Inform all players
for (MPlayer uplayer : MPlayerColl.get().getAllOnline())
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
{
uplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, uplayer, true), newLeader.describeTo(uplayer), targetFaction.describeTo(uplayer));
mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, mplayer, true), newLeader.describeTo(mplayer), targetFaction.describeTo(mplayer));
}
}

View File

@ -63,13 +63,13 @@ public class CmdFactionsList extends FCommand
{
if (faction.isNone())
{
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColl.get().getNone().getUPlayersWhereOnline(true).size()));
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColl.get().getNone().getMPlayersWhereOnline(true).size()));
continue;
}
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
faction.getName(usender),
faction.getUPlayersWhereOnline(true).size(),
faction.getUPlayers().size(),
faction.getMPlayersWhereOnline(true).size(),
faction.getMPlayers().size(),
faction.getLandCount(),
faction.getPowerRounded(),
faction.getPowerMaxRounded())

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.MPlayer;
@ -51,7 +51,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
Faction from = this.arg(1, ARFaction.get());
if (from == null) return;
MPlayer to = this.arg(2, ARUPlayer.getAny());
MPlayer to = this.arg(2, ARMPlayer.getAny());
if (to == null) return;
boolean success = Econ.transferMoney(usender, from, to, amount);

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.MPlayer;
@ -48,7 +48,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
MPlayer from = this.arg(1, ARUPlayer.getAny());
MPlayer from = this.arg(1, ARMPlayer.getAny());
if (from == null) return;
Faction to = this.arg(2, ARFaction.get());

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -32,7 +32,7 @@ public class CmdFactionsOfficer extends FCommand
@Override
public void perform()
{
MPlayer you = this.arg(0, ARUPlayer.getAny());
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
boolean permAny = Perm.OFFICER_ANY.has(sender, false);

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
import java.util.LinkedHashMap;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Progressbar;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -37,24 +37,24 @@ public class CmdFactionsPlayer extends FCommand
public void perform()
{
// Args
MPlayer uplayer = this.arg(0, ARUPlayer.getAny(), usender);
if (uplayer == null) return;
MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), usender);
if (mplayer == null) return;
// INFO: Title
msg(Txt.titleize(Txt.upperCaseFirst(uplayer.getUniverse()) + " Player " + uplayer.describeTo(usender)));
msg(Txt.titleize(Txt.upperCaseFirst(mplayer.getUniverse()) + " Player " + mplayer.describeTo(usender)));
// INFO: Power (as progress bar)
double progressbarQuota = uplayer.getPower() / uplayer.getPowerMax();
int progressbarWidth = (int) Math.round(uplayer.getPowerMax() / uplayer.getPowerMaxUniversal() * 100);
double progressbarQuota = mplayer.getPower() / mplayer.getPowerMax();
int progressbarWidth = (int) Math.round(mplayer.getPowerMax() / mplayer.getPowerMaxUniversal() * 100);
msg("<k>Power: <v>%s", Progressbar.HEALTHBAR_CLASSIC.withQuota(progressbarQuota).withWidth(progressbarWidth).render());
// INFO: Power (as digits)
msg("<k>Power: <v>%.2f / %.2f", uplayer.getPower(), uplayer.getPowerMax());
msg("<k>Power: <v>%.2f / %.2f", mplayer.getPower(), mplayer.getPowerMax());
// INFO: Power Boost
if (uplayer.hasPowerBoost())
if (mplayer.hasPowerBoost())
{
double powerBoost = uplayer.getPowerBoost();
double powerBoost = mplayer.getPowerBoost();
String powerBoostType = (powerBoost > 0 ? "bonus" : "penalty");
msg("<k>Power Boost: <v>%f <i>(a manually granted %s)", powerBoost, powerBoostType);
}
@ -63,20 +63,20 @@ public class CmdFactionsPlayer extends FCommand
// If the player is not at maximum we wan't to display how much time left.
String stringTillMax = "";
double powerTillMax = uplayer.getPowerMax() - uplayer.getPower();
double powerTillMax = mplayer.getPowerMax() - mplayer.getPower();
if (powerTillMax > 0)
{
long millisTillMax = (long) (powerTillMax * TimeUnit.MILLIS_PER_HOUR / uplayer.getPowerPerHour());
long millisTillMax = (long) (powerTillMax * TimeUnit.MILLIS_PER_HOUR / mplayer.getPowerPerHour());
LinkedHashMap<TimeUnit, Long> unitcountsTillMax = TimeDiffUtil.unitcounts(millisTillMax, TimeUnit.getAllButMillis());
unitcountsTillMax = TimeDiffUtil.limit(unitcountsTillMax, 2);
String unitcountsTillMaxFormated = TimeDiffUtil.formatedVerboose(unitcountsTillMax, "<i>");
stringTillMax = Txt.parse(" <i>(%s <i>left till max)", unitcountsTillMaxFormated);
}
msg("<k>Power per Hour: <v>%.2f%s", uplayer.getPowerPerHour(), stringTillMax);
msg("<k>Power per Hour: <v>%.2f%s", mplayer.getPowerPerHour(), stringTillMax);
// INFO: Power per Death
msg("<k>Power per Death: <v>%.2f", uplayer.getPowerPerDeath());
msg("<k>Power per Death: <v>%.2f", mplayer.getPowerPerDeath());
}

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
@ -56,7 +56,7 @@ public class CmdFactionsPowerBoost extends FCommand
if (doPlayer)
{
MPlayer targetPlayer = this.arg(1, ARUPlayer.getAny());
MPlayer targetPlayer = this.arg(1, ARMPlayer.getAny());
if (targetPlayer == null) return;
targetPlayer.setPowerBoost(targetPower);

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -35,7 +35,7 @@ public class CmdFactionsPromote extends FCommand
@Override
public void perform()
{
MPlayer you = this.arg(0, ARUPlayer.getAny());
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
if (you.getFaction() != usenderFaction)

View File

@ -4,7 +4,7 @@ import org.bukkit.ChatColor;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsTitleChange;
@ -40,7 +40,7 @@ public class CmdFactionsTitle extends FCommand
public void perform()
{
// Args
MPlayer you = this.arg(0, ARUPlayer.getAny());
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
String newTitle = this.argConcatFrom(1, ARString.get(), "");

View File

@ -36,12 +36,12 @@ public class ARFaction extends ArgReaderAbstract<Faction>
result.setResult(FactionColl.get().getBestNameMatch(str));
if (result.hasResult()) return result;
// UPlayer Name Exact
// MPlayer Name Exact
String id = IdUtil.getId(str);
MPlayer uplayer = MPlayer.get(id);
if (uplayer != null)
MPlayer mplayer = MPlayer.get(id);
if (mplayer != null)
{
result.setResult(uplayer.getFaction());
result.setResult(mplayer.getFaction());
return result;
}

View File

@ -4,7 +4,7 @@ import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.massivecore.cmd.arg.ArgReader;
public class ARUPlayer
public class ARMPlayer
{
// -------------------------------------------- //
// INSTANCE

View File

@ -33,8 +33,8 @@ public class ReqRoleIsAtLeast extends ReqAbstract
@Override
public boolean apply(CommandSender sender, MassiveCommand command)
{
MPlayer uplayer = MPlayer.get(sender);
return uplayer.getRole().isAtLeast(this.rel);
MPlayer mplayer = MPlayer.get(sender);
return mplayer.getRole().isAtLeast(this.rel);
}
@Override

View File

@ -99,7 +99,7 @@ public class Board extends Entity<Board> implements BoardInterface
{
if (ps == null) return null;
TerritoryAccess ta = this.getTerritoryAccessAt(ps);
return ta.getHostFaction(this);
return ta.getHostFaction();
}
// SET

View File

@ -407,9 +407,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
return this.getInvitedPlayerIds().contains(playerId);
}
public boolean isInvited(MPlayer uplayer)
public boolean isInvited(MPlayer mplayer)
{
return this.isInvited(uplayer.getId());
return this.isInvited(mplayer.getId());
}
public boolean setInvited(String playerId, boolean invited)
@ -429,9 +429,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
}
public void setInvited(MPlayer uplayer, boolean invited)
public void setInvited(MPlayer mplayer, boolean invited)
{
this.setInvited(uplayer.getId(), invited);
this.setInvited(mplayer.getId(), invited);
}
// -------------------------------------------- //
@ -774,9 +774,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
if (this.getFlag(FFlag.INFPOWER)) return 999999;
double ret = 0;
for (MPlayer uplayer : this.getUPlayers())
for (MPlayer mplayer : this.getMPlayers())
{
ret += uplayer.getPower();
ret += mplayer.getPower();
}
double factionPowerMax = MConf.get().factionPowerMax;
@ -795,9 +795,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
if (this.getFlag(FFlag.INFPOWER)) return 999999;
double ret = 0;
for (MPlayer uplayer : this.getUPlayers())
for (MPlayer mplayer : this.getMPlayers())
{
ret += uplayer.getPowerMax();
ret += mplayer.getPowerMax();
}
double factionPowerMax = MConf.get().factionPowerMax;
@ -836,13 +836,13 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
}
// -------------------------------------------- //
// FOREIGN KEY: UPLAYER
// FOREIGN KEY: MPLAYER
// -------------------------------------------- //
protected transient List<MPlayer> uplayers = new ArrayList<MPlayer>();
public void reindexUPlayers()
protected transient List<MPlayer> mplayers = new ArrayList<MPlayer>();
public void reindexMPlayers()
{
this.uplayers.clear();
this.mplayers.clear();
String factionId = this.getId();
if (factionId == null) return;
@ -850,42 +850,42 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
for (MPlayer mplayer : MPlayerColl.get().getAll())
{
if (!MUtil.equals(factionId, mplayer.getFactionId())) continue;
this.uplayers.add(mplayer);
this.mplayers.add(mplayer);
}
}
// TODO: Even though this check method removeds the invalid entries it's not a true solution.
// TODO: Find the bug causing non-attached UPlayers to be present in the index.
private void checkUPlayerIndex()
// TODO: Find the bug causing non-attached MPlayers to be present in the index.
private void checkMPlayerIndex()
{
Iterator<MPlayer> iter = this.uplayers.iterator();
Iterator<MPlayer> iter = this.mplayers.iterator();
while (iter.hasNext())
{
MPlayer uplayer = iter.next();
if (!uplayer.attached())
MPlayer mplayer = iter.next();
if (!mplayer.attached())
{
String msg = Txt.parse("<rose>WARN: <i>Faction <h>%s <i>aka <h>%s <i>had unattached uplayer in index:", this.getName(), this.getId());
String msg = Txt.parse("<rose>WARN: <i>Faction <h>%s <i>aka <h>%s <i>had unattached mplayer in index:", this.getName(), this.getId());
Factions.get().log(msg);
Factions.get().log(Factions.get().gson.toJson(uplayer));
Factions.get().log(Factions.get().gson.toJson(mplayer));
iter.remove();
}
}
}
public List<MPlayer> getUPlayers()
public List<MPlayer> getMPlayers()
{
this.checkUPlayerIndex();
return new ArrayList<MPlayer>(this.uplayers);
this.checkMPlayerIndex();
return new ArrayList<MPlayer>(this.mplayers);
}
public List<MPlayer> getUPlayersWhereOnline(boolean online)
public List<MPlayer> getMPlayersWhereOnline(boolean online)
{
List<MPlayer> ret = this.getUPlayers();
List<MPlayer> ret = this.getMPlayers();
Iterator<MPlayer> iter = ret.iterator();
while (iter.hasNext())
{
MPlayer uplayer = iter.next();
if (uplayer.isOnline() != online)
MPlayer mplayer = iter.next();
if (mplayer.isOnline() != online)
{
iter.remove();
}
@ -893,14 +893,14 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
return ret;
}
public List<MPlayer> getUPlayersWhereRole(Rel role)
public List<MPlayer> getMPlayersWhereRole(Rel role)
{
List<MPlayer> ret = this.getUPlayers();
List<MPlayer> ret = this.getMPlayers();
Iterator<MPlayer> iter = ret.iterator();
while (iter.hasNext())
{
MPlayer uplayer = iter.next();
if (uplayer.getRole() != role)
MPlayer mplayer = iter.next();
if (mplayer.getRole() != role)
{
iter.remove();
}
@ -910,14 +910,14 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
public MPlayer getLeader()
{
List<MPlayer> ret = this.getUPlayers();
List<MPlayer> ret = this.getMPlayers();
Iterator<MPlayer> iter = ret.iterator();
while (iter.hasNext())
{
MPlayer uplayer = iter.next();
if (uplayer.getRole() == Rel.LEADER)
MPlayer mplayer = iter.next();
if (mplayer.getRole() == Rel.LEADER)
{
return uplayer;
return mplayer;
}
}
return null;
@ -928,9 +928,8 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
List<CommandSender> ret = new ArrayList<CommandSender>();
for (CommandSender player : IdUtil.getOnlineSenders())
{
MPlayer uplayer = MPlayer.get(player);
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
if (uplayer.getFaction() != this) continue;
MPlayer mplayer = MPlayer.get(player);
if (mplayer.getFaction() != this) continue;
ret.add(player);
}
return ret;
@ -941,9 +940,8 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
List<Player> ret = new ArrayList<Player>();
for (Player player : Bukkit.getOnlinePlayers())
{
MPlayer uplayer = MPlayer.get(player);
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
if (uplayer.getFaction() != this) continue;
MPlayer mplayer = MPlayer.get(player);
if (mplayer.getFaction() != this) continue;
ret.add(player);
}
return ret;
@ -958,10 +956,10 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
MPlayer oldLeader = this.getLeader();
// get list of officers, or list of normal members if there are no officers
List<MPlayer> replacements = this.getUPlayersWhereRole(Rel.OFFICER);
List<MPlayer> replacements = this.getMPlayersWhereRole(Rel.OFFICER);
if (replacements == null || replacements.isEmpty())
{
replacements = this.getUPlayersWhereRole(Rel.MEMBER);
replacements = this.getMPlayersWhereRole(Rel.MEMBER);
}
if (replacements == null || replacements.isEmpty())
@ -1007,19 +1005,19 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
// FACTION ONLINE STATE
// -------------------------------------------- //
public boolean isAllUPlayersOffline()
public boolean isAllMPlayersOffline()
{
return this.getUPlayersWhereOnline(true).size() == 0;
return this.getMPlayersWhereOnline(true).size() == 0;
}
public boolean isAnyUPlayersOnline()
public boolean isAnyMPlayersOnline()
{
return !this.isAllUPlayersOffline();
return !this.isAllMPlayersOffline();
}
public boolean isFactionConsideredOffline()
{
return this.isAllUPlayersOffline();
return this.isAllMPlayersOffline();
}
public boolean isFactionConsideredOnline()

View File

@ -50,7 +50,7 @@ public class FactionColl extends Coll<Faction>
// Example Reason: When creating the special factions for the first time "createSpecialFactions" a clean would be triggered otherwise.
if (ret == null && Factions.get().isDatabaseInitialized())
{
String message = Txt.parse("<b>Non existing factionId <h>%s <b>requested. <i>Cleaning all boards and uplayers.", this.fixId(oid));
String message = Txt.parse("<b>Non existing factionId <h>%s <b>requested. <i>Cleaning all boards and mplayers.", this.fixId(oid));
Factions.get().log(message);
BoardColl.get().clean();
@ -64,11 +64,11 @@ public class FactionColl extends Coll<Faction>
// INDEX
// -------------------------------------------- //
public void reindexUPlayers()
public void reindexMPlayers()
{
for (Faction faction : this.getAll())
{
faction.reindexUPlayers();
faction.reindexMPlayers();
}
}
@ -199,7 +199,7 @@ public class FactionColl extends Coll<Faction>
int landCount = faction.getLandCount();
if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0)
{
List<MPlayer> players = faction.getUPlayers();
List<MPlayer> players = faction.getMPlayers();
int playerCount = players.size();
double reward = econLandReward * landCount / playerCount;
for (MPlayer player : players)
@ -320,11 +320,11 @@ public class FactionColl extends Coll<Faction>
// INDEX
// -------------------------------------------- //
public void reindexUPlayers()
public void reindexMPlayers()
{
for (FactionColl coll : this.getColls())
{
coll.reindexUPlayers();
coll.reindexMPlayers();
}
}
*/

View File

@ -77,7 +77,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
// ... update the index.
Faction faction = this.getFaction();
faction.uplayers.add(this);
faction.mplayers.add(this);
//Factions.get().log(Txt.parse("<g>postAttach added <h>%s <i>aka <h>%s <i>to <h>%s <i>aka <h>%s<i>.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName()));
}
@ -90,7 +90,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
// ... update the index.
Faction faction = this.getFaction();
faction.uplayers.remove(this);
faction.mplayers.remove(this);
//Factions.get().log(Txt.parse("<b>preDetach removed <h>%s <i>aka <h>%s <i>to <h>%s <i>aka <h>%s<i>.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName()));
}
@ -140,7 +140,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
// Null means false
private Boolean usingAdminMode = null;
// The id for the faction this uplayer is currently autoclaiming for.
// The id for the faction this player is currently autoclaiming for.
// NOTE: This field will not be saved to the database ever.
// Null means the player isn't auto claiming.
private transient Faction autoClaimFaction = null;
@ -214,8 +214,8 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
Faction oldFaction = Faction.get(oldFactionId);
Faction faction = this.getFaction();
if (oldFaction != null) oldFaction.uplayers.remove(this);
if (faction != null) faction.uplayers.add(this);
if (oldFaction != null) oldFaction.mplayers.remove(this);
if (faction != null) faction.mplayers.add(this);
String oldFactionIdDesc = "NULL";
String oldFactionNameDesc = "NULL";
@ -556,9 +556,9 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
{
return this.getNameAndTitle(this.getColorTo(faction).toString());
}
public String getNameAndTitle(MPlayer uplayer)
public String getNameAndTitle(MPlayer mplayer)
{
return this.getNameAndTitle(this.getColorTo(uplayer).toString());
return this.getNameAndTitle(this.getColorTo(mplayer).toString());
}
// -------------------------------------------- //
@ -637,7 +637,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
boolean permanent = myFaction.getFlag(FFlag.PERMANENT);
if (myFaction.getUPlayers().size() > 1)
if (myFaction.getMPlayers().size() > 1)
{
if (!permanent && this.getRole() == Rel.LEADER)
{
@ -659,9 +659,9 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
if (myFaction.isNormal())
{
for (MPlayer uplayer : myFaction.getUPlayersWhereOnline(true))
for (MPlayer mplayer : myFaction.getMPlayersWhereOnline(true))
{
uplayer.msg("%s<i> left %s<i>.", this.describeTo(uplayer, true), myFaction.describeTo(uplayer));
mplayer.msg("%s<i> left %s<i>.", this.describeTo(mplayer, true), myFaction.describeTo(mplayer));
}
if (MConf.get().logFactionLeave)
@ -672,7 +672,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
this.resetFactionData();
if (myFaction.isNormal() && !permanent && myFaction.getUPlayers().isEmpty())
if (myFaction.isNormal() && !permanent && myFaction.getMPlayers().isEmpty())
{
// Remove this faction
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
@ -717,7 +717,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
return false;
}
if (newFaction.getUPlayers().size() < mconf.claimsRequireMinFactionMembers)
if (newFaction.getMPlayers().size() < mconf.claimsRequireMinFactionMembers)
{
msg("Factions must have at least <h>%s<b> members to claim land.", mconf.claimsRequireMinFactionMembers);
return false;
@ -804,11 +804,11 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
informees.add(this);
if (newFaction.isNormal())
{
informees.addAll(newFaction.getUPlayers());
informees.addAll(newFaction.getMPlayers());
}
if (oldFaction.isNormal())
{
informees.addAll(oldFaction.getUPlayers());
informees.addAll(oldFaction.getMPlayers());
}
if (MConf.get().logLandClaims)
{

View File

@ -30,14 +30,14 @@ public class MPlayerColl extends SenderColl<MPlayer>
public void clean()
{
String universe = this.getUniverse();
for (MPlayer uplayer : this.getAll())
for (MPlayer mplayer : this.getAll())
{
String factionId = uplayer.getFactionId();
String factionId = mplayer.getFactionId();
if (FactionColl.get().containsId(factionId)) continue;
uplayer.resetFactionData();
mplayer.resetFactionData();
String message = Txt.parse("<i>Reset data for <h>%s <i>in <h>%s <i>universe. Unknown factionId <h>%s", uplayer.getDisplayName(IdUtil.getConsole()), universe, factionId);
String message = Txt.parse("<i>Reset data for <h>%s <i>in <h>%s <i>universe. Unknown factionId <h>%s", mplayer.getDisplayName(IdUtil.getConsole()), universe, factionId);
Factions.get().log(message);
}
}
@ -49,31 +49,31 @@ public class MPlayerColl extends SenderColl<MPlayer>
long now = System.currentTimeMillis();
double toleranceMillis = MConf.get().removePlayerDataAfterInactiveDays * TimeUnit.MILLIS_PER_DAY;
for (MPlayer uplayer : this.getAll())
for (MPlayer mplayer : this.getAll())
{
Long lastPlayed = Mixin.getLastPlayed(uplayer.getId());
Long lastPlayed = Mixin.getLastPlayed(mplayer.getId());
if (lastPlayed == null) continue;
if (uplayer.isOnline()) continue;
if (mplayer.isOnline()) continue;
if (now - lastPlayed <= toleranceMillis) continue;
if (MConf.get().logFactionLeave || MConf.get().logFactionKick)
{
Factions.get().log("Player "+uplayer.getName()+" was auto-removed due to inactivity.");
Factions.get().log("Player "+mplayer.getName()+" was auto-removed due to inactivity.");
}
// if player is faction leader, sort out the faction since he's going away
if (uplayer.getRole() == Rel.LEADER)
if (mplayer.getRole() == Rel.LEADER)
{
Faction faction = uplayer.getFaction();
Faction faction = mplayer.getFaction();
if (faction != null)
{
uplayer.getFaction().promoteNewLeader();
mplayer.getFaction().promoteNewLeader();
}
}
uplayer.leave();
uplayer.detach();
mplayer.leave();
mplayer.detach();
}
}
@ -89,18 +89,18 @@ public class MPlayerColl extends SenderColl<MPlayer>
if ( ! oldFile.exists()) return;
// Read the file content through GSON.
Type type = new TypeToken<Map<String, UPlayer>>(){}.getType();
Map<String, UPlayer> id2uplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
Type type = new TypeToken<Map<String, MPlayer>>(){}.getType();
Map<String, MPlayer> id2mplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
// The Coll
UPlayerColl coll = this.getForUniverse(MassiveCore.DEFAULT);
MPlayerColl coll = this.getForUniverse(MassiveCore.DEFAULT);
// Set the data
for (Entry<String, UPlayer> entry : id2uplayer.entrySet())
for (Entry<String, MPlayer> entry : id2mplayer.entrySet())
{
String playerId = entry.getKey();
UPlayer uplayer = entry.getValue();
coll.attach(uplayer, playerId);
MPlayer mplayer = entry.getValue();
coll.attach(mplayer, playerId);
}
// Mark as migrated
@ -113,7 +113,7 @@ public class MPlayerColl extends SenderColl<MPlayer>
public void clean()
{
for (UPlayerColl coll : this.getColls())
for (MPlayerColl coll : this.getColls())
{
coll.clean();
}

View File

@ -20,8 +20,8 @@ public class EventFactionsInvitedChange extends EventFactionsAbstractSender
// FIELDS
// -------------------------------------------- //
private final MPlayer uplayer;
public MPlayer getUPlayer() { return this.uplayer; }
private final MPlayer mplayer;
public MPlayer getMPlayer() { return this.mplayer; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
@ -34,10 +34,10 @@ public class EventFactionsInvitedChange extends EventFactionsAbstractSender
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsInvitedChange(CommandSender sender, MPlayer uplayer, Faction faction, boolean newInvited)
public EventFactionsInvitedChange(CommandSender sender, MPlayer mplayer, Faction faction, boolean newInvited)
{
super(sender);
this.uplayer = uplayer;
this.mplayer = mplayer;
this.faction = faction;
this.newInvited = newInvited;
}

View File

@ -27,8 +27,8 @@ public class EventFactionsMembershipChange extends EventFactionsAbstractSender
super.setCancelled(cancelled);
}
private final MPlayer uplayer;
public MPlayer getUPlayer() { return this.uplayer; }
private final MPlayer mplayer;
public MPlayer getMPlayer() { return this.mplayer; }
private final Faction newFaction;
public Faction getNewFaction() { return this.newFaction; }
@ -40,10 +40,10 @@ public class EventFactionsMembershipChange extends EventFactionsAbstractSender
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsMembershipChange(CommandSender sender, MPlayer uplayer, Faction newFaction, MembershipChangeReason reason)
public EventFactionsMembershipChange(CommandSender sender, MPlayer mplayer, Faction newFaction, MembershipChangeReason reason)
{
super(sender);
this.uplayer = uplayer;
this.mplayer = mplayer;
this.newFaction = newFaction;
this.reason = reason;
}

View File

@ -19,8 +19,8 @@ public class EventFactionsPowerChange extends EventFactionsAbstractSender
// FIELDS
// -------------------------------------------- //
private final MPlayer uplayer;
public MPlayer getUPlayer() { return this.uplayer; }
private final MPlayer mplayer;
public MPlayer getMPlayer() { return this.mplayer; }
private final PowerChangeReason reason;
public PowerChangeReason getReason() { return this.reason; }
@ -33,12 +33,12 @@ public class EventFactionsPowerChange extends EventFactionsAbstractSender
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsPowerChange(CommandSender sender, MPlayer uplayer, PowerChangeReason reason, double newPower)
public EventFactionsPowerChange(CommandSender sender, MPlayer mplayer, PowerChangeReason reason, double newPower)
{
super(sender);
this.uplayer = uplayer;
this.mplayer = mplayer;
this.reason = reason;
this.newPower = uplayer.getLimitedPower(newPower);
this.newPower = mplayer.getLimitedPower(newPower);
}
// -------------------------------------------- //

View File

@ -19,8 +19,8 @@ public class EventFactionsTitleChange extends EventFactionsAbstractSender
// FIELDS
// -------------------------------------------- //
private final MPlayer uplayer;
public MPlayer getUPlayer() { return this.uplayer; }
private final MPlayer mplayer;
public MPlayer getMPlayer() { return this.mplayer; }
private String newTitle;
public String getNewTitle() { return this.newTitle; }
@ -30,10 +30,10 @@ public class EventFactionsTitleChange extends EventFactionsAbstractSender
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsTitleChange(CommandSender sender, MPlayer uplayer, String newTitle)
public EventFactionsTitleChange(CommandSender sender, MPlayer mplayer, String newTitle)
{
super(sender);
this.uplayer = uplayer;
this.mplayer = mplayer;
this.newTitle = newTitle;
}

View File

@ -152,9 +152,9 @@ public class Econ
}
}
public static Set<MPlayer> getUPlayers(EconomyParticipator ep)
public static Set<MPlayer> getMPlayers(EconomyParticipator ep)
{
Set<MPlayer> uplayers = new HashSet<MPlayer>();
Set<MPlayer> mplayers = new HashSet<MPlayer>();
if (ep == null)
{
@ -162,22 +162,22 @@ public class Econ
}
else if (ep instanceof MPlayer)
{
uplayers.add((MPlayer)ep);
mplayers.add((MPlayer)ep);
}
else if (ep instanceof Faction)
{
uplayers.addAll(((Faction)ep).getUPlayers());
mplayers.addAll(((Faction)ep).getMPlayers());
}
return uplayers;
return mplayers;
}
public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount)
{
Set<MPlayer> recipients = new HashSet<MPlayer>();
recipients.addAll(getUPlayers(invoker));
recipients.addAll(getUPlayers(from));
recipients.addAll(getUPlayers(to));
recipients.addAll(getMPlayers(invoker));
recipients.addAll(getMPlayers(from));
recipients.addAll(getMPlayers(to));
if (invoker == null)
{

View File

@ -652,11 +652,11 @@ public class EngineDynmap extends EngineAbstract
Set<String> ret = new HashSet<String>();
for (MPlayer uplayer : faction.getUPlayers())
for (MPlayer mplayer : faction.getMPlayers())
{
// NOTE: We add both UUID and name. This might be a good idea for future proofing.
ret.add(uplayer.getId());
ret.add(uplayer.getName());
ret.add(mplayer.getId());
ret.add(mplayer.getName());
}
return ret;
@ -779,22 +779,22 @@ public class EngineDynmap extends EngineAbstract
}
// Players
List<MPlayer> playersList = faction.getUPlayers();
List<MPlayer> playersList = faction.getMPlayers();
String playersCount = String.valueOf(playersList.size());
String players = getPlayerString(playersList);
MPlayer playersLeaderObject = faction.getLeader();
String playersLeader = getPlayerName(playersLeaderObject);
List<MPlayer> playersOfficersList = faction.getUPlayersWhereRole(Rel.OFFICER);
List<MPlayer> playersOfficersList = faction.getMPlayersWhereRole(Rel.OFFICER);
String playersOfficersCount = String.valueOf(playersOfficersList.size());
String playersOfficers = getPlayerString(playersOfficersList);
List<MPlayer> playersMembersList = faction.getUPlayersWhereRole(Rel.MEMBER);
List<MPlayer> playersMembersList = faction.getMPlayersWhereRole(Rel.MEMBER);
String playersMembersCount = String.valueOf(playersMembersList.size());
String playersMembers = getPlayerString(playersMembersList);
List<MPlayer> playersRecruitsList = faction.getUPlayersWhereRole(Rel.RECRUIT);
List<MPlayer> playersRecruitsList = faction.getMPlayersWhereRole(Rel.RECRUIT);
String playersRecruitsCount = String.valueOf(playersRecruitsList.size());
String playersRecruits = getPlayerString(playersRecruitsList);
@ -812,21 +812,21 @@ public class EngineDynmap extends EngineAbstract
return ret;
}
public static String getPlayerString(List<MPlayer> uplayers)
public static String getPlayerString(List<MPlayer> mplayers)
{
String ret = "";
for (MPlayer uplayer : uplayers)
for (MPlayer mplayer : mplayers)
{
if (ret.length() > 0) ret += ", ";
ret += getPlayerName(uplayer);
ret += getPlayerName(mplayer);
}
return ret;
}
public static String getPlayerName(MPlayer uplayer)
public static String getPlayerName(MPlayer mplayer)
{
if (uplayer == null) return "none";
return escapeHtml(uplayer.getName());
if (mplayer == null) return "none";
return escapeHtml(mplayer.getName());
}
public static String boolcolor(String string, boolean bool)

View File

@ -72,7 +72,7 @@ public class EngineLwc implements Listener
public static void removeAlienProtections(PS chunkPs, Faction faction)
{
List<MPlayer> nonAliens = faction.getUPlayers();
List<MPlayer> nonAliens = faction.getMPlayers();
for (Protection protection : getProtectionsInChunk(chunkPs))
{
MPlayer owner = MPlayer.get(protection.getOwner());

View File

@ -57,12 +57,12 @@ public class FactionsListenerEcon implements Listener
if (event.getReason() != MembershipChangeReason.LEAVE) return;
// ... and that player was the last one in the faction ...
MPlayer uplayer = event.getUPlayer();
Faction oldFaction = uplayer.getFaction();
if (oldFaction.getUPlayers().size() > 1) return;
MPlayer mplayer = event.getMPlayer();
Faction oldFaction = mplayer.getFaction();
if (oldFaction.getMPlayers().size() > 1) return;
// ... then transfer all money to the player.
Econ.transferMoney(uplayer, oldFaction, uplayer, Money.get(oldFaction));
Econ.transferMoney(mplayer, oldFaction, mplayer, Money.get(oldFaction));
}
// -------------------------------------------- //

View File

@ -121,16 +121,16 @@ public class FactionsListenerMain implements Listener
// CHUNK CHANGE: TERRITORY INFO
// -------------------------------------------- //
public void chunkChangeTerritoryInfo(MPlayer uplayer, Player player, PS chunkFrom, PS chunkTo, Faction factionFrom, Faction factionTo)
public void chunkChangeTerritoryInfo(MPlayer mplayer, Player player, PS chunkFrom, PS chunkTo, Faction factionFrom, Faction factionTo)
{
// send host faction info updates
if (uplayer.isMapAutoUpdating())
if (mplayer.isMapAutoUpdating())
{
uplayer.sendMessage(BoardColl.get().getMap(uplayer, chunkTo, player.getLocation().getYaw()));
mplayer.sendMessage(BoardColl.get().getMap(mplayer, chunkTo, player.getLocation().getYaw()));
}
else if (factionFrom != factionTo)
{
String msg = Txt.parse("<i>") + " ~ " + factionTo.getName(uplayer);
String msg = Txt.parse("<i>") + " ~ " + factionTo.getName(mplayer);
if (factionTo.hasDescription())
{
msg += " - " + factionTo.getDescription();
@ -140,24 +140,24 @@ public class FactionsListenerMain implements Listener
// Show access level message if it changed.
TerritoryAccess accessFrom = BoardColl.get().getTerritoryAccessAt(chunkFrom);
Boolean hasTerritoryAccessFrom = accessFrom.hasTerritoryAccess(uplayer);
Boolean hasTerritoryAccessFrom = accessFrom.hasTerritoryAccess(mplayer);
TerritoryAccess accessTo = BoardColl.get().getTerritoryAccessAt(chunkTo);
Boolean hasTerritoryAccessTo = accessTo.hasTerritoryAccess(uplayer);
Boolean hasTerritoryAccessTo = accessTo.hasTerritoryAccess(mplayer);
if (!MUtil.equals(hasTerritoryAccessFrom, hasTerritoryAccessTo))
{
if (hasTerritoryAccessTo == null)
{
uplayer.msg("<i>You have standard access to this area.");
mplayer.msg("<i>You have standard access to this area.");
}
else if (hasTerritoryAccessTo)
{
uplayer.msg("<g>You have elevated access to this area.");
mplayer.msg("<g>You have elevated access to this area.");
}
else
{
uplayer.msg("<b>You have decreased access to this area.");
mplayer.msg("<b>You have decreased access to this area.");
}
}
}
@ -166,14 +166,14 @@ public class FactionsListenerMain implements Listener
// CHUNK CHANGE: AUTO CLAIM
// -------------------------------------------- //
public void chunkChangeAutoClaim(MPlayer uplayer, PS chunkTo)
public void chunkChangeAutoClaim(MPlayer mplayer, PS chunkTo)
{
// If the player is auto claiming ...
Faction autoClaimFaction = uplayer.getAutoClaimFaction();
Faction autoClaimFaction = mplayer.getAutoClaimFaction();
if (autoClaimFaction == null) return;
// ... try claim.
uplayer.tryClaim(autoClaimFaction, chunkTo, true, true);
mplayer.tryClaim(autoClaimFaction, chunkTo, true, true);
}
// -------------------------------------------- //
@ -462,10 +462,10 @@ public class FactionsListenerMain implements Listener
// If a player is trying to run a command ...
Player player = event.getPlayer();
MPlayer uplayer = MPlayer.get(player);
MPlayer mplayer = MPlayer.get(player);
// ... and the player does not have adminmode ...
if (uplayer.isUsingAdminMode()) return;
if (mplayer.isUsingAdminMode()) return;
// ... clean up the command ...
String command = event.getMessage();
@ -474,9 +474,9 @@ public class FactionsListenerMain implements Listener
command = command.trim();
// ... the command may be denied for members of permanent factions ...
if (uplayer.hasFaction() && uplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, MConf.get().denyCommandsPermanentFactionMember))
if (mplayer.hasFaction() && mplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, MConf.get().denyCommandsPermanentFactionMember))
{
uplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
mplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
event.setCancelled(true);
return;
}
@ -487,13 +487,13 @@ public class FactionsListenerMain implements Listener
if (factionAtPs.isNone()) return; // TODO: An NPE can arise here? Why?
// ... the command may be denied in the territory of this relation type ...
Rel rel = factionAtPs.getRelationTo(uplayer);
Rel rel = factionAtPs.getRelationTo(mplayer);
List<String> deniedCommands = MConf.get().denyCommandsTerritoryRelation.get(rel);
if (deniedCommands == null) return;
if (!containsCommand(command, deniedCommands)) return;
uplayer.msg("<b>You can't use \"<h>/%s<b>\" in %s territory.", command, Txt.getNicedEnum(rel));
mplayer.msg("<b>You can't use \"<h>/%s<b>\" in %s territory.", command, Txt.getNicedEnum(rel));
event.setCancelled(true);
}
@ -712,21 +712,21 @@ public class FactionsListenerMain implements Listener
String name = player.getName();
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
MPlayer uplayer = MPlayer.get(player);
if (uplayer.isUsingAdminMode()) return true;
MPlayer mplayer = MPlayer.get(player);
if (mplayer.isUsingAdminMode()) return true;
if (!FPerm.BUILD.has(uplayer, ps, false) && FPerm.PAINBUILD.has(uplayer, ps, false))
if (!FPerm.BUILD.has(mplayer, ps, false) && FPerm.PAINBUILD.has(mplayer, ps, false))
{
if (verboose)
{
Faction hostFaction = BoardColl.get().getFactionAt(ps);
uplayer.msg("<b>It is painful to build in the territory of %s<b>.", hostFaction.describeTo(uplayer));
mplayer.msg("<b>It is painful to build in the territory of %s<b>.", hostFaction.describeTo(mplayer));
player.damage(MConf.get().actionDeniedPainAmount);
}
return true;
}
return FPerm.BUILD.has(uplayer, ps, verboose);
return FPerm.BUILD.has(mplayer, ps, verboose);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
@ -891,10 +891,10 @@ public class FactionsListenerMain implements Listener
String name = player.getName();
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
MPlayer uplayer = MPlayer.get(player);
if (uplayer.isUsingAdminMode()) return true;
MPlayer mplayer = MPlayer.get(player);
if (mplayer.isUsingAdminMode()) return true;
return FPerm.BUILD.has(uplayer, ps, !justCheck);
return FPerm.BUILD.has(mplayer, ps, !justCheck);
}
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck)
@ -948,7 +948,7 @@ public class FactionsListenerMain implements Listener
{
// If a player is respawning ...
final Player player = event.getPlayer();
final MPlayer uplayer = MPlayer.get(player);
final MPlayer mplayer = MPlayer.get(player);
// ... homes are enabled, active and at this priority ...
if (!MConf.get().homesEnabled) return;
@ -956,7 +956,7 @@ public class FactionsListenerMain implements Listener
if (MConf.get().homesTeleportToOnDeathPriority != priority) return;
// ... and the player has a faction ...
final Faction faction = uplayer.getFaction();
final Faction faction = mplayer.getFaction();
if (faction.isNone()) return;
// ... and the faction has a home ...

View File

@ -4,9 +4,9 @@ import com.massivecraft.factions.entity.MPlayer;
public interface PowerMixin
{
public double getMaxUniversal(MPlayer uplayer);
public double getMax(MPlayer uplayer);
public double getMin(MPlayer uplayer);
public double getPerHour(MPlayer uplayer);
public double getPerDeath(MPlayer uplayer);
public double getMaxUniversal(MPlayer mplayer);
public double getMax(MPlayer mplayer);
public double getMin(MPlayer mplayer);
public double getPerHour(MPlayer mplayer);
public double getPerDeath(MPlayer mplayer);
}

View File

@ -40,18 +40,18 @@ public class RelationUtil
}
else if (that instanceof MPlayer)
{
MPlayer uplayerthat = (MPlayer) that;
MPlayer mplayerthat = (MPlayer) that;
if (that == me)
{
ret = "you";
}
else if (thatFaction == myFaction)
{
ret = uplayerthat.getNameAndTitle(myFaction);
ret = mplayerthat.getNameAndTitle(myFaction);
}
else
{
ret = uplayerthat.getNameAndFactionName();
ret = mplayerthat.getNameAndFactionName();
}
}