Renaming sender vars in the command system to more proper names.
This commit is contained in:
parent
882bdf4c88
commit
e32a741b3b
@ -42,7 +42,7 @@ public class CmdFactionsAccess extends FCommand
|
||||
if (type.isEmpty() || type.equals("view"))
|
||||
{
|
||||
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.");
|
||||
return;
|
||||
@ -52,7 +52,7 @@ public class CmdFactionsAccess extends FCommand
|
||||
}
|
||||
|
||||
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;
|
||||
if (type.equals("f") || type.equals("faction"))
|
||||
@ -72,14 +72,14 @@ public class CmdFactionsAccess extends FCommand
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(fme), fme);
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(usender), usender);
|
||||
if (targetPlayer == null) return;
|
||||
added = territory.toggleFPlayer(targetPlayer);
|
||||
target = "Player \""+targetPlayer.getName()+"\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(myFaction), myFaction);
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(usenderFaction), usenderFaction);
|
||||
if (targetFaction == null) return;
|
||||
added = territory.toggleFaction(targetFaction);
|
||||
target = "Faction \""+targetFaction.getName()+"\"";
|
||||
|
@ -19,20 +19,20 @@ public class CmdFactionsAdmin extends FCommand
|
||||
@Override
|
||||
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;
|
||||
|
||||
fme.setUsingAdminMode(target);
|
||||
usender.setUsingAdminMode(target);
|
||||
|
||||
if ( fme.isUsingAdminMode())
|
||||
if ( usender.isUsingAdminMode())
|
||||
{
|
||||
fme.msg("<i>You have enabled admin bypass mode.");
|
||||
Factions.get().log(fme.getName() + " has ENABLED admin bypass mode.");
|
||||
usender.msg("<i>You have enabled admin bypass mode.");
|
||||
Factions.get().log(usender.getName() + " has ENABLED admin bypass mode.");
|
||||
}
|
||||
else
|
||||
{
|
||||
fme.msg("<i>You have disabled admin bypass mode.");
|
||||
Factions.get().log(fme.getName() + " DISABLED admin bypass mode.");
|
||||
usender.msg("<i>You have disabled admin bypass mode.");
|
||||
Factions.get().log(usender.getName() + " DISABLED admin bypass mode.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,20 +23,20 @@ public class CmdFactionsAutoClaim extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
Faction forFaction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||
if (forFaction == null || forFaction == fme.getAutoClaimFaction())
|
||||
Faction forFaction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
|
||||
if (forFaction == null || forFaction == usender.getAutoClaimFaction())
|
||||
{
|
||||
fme.setAutoClaimFaction(null);
|
||||
usender.setAutoClaimFaction(null);
|
||||
msg("<i>Auto-claiming of land disabled.");
|
||||
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));
|
||||
fme.tryClaim(forFaction, PS.valueOf(me), true, true);
|
||||
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(usender));
|
||||
usender.tryClaim(forFaction, PS.valueOf(me), true, true);
|
||||
}
|
||||
|
||||
}
|
@ -33,7 +33,7 @@ public class CmdFactionsClaim extends FCommand
|
||||
Integer radius = this.arg(0, ARInteger.get(), 1);
|
||||
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;
|
||||
|
||||
// FPerm
|
||||
@ -46,7 +46,7 @@ public class CmdFactionsClaim extends FCommand
|
||||
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);
|
||||
return;
|
||||
@ -57,7 +57,7 @@ public class CmdFactionsClaim extends FCommand
|
||||
// single chunk
|
||||
if (radius < 2)
|
||||
{
|
||||
fme.tryClaim(forFaction, PS.valueOf(me), true, true);
|
||||
usender.tryClaim(forFaction, PS.valueOf(me), true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class CmdFactionsClaim extends FCommand
|
||||
@Override
|
||||
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)
|
||||
{
|
||||
this.failCount = 0;
|
||||
|
@ -34,13 +34,13 @@ public class CmdFactionsCreate extends FCommand
|
||||
String newName = this.arg(0);
|
||||
|
||||
// Verify
|
||||
if (fme.getFaction().isNormal())
|
||||
if (usender.getFaction().isNormal())
|
||||
{
|
||||
msg("<b>You must leave your current faction first.");
|
||||
return;
|
||||
}
|
||||
|
||||
FactionColl coll = FactionColls.get().get(fme);
|
||||
FactionColl coll = FactionColls.get().get(usender);
|
||||
|
||||
if (coll.isNameTaken(newName))
|
||||
{
|
||||
@ -67,24 +67,24 @@ public class CmdFactionsCreate extends FCommand
|
||||
Faction faction = coll.create(factionId);
|
||||
faction.setName(newName);
|
||||
|
||||
fme.setRole(Rel.LEADER);
|
||||
fme.setFaction(faction);
|
||||
usender.setRole(Rel.LEADER);
|
||||
usender.setFaction(faction);
|
||||
|
||||
FactionsEventMembershipChange joinEvent = new FactionsEventMembershipChange(sender, fme, faction, MembershipChangeReason.CREATE);
|
||||
FactionsEventMembershipChange joinEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
|
||||
joinEvent.run();
|
||||
// NOTE: join event cannot be cancelled or you'll have an empty faction
|
||||
|
||||
// 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());
|
||||
|
||||
if (MConf.get().logFactionCreate)
|
||||
{
|
||||
Factions.get().log(fme.getName()+" created a new faction: "+newName);
|
||||
Factions.get().log(usender.getName()+" created a new faction: "+newName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,16 +25,16 @@ public class CmdFactionsDemote extends FCommand
|
||||
@Override
|
||||
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.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;
|
||||
}
|
||||
|
||||
if (you == fme)
|
||||
if (you == usender)
|
||||
{
|
||||
msg("<b>The target player mustn't be yourself.");
|
||||
return;
|
||||
@ -42,23 +42,23 @@ public class CmdFactionsDemote extends FCommand
|
||||
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,16 +27,16 @@ public class CmdFactionsDescription extends FCommand
|
||||
String newDescription = this.argConcatFrom(1);
|
||||
|
||||
// Event
|
||||
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, myFaction, newDescription);
|
||||
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, usenderFaction, newDescription);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newDescription = event.getNewDescription();
|
||||
|
||||
// Apply
|
||||
myFaction.setDescription(this.argConcatFrom(1));
|
||||
usenderFaction.setDescription(this.argConcatFrom(1));
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class CmdFactionsDisband extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(fme), myFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(usender), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// FPerm
|
||||
@ -58,9 +58,9 @@ public class CmdFactionsDisband extends FCommand
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
uplayer.msg("<h>%s<i> disbanded your faction.", who);
|
||||
@ -73,7 +73,7 @@ public class CmdFactionsDisband extends FCommand
|
||||
|
||||
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())+".");
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,12 +26,12 @@ public class CmdFactionsFlag extends FCommand
|
||||
@Override
|
||||
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 ( ! 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())
|
||||
{
|
||||
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
||||
@ -44,7 +44,7 @@ public class CmdFactionsFlag extends FCommand
|
||||
|
||||
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));
|
||||
return;
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class CmdFactionsFlag extends FCommand
|
||||
if ( ! Perm.FLAG_SET.has(sender, true)) return;
|
||||
|
||||
// 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);
|
||||
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
||||
}
|
||||
|
@ -40,32 +40,32 @@ public class CmdFactionsHome extends FCommand
|
||||
// TODO: Hide this command on help also.
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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:"));
|
||||
fme.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
|
||||
usender.msg("<b>Your faction does not have a home. " + (usender.getRole().isLessThan(Rel.OFFICER) ? "<i> Ask your leader to:" : "<i>You should:"));
|
||||
usender.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -81,10 +81,10 @@ public class CmdFactionsHome extends FCommand
|
||||
faction.getFlag(FFlag.PVP)
|
||||
&&
|
||||
(
|
||||
! fme.isInOwnTerritory()
|
||||
! usender.isInOwnTerritory()
|
||||
||
|
||||
(
|
||||
fme.isInOwnTerritory()
|
||||
usender.isInOwnTerritory()
|
||||
&&
|
||||
! uconf.homesTeleportIgnoreEnemiesIfInOwnTerritory
|
||||
)
|
||||
@ -102,7 +102,7 @@ public class CmdFactionsHome extends FCommand
|
||||
continue;
|
||||
|
||||
UPlayer fp = UPlayer.get(p);
|
||||
if (fme.getRelationTo(fp) != Rel.ENEMY)
|
||||
if (usender.getRelationTo(fp) != Rel.ENEMY)
|
||||
continue;
|
||||
|
||||
Location l = p.getLocation();
|
||||
@ -115,7 +115,7 @@ public class CmdFactionsHome extends FCommand
|
||||
if (dx > max || dy > max || dz > max)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class CmdFactionsHome extends FCommand
|
||||
// Apply
|
||||
try
|
||||
{
|
||||
Mixin.teleport(me, myFaction.getHome(), "your faction home", sender);
|
||||
Mixin.teleport(me, usenderFaction.getHome(), "your faction home", sender);
|
||||
}
|
||||
catch (TeleporterException e)
|
||||
{
|
||||
|
@ -30,39 +30,39 @@ public class CmdFactionsInvite extends FCommand
|
||||
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
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;
|
||||
|
||||
// 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));
|
||||
return;
|
||||
}
|
||||
|
||||
// FPerm
|
||||
if ( ! FPerm.INVITE.has(sender, myFaction, true)) return;
|
||||
if ( ! FPerm.INVITE.has(sender, usenderFaction, true)) return;
|
||||
|
||||
// Event
|
||||
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, myFaction, newInvited);
|
||||
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, usenderFaction, newInvited);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newInvited = event.isNewInvited();
|
||||
|
||||
// Apply
|
||||
myFaction.setInvited(uplayer, newInvited);
|
||||
usenderFaction.setInvited(uplayer, newInvited);
|
||||
|
||||
// Inform
|
||||
if (newInvited)
|
||||
{
|
||||
uplayer.msg("%s<i> invited you to %s", fme.describeTo(uplayer, true), myFaction.describeTo(uplayer));
|
||||
myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), uplayer.describeTo(myFaction));
|
||||
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));
|
||||
}
|
||||
else
|
||||
{
|
||||
uplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(uplayer), myFaction.describeTo(uplayer));
|
||||
myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), uplayer.describeTo(myFaction));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class CmdFactionsJoin extends FCommand
|
||||
Faction faction = this.arg(0, ARFaction.get(sender));
|
||||
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;
|
||||
Faction uplayerFaction = uplayer.getFaction();
|
||||
|
||||
boolean samePlayer = uplayer == fme;
|
||||
boolean samePlayer = uplayer == usender;
|
||||
|
||||
// Validate
|
||||
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
|
||||
@ -46,29 +46,29 @@ public class CmdFactionsJoin extends FCommand
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.");
|
||||
if (samePlayer)
|
||||
@ -79,17 +79,17 @@ public class CmdFactionsJoin extends FCommand
|
||||
}
|
||||
|
||||
// Event
|
||||
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fme, faction, MembershipChangeReason.JOIN);
|
||||
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN);
|
||||
membershipChangeEvent.run();
|
||||
if (membershipChangeEvent.isCancelled()) return;
|
||||
|
||||
// Inform
|
||||
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));
|
||||
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
|
||||
uplayer.resetFactionData();
|
||||
@ -103,7 +103,7 @@ public class CmdFactionsJoin extends FCommand
|
||||
if (samePlayer)
|
||||
Factions.get().log("%s joined the faction %s.", uplayer.getName(), faction.getName());
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,14 +34,14 @@ public class CmdFactionsKick extends FCommand
|
||||
if (uplayer == null) return;
|
||||
|
||||
// Validate
|
||||
if (fme == uplayer)
|
||||
if (usender == uplayer)
|
||||
{
|
||||
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 || fme.isUsingAdminMode()))
|
||||
if (uplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
|
||||
{
|
||||
msg("<b>The leader can not be kicked.");
|
||||
return;
|
||||
@ -63,16 +63,16 @@ public class CmdFactionsKick extends FCommand
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
// Inform
|
||||
uplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(uplayerFaction, true), uplayer.describeTo(uplayerFaction, true));
|
||||
uplayer.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer));
|
||||
if (uplayerFaction != myFaction)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
|
@ -31,32 +31,32 @@ public class CmdFactionsLeader extends FCommand
|
||||
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
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;
|
||||
|
||||
UPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
||||
|
||||
// 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
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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()));
|
||||
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;
|
||||
}
|
||||
|
||||
if (newLeader == fme)
|
||||
if (newLeader == usender)
|
||||
{
|
||||
msg("<b>The target player musn't be yourself.");
|
||||
return;
|
||||
@ -75,8 +75,8 @@ public class CmdFactionsLeader extends FCommand
|
||||
if (targetFactionCurrentLeader == newLeader)
|
||||
{
|
||||
targetFaction.promoteNewLeader();
|
||||
msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(fme, true));
|
||||
newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", fme.describeTo(newLeader, 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>.", usender.describeTo(newLeader, true));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -87,12 +87,12 @@ public class CmdFactionsLeader extends FCommand
|
||||
}
|
||||
newLeader.setFaction(targetFaction);
|
||||
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
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class CmdFactionsLeave extends FCommand {
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
fme.leave();
|
||||
usender.leave();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class CmdFactionsList extends FCommand
|
||||
continue;
|
||||
}
|
||||
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
||||
faction.getName(fme),
|
||||
faction.getName(usender),
|
||||
faction.getUPlayersWhereOnline(true).size(),
|
||||
faction.getUPlayers().size(),
|
||||
faction.getLandCount(),
|
||||
|
@ -28,11 +28,11 @@ public class CmdFactionsMap extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.arg(0, ARBoolean.get(), !mme.isMapAutoUpdating()))
|
||||
if (this.arg(0, ARBoolean.get(), !msender.isMapAutoUpdating()))
|
||||
{
|
||||
// Turn on
|
||||
|
||||
mme.setMapAutoUpdating(true);
|
||||
msender.setMapAutoUpdating(true);
|
||||
msg("<i>Map auto update <green>ENABLED.");
|
||||
|
||||
// And show the map once
|
||||
@ -41,14 +41,14 @@ public class CmdFactionsMap extends FCommand
|
||||
else
|
||||
{
|
||||
// Turn off
|
||||
mme.setMapAutoUpdating(false);
|
||||
msender.setMapAutoUpdating(false);
|
||||
msg("<i>Map auto update <red>DISABLED.");
|
||||
}
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ public class CmdFactionsMoneyBalance extends FCommand
|
||||
@Override
|
||||
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 != 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ public class CmdFactionsMoneyDeposit extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
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;
|
||||
|
||||
boolean success = Econ.transferMoney(fme, fme, faction, amount);
|
||||
boolean success = Econ.transferMoney(usender, usender, faction, amount);
|
||||
|
||||
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))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,11 @@ public class CmdFactionsMoneyTransferFf extends FCommand
|
||||
Faction to = this.arg(2, ARFaction.get(sender));
|
||||
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)
|
||||
{
|
||||
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))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
||||
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
|
||||
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)
|
||||
{
|
||||
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))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ public class CmdFactionsMoneyTransferPf extends FCommand
|
||||
Faction to = this.arg(2, ARFaction.get(sender));
|
||||
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)
|
||||
{
|
||||
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))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,16 +35,16 @@ public class CmdFactionsMoneyWithdraw extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
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))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ public class CmdFactionsName extends FCommand
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
|
||||
FactionColl factionColl = FactionColls.get().get(myFaction);
|
||||
if (factionColl.isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(myFaction.getComparisonName()))
|
||||
FactionColl factionColl = FactionColls.get().get(usenderFaction);
|
||||
if (factionColl.isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(usenderFaction.getComparisonName()))
|
||||
{
|
||||
msg("<b>That name is already taken");
|
||||
return;
|
||||
@ -49,24 +49,24 @@ public class CmdFactionsName extends FCommand
|
||||
}
|
||||
|
||||
// Event
|
||||
FactionsEventNameChange event = new FactionsEventNameChange(sender, myFaction, newName);
|
||||
FactionsEventNameChange event = new FactionsEventNameChange(sender, usenderFaction, newName);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newName = event.getNewName();
|
||||
|
||||
// Apply
|
||||
String oldName = myFaction.getName();
|
||||
myFaction.setName(newName);
|
||||
String oldName = usenderFaction.getName();
|
||||
usenderFaction.setName(newName);
|
||||
|
||||
// Inform
|
||||
myFaction.msg("%s<i> changed your faction name to %s", fme.describeTo(myFaction, true), myFaction.getName(myFaction));
|
||||
for (Faction faction : FactionColls.get().get(myFaction).getAll())
|
||||
usenderFaction.msg("%s<i> changed your faction name to %s", usender.describeTo(usenderFaction, true), usenderFaction.getName(usenderFaction));
|
||||
for (Faction faction : FactionColls.get().get(usenderFaction).getAll())
|
||||
{
|
||||
if (faction == myFaction)
|
||||
if (faction == usenderFaction)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,19 +28,19 @@ public class CmdFactionsOfficer extends FCommand
|
||||
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
||||
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;
|
||||
}
|
||||
|
||||
if (fme != null && fme.getRole() != Rel.LEADER && !permAny)
|
||||
if (usender != null && usender.getRole() != Rel.LEADER && !permAny)
|
||||
{
|
||||
msg("<b>You are not the faction leader.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == fme && !permAny)
|
||||
if (you == usender && !permAny)
|
||||
{
|
||||
msg("<b>The target player musn't be yourself.");
|
||||
return;
|
||||
@ -57,14 +57,14 @@ public class CmdFactionsOfficer extends FCommand
|
||||
// Revoke
|
||||
you.setRole(Rel.MEMBER);
|
||||
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
|
||||
{
|
||||
// Give
|
||||
you.setRole(Rel.OFFICER);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,21 +23,21 @@ public class CmdFactionsOpen extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Boolean newOpen = this.arg(0, ARBoolean.get(), !myFaction.isOpen());
|
||||
Boolean newOpen = this.arg(0, ARBoolean.get(), !usenderFaction.isOpen());
|
||||
if (newOpen == null) return;
|
||||
|
||||
// Event
|
||||
FactionsEventOpenChange event = new FactionsEventOpenChange(sender, myFaction, newOpen);
|
||||
FactionsEventOpenChange event = new FactionsEventOpenChange(sender, usenderFaction, newOpen);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newOpen = event.isNewOpen();
|
||||
|
||||
// Apply
|
||||
myFaction.setOpen(newOpen);
|
||||
usenderFaction.setOpen(newOpen);
|
||||
|
||||
// Inform
|
||||
String descTarget = myFaction.isOpen() ? "open" : "closed";
|
||||
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), descTarget);
|
||||
String descTarget = usenderFaction.isOpen() ? "open" : "closed";
|
||||
usenderFaction.msg("%s<i> changed the faction to <h>%s<i>.", usender.describeTo(usenderFaction, true), descTarget);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ public class CmdFactionsPerm extends FCommand
|
||||
@Override
|
||||
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 ( ! this.argIsSet(1))
|
||||
{
|
||||
msg(Txt.titleize("Perms for " + faction.describeTo(fme, true)));
|
||||
msg(Txt.titleize("Perms for " + faction.describeTo(usender, true)));
|
||||
msg(FPerm.getStateHeaders());
|
||||
for (FPerm perm : FPerm.values())
|
||||
{
|
||||
@ -48,7 +48,7 @@ public class CmdFactionsPerm extends FCommand
|
||||
|
||||
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(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||
return;
|
||||
@ -72,7 +72,7 @@ public class CmdFactionsPerm extends FCommand
|
||||
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(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
Faction faction = this.arg(0, ARFaction.get(fme));
|
||||
Faction faction = this.arg(0, ARFaction.get(usender));
|
||||
if (faction == null) return;
|
||||
|
||||
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.");
|
||||
|
||||
// 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+".");
|
||||
}
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ public class CmdFactionsPromote extends FCommand
|
||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
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;
|
||||
}
|
||||
|
||||
if (you == fme)
|
||||
if (you == usender)
|
||||
{
|
||||
msg("<b>The target player mustn't be yourself.");
|
||||
return;
|
||||
@ -42,24 +42,24 @@ public class CmdFactionsPromote extends FCommand
|
||||
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (!fme.getRole().isAtLeast(Rel.LEADER))
|
||||
if (!usender.getRole().isAtLeast(Rel.LEADER))
|
||||
{
|
||||
msg("<b>You must be the leader to promote someone to officer.");
|
||||
return;
|
||||
}
|
||||
// Give
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,40 +39,40 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
|
||||
|
||||
// Verify
|
||||
|
||||
if (otherFaction == myFaction)
|
||||
if (otherFaction == usenderFaction)
|
||||
{
|
||||
msg("<b>Nope! You can't declare a relation to yourself :)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.getRelationWish(otherFaction) == newRelation)
|
||||
if (usenderFaction.getRelationWish(otherFaction) == newRelation)
|
||||
{
|
||||
msg("<b>You already have that relation wish set with %s.", otherFaction.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
// Event
|
||||
FactionsEventRelationChange event = new FactionsEventRelationChange(sender, myFaction, otherFaction, newRelation);
|
||||
FactionsEventRelationChange event = new FactionsEventRelationChange(sender, usenderFaction, otherFaction, newRelation);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newRelation = event.getNewRelation();
|
||||
|
||||
// try to set the new relation
|
||||
myFaction.setRelationWish(otherFaction, newRelation);
|
||||
Rel currentRelation = myFaction.getRelationTo(otherFaction, true);
|
||||
usenderFaction.setRelationWish(otherFaction, newRelation);
|
||||
Rel currentRelation = usenderFaction.getRelationTo(otherFaction, true);
|
||||
|
||||
// if the relation change was successful
|
||||
if (newRelation == currentRelation)
|
||||
{
|
||||
otherFaction.msg("%s<i> is now %s.", myFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
|
||||
myFaction.msg("%s<i> is now %s.", otherFaction.describeTo(myFaction, true), newRelation.getDescFactionOne());
|
||||
otherFaction.msg("%s<i> is now %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
|
||||
usenderFaction.msg("%s<i> is now %s.", otherFaction.describeTo(usenderFaction, true), newRelation.getDescFactionOne());
|
||||
}
|
||||
// inform the other faction of your request
|
||||
else
|
||||
{
|
||||
otherFaction.msg("%s<i> wishes to be %s.", myFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
|
||||
otherFaction.msg("<i>Type <c>/"+ConfServer.baseCommandAliases.get(0)+" "+newRelation+" "+myFaction.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());
|
||||
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+" "+usenderFaction.getName()+"<i> to accept.");
|
||||
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!!
|
||||
@ -80,13 +80,13 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
|
||||
if ( newRelation != Rel.TRUCE && otherFaction.getFlag(FFlag.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.");
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class CmdFactionsSethome extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
PS newHome = PS.valueOf(me.getLocation());
|
||||
@ -35,7 +35,7 @@ public class CmdFactionsSethome extends FCommand
|
||||
// Validate
|
||||
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;
|
||||
}
|
||||
|
||||
@ -43,9 +43,9 @@ public class CmdFactionsSethome extends FCommand
|
||||
if ( ! FPerm.SETHOME.has(sender, faction, true)) return;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -59,11 +59,11 @@ public class CmdFactionsSethome extends FCommand
|
||||
faction.setHome(newHome);
|
||||
|
||||
// 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());
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class CmdFactionsShow extends FCommand
|
||||
@Override
|
||||
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;
|
||||
|
||||
UConf uconf = UConf.get(faction);
|
||||
@ -43,7 +43,7 @@ public class CmdFactionsShow extends FCommand
|
||||
Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
|
||||
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());
|
||||
|
||||
// Display important flags
|
||||
@ -99,7 +99,7 @@ public class CmdFactionsShow extends FCommand
|
||||
String sepparator = Txt.parse("<i>")+", ";
|
||||
|
||||
// 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))
|
||||
{
|
||||
@ -121,11 +121,11 @@ public class CmdFactionsShow extends FCommand
|
||||
{
|
||||
if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
|
||||
{
|
||||
memberOnlineNames.add(follower.getNameAndTitle(fme));
|
||||
memberOnlineNames.add(follower.getNameAndTitle(usender));
|
||||
}
|
||||
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()))
|
||||
{
|
||||
memberOnlineNames.add(follower.getNameAndTitle(fme));
|
||||
memberOnlineNames.add(follower.getNameAndTitle(usender));
|
||||
}
|
||||
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()))
|
||||
{
|
||||
memberOnlineNames.add(follower.getNameAndTitle(fme));
|
||||
memberOnlineNames.add(follower.getNameAndTitle(usender));
|
||||
}
|
||||
else
|
||||
{
|
||||
memberOfflineNames.add(follower.getNameAndTitle(fme));
|
||||
memberOfflineNames.add(follower.getNameAndTitle(usender));
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,11 +157,11 @@ public class CmdFactionsShow extends FCommand
|
||||
{
|
||||
if (follower.isOnline())
|
||||
{
|
||||
memberOnlineNames.add(follower.getNameAndTitle(fme));
|
||||
memberOnlineNames.add(follower.getNameAndTitle(usender));
|
||||
}
|
||||
else
|
||||
{
|
||||
memberOfflineNames.add(follower.getNameAndTitle(fme));
|
||||
memberOfflineNames.add(follower.getNameAndTitle(usender));
|
||||
}
|
||||
}
|
||||
sendMessage(Txt.parse("<a>Members online: ") + Txt.implode(memberOnlineNames, sepparator));
|
||||
|
@ -33,7 +33,7 @@ public class CmdFactionsTitle extends FCommand
|
||||
if (newTitle == null) return;
|
||||
|
||||
// Verify
|
||||
if ( ! canIAdministerYou(fme, you)) return;
|
||||
if ( ! canIAdministerYou(usender, you)) return;
|
||||
|
||||
// Event
|
||||
FactionsEventTitleChange event = new FactionsEventTitleChange(sender, you, newTitle);
|
||||
@ -45,7 +45,7 @@ public class CmdFactionsTitle extends FCommand
|
||||
you.setTitle(newTitle);
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ public class CmdFactionsUnclaim extends FCommand
|
||||
Faction newFaction = FactionColls.get().get(me).getNone();
|
||||
|
||||
// FPerm
|
||||
if (!FPerm.TERRITORY.has(sender, myFaction, true)) return;
|
||||
if (!FPerm.TERRITORY.has(sender, usenderFaction, true)) return;
|
||||
|
||||
// Apply
|
||||
if (fme.tryClaim(newFaction, chunk, true, true)) return;
|
||||
if (usender.tryClaim(newFaction, chunk, true, true)) return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class CmdFactionsUnclaimall extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = myFaction;
|
||||
Faction faction = usenderFaction;
|
||||
Faction newFaction = FactionColls.get().get(faction).getNone();
|
||||
|
||||
// FPerm
|
||||
@ -58,12 +58,12 @@ public class CmdFactionsUnclaimall extends FCommand
|
||||
}
|
||||
|
||||
// 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
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,16 +9,16 @@ import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public abstract class FCommand extends MCommand
|
||||
{
|
||||
public MPlayer mme;
|
||||
public UPlayer fme;
|
||||
public Faction myFaction;
|
||||
public MPlayer msender;
|
||||
public UPlayer usender;
|
||||
public Faction usenderFaction;
|
||||
|
||||
@Override
|
||||
public void fixSenderVars()
|
||||
{
|
||||
this.mme = MPlayer.get(sender);
|
||||
this.fme = UPlayer.get(this.sender);
|
||||
this.myFaction = this.fme.getFaction();
|
||||
this.msender = MPlayer.get(sender);
|
||||
this.usender = UPlayer.get(this.sender);
|
||||
this.usenderFaction = this.usender.getFaction();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user