Starting to rename fplayer --> uplayer since we will need an mplayer.
This commit is contained in:
@@ -3,10 +3,10 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.TerritoryAccess;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
|
||||
@@ -73,7 +73,7 @@ public class CmdFactionsAccess extends FCommand
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(fme), fme);
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(fme), fme);
|
||||
if (targetPlayer == null) return;
|
||||
added = territory.toggleFPlayer(targetPlayer);
|
||||
target = "Player \""+targetPlayer.getName()+"\"";
|
||||
|
@@ -5,8 +5,8 @@ import java.util.ArrayList;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
@@ -75,7 +75,7 @@ public class CmdFactionsCreate extends FCommand
|
||||
// NOTE: join event cannot be cancelled or you'll have an empty faction
|
||||
|
||||
// Inform
|
||||
for (FPlayer follower : FPlayerColls.get().get(fme).getAllOnline())
|
||||
for (UPlayer follower : UPlayerColls.get().get(fme).getAllOnline())
|
||||
{
|
||||
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower));
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsDemote extends FCommand
|
||||
@@ -25,7 +25,7 @@ public class CmdFactionsDemote extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny(fme));
|
||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(fme));
|
||||
if (you == null) return;
|
||||
|
||||
if (you.getFaction() != myFaction)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
@@ -53,24 +53,24 @@ public class CmdFactionsDisband extends FCommand
|
||||
|
||||
// Merged Apply and Inform
|
||||
|
||||
// Send FPlayerLeaveEvent for each player in the faction
|
||||
for (FPlayer fplayer : faction.getFPlayers())
|
||||
// Run event for each player in the faction
|
||||
for (UPlayer uplayer : faction.getUPlayers())
|
||||
{
|
||||
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND);
|
||||
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, uplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND);
|
||||
membershipChangeEvent.run();
|
||||
}
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayerColls.get().get(fme).getAllOnline())
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(fme).getAllOnline())
|
||||
{
|
||||
String who = fme.describeTo(fplayer);
|
||||
if (fplayer.getFaction() == faction)
|
||||
String who = fme.describeTo(uplayer);
|
||||
if (uplayer.getFaction() == faction)
|
||||
{
|
||||
fplayer.msg("<h>%s<i> disbanded your faction.", who);
|
||||
uplayer.msg("<h>%s<i> disbanded your faction.", who);
|
||||
}
|
||||
else
|
||||
{
|
||||
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
|
||||
uplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(uplayer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@ import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.FactionsEventHomeTeleport;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
@@ -99,7 +99,7 @@ public class CmdFactionsHome extends FCommand
|
||||
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w)
|
||||
continue;
|
||||
|
||||
FPlayer fp = FPlayer.get(p);
|
||||
UPlayer fp = UPlayer.get(p);
|
||||
if (fme.getRelationTo(fp) != Rel.ENEMY)
|
||||
continue;
|
||||
|
||||
|
@@ -3,8 +3,8 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.event.FactionsEventInvitedChange;
|
||||
import com.massivecraft.mcore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
@@ -27,16 +27,16 @@ public class CmdFactionsInvite extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
FPlayer fplayer = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
if (fplayer == null) return;
|
||||
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (uplayer == null) return;
|
||||
|
||||
Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(fplayer));
|
||||
Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(uplayer));
|
||||
if (newInvited == null) return;
|
||||
|
||||
// Allready member?
|
||||
if (fplayer.getFaction() == myFaction)
|
||||
if (uplayer.getFaction() == myFaction)
|
||||
{
|
||||
msg("%s<i> is already a member of %s", fplayer.getName(), myFaction.getTag());
|
||||
msg("%s<i> is already a member of %s", uplayer.getName(), myFaction.getTag());
|
||||
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
|
||||
return;
|
||||
}
|
||||
@@ -45,24 +45,24 @@ public class CmdFactionsInvite extends FCommand
|
||||
if ( ! FPerm.INVITE.has(sender, myFaction, true)) return;
|
||||
|
||||
// Event
|
||||
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, fplayer, myFaction, newInvited);
|
||||
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, myFaction, newInvited);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newInvited = event.isNewInvited();
|
||||
|
||||
// Apply
|
||||
myFaction.setInvited(fplayer, newInvited);
|
||||
myFaction.setInvited(uplayer, newInvited);
|
||||
|
||||
// Inform
|
||||
if (newInvited)
|
||||
{
|
||||
fplayer.msg("%s<i> invited you to %s", fme.describeTo(fplayer, true), myFaction.describeTo(fplayer));
|
||||
myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), fplayer.describeTo(myFaction));
|
||||
uplayer.msg("%s<i> invited you to %s", fme.describeTo(uplayer, true), myFaction.describeTo(uplayer));
|
||||
myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), uplayer.describeTo(myFaction));
|
||||
}
|
||||
else
|
||||
{
|
||||
fplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(fplayer), myFaction.describeTo(fplayer));
|
||||
myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), fplayer.describeTo(myFaction));
|
||||
uplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(uplayer), myFaction.describeTo(uplayer));
|
||||
myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), uplayer.describeTo(myFaction));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
@@ -31,10 +31,10 @@ public class CmdFactionsJoin extends FCommand
|
||||
Faction faction = this.arg(0, ARFaction.get(sender));
|
||||
if (faction == null) return;
|
||||
|
||||
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender), fme);
|
||||
if (fplayer == null) return;
|
||||
UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), fme);
|
||||
if (uplayer == null) return;
|
||||
|
||||
boolean samePlayer = fplayer == fme;
|
||||
boolean samePlayer = uplayer == fme;
|
||||
|
||||
// Validate
|
||||
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
|
||||
@@ -43,36 +43,36 @@ public class CmdFactionsJoin extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (faction == fplayer.getFaction())
|
||||
if (faction == uplayer.getFaction())
|
||||
{
|
||||
msg("<b>%s %s already a member of %s", fplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme));
|
||||
msg("<b>%s %s already a member of %s", uplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme));
|
||||
return;
|
||||
}
|
||||
|
||||
if (UConf.get(faction).factionMemberLimit > 0 && faction.getFPlayers().size() >= UConf.get(faction).factionMemberLimit)
|
||||
if (UConf.get(faction).factionMemberLimit > 0 && faction.getUPlayers().size() >= UConf.get(faction).factionMemberLimit)
|
||||
{
|
||||
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getTag(fme), UConf.get(faction).factionMemberLimit, fplayer.describeTo(fme, false));
|
||||
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getTag(fme), UConf.get(faction).factionMemberLimit, uplayer.describeTo(fme, false));
|
||||
return;
|
||||
}
|
||||
|
||||
if (fplayer.hasFaction())
|
||||
if (uplayer.hasFaction())
|
||||
{
|
||||
msg("<b>%s must leave %s current faction first.", fplayer.describeTo(fme, true), (samePlayer ? "your" : "their"));
|
||||
msg("<b>%s must leave %s current faction first.", uplayer.describeTo(fme, true), (samePlayer ? "your" : "their"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UConf.get(faction).canLeaveWithNegativePower && fplayer.getPower() < 0)
|
||||
if (!UConf.get(faction).canLeaveWithNegativePower && uplayer.getPower() < 0)
|
||||
{
|
||||
msg("<b>%s cannot join a faction with a negative power level.", fplayer.describeTo(fme, true));
|
||||
msg("<b>%s cannot join a faction with a negative power level.", uplayer.describeTo(fme, true));
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! (faction.isOpen() || faction.isInvited(fplayer) || fme.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
||||
if( ! (faction.isOpen() || faction.isInvited(uplayer) || fme.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
||||
{
|
||||
msg("<i>This faction requires invitation.");
|
||||
if (samePlayer)
|
||||
{
|
||||
faction.msg("%s<i> tried to join your faction.", fplayer.describeTo(faction, true));
|
||||
faction.msg("%s<i> tried to join your faction.", uplayer.describeTo(faction, true));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -85,24 +85,24 @@ public class CmdFactionsJoin extends FCommand
|
||||
// Inform
|
||||
if (!samePlayer)
|
||||
{
|
||||
fplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(fplayer, true), faction.getTag(fplayer));
|
||||
uplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(uplayer, true), faction.getTag(uplayer));
|
||||
}
|
||||
faction.msg("<i>%s joined your faction.", fplayer.describeTo(faction, true));
|
||||
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme));
|
||||
faction.msg("<i>%s joined your faction.", uplayer.describeTo(faction, true));
|
||||
fme.msg("<i>%s successfully joined %s.", uplayer.describeTo(fme, true), faction.getTag(fme));
|
||||
|
||||
// Apply
|
||||
fplayer.resetFactionData();
|
||||
fplayer.setFaction(faction);
|
||||
uplayer.resetFactionData();
|
||||
uplayer.setFaction(faction);
|
||||
|
||||
faction.setInvited(fplayer, false);
|
||||
faction.setInvited(uplayer, false);
|
||||
|
||||
// Derplog
|
||||
if (MConf.get().logFactionJoin)
|
||||
{
|
||||
if (samePlayer)
|
||||
Factions.get().log("%s joined the faction %s.", fplayer.getName(), faction.getTag());
|
||||
Factions.get().log("%s joined the faction %s.", uplayer.getName(), faction.getTag());
|
||||
else
|
||||
Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), fplayer.getName(), faction.getTag());
|
||||
Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), uplayer.getName(), faction.getTag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@ import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
@@ -30,58 +30,58 @@ public class CmdFactionsKick extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Arg
|
||||
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||
if (fplayer == null) return;
|
||||
UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender));
|
||||
if (uplayer == null) return;
|
||||
|
||||
// Validate
|
||||
if (fme == fplayer)
|
||||
if (fme == uplayer)
|
||||
{
|
||||
msg("<b>You cannot kick yourself.");
|
||||
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
|
||||
return;
|
||||
}
|
||||
|
||||
if (fplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || fme.isUsingAdminMode()))
|
||||
if (uplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || fme.isUsingAdminMode()))
|
||||
{
|
||||
msg("<b>The leader can not be kicked.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! UConf.get(fplayer).canLeaveWithNegativePower && fplayer.getPower() < 0)
|
||||
if ( ! UConf.get(uplayer).canLeaveWithNegativePower && uplayer.getPower() < 0)
|
||||
{
|
||||
msg("<b>You cannot kick that member until their power is positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
// FPerm
|
||||
Faction fplayerFaction = fplayer.getFaction();
|
||||
if (!FPerm.KICK.has(sender, fplayerFaction)) return;
|
||||
Faction uplayerFaction = uplayer.getFaction();
|
||||
if (!FPerm.KICK.has(sender, uplayerFaction)) return;
|
||||
|
||||
// Event
|
||||
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(fplayer).getNone(), MembershipChangeReason.KICK);
|
||||
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, uplayer, FactionColls.get().get(uplayer).getNone(), MembershipChangeReason.KICK);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
// Inform
|
||||
fplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(fplayerFaction, true), fplayer.describeTo(fplayerFaction, true));
|
||||
fplayer.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(fplayer, true), fplayerFaction.describeTo(fplayer));
|
||||
if (fplayerFaction != myFaction)
|
||||
uplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(uplayerFaction, true), uplayer.describeTo(uplayerFaction, true));
|
||||
uplayer.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer));
|
||||
if (uplayerFaction != myFaction)
|
||||
{
|
||||
fme.msg("<i>You kicked %s<i> from the faction %s<i>!", fplayer.describeTo(fme), fplayerFaction.describeTo(fme));
|
||||
fme.msg("<i>You kicked %s<i> from the faction %s<i>!", uplayer.describeTo(fme), uplayerFaction.describeTo(fme));
|
||||
}
|
||||
|
||||
if (MConf.get().logFactionKick)
|
||||
{
|
||||
Factions.get().log(fme.getDisplayName() + " kicked " + fplayer.getName() + " from the faction " + fplayerFaction.getTag());
|
||||
Factions.get().log(fme.getDisplayName() + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getTag());
|
||||
}
|
||||
|
||||
// Apply
|
||||
if (fplayer.getRole() == Rel.LEADER)
|
||||
if (uplayer.getRole() == Rel.LEADER)
|
||||
{
|
||||
fplayerFaction.promoteNewLeader();
|
||||
uplayerFaction.promoteNewLeader();
|
||||
}
|
||||
fplayerFaction.setInvited(fplayer, false);
|
||||
fplayer.resetFactionData();
|
||||
uplayerFaction.setInvited(uplayer, false);
|
||||
uplayer.resetFactionData();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
||||
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
||||
@@ -28,15 +28,15 @@ public class CmdFactionsLeader extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
FPlayer newLeader = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (newLeader == null) return;
|
||||
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(sender), myFaction);
|
||||
if (targetFaction == null) return;
|
||||
|
||||
FPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
||||
UPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
||||
|
||||
// We now have fplayer and the target faction
|
||||
// We now have uplayer and the target faction
|
||||
if (this.senderIsConsole || fme.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
|
||||
{
|
||||
// Do whatever you wish
|
||||
@@ -63,7 +63,7 @@ public class CmdFactionsLeader extends FCommand
|
||||
}
|
||||
}
|
||||
|
||||
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
||||
// only run event when newLeader isn't actually in the faction
|
||||
if (newLeader.getFaction() != targetFaction)
|
||||
{
|
||||
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER);
|
||||
@@ -90,9 +90,9 @@ public class CmdFactionsLeader extends FCommand
|
||||
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(fme, true));
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayerColls.get().get(sender).getAllOnline())
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(sender).getAllOnline())
|
||||
{
|
||||
fplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(fme, fplayer, true), newLeader.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||
uplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(fme, uplayer, true), newLeader.describeTo(uplayer), targetFaction.describeTo(uplayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -53,13 +53,13 @@ public class CmdFactionsList extends FCommand
|
||||
{
|
||||
if (faction.isNone())
|
||||
{
|
||||
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColls.get().get(sender).getNone().getFPlayersWhereOnline(true).size()));
|
||||
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColls.get().get(sender).getNone().getUPlayersWhereOnline(true).size()));
|
||||
continue;
|
||||
}
|
||||
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
||||
faction.getTag(fme),
|
||||
faction.getFPlayersWhereOnline(true).size(),
|
||||
faction.getFPlayers().size(),
|
||||
faction.getUPlayersWhereOnline(true).size(),
|
||||
faction.getUPlayers().size(),
|
||||
faction.getLandCount(),
|
||||
faction.getPowerRounded(),
|
||||
faction.getPowerMaxRounded())
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@@ -40,7 +40,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
||||
Faction from = this.arg(1, ARFaction.get(sender));
|
||||
if (from == null) return;
|
||||
|
||||
FPlayer to = this.arg(2, ARFPlayer.getStartAny(sender));
|
||||
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@@ -37,7 +37,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
FPlayer from = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||
UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender));
|
||||
if (from == null) return;
|
||||
|
||||
Faction to = this.arg(2, ARFaction.get(sender));
|
||||
|
@@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@@ -38,7 +38,7 @@ public class CmdFactionsMoneyWithdraw extends FCommand
|
||||
Faction from = this.arg(1, ARFaction.get(sender), myFaction);
|
||||
if (from == null) return;
|
||||
|
||||
FPlayer to = fme;
|
||||
UPlayer to = fme;
|
||||
|
||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||
|
||||
|
@@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CmdFactionsOfficer extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (you == null) return;
|
||||
|
||||
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsPower extends FCommand
|
||||
@@ -20,7 +20,7 @@ public class CmdFactionsPower extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
FPlayer target = this.arg(0, ARFPlayer.getStartAny(fme), fme);
|
||||
UPlayer target = this.arg(0, ARUPlayer.getStartAny(fme), fme);
|
||||
if (target == null) return;
|
||||
|
||||
if (target != fme && ! Perm.POWER_ANY.has(sender, true)) return;
|
||||
|
@@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
@@ -45,7 +45,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender));
|
||||
if (targetPlayer == null) return;
|
||||
|
||||
targetPlayer.setPowerBoost(targetPower);
|
||||
|
@@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsPromote extends FCommand
|
||||
@@ -25,7 +25,7 @@ public class CmdFactionsPromote extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (you == null) return;
|
||||
|
||||
if (you.getFaction() != myFaction)
|
||||
|
@@ -7,7 +7,7 @@ import java.util.Map;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FFlag;
|
||||
@@ -35,10 +35,10 @@ public class CmdFactionsShow extends FCommand
|
||||
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
Collection<FPlayer> leaders = faction.getFPlayersWhereRole(Rel.LEADER);
|
||||
Collection<FPlayer> officers = faction.getFPlayersWhereRole(Rel.OFFICER);
|
||||
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER);
|
||||
Collection<FPlayer> recruits = faction.getFPlayersWhereRole(Rel.RECRUIT);
|
||||
Collection<UPlayer> leaders = faction.getUPlayersWhereRole(Rel.LEADER);
|
||||
Collection<UPlayer> officers = faction.getUPlayersWhereRole(Rel.OFFICER);
|
||||
Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
|
||||
Collection<UPlayer> recruits = faction.getUPlayersWhereRole(Rel.RECRUIT);
|
||||
|
||||
msg(Txt.titleize(faction.getTag(fme)));
|
||||
msg("<a>Description: <i>%s", faction.getDescription());
|
||||
@@ -101,7 +101,7 @@ public class CmdFactionsShow extends FCommand
|
||||
List<String> memberOnlineNames = new ArrayList<String>();
|
||||
List<String> memberOfflineNames = new ArrayList<String>();
|
||||
|
||||
for (FPlayer follower : leaders)
|
||||
for (UPlayer follower : leaders)
|
||||
{
|
||||
if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
|
||||
{
|
||||
@@ -113,7 +113,7 @@ public class CmdFactionsShow extends FCommand
|
||||
}
|
||||
}
|
||||
|
||||
for (FPlayer follower : officers)
|
||||
for (UPlayer follower : officers)
|
||||
{
|
||||
if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
|
||||
{
|
||||
@@ -125,7 +125,7 @@ public class CmdFactionsShow extends FCommand
|
||||
}
|
||||
}
|
||||
|
||||
for (FPlayer follower : normals)
|
||||
for (UPlayer follower : normals)
|
||||
{
|
||||
if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
|
||||
{
|
||||
@@ -137,7 +137,7 @@ public class CmdFactionsShow extends FCommand
|
||||
}
|
||||
}
|
||||
|
||||
for (FPlayer follower : recruits)
|
||||
for (UPlayer follower : recruits)
|
||||
{
|
||||
if (follower.isOnline())
|
||||
{
|
||||
|
@@ -3,9 +3,9 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.event.FactionsEventTitleChange;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.mcore.cmd.arg.ARString;
|
||||
@@ -28,7 +28,7 @@ public class CmdFactionsTitle extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
||||
if (you == null) return;
|
||||
|
||||
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
||||
|
@@ -1,20 +1,20 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public abstract class FCommand extends MCommand
|
||||
{
|
||||
public FPlayer fme;
|
||||
public UPlayer fme;
|
||||
public Faction myFaction;
|
||||
|
||||
@Override
|
||||
public void fixSenderVars()
|
||||
{
|
||||
this.fme = FPlayer.get(this.sender);
|
||||
this.fme = UPlayer.get(this.sender);
|
||||
this.myFaction = this.fme.getFaction();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public abstract class FCommand extends MCommand
|
||||
// COMMONLY USED LOGIC
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean canIAdministerYou(FPlayer i, FPlayer you)
|
||||
public boolean canIAdministerYou(UPlayer i, UPlayer you)
|
||||
{
|
||||
if ( ! i.getFaction().equals(you.getFaction()))
|
||||
{
|
||||
|
@@ -1,22 +0,0 @@
|
||||
package com.massivecraft.factions.cmd.arg;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
|
||||
import com.massivecraft.mcore.cmd.arg.ArgReader;
|
||||
|
||||
public class ARFPlayer
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ArgReader<FPlayer> getFullAny(Object o) { return ARSenderEntity.getFullAny(FPlayerColls.get().get(o)); }
|
||||
|
||||
public static ArgReader<FPlayer> getStartAny(Object o) { return ARSenderEntity.getStartAny(FPlayerColls.get().get(o)); }
|
||||
|
||||
public static ArgReader<FPlayer> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(FPlayerColls.get().get(o)); }
|
||||
|
||||
public static ArgReader<FPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(FPlayerColls.get().get(o)); }
|
||||
|
||||
}
|
@@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.FPlayerColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
@@ -47,11 +47,11 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
||||
result.setResult(this.getColl().getBestTagMatch(str));
|
||||
if (result.hasResult()) return result;
|
||||
|
||||
// FPlayer Name Exact
|
||||
FPlayer fplayer = FPlayerColls.get().get(this.getColl()).get(str);
|
||||
if (fplayer != null)
|
||||
// UPlayer Name Exact
|
||||
UPlayer uplayer = UPlayerColls.get().get(this.getColl()).get(str);
|
||||
if (uplayer != null)
|
||||
{
|
||||
result.setResult(fplayer.getFaction());
|
||||
result.setResult(uplayer.getFaction());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
22
src/com/massivecraft/factions/cmd/arg/ARUPlayer.java
Normal file
22
src/com/massivecraft/factions/cmd/arg/ARUPlayer.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.massivecraft.factions.cmd.arg;
|
||||
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
|
||||
import com.massivecraft.mcore.cmd.arg.ArgReader;
|
||||
|
||||
public class ARUPlayer
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ArgReader<UPlayer> getFullAny(Object o) { return ARSenderEntity.getFullAny(UPlayerColls.get().get(o)); }
|
||||
|
||||
public static ArgReader<UPlayer> getStartAny(Object o) { return ARSenderEntity.getStartAny(UPlayerColls.get().get(o)); }
|
||||
|
||||
public static ArgReader<UPlayer> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(UPlayerColls.get().get(o)); }
|
||||
|
||||
public static ArgReader<UPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(UPlayerColls.get().get(o)); }
|
||||
|
||||
}
|
@@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd.req;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.entity.FPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqAbstract;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
@@ -33,8 +33,8 @@ public class ReqRoleIsAtLeast extends ReqAbstract
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MCommand command)
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(sender);
|
||||
return fplayer.getRole().isAtLeast(this.rel);
|
||||
UPlayer uplayer = UPlayer.get(sender);
|
||||
return uplayer.getRole().isAtLeast(this.rel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user