Renaming sender vars in the command system to more proper names.

This commit is contained in:
Olof Larsson 2013-04-25 07:29:19 +02:00
parent 882bdf4c88
commit e32a741b3b
36 changed files with 200 additions and 200 deletions

View File

@ -42,7 +42,7 @@ public class CmdFactionsAccess extends FCommand
if (type.isEmpty() || type.equals("view")) if (type.isEmpty() || type.equals("view"))
{ {
if ( ! accessAny && ! Perm.ACCESS_VIEW.has(sender, true)) return; if ( ! accessAny && ! Perm.ACCESS_VIEW.has(sender, true)) return;
if ( ! accessAny && ! territory.doesHostFactionMatch(fme)) if ( ! accessAny && ! territory.doesHostFactionMatch(usender))
{ {
msg("<b>This territory isn't controlled by your faction, so you can't view the access list."); msg("<b>This territory isn't controlled by your faction, so you can't view the access list.");
return; return;
@ -52,7 +52,7 @@ public class CmdFactionsAccess extends FCommand
} }
if ( ! accessAny && ! Perm.ACCESS.has(sender, true)) return; if ( ! accessAny && ! Perm.ACCESS.has(sender, true)) return;
if ( ! accessAny && ! FPerm.ACCESS.has(fme, locFaction, true)) return; if ( ! accessAny && ! FPerm.ACCESS.has(usender, locFaction, true)) return;
boolean doPlayer = true; boolean doPlayer = true;
if (type.equals("f") || type.equals("faction")) if (type.equals("f") || type.equals("faction"))
@ -72,14 +72,14 @@ public class CmdFactionsAccess extends FCommand
if (doPlayer) if (doPlayer)
{ {
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(fme), fme); UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(usender), usender);
if (targetPlayer == null) return; if (targetPlayer == null) return;
added = territory.toggleFPlayer(targetPlayer); added = territory.toggleFPlayer(targetPlayer);
target = "Player \""+targetPlayer.getName()+"\""; target = "Player \""+targetPlayer.getName()+"\"";
} }
else else
{ {
Faction targetFaction = this.arg(1, ARFaction.get(myFaction), myFaction); Faction targetFaction = this.arg(1, ARFaction.get(usenderFaction), usenderFaction);
if (targetFaction == null) return; if (targetFaction == null) return;
added = territory.toggleFaction(targetFaction); added = territory.toggleFaction(targetFaction);
target = "Faction \""+targetFaction.getName()+"\""; target = "Faction \""+targetFaction.getName()+"\"";

View File

@ -19,20 +19,20 @@ public class CmdFactionsAdmin extends FCommand
@Override @Override
public void perform() public void perform()
{ {
Boolean target = this.arg(0, ARBoolean.get(), !fme.isUsingAdminMode()); Boolean target = this.arg(0, ARBoolean.get(), !usender.isUsingAdminMode());
if (target == null) return; if (target == null) return;
fme.setUsingAdminMode(target); usender.setUsingAdminMode(target);
if ( fme.isUsingAdminMode()) if ( usender.isUsingAdminMode())
{ {
fme.msg("<i>You have enabled admin bypass mode."); usender.msg("<i>You have enabled admin bypass mode.");
Factions.get().log(fme.getName() + " has ENABLED admin bypass mode."); Factions.get().log(usender.getName() + " has ENABLED admin bypass mode.");
} }
else else
{ {
fme.msg("<i>You have disabled admin bypass mode."); usender.msg("<i>You have disabled admin bypass mode.");
Factions.get().log(fme.getName() + " DISABLED admin bypass mode."); Factions.get().log(usender.getName() + " DISABLED admin bypass mode.");
} }
} }
} }

View File

@ -23,20 +23,20 @@ public class CmdFactionsAutoClaim extends FCommand
@Override @Override
public void perform() public void perform()
{ {
Faction forFaction = this.arg(0, ARFaction.get(myFaction), myFaction); Faction forFaction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
if (forFaction == null || forFaction == fme.getAutoClaimFaction()) if (forFaction == null || forFaction == usender.getAutoClaimFaction())
{ {
fme.setAutoClaimFaction(null); usender.setAutoClaimFaction(null);
msg("<i>Auto-claiming of land disabled."); msg("<i>Auto-claiming of land disabled.");
return; return;
} }
if (forFaction.isNormal() && !FPerm.TERRITORY.has(fme, forFaction, true)) return; if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
fme.setAutoClaimFaction(forFaction); usender.setAutoClaimFaction(forFaction);
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme)); msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(usender));
fme.tryClaim(forFaction, PS.valueOf(me), true, true); usender.tryClaim(forFaction, PS.valueOf(me), true, true);
} }
} }

View File

@ -33,7 +33,7 @@ public class CmdFactionsClaim extends FCommand
Integer radius = this.arg(0, ARInteger.get(), 1); Integer radius = this.arg(0, ARInteger.get(), 1);
if (radius == null) return; if (radius == null) return;
final Faction forFaction = this.arg(1, ARFaction.get(me), myFaction); final Faction forFaction = this.arg(1, ARFaction.get(me), usenderFaction);
if (forFaction == null) return; if (forFaction == null) return;
// FPerm // FPerm
@ -46,7 +46,7 @@ public class CmdFactionsClaim extends FCommand
return; return;
} }
if (radius > MConf.get().radiusClaimRadiusLimit && !fme.isUsingAdminMode()) if (radius > MConf.get().radiusClaimRadiusLimit && !usender.isUsingAdminMode())
{ {
msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().radiusClaimRadiusLimit); msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().radiusClaimRadiusLimit);
return; return;
@ -57,7 +57,7 @@ public class CmdFactionsClaim extends FCommand
// single chunk // single chunk
if (radius < 2) if (radius < 2)
{ {
fme.tryClaim(forFaction, PS.valueOf(me), true, true); usender.tryClaim(forFaction, PS.valueOf(me), true, true);
return; return;
} }
@ -81,7 +81,7 @@ public class CmdFactionsClaim extends FCommand
@Override @Override
public boolean work() public boolean work()
{ {
boolean success = fme.tryClaim(forFaction, PS.valueOf(this.currentLocation()), true, true); boolean success = usender.tryClaim(forFaction, PS.valueOf(this.currentLocation()), true, true);
if (success) if (success)
{ {
this.failCount = 0; this.failCount = 0;

View File

@ -34,13 +34,13 @@ public class CmdFactionsCreate extends FCommand
String newName = this.arg(0); String newName = this.arg(0);
// Verify // Verify
if (fme.getFaction().isNormal()) if (usender.getFaction().isNormal())
{ {
msg("<b>You must leave your current faction first."); msg("<b>You must leave your current faction first.");
return; return;
} }
FactionColl coll = FactionColls.get().get(fme); FactionColl coll = FactionColls.get().get(usender);
if (coll.isNameTaken(newName)) if (coll.isNameTaken(newName))
{ {
@ -67,24 +67,24 @@ public class CmdFactionsCreate extends FCommand
Faction faction = coll.create(factionId); Faction faction = coll.create(factionId);
faction.setName(newName); faction.setName(newName);
fme.setRole(Rel.LEADER); usender.setRole(Rel.LEADER);
fme.setFaction(faction); usender.setFaction(faction);
FactionsEventMembershipChange joinEvent = new FactionsEventMembershipChange(sender, fme, faction, MembershipChangeReason.CREATE); FactionsEventMembershipChange joinEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
joinEvent.run(); joinEvent.run();
// NOTE: join event cannot be cancelled or you'll have an empty faction // NOTE: join event cannot be cancelled or you'll have an empty faction
// Inform // Inform
for (UPlayer follower : UPlayerColls.get().get(fme).getAllOnline()) for (UPlayer follower : UPlayerColls.get().get(usender).getAllOnline())
{ {
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getName(follower)); follower.msg("%s<i> created a new faction %s", usender.describeTo(follower, true), faction.getName(follower));
} }
msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate()); msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
if (MConf.get().logFactionCreate) if (MConf.get().logFactionCreate)
{ {
Factions.get().log(fme.getName()+" created a new faction: "+newName); Factions.get().log(usender.getName()+" created a new faction: "+newName);
} }
} }

View File

@ -25,16 +25,16 @@ public class CmdFactionsDemote extends FCommand
@Override @Override
public void perform() public void perform()
{ {
UPlayer you = this.arg(0, ARUPlayer.getStartAny(fme)); UPlayer you = this.arg(0, ARUPlayer.getStartAny(usender));
if (you == null) return; if (you == null) return;
if (you.getFaction() != myFaction) if (you.getFaction() != usenderFaction)
{ {
msg("%s<b> is not a member in your faction.", you.describeTo(fme, true)); msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
return; return;
} }
if (you == fme) if (you == usender)
{ {
msg("<b>The target player mustn't be yourself."); msg("<b>The target player mustn't be yourself.");
return; return;
@ -42,23 +42,23 @@ public class CmdFactionsDemote extends FCommand
if (you.getRole() == Rel.MEMBER) if (you.getRole() == Rel.MEMBER)
{ {
if (!fme.getRole().isAtLeast(Rel.OFFICER)) if (!usender.getRole().isAtLeast(Rel.OFFICER))
{ {
msg("<b>You must be an officer to demote a member to recruit."); msg("<b>You must be an officer to demote a member to recruit.");
return; return;
} }
you.setRole(Rel.RECRUIT); you.setRole(Rel.RECRUIT);
myFaction.msg("%s<i> was demoted to being a recruit in your faction.", you.describeTo(myFaction, true)); usenderFaction.msg("%s<i> was demoted to being a recruit in your faction.", you.describeTo(usenderFaction, true));
} }
else if (you.getRole() == Rel.OFFICER) else if (you.getRole() == Rel.OFFICER)
{ {
if (!fme.getRole().isAtLeast(Rel.LEADER)) if (!usender.getRole().isAtLeast(Rel.LEADER))
{ {
msg("<b>You must be the leader to demote an officer to member."); msg("<b>You must be the leader to demote an officer to member.");
return; return;
} }
you.setRole(Rel.MEMBER); you.setRole(Rel.MEMBER);
myFaction.msg("%s<i> was demoted to being a member in your faction.", you.describeTo(myFaction, true)); usenderFaction.msg("%s<i> was demoted to being a member in your faction.", you.describeTo(usenderFaction, true));
} }
} }

View File

@ -27,16 +27,16 @@ public class CmdFactionsDescription extends FCommand
String newDescription = this.argConcatFrom(1); String newDescription = this.argConcatFrom(1);
// Event // Event
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, myFaction, newDescription); FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, usenderFaction, newDescription);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newDescription = event.getNewDescription(); newDescription = event.getNewDescription();
// Apply // Apply
myFaction.setDescription(this.argConcatFrom(1)); usenderFaction.setDescription(this.argConcatFrom(1));
// Inform // Inform
myFaction.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender), myFaction.getDescription()); usenderFaction.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender), usenderFaction.getDescription());
} }
} }

View File

@ -30,7 +30,7 @@ public class CmdFactionsDisband extends FCommand
public void perform() public void perform()
{ {
// Args // Args
Faction faction = this.arg(0, ARFaction.get(fme), myFaction); Faction faction = this.arg(0, ARFaction.get(usender), usenderFaction);
if (faction == null) return; if (faction == null) return;
// FPerm // FPerm
@ -58,9 +58,9 @@ public class CmdFactionsDisband extends FCommand
} }
// Inform all players // Inform all players
for (UPlayer uplayer : UPlayerColls.get().get(fme).getAllOnline()) for (UPlayer uplayer : UPlayerColls.get().get(usender).getAllOnline())
{ {
String who = fme.describeTo(uplayer); String who = usender.describeTo(uplayer);
if (uplayer.getFaction() == faction) if (uplayer.getFaction() == faction)
{ {
uplayer.msg("<h>%s<i> disbanded your faction.", who); uplayer.msg("<h>%s<i> disbanded your faction.", who);
@ -73,7 +73,7 @@ public class CmdFactionsDisband extends FCommand
if (MConf.get().logFactionDisband) if (MConf.get().logFactionDisband)
{ {
Factions.get().log("The faction "+faction.getName()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+"."); Factions.get().log("The faction "+faction.getName()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : usender.getName())+".");
} }

View File

@ -26,12 +26,12 @@ public class CmdFactionsFlag extends FCommand
@Override @Override
public void perform() public void perform()
{ {
Faction faction = this.arg(0, ARFaction.get(sender), myFaction); Faction faction = this.arg(0, ARFaction.get(sender), usenderFaction);
if (faction == null) return; if (faction == null) return;
if ( ! this.argIsSet(1)) if ( ! this.argIsSet(1))
{ {
msg(Txt.titleize("Flags for " + faction.describeTo(fme, true))); msg(Txt.titleize("Flags for " + faction.describeTo(usender, true)));
for (FFlag flag : FFlag.values()) for (FFlag flag : FFlag.values())
{ {
msg(flag.getStateInfo(faction.getFlag(flag), true)); msg(flag.getStateInfo(faction.getFlag(flag), true));
@ -44,7 +44,7 @@ public class CmdFactionsFlag extends FCommand
if ( ! this.argIsSet(2)) if ( ! this.argIsSet(2))
{ {
msg(Txt.titleize("Flag for " + faction.describeTo(fme, true))); msg(Txt.titleize("Flag for " + faction.describeTo(usender, true)));
msg(flag.getStateInfo(faction.getFlag(flag), true)); msg(flag.getStateInfo(faction.getFlag(flag), true));
return; return;
} }
@ -56,7 +56,7 @@ public class CmdFactionsFlag extends FCommand
if ( ! Perm.FLAG_SET.has(sender, true)) return; if ( ! Perm.FLAG_SET.has(sender, true)) return;
// Do the change // Do the change
msg(Txt.titleize("Flag for " + faction.describeTo(fme, true))); msg(Txt.titleize("Flag for " + faction.describeTo(usender, true)));
faction.setFlag(flag, targetValue); faction.setFlag(flag, targetValue);
msg(flag.getStateInfo(faction.getFlag(flag), true)); msg(flag.getStateInfo(faction.getFlag(flag), true));
} }

View File

@ -40,32 +40,32 @@ public class CmdFactionsHome extends FCommand
// TODO: Hide this command on help also. // TODO: Hide this command on help also.
if ( ! uconf.homesEnabled) if ( ! uconf.homesEnabled)
{ {
fme.msg("<b>Sorry, Faction homes are disabled on this server."); usender.msg("<b>Sorry, Faction homes are disabled on this server.");
return; return;
} }
if ( ! uconf.homesTeleportCommandEnabled) if ( ! uconf.homesTeleportCommandEnabled)
{ {
fme.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server."); usender.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
return; return;
} }
if ( ! myFaction.hasHome()) if ( ! usenderFaction.hasHome())
{ {
fme.msg("<b>Your faction does not have a home. " + (fme.getRole().isLessThan(Rel.OFFICER) ? "<i> Ask your leader to:" : "<i>You should:")); usender.msg("<b>Your faction does not have a home. " + (usender.getRole().isLessThan(Rel.OFFICER) ? "<i> Ask your leader to:" : "<i>You should:"));
fme.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate()); usender.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
return; return;
} }
if ( ! uconf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) if ( ! uconf.homesTeleportAllowedFromEnemyTerritory && usender.isInEnemyTerritory())
{ {
fme.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction."); usender.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction.");
return; return;
} }
if (!uconf.homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(myFaction.getHome().getWorld())) if (!uconf.homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(usenderFaction.getHome().getWorld()))
{ {
fme.msg("<b>You cannot teleport to your faction home while in a different world."); usender.msg("<b>You cannot teleport to your faction home while in a different world.");
return; return;
} }
@ -81,10 +81,10 @@ public class CmdFactionsHome extends FCommand
faction.getFlag(FFlag.PVP) faction.getFlag(FFlag.PVP)
&& &&
( (
! fme.isInOwnTerritory() ! usender.isInOwnTerritory()
|| ||
( (
fme.isInOwnTerritory() usender.isInOwnTerritory()
&& &&
! uconf.homesTeleportIgnoreEnemiesIfInOwnTerritory ! uconf.homesTeleportIgnoreEnemiesIfInOwnTerritory
) )
@ -102,7 +102,7 @@ public class CmdFactionsHome extends FCommand
continue; continue;
UPlayer fp = UPlayer.get(p); UPlayer fp = UPlayer.get(p);
if (fme.getRelationTo(fp) != Rel.ENEMY) if (usender.getRelationTo(fp) != Rel.ENEMY)
continue; continue;
Location l = p.getLocation(); Location l = p.getLocation();
@ -115,7 +115,7 @@ public class CmdFactionsHome extends FCommand
if (dx > max || dy > max || dz > max) if (dx > max || dy > max || dz > max)
continue; continue;
fme.msg("<b>You cannot teleport to your faction home while an enemy is within " + uconf.homesTeleportAllowedEnemyDistance + " blocks of you."); usender.msg("<b>You cannot teleport to your faction home while an enemy is within " + uconf.homesTeleportAllowedEnemyDistance + " blocks of you.");
return; return;
} }
} }
@ -128,7 +128,7 @@ public class CmdFactionsHome extends FCommand
// Apply // Apply
try try
{ {
Mixin.teleport(me, myFaction.getHome(), "your faction home", sender); Mixin.teleport(me, usenderFaction.getHome(), "your faction home", sender);
} }
catch (TeleporterException e) catch (TeleporterException e)
{ {

View File

@ -30,39 +30,39 @@ public class CmdFactionsInvite extends FCommand
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
if (uplayer == null) return; if (uplayer == null) return;
Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(uplayer)); Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
if (newInvited == null) return; if (newInvited == null) return;
// Allready member? // Allready member?
if (uplayer.getFaction() == myFaction) if (uplayer.getFaction() == usenderFaction)
{ {
msg("%s<i> is already a member of %s", uplayer.getName(), myFaction.getName()); msg("%s<i> is already a member of %s", uplayer.getName(), usenderFaction.getName());
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false)); msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
return; return;
} }
// FPerm // FPerm
if ( ! FPerm.INVITE.has(sender, myFaction, true)) return; if ( ! FPerm.INVITE.has(sender, usenderFaction, true)) return;
// Event // Event
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, myFaction, newInvited); FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, usenderFaction, newInvited);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newInvited = event.isNewInvited(); newInvited = event.isNewInvited();
// Apply // Apply
myFaction.setInvited(uplayer, newInvited); usenderFaction.setInvited(uplayer, newInvited);
// Inform // Inform
if (newInvited) if (newInvited)
{ {
uplayer.msg("%s<i> invited you to %s", fme.describeTo(uplayer, true), myFaction.describeTo(uplayer)); uplayer.msg("%s<i> invited you to %s", usender.describeTo(uplayer, true), usenderFaction.describeTo(uplayer));
myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), uplayer.describeTo(myFaction)); usenderFaction.msg("%s<i> invited %s<i> to your faction.", usender.describeTo(usenderFaction, true), uplayer.describeTo(usenderFaction));
} }
else else
{ {
uplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(uplayer), myFaction.describeTo(uplayer)); uplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", usender.describeTo(uplayer), usenderFaction.describeTo(uplayer));
myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), uplayer.describeTo(myFaction)); usenderFaction.msg("%s<i> revoked %s's<i> invitation.", usender.describeTo(usenderFaction), uplayer.describeTo(usenderFaction));
} }
} }

View File

@ -31,11 +31,11 @@ public class CmdFactionsJoin extends FCommand
Faction faction = this.arg(0, ARFaction.get(sender)); Faction faction = this.arg(0, ARFaction.get(sender));
if (faction == null) return; if (faction == null) return;
UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), fme); UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), usender);
if (uplayer == null) return; if (uplayer == null) return;
Faction uplayerFaction = uplayer.getFaction(); Faction uplayerFaction = uplayer.getFaction();
boolean samePlayer = uplayer == fme; boolean samePlayer = uplayer == usender;
// Validate // Validate
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false)) if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
@ -46,29 +46,29 @@ public class CmdFactionsJoin extends FCommand
if (faction == uplayerFaction) if (faction == uplayerFaction)
{ {
msg("<b>%s %s already a member of %s", uplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getName(fme)); msg("<b>%s %s already a member of %s", uplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
return; return;
} }
if (UConf.get(faction).factionMemberLimit > 0 && faction.getUPlayers().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.getName(fme), UConf.get(faction).factionMemberLimit, uplayer.describeTo(fme, false)); msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), UConf.get(faction).factionMemberLimit, uplayer.describeTo(usender, false));
return; return;
} }
if (uplayerFaction.isNormal()) if (uplayerFaction.isNormal())
{ {
msg("<b>%s must leave %s current faction first.", uplayer.describeTo(fme, true), (samePlayer ? "your" : "their")); msg("<b>%s must leave %s current faction first.", uplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
return; return;
} }
if (!UConf.get(faction).canLeaveWithNegativePower && uplayer.getPower() < 0) if (!UConf.get(faction).canLeaveWithNegativePower && uplayer.getPower() < 0)
{ {
msg("<b>%s cannot join a faction with a negative power level.", uplayer.describeTo(fme, true)); msg("<b>%s cannot join a faction with a negative power level.", uplayer.describeTo(usender, true));
return; return;
} }
if( ! (faction.isOpen() || faction.isInvited(uplayer) || fme.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false))) if( ! (faction.isOpen() || faction.isInvited(uplayer) || usender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
{ {
msg("<i>This faction requires invitation."); msg("<i>This faction requires invitation.");
if (samePlayer) if (samePlayer)
@ -79,17 +79,17 @@ public class CmdFactionsJoin extends FCommand
} }
// Event // Event
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fme, faction, MembershipChangeReason.JOIN); FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN);
membershipChangeEvent.run(); membershipChangeEvent.run();
if (membershipChangeEvent.isCancelled()) return; if (membershipChangeEvent.isCancelled()) return;
// Inform // Inform
if (!samePlayer) if (!samePlayer)
{ {
uplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(uplayer, true), faction.getName(uplayer)); uplayer.msg("<i>%s moved you into the faction %s.", usender.describeTo(uplayer, true), faction.getName(uplayer));
} }
faction.msg("<i>%s joined your faction.", uplayer.describeTo(faction, true)); faction.msg("<i>%s joined your faction.", uplayer.describeTo(faction, true));
fme.msg("<i>%s successfully joined %s.", uplayer.describeTo(fme, true), faction.getName(fme)); usender.msg("<i>%s successfully joined %s.", uplayer.describeTo(usender, true), faction.getName(usender));
// Apply // Apply
uplayer.resetFactionData(); uplayer.resetFactionData();
@ -103,7 +103,7 @@ public class CmdFactionsJoin extends FCommand
if (samePlayer) if (samePlayer)
Factions.get().log("%s joined the faction %s.", uplayer.getName(), faction.getName()); Factions.get().log("%s joined the faction %s.", uplayer.getName(), faction.getName());
else else
Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), uplayer.getName(), faction.getName()); Factions.get().log("%s moved the player %s into the faction %s.", usender.getName(), uplayer.getName(), faction.getName());
} }
} }
} }

View File

@ -34,14 +34,14 @@ public class CmdFactionsKick extends FCommand
if (uplayer == null) return; if (uplayer == null) return;
// Validate // Validate
if (fme == uplayer) if (usender == uplayer)
{ {
msg("<b>You cannot kick yourself."); msg("<b>You cannot kick yourself.");
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false)); msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
return; return;
} }
if (uplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || fme.isUsingAdminMode())) if (uplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
{ {
msg("<b>The leader can not be kicked."); msg("<b>The leader can not be kicked.");
return; return;
@ -63,16 +63,16 @@ public class CmdFactionsKick extends FCommand
if (event.isCancelled()) return; if (event.isCancelled()) return;
// Inform // Inform
uplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(uplayerFaction, true), uplayer.describeTo(uplayerFaction, true)); 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", fme.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer)); uplayer.msg("%s<i> kicked you from %s<i>! :O", usender.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer));
if (uplayerFaction != myFaction) if (uplayerFaction != usenderFaction)
{ {
fme.msg("<i>You kicked %s<i> from the faction %s<i>!", uplayer.describeTo(fme), uplayerFaction.describeTo(fme)); usender.msg("<i>You kicked %s<i> from the faction %s<i>!", uplayer.describeTo(usender), uplayerFaction.describeTo(usender));
} }
if (MConf.get().logFactionKick) if (MConf.get().logFactionKick)
{ {
Factions.get().log(fme.getDisplayName() + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getName()); Factions.get().log(usender.getDisplayName() + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getName());
} }
// Apply // Apply

View File

@ -31,32 +31,32 @@ public class CmdFactionsLeader extends FCommand
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
if (newLeader == null) return; if (newLeader == null) return;
Faction targetFaction = this.arg(1, ARFaction.get(sender), myFaction); Faction targetFaction = this.arg(1, ARFaction.get(sender), usenderFaction);
if (targetFaction == null) return; if (targetFaction == null) return;
UPlayer targetFactionCurrentLeader = targetFaction.getLeader(); UPlayer targetFactionCurrentLeader = targetFaction.getLeader();
// We now have uplayer and the target faction // We now have uplayer and the target faction
if (this.senderIsConsole || fme.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false)) if (this.senderIsConsole || usender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
{ {
// Do whatever you wish // Do whatever you wish
} }
else else
{ {
// Follow the standard rules // Follow the standard rules
if (fme.getRole() != Rel.LEADER || targetFaction != myFaction) if (usender.getRole() != Rel.LEADER || targetFaction != usenderFaction)
{ {
sender.sendMessage(Txt.parse("<b>You must be leader of the faction to %s.", this.getDesc())); sender.sendMessage(Txt.parse("<b>You must be leader of the faction to %s.", this.getDesc()));
return; return;
} }
if (newLeader.getFaction() != myFaction) if (newLeader.getFaction() != usenderFaction)
{ {
msg("%s<i> is not a member in the faction.", newLeader.describeTo(fme, true)); msg("%s<i> is not a member in the faction.", newLeader.describeTo(usender, true));
return; return;
} }
if (newLeader == fme) if (newLeader == usender)
{ {
msg("<b>The target player musn't be yourself."); msg("<b>The target player musn't be yourself.");
return; return;
@ -75,8 +75,8 @@ public class CmdFactionsLeader extends FCommand
if (targetFactionCurrentLeader == newLeader) if (targetFactionCurrentLeader == newLeader)
{ {
targetFaction.promoteNewLeader(); targetFaction.promoteNewLeader();
msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(fme, true)); msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(usender, true));
newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", fme.describeTo(newLeader, true)); newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", usender.describeTo(newLeader, true));
return; return;
} }
@ -87,12 +87,12 @@ public class CmdFactionsLeader extends FCommand
} }
newLeader.setFaction(targetFaction); newLeader.setFaction(targetFaction);
newLeader.setRole(Rel.LEADER); newLeader.setRole(Rel.LEADER);
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(fme, true)); msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(usender, true));
// Inform all players // Inform all players
for (UPlayer uplayer : UPlayerColls.get().get(sender).getAllOnline()) for (UPlayer uplayer : UPlayerColls.get().get(sender).getAllOnline())
{ {
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)); 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));
} }
} }
} }

View File

@ -18,7 +18,7 @@ public class CmdFactionsLeave extends FCommand {
@Override @Override
public void perform() public void perform()
{ {
fme.leave(); usender.leave();
} }
} }

View File

@ -57,7 +57,7 @@ public class CmdFactionsList extends FCommand
continue; continue;
} }
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d", lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
faction.getName(fme), faction.getName(usender),
faction.getUPlayersWhereOnline(true).size(), faction.getUPlayersWhereOnline(true).size(),
faction.getUPlayers().size(), faction.getUPlayers().size(),
faction.getLandCount(), faction.getLandCount(),

View File

@ -28,11 +28,11 @@ public class CmdFactionsMap extends FCommand
return; return;
} }
if (this.arg(0, ARBoolean.get(), !mme.isMapAutoUpdating())) if (this.arg(0, ARBoolean.get(), !msender.isMapAutoUpdating()))
{ {
// Turn on // Turn on
mme.setMapAutoUpdating(true); msender.setMapAutoUpdating(true);
msg("<i>Map auto update <green>ENABLED."); msg("<i>Map auto update <green>ENABLED.");
// And show the map once // And show the map once
@ -41,14 +41,14 @@ public class CmdFactionsMap extends FCommand
else else
{ {
// Turn off // Turn off
mme.setMapAutoUpdating(false); msender.setMapAutoUpdating(false);
msg("<i>Map auto update <red>DISABLED."); msg("<i>Map auto update <red>DISABLED.");
} }
} }
public void showMap() public void showMap()
{ {
sendMessage(BoardColls.get().getMap(myFaction, PS.valueOf(me), fme.getPlayer().getLocation().getYaw())); sendMessage(BoardColls.get().getMap(usenderFaction, PS.valueOf(me), usender.getPlayer().getLocation().getYaw()));
} }
} }

View File

@ -22,12 +22,12 @@ public class CmdFactionsMoneyBalance extends FCommand
@Override @Override
public void perform() public void perform()
{ {
Faction faction = this.arg(0, ARFaction.get(sender), myFaction); Faction faction = this.arg(0, ARFaction.get(sender), usenderFaction);
if (faction == null) return; if (faction == null) return;
if (faction != myFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return; if (faction != usenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
Econ.sendBalanceInfo(fme, faction); Econ.sendBalanceInfo(usender, faction);
} }
} }

View File

@ -35,14 +35,14 @@ public class CmdFactionsMoneyDeposit extends FCommand
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return; if (amount == null) return;
Faction faction = this.arg(1, ARFaction.get(sender), myFaction); Faction faction = this.arg(1, ARFaction.get(sender), usenderFaction);
if (faction == null) return; if (faction == null) return;
boolean success = Econ.transferMoney(fme, fme, faction, amount); boolean success = Econ.transferMoney(usender, usender, faction, amount);
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Money.format(fme, amount), faction.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(usender, amount), faction.describeTo(null))));
} }
} }

View File

@ -41,11 +41,11 @@ public class CmdFactionsMoneyTransferFf extends FCommand
Faction to = this.arg(2, ARFaction.get(sender)); Faction to = this.arg(2, ARFaction.get(sender));
if (to == null) return; if (to == null) return;
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(usender, from, to, amount);
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -43,11 +43,11 @@ public class CmdFactionsMoneyTransferFp extends FCommand
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender)); UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
if (to == null) return; if (to == null) return;
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(usender, from, to, amount);
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -43,11 +43,11 @@ public class CmdFactionsMoneyTransferPf extends FCommand
Faction to = this.arg(2, ARFaction.get(sender)); Faction to = this.arg(2, ARFaction.get(sender));
if (to == null) return; if (to == null) return;
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(usender, from, to, amount);
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -35,16 +35,16 @@ public class CmdFactionsMoneyWithdraw extends FCommand
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return; if (amount == null) return;
Faction from = this.arg(1, ARFaction.get(sender), myFaction); Faction from = this.arg(1, ARFaction.get(sender), usenderFaction);
if (from == null) return; if (from == null) return;
UPlayer to = fme; UPlayer to = usender;
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(usender, from, to, amount);
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Money.format(from, amount), from.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(from, amount), from.describeTo(null))));
} }
} }
} }

View File

@ -33,8 +33,8 @@ public class CmdFactionsName extends FCommand
// TODO does not first test cover selfcase? // TODO does not first test cover selfcase?
FactionColl factionColl = FactionColls.get().get(myFaction); FactionColl factionColl = FactionColls.get().get(usenderFaction);
if (factionColl.isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(myFaction.getComparisonName())) if (factionColl.isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(usenderFaction.getComparisonName()))
{ {
msg("<b>That name is already taken"); msg("<b>That name is already taken");
return; return;
@ -49,24 +49,24 @@ public class CmdFactionsName extends FCommand
} }
// Event // Event
FactionsEventNameChange event = new FactionsEventNameChange(sender, myFaction, newName); FactionsEventNameChange event = new FactionsEventNameChange(sender, usenderFaction, newName);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newName = event.getNewName(); newName = event.getNewName();
// Apply // Apply
String oldName = myFaction.getName(); String oldName = usenderFaction.getName();
myFaction.setName(newName); usenderFaction.setName(newName);
// Inform // Inform
myFaction.msg("%s<i> changed your faction name to %s", fme.describeTo(myFaction, true), myFaction.getName(myFaction)); usenderFaction.msg("%s<i> changed your faction name to %s", usender.describeTo(usenderFaction, true), usenderFaction.getName(usenderFaction));
for (Faction faction : FactionColls.get().get(myFaction).getAll()) for (Faction faction : FactionColls.get().get(usenderFaction).getAll())
{ {
if (faction == myFaction) if (faction == usenderFaction)
{ {
continue; continue;
} }
faction.msg("<i>The faction %s<i> changed their name to %s.", fme.getColorTo(faction)+oldName, myFaction.getName(faction)); faction.msg("<i>The faction %s<i> changed their name to %s.", usender.getColorTo(faction)+oldName, usenderFaction.getName(faction));
} }
} }

View File

@ -28,19 +28,19 @@ public class CmdFactionsOfficer extends FCommand
boolean permAny = Perm.OFFICER_ANY.has(sender, false); boolean permAny = Perm.OFFICER_ANY.has(sender, false);
Faction targetFaction = you.getFaction(); Faction targetFaction = you.getFaction();
if (targetFaction != myFaction && !permAny) if (targetFaction != usenderFaction && !permAny)
{ {
msg("%s<b> is not a member in your faction.", you.describeTo(fme, true)); msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
return; return;
} }
if (fme != null && fme.getRole() != Rel.LEADER && !permAny) if (usender != null && usender.getRole() != Rel.LEADER && !permAny)
{ {
msg("<b>You are not the faction leader."); msg("<b>You are not the faction leader.");
return; return;
} }
if (you == fme && !permAny) if (you == usender && !permAny)
{ {
msg("<b>The target player musn't be yourself."); msg("<b>The target player musn't be yourself.");
return; return;
@ -57,14 +57,14 @@ public class CmdFactionsOfficer extends FCommand
// Revoke // Revoke
you.setRole(Rel.MEMBER); you.setRole(Rel.MEMBER);
targetFaction.msg("%s<i> is no longer officer in your faction.", you.describeTo(targetFaction, true)); targetFaction.msg("%s<i> is no longer officer in your faction.", you.describeTo(targetFaction, true));
msg("<i>You have removed officer status from %s<i>.", you.describeTo(fme, true)); msg("<i>You have removed officer status from %s<i>.", you.describeTo(usender, true));
} }
else else
{ {
// Give // Give
you.setRole(Rel.OFFICER); you.setRole(Rel.OFFICER);
targetFaction.msg("%s<i> was promoted to officer in your faction.", you.describeTo(targetFaction, true)); targetFaction.msg("%s<i> was promoted to officer in your faction.", you.describeTo(targetFaction, true));
msg("<i>You have promoted %s<i> to officer.", you.describeTo(fme, true)); msg("<i>You have promoted %s<i> to officer.", you.describeTo(usender, true));
} }
} }

View File

@ -23,21 +23,21 @@ public class CmdFactionsOpen extends FCommand
public void perform() public void perform()
{ {
// Args // Args
Boolean newOpen = this.arg(0, ARBoolean.get(), !myFaction.isOpen()); Boolean newOpen = this.arg(0, ARBoolean.get(), !usenderFaction.isOpen());
if (newOpen == null) return; if (newOpen == null) return;
// Event // Event
FactionsEventOpenChange event = new FactionsEventOpenChange(sender, myFaction, newOpen); FactionsEventOpenChange event = new FactionsEventOpenChange(sender, usenderFaction, newOpen);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newOpen = event.isNewOpen(); newOpen = event.isNewOpen();
// Apply // Apply
myFaction.setOpen(newOpen); usenderFaction.setOpen(newOpen);
// Inform // Inform
String descTarget = myFaction.isOpen() ? "open" : "closed"; String descTarget = usenderFaction.isOpen() ? "open" : "closed";
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), descTarget); usenderFaction.msg("%s<i> changed the faction to <h>%s<i>.", usender.describeTo(usenderFaction, true), descTarget);
} }
} }

View File

@ -29,12 +29,12 @@ public class CmdFactionsPerm extends FCommand
@Override @Override
public void perform() public void perform()
{ {
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction); Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
if (faction == null) return; if (faction == null) return;
if ( ! this.argIsSet(1)) if ( ! this.argIsSet(1))
{ {
msg(Txt.titleize("Perms for " + faction.describeTo(fme, true))); msg(Txt.titleize("Perms for " + faction.describeTo(usender, true)));
msg(FPerm.getStateHeaders()); msg(FPerm.getStateHeaders());
for (FPerm perm : FPerm.values()) for (FPerm perm : FPerm.values())
{ {
@ -48,7 +48,7 @@ public class CmdFactionsPerm extends FCommand
if ( ! this.argIsSet(2)) if ( ! this.argIsSet(2))
{ {
msg(Txt.titleize("Perm for " + faction.describeTo(fme, true))); msg(Txt.titleize("Perm for " + faction.describeTo(usender, true)));
msg(FPerm.getStateHeaders()); msg(FPerm.getStateHeaders());
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true)); msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
return; return;
@ -72,7 +72,7 @@ public class CmdFactionsPerm extends FCommand
faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true); faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true);
} }
msg(Txt.titleize("Perm for " + faction.describeTo(fme, true))); msg(Txt.titleize("Perm for " + faction.describeTo(usender, true)));
msg(FPerm.getStateHeaders()); msg(FPerm.getStateHeaders());
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true)); msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
} }

View File

@ -22,7 +22,7 @@ public class CmdFactionsPowerBoost extends FCommand
@Override @Override
public void perform() public void perform()
{ {
Faction faction = this.arg(0, ARFaction.get(fme)); Faction faction = this.arg(0, ARFaction.get(usender));
if (faction == null) return; if (faction == null) return;
Double amount = this.arg(1, ARDouble.get()); Double amount = this.arg(1, ARDouble.get());
@ -33,6 +33,6 @@ public class CmdFactionsPowerBoost extends FCommand
msg("<i>"+faction.getName()+" now has a power bonus/penalty of "+amount+" to min and max power levels."); msg("<i>"+faction.getName()+" now has a power bonus/penalty of "+amount+" to min and max power levels.");
// TODO: Inconsistent. Why is there no boolean to toggle this logging of? // TODO: Inconsistent. Why is there no boolean to toggle this logging of?
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+faction.getName()+" to "+amount+"."); Factions.get().log(usender.getName()+" has set the power bonus/penalty for "+faction.getName()+" to "+amount+".");
} }
} }

View File

@ -28,13 +28,13 @@ public class CmdFactionsPromote extends FCommand
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
if (you == null) return; if (you == null) return;
if (you.getFaction() != myFaction) if (you.getFaction() != usenderFaction)
{ {
msg("%s<b> is not a member in your faction.", you.describeTo(fme, true)); msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
return; return;
} }
if (you == fme) if (you == usender)
{ {
msg("<b>The target player mustn't be yourself."); msg("<b>The target player mustn't be yourself.");
return; return;
@ -42,24 +42,24 @@ public class CmdFactionsPromote extends FCommand
if (you.getRole() == Rel.RECRUIT) if (you.getRole() == Rel.RECRUIT)
{ {
if (!fme.getRole().isAtLeast(Rel.OFFICER)) if (!usender.getRole().isAtLeast(Rel.OFFICER))
{ {
msg("<b>You must be an officer to promote someone to member."); msg("<b>You must be an officer to promote someone to member.");
return; return;
} }
you.setRole(Rel.MEMBER); you.setRole(Rel.MEMBER);
myFaction.msg("%s<i> was promoted to being a member of your faction.", you.describeTo(myFaction, true)); usenderFaction.msg("%s<i> was promoted to being a member of your faction.", you.describeTo(usenderFaction, true));
} }
else if (you.getRole() == Rel.MEMBER) else if (you.getRole() == Rel.MEMBER)
{ {
if (!fme.getRole().isAtLeast(Rel.LEADER)) if (!usender.getRole().isAtLeast(Rel.LEADER))
{ {
msg("<b>You must be the leader to promote someone to officer."); msg("<b>You must be the leader to promote someone to officer.");
return; return;
} }
// Give // Give
you.setRole(Rel.OFFICER); you.setRole(Rel.OFFICER);
myFaction.msg("%s<i> was promoted to being a officer in your faction.", you.describeTo(myFaction, true)); usenderFaction.msg("%s<i> was promoted to being a officer in your faction.", you.describeTo(usenderFaction, true));
} }
} }

View File

@ -39,40 +39,40 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
// Verify // Verify
if (otherFaction == myFaction) if (otherFaction == usenderFaction)
{ {
msg("<b>Nope! You can't declare a relation to yourself :)"); msg("<b>Nope! You can't declare a relation to yourself :)");
return; return;
} }
if (myFaction.getRelationWish(otherFaction) == newRelation) if (usenderFaction.getRelationWish(otherFaction) == newRelation)
{ {
msg("<b>You already have that relation wish set with %s.", otherFaction.getName()); msg("<b>You already have that relation wish set with %s.", otherFaction.getName());
return; return;
} }
// Event // Event
FactionsEventRelationChange event = new FactionsEventRelationChange(sender, myFaction, otherFaction, newRelation); FactionsEventRelationChange event = new FactionsEventRelationChange(sender, usenderFaction, otherFaction, newRelation);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newRelation = event.getNewRelation(); newRelation = event.getNewRelation();
// try to set the new relation // try to set the new relation
myFaction.setRelationWish(otherFaction, newRelation); usenderFaction.setRelationWish(otherFaction, newRelation);
Rel currentRelation = myFaction.getRelationTo(otherFaction, true); Rel currentRelation = usenderFaction.getRelationTo(otherFaction, true);
// if the relation change was successful // if the relation change was successful
if (newRelation == currentRelation) if (newRelation == currentRelation)
{ {
otherFaction.msg("%s<i> is now %s.", myFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne()); otherFaction.msg("%s<i> is now %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
myFaction.msg("%s<i> is now %s.", otherFaction.describeTo(myFaction, true), newRelation.getDescFactionOne()); usenderFaction.msg("%s<i> is now %s.", otherFaction.describeTo(usenderFaction, true), newRelation.getDescFactionOne());
} }
// inform the other faction of your request // inform the other faction of your request
else else
{ {
otherFaction.msg("%s<i> wishes to be %s.", myFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne()); otherFaction.msg("%s<i> wishes to be %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
otherFaction.msg("<i>Type <c>/"+ConfServer.baseCommandAliases.get(0)+" "+newRelation+" "+myFaction.getName()+"<i> to accept."); otherFaction.msg("<i>Type <c>/"+ConfServer.baseCommandAliases.get(0)+" "+newRelation+" "+usenderFaction.getName()+"<i> to accept.");
myFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(myFaction, true), newRelation.getColor()+newRelation.getDescFactionOne()); usenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(usenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
} }
// TODO: The ally case should work!! // TODO: The ally case should work!!
@ -80,13 +80,13 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
if ( newRelation != Rel.TRUCE && otherFaction.getFlag(FFlag.PEACEFUL)) if ( newRelation != Rel.TRUCE && otherFaction.getFlag(FFlag.PEACEFUL))
{ {
otherFaction.msg("<i>This will have no effect while your faction is peaceful."); otherFaction.msg("<i>This will have no effect while your faction is peaceful.");
myFaction.msg("<i>This will have no effect while their faction is peaceful."); usenderFaction.msg("<i>This will have no effect while their faction is peaceful.");
} }
if ( newRelation != Rel.TRUCE && myFaction.getFlag(FFlag.PEACEFUL)) if ( newRelation != Rel.TRUCE && usenderFaction.getFlag(FFlag.PEACEFUL))
{ {
otherFaction.msg("<i>This will have no effect while their faction is peaceful."); otherFaction.msg("<i>This will have no effect while their faction is peaceful.");
myFaction.msg("<i>This will have no effect while your faction is peaceful."); usenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
} }
} }
} }

View File

@ -27,7 +27,7 @@ public class CmdFactionsSethome extends FCommand
public void perform() public void perform()
{ {
// Args // Args
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction); Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
if (faction == null) return; if (faction == null) return;
PS newHome = PS.valueOf(me.getLocation()); PS newHome = PS.valueOf(me.getLocation());
@ -35,7 +35,7 @@ public class CmdFactionsSethome extends FCommand
// Validate // Validate
if ( ! UConf.get(faction).homesEnabled) if ( ! UConf.get(faction).homesEnabled)
{ {
fme.msg("<b>Sorry, Faction homes are disabled on this server."); usender.msg("<b>Sorry, Faction homes are disabled on this server.");
return; return;
} }
@ -43,9 +43,9 @@ public class CmdFactionsSethome extends FCommand
if ( ! FPerm.SETHOME.has(sender, faction, true)) return; if ( ! FPerm.SETHOME.has(sender, faction, true)) return;
// Verify // Verify
if (!fme.isUsingAdminMode() && !faction.isValidHome(newHome)) if (!usender.isUsingAdminMode() && !faction.isValidHome(newHome))
{ {
fme.msg("<b>Sorry, your faction home can only be set inside your own claimed territory."); usender.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
return; return;
} }
@ -59,11 +59,11 @@ public class CmdFactionsSethome extends FCommand
faction.setHome(newHome); faction.setHome(newHome);
// Inform // Inform
faction.msg("%s<i> set the home for your faction. You can now use:", fme.describeTo(myFaction, true)); faction.msg("%s<i> set the home for your faction. You can now use:", usender.describeTo(usenderFaction, true));
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate()); faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
if (faction != myFaction) if (faction != usenderFaction)
{ {
fme.msg("<b>You have set the home for the "+faction.getName(fme)+"<i> faction."); usender.msg("<b>You have set the home for the "+faction.getName(usender)+"<i> faction.");
} }
} }

View File

@ -33,7 +33,7 @@ public class CmdFactionsShow extends FCommand
@Override @Override
public void perform() public void perform()
{ {
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction); Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
if (faction == null) return; if (faction == null) return;
UConf uconf = UConf.get(faction); UConf uconf = UConf.get(faction);
@ -43,7 +43,7 @@ public class CmdFactionsShow extends FCommand
Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER); Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
Collection<UPlayer> recruits = faction.getUPlayersWhereRole(Rel.RECRUIT); Collection<UPlayer> recruits = faction.getUPlayersWhereRole(Rel.RECRUIT);
msg(Txt.titleize(faction.getName(fme))); msg(Txt.titleize(faction.getName(usender)));
msg("<a>Description: <i>%s", faction.getDescription()); msg("<a>Description: <i>%s", faction.getDescription());
// Display important flags // Display important flags
@ -99,7 +99,7 @@ public class CmdFactionsShow extends FCommand
String sepparator = Txt.parse("<i>")+", "; String sepparator = Txt.parse("<i>")+", ";
// List the relations to other factions // List the relations to other factions
Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(fme, true); Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(usender, true);
if (faction.getFlag(FFlag.PEACEFUL)) if (faction.getFlag(FFlag.PEACEFUL))
{ {
@ -121,11 +121,11 @@ public class CmdFactionsShow extends FCommand
{ {
if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
{ {
memberOnlineNames.add(follower.getNameAndTitle(fme)); memberOnlineNames.add(follower.getNameAndTitle(usender));
} }
else else
{ {
memberOfflineNames.add(follower.getNameAndTitle(fme)); memberOfflineNames.add(follower.getNameAndTitle(usender));
} }
} }
@ -133,11 +133,11 @@ public class CmdFactionsShow extends FCommand
{ {
if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
{ {
memberOnlineNames.add(follower.getNameAndTitle(fme)); memberOnlineNames.add(follower.getNameAndTitle(usender));
} }
else else
{ {
memberOfflineNames.add(follower.getNameAndTitle(fme)); memberOfflineNames.add(follower.getNameAndTitle(usender));
} }
} }
@ -145,11 +145,11 @@ public class CmdFactionsShow extends FCommand
{ {
if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
{ {
memberOnlineNames.add(follower.getNameAndTitle(fme)); memberOnlineNames.add(follower.getNameAndTitle(usender));
} }
else else
{ {
memberOfflineNames.add(follower.getNameAndTitle(fme)); memberOfflineNames.add(follower.getNameAndTitle(usender));
} }
} }
@ -157,11 +157,11 @@ public class CmdFactionsShow extends FCommand
{ {
if (follower.isOnline()) if (follower.isOnline())
{ {
memberOnlineNames.add(follower.getNameAndTitle(fme)); memberOnlineNames.add(follower.getNameAndTitle(usender));
} }
else else
{ {
memberOfflineNames.add(follower.getNameAndTitle(fme)); memberOfflineNames.add(follower.getNameAndTitle(usender));
} }
} }
sendMessage(Txt.parse("<a>Members online: ") + Txt.implode(memberOnlineNames, sepparator)); sendMessage(Txt.parse("<a>Members online: ") + Txt.implode(memberOnlineNames, sepparator));

View File

@ -33,7 +33,7 @@ public class CmdFactionsTitle extends FCommand
if (newTitle == null) return; if (newTitle == null) return;
// Verify // Verify
if ( ! canIAdministerYou(fme, you)) return; if ( ! canIAdministerYou(usender, you)) return;
// Event // Event
FactionsEventTitleChange event = new FactionsEventTitleChange(sender, you, newTitle); FactionsEventTitleChange event = new FactionsEventTitleChange(sender, you, newTitle);
@ -45,7 +45,7 @@ public class CmdFactionsTitle extends FCommand
you.setTitle(newTitle); you.setTitle(newTitle);
// Inform // Inform
myFaction.msg("%s<i> changed a title: %s", fme.describeTo(myFaction, true), you.describeTo(myFaction, true)); usenderFaction.msg("%s<i> changed a title: %s", usender.describeTo(usenderFaction, true), you.describeTo(usenderFaction, true));
} }
} }

View File

@ -26,10 +26,10 @@ public class CmdFactionsUnclaim extends FCommand
Faction newFaction = FactionColls.get().get(me).getNone(); Faction newFaction = FactionColls.get().get(me).getNone();
// FPerm // FPerm
if (!FPerm.TERRITORY.has(sender, myFaction, true)) return; if (!FPerm.TERRITORY.has(sender, usenderFaction, true)) return;
// Apply // Apply
if (fme.tryClaim(newFaction, chunk, true, true)) return; if (usender.tryClaim(newFaction, chunk, true, true)) return;
} }
} }

View File

@ -30,7 +30,7 @@ public class CmdFactionsUnclaimall extends FCommand
public void perform() public void perform()
{ {
// Args // Args
Faction faction = myFaction; Faction faction = usenderFaction;
Faction newFaction = FactionColls.get().get(faction).getNone(); Faction newFaction = FactionColls.get().get(faction).getNone();
// FPerm // FPerm
@ -58,12 +58,12 @@ public class CmdFactionsUnclaimall extends FCommand
} }
// Inform // Inform
myFaction.msg("%s<i> unclaimed <h>5 <i> of your <h>200 <i>faction land. You now have <h>23 <i>land left.", fme.describeTo(myFaction, true), countSuccess, countTotal, countFail); usenderFaction.msg("%s<i> unclaimed <h>5 <i> of your <h>200 <i>faction land. You now have <h>23 <i>land left.", usender.describeTo(usenderFaction, true), countSuccess, countTotal, countFail);
// Log // Log
if (MConf.get().logLandUnclaims) if (MConf.get().logLandUnclaims)
{ {
Factions.get().log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getName()); Factions.get().log(usender.getName()+" unclaimed everything for the faction: "+usenderFaction.getName());
} }
} }

View File

@ -9,16 +9,16 @@ import com.massivecraft.mcore.util.Txt;
public abstract class FCommand extends MCommand public abstract class FCommand extends MCommand
{ {
public MPlayer mme; public MPlayer msender;
public UPlayer fme; public UPlayer usender;
public Faction myFaction; public Faction usenderFaction;
@Override @Override
public void fixSenderVars() public void fixSenderVars()
{ {
this.mme = MPlayer.get(sender); this.msender = MPlayer.get(sender);
this.fme = UPlayer.get(this.sender); this.usender = UPlayer.get(this.sender);
this.myFaction = this.fme.getFaction(); this.usenderFaction = this.usender.getFaction();
} }
// -------------------------------------------- // // -------------------------------------------- //