Step 1 in many removing the universe system. Untested and lacking auto convert features.
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.massivecore.cmd.HelpCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
@ -32,7 +31,6 @@ public class CmdFactionsAccess extends FCommand
|
||||
this.addAliases("access");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.ACCESS.node));
|
||||
}
|
||||
|
@ -6,8 +6,7 @@ import java.util.List;
|
||||
|
||||
import com.massivecraft.factions.RelationParticipator;
|
||||
import com.massivecraft.factions.TerritoryAccess;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -32,7 +31,6 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
|
||||
public CmdFactionsAccessAbstract()
|
||||
{
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
}
|
||||
|
||||
@ -44,7 +42,7 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
chunk = PS.valueOf(me).getChunk(true);
|
||||
ta = BoardColls.get().getTerritoryAccessAt(chunk);
|
||||
ta = BoardColl.get().getTerritoryAccessAt(chunk);
|
||||
hostFaction = ta.getHostFaction(usender);
|
||||
|
||||
this.innerPerform();
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -35,7 +35,7 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
|
||||
public void innerPerform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(usender));
|
||||
Faction faction = this.arg(0, ARFaction.get());
|
||||
if (faction == null) return;
|
||||
|
||||
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isFactionIdGranted(faction.getId()));
|
||||
@ -46,7 +46,7 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
|
||||
|
||||
// Apply
|
||||
ta = ta.withFactionId(faction.getId(), newValue);
|
||||
BoardColls.get().setTerritoryAccessAt(chunk, ta);
|
||||
BoardColl.get().setTerritoryAccessAt(chunk, ta);
|
||||
|
||||
// Inform
|
||||
this.sendAccessInfo();
|
||||
|
@ -3,8 +3,8 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -35,7 +35,7 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
|
||||
public void innerPerform()
|
||||
{
|
||||
// Args
|
||||
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(usender));
|
||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
|
||||
if (uplayer == null) return;
|
||||
|
||||
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));
|
||||
@ -46,7 +46,7 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
|
||||
|
||||
// Apply
|
||||
ta = ta.withPlayerId(uplayer.getId(), newValue);
|
||||
BoardColls.get().setTerritoryAccessAt(chunk, ta);
|
||||
BoardColl.get().setTerritoryAccessAt(chunk, ta);
|
||||
|
||||
// Inform
|
||||
this.sendAccessInfo();
|
||||
|
@ -3,9 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -25,7 +23,6 @@ public class CmdFactionsAutoClaim extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.AUTOCLAIM.node));
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
}
|
||||
@ -36,12 +33,9 @@ public class CmdFactionsAutoClaim extends FCommand
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
// Check disabled
|
||||
if (UConf.isDisabled(sender, sender)) return;
|
||||
|
||||
{
|
||||
// Args
|
||||
Faction forFaction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
|
||||
Faction forFaction = this.arg(0, ARFaction.get(), usenderFaction);
|
||||
|
||||
if (forFaction == null || forFaction == usender.getAutoClaimFaction())
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.task.SpiralTask;
|
||||
@ -29,7 +28,6 @@ public class CmdFactionsClaim extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node));
|
||||
}
|
||||
@ -45,7 +43,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), usenderFaction);
|
||||
final Faction forFaction = this.arg(1, ARFaction.get(), usenderFaction);
|
||||
if (forFaction == null) return;
|
||||
|
||||
// FPerm
|
||||
|
@ -5,14 +5,12 @@ import java.util.ArrayList;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasntFaction;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MPlayerColl;
|
||||
import com.massivecraft.factions.event.EventFactionsCreate;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
@ -34,7 +32,6 @@ public class CmdFactionsCreate extends FCommand
|
||||
this.addRequiredArg("name");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasntFaction.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.CREATE.node));
|
||||
}
|
||||
@ -50,15 +47,13 @@ public class CmdFactionsCreate extends FCommand
|
||||
String newName = this.arg(0);
|
||||
|
||||
// Verify
|
||||
FactionColl coll = FactionColls.get().get(usender);
|
||||
|
||||
if (coll.isNameTaken(newName))
|
||||
if (FactionColl.get().isNameTaken(newName))
|
||||
{
|
||||
msg("<b>That name is already in use.");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> nameValidationErrors = coll.validateName(newName);
|
||||
ArrayList<String> nameValidationErrors = FactionColl.get().validateName(newName);
|
||||
if (nameValidationErrors.size() > 0)
|
||||
{
|
||||
sendMessage(nameValidationErrors);
|
||||
@ -69,12 +64,12 @@ public class CmdFactionsCreate extends FCommand
|
||||
String factionId = MStore.createId();
|
||||
|
||||
// Event
|
||||
EventFactionsCreate createEvent = new EventFactionsCreate(sender, coll.getUniverse(), factionId, newName);
|
||||
EventFactionsCreate createEvent = new EventFactionsCreate(sender, factionId, newName);
|
||||
createEvent.run();
|
||||
if (createEvent.isCancelled()) return;
|
||||
|
||||
// Apply
|
||||
Faction faction = coll.create(factionId);
|
||||
Faction faction = FactionColl.get().create(factionId);
|
||||
faction.setName(newName);
|
||||
|
||||
usender.setRole(Rel.LEADER);
|
||||
@ -85,7 +80,7 @@ public class CmdFactionsCreate extends FCommand
|
||||
// NOTE: join event cannot be cancelled or you'll have an empty faction
|
||||
|
||||
// Inform
|
||||
for (UPlayer follower : UPlayerColls.get().get(usender).getAllOnline())
|
||||
for (MPlayer follower : MPlayerColl.get().getAllOnline())
|
||||
{
|
||||
follower.msg("%s<i> created a new faction %s", usender.describeTo(follower, true), faction.getName(follower));
|
||||
}
|
||||
|
@ -3,8 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsDemote extends FCommand
|
||||
@ -22,7 +21,6 @@ public class CmdFactionsDemote extends FCommand
|
||||
this.addRequiredArg("player");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.DEMOTE.node));
|
||||
|
||||
//To demote someone from member -> recruit you must be an officer.
|
||||
@ -37,7 +35,7 @@ public class CmdFactionsDemote extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
UPlayer you = this.arg(0, ARUPlayer.getAny(usender));
|
||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
||||
if (you == null) return;
|
||||
|
||||
if (you.getFaction() != usenderFaction)
|
||||
|
@ -2,10 +2,9 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsDescriptionChange;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
@ -26,7 +25,6 @@ public class CmdFactionsDescription extends FCommand
|
||||
this.setErrorOnToManyArgs(false);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
@ -52,7 +50,7 @@ public class CmdFactionsDescription extends FCommand
|
||||
usenderFaction.setDescription(newDescription);
|
||||
|
||||
// Inform
|
||||
for (UPlayer follower : usenderFaction.getUPlayers())
|
||||
for (MPlayer follower : usenderFaction.getUPlayers())
|
||||
{
|
||||
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MPlayerColl;
|
||||
import com.massivecraft.factions.event.EventFactionsDisband;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
@ -33,7 +32,6 @@ public class CmdFactionsDisband extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.DISBAND.node));
|
||||
}
|
||||
|
||||
@ -45,7 +43,7 @@ public class CmdFactionsDisband extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(usender), usenderFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// FPerm
|
||||
@ -66,14 +64,14 @@ public class CmdFactionsDisband extends FCommand
|
||||
// Merged Apply and Inform
|
||||
|
||||
// Run event for each player in the faction
|
||||
for (UPlayer uplayer : faction.getUPlayers())
|
||||
for (MPlayer uplayer : faction.getUPlayers())
|
||||
{
|
||||
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, uplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND);
|
||||
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, uplayer, FactionColl.get().getNone(), MembershipChangeReason.DISBAND);
|
||||
membershipChangeEvent.run();
|
||||
}
|
||||
|
||||
// Inform all players
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(usender).getAllOnline())
|
||||
for (MPlayer uplayer : MPlayerColl.get().getAllOnline())
|
||||
{
|
||||
String who = usender.describeTo(uplayer);
|
||||
if (uplayer.getFaction() == faction)
|
||||
|
@ -7,9 +7,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
@ -39,7 +38,6 @@ public class CmdFactionsFaction extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.FACTION.node));
|
||||
}
|
||||
|
||||
@ -51,11 +49,10 @@ public class CmdFactionsFaction extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// Data precalculation
|
||||
UConf uconf = UConf.get(faction);
|
||||
//boolean none = faction.isNone();
|
||||
boolean normal = faction.isNormal();
|
||||
|
||||
@ -82,13 +79,13 @@ public class CmdFactionsFaction extends FCommand
|
||||
msg("<a>Land / Power / Maxpower: <i> %d/%d/%d %s", faction.getLandCount(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost);
|
||||
|
||||
// show the land value
|
||||
if (Econ.isEnabled(faction))
|
||||
if (Econ.isEnabled())
|
||||
{
|
||||
long landCount = faction.getLandCount();
|
||||
|
||||
for (EventFactionsChunkChangeType type : EventFactionsChunkChangeType.values())
|
||||
{
|
||||
Double money = uconf.econChunkCost.get(type);
|
||||
Double money = MConf.get().econChunkCost.get(type);
|
||||
if (money == null) continue;
|
||||
if (money == 0D) continue;
|
||||
money *= landCount;
|
||||
@ -108,7 +105,7 @@ public class CmdFactionsFaction extends FCommand
|
||||
}
|
||||
|
||||
// Show bank contents
|
||||
if (UConf.get(faction).bankEnabled)
|
||||
if (MConf.get().bankEnabled)
|
||||
{
|
||||
msg("<a>Bank contains: <i>"+Money.format(Money.get(faction)));
|
||||
}
|
||||
@ -148,10 +145,10 @@ public class CmdFactionsFaction extends FCommand
|
||||
List<String> followerNamesOnline = new ArrayList<String>();
|
||||
List<String> followerNamesOffline = new ArrayList<String>();
|
||||
|
||||
List<UPlayer> followers = faction.getUPlayers();
|
||||
List<MPlayer> followers = faction.getUPlayers();
|
||||
Collections.sort(followers, PlayerRoleComparator.get());
|
||||
|
||||
for (UPlayer follower : followers)
|
||||
for (MPlayer follower : followers)
|
||||
{
|
||||
if (follower.isOnline() && Mixin.canSee(sender, follower.getId()))
|
||||
{
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.FFlag;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFFlag;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -27,7 +26,6 @@ public class CmdFactionsFlag extends FCommand
|
||||
this.addOptionalArg("yes/no", "read");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.FLAG.node));
|
||||
}
|
||||
|
||||
@ -38,7 +36,7 @@ public class CmdFactionsFlag extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
Faction faction = this.arg(0, ARFaction.get(sender), usenderFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
if ( ! this.argIsSet(1))
|
||||
|
@ -8,11 +8,10 @@ import com.massivecraft.factions.FFlag;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.EventFactionsHomeTeleport;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -34,7 +33,6 @@ public class CmdFactionsHome extends FCommand
|
||||
this.addAliases("home");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.HOME.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
@ -47,16 +45,14 @@ public class CmdFactionsHome extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
UConf uconf = UConf.get(sender);
|
||||
|
||||
// TODO: Hide this command on help also.
|
||||
if ( ! uconf.homesEnabled)
|
||||
if ( ! MConf.get().homesEnabled)
|
||||
{
|
||||
usender.msg("<b>Sorry, Faction homes are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! uconf.homesTeleportCommandEnabled)
|
||||
if ( ! MConf.get().homesTeleportCommandEnabled)
|
||||
{
|
||||
usender.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
|
||||
return;
|
||||
@ -69,26 +65,26 @@ public class CmdFactionsHome extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! uconf.homesTeleportAllowedFromEnemyTerritory && usender.isInEnemyTerritory())
|
||||
if ( ! MConf.get().homesTeleportAllowedFromEnemyTerritory && usender.isInEnemyTerritory())
|
||||
{
|
||||
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(usenderFaction.getHome().getWorld()))
|
||||
if ( ! MConf.get().homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(usenderFaction.getHome().getWorld()))
|
||||
{
|
||||
usender.msg("<b>You cannot teleport to your faction home while in a different world.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Faction faction = BoardColls.get().getFactionAt(PS.valueOf(me));
|
||||
Faction faction = BoardColl.get().getFactionAt(PS.valueOf(me));
|
||||
Location loc = me.getLocation().clone();
|
||||
|
||||
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
|
||||
if
|
||||
(
|
||||
uconf.homesTeleportAllowedEnemyDistance > 0
|
||||
MConf.get().homesTeleportAllowedEnemyDistance > 0
|
||||
&&
|
||||
faction.getFlag(FFlag.PVP)
|
||||
&&
|
||||
@ -98,7 +94,7 @@ public class CmdFactionsHome extends FCommand
|
||||
(
|
||||
usender.isInOwnTerritory()
|
||||
&&
|
||||
! uconf.homesTeleportIgnoreEnemiesIfInOwnTerritory
|
||||
! MConf.get().homesTeleportIgnoreEnemiesIfInOwnTerritory
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -113,7 +109,7 @@ public class CmdFactionsHome extends FCommand
|
||||
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w)
|
||||
continue;
|
||||
|
||||
UPlayer fp = UPlayer.get(p);
|
||||
MPlayer fp = MPlayer.get(p);
|
||||
if (usender.getRelationTo(fp) != Rel.ENEMY)
|
||||
continue;
|
||||
|
||||
@ -121,13 +117,13 @@ public class CmdFactionsHome extends FCommand
|
||||
double dx = Math.abs(x - l.getX());
|
||||
double dy = Math.abs(y - l.getY());
|
||||
double dz = Math.abs(z - l.getZ());
|
||||
double max = uconf.homesTeleportAllowedEnemyDistance;
|
||||
double max = MConf.get().homesTeleportAllowedEnemyDistance;
|
||||
|
||||
// box-shaped distance check
|
||||
if (dx > max || dy > max || dz > max)
|
||||
continue;
|
||||
|
||||
usender.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 " + MConf.get().homesTeleportAllowedEnemyDistance + " blocks of you.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,8 @@ import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsInvitedChange;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -28,7 +27,6 @@ public class CmdFactionsInvite extends FCommand
|
||||
this.addOptionalArg("yes/no", "toggle");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.INVITE.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
@ -42,7 +40,7 @@ public class CmdFactionsInvite extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
|
||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
|
||||
if (uplayer == null) return;
|
||||
|
||||
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
|
||||
|
@ -4,11 +4,9 @@ import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -30,7 +28,6 @@ public class CmdFactionsJoin extends FCommand
|
||||
this.addOptionalArg("player", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.JOIN.node));
|
||||
}
|
||||
|
||||
@ -42,10 +39,10 @@ public class CmdFactionsJoin extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(sender));
|
||||
Faction faction = this.arg(0, ARFaction.get());
|
||||
if (faction == null) return;
|
||||
|
||||
UPlayer uplayer = this.arg(1, ARUPlayer.getAny(sender), usender);
|
||||
MPlayer uplayer = this.arg(1, ARUPlayer.getAny(), usender);
|
||||
if (uplayer == null) return;
|
||||
Faction uplayerFaction = uplayer.getFaction();
|
||||
|
||||
@ -64,9 +61,9 @@ public class CmdFactionsJoin extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (UConf.get(faction).factionMemberLimit > 0 && faction.getUPlayers().size() >= UConf.get(faction).factionMemberLimit)
|
||||
if (MConf.get().factionMemberLimit > 0 && faction.getUPlayers().size() >= MConf.get().factionMemberLimit)
|
||||
{
|
||||
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), UConf.get(faction).factionMemberLimit, uplayer.describeTo(usender, false));
|
||||
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), MConf.get().factionMemberLimit, uplayer.describeTo(usender, false));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -76,7 +73,7 @@ public class CmdFactionsJoin extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UConf.get(faction).canLeaveWithNegativePower && uplayer.getPower() < 0)
|
||||
if (!MConf.get().canLeaveWithNegativePower && uplayer.getPower() < 0)
|
||||
{
|
||||
msg("<b>%s cannot join a faction with a negative power level.", uplayer.describeTo(usender, true));
|
||||
return;
|
||||
|
@ -5,12 +5,10 @@ import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -31,7 +29,6 @@ public class CmdFactionsKick extends FCommand
|
||||
this.addRequiredArg("player");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.KICK.node));
|
||||
}
|
||||
|
||||
@ -43,7 +40,7 @@ public class CmdFactionsKick extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Arg
|
||||
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
|
||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
|
||||
if (uplayer == null) return;
|
||||
|
||||
// Validate
|
||||
@ -60,7 +57,7 @@ public class CmdFactionsKick extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! UConf.get(uplayer).canLeaveWithNegativePower && uplayer.getPower() < 0)
|
||||
if ( ! MConf.get().canLeaveWithNegativePower && uplayer.getPower() < 0)
|
||||
{
|
||||
msg("<b>You cannot kick that member until their power is positive.");
|
||||
return;
|
||||
@ -71,7 +68,7 @@ public class CmdFactionsKick extends FCommand
|
||||
if (!FPerm.KICK.has(usender, uplayerFaction, true)) return;
|
||||
|
||||
// Event
|
||||
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, uplayer, FactionColls.get().get(uplayer).getNone(), MembershipChangeReason.KICK);
|
||||
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, uplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
|
@ -4,10 +4,9 @@ import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MPlayerColl;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.factions.util.RelationUtil;
|
||||
@ -29,7 +28,6 @@ public class CmdFactionsLeader extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.LEADER.node));
|
||||
}
|
||||
|
||||
@ -40,13 +38,13 @@ public class CmdFactionsLeader extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
UPlayer newLeader = this.arg(0, ARUPlayer.getAny(sender));
|
||||
MPlayer newLeader = this.arg(0, ARUPlayer.getAny());
|
||||
if (newLeader == null) return;
|
||||
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(sender), usenderFaction);
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(), usenderFaction);
|
||||
if (targetFaction == null) return;
|
||||
|
||||
UPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
||||
MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
||||
|
||||
// We now have uplayer and the target faction
|
||||
if (this.senderIsConsole || usender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
|
||||
@ -102,7 +100,7 @@ public class CmdFactionsLeader extends FCommand
|
||||
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(usender, true));
|
||||
|
||||
// Inform all players
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(sender).getAllOnline())
|
||||
for (MPlayer uplayer : MPlayerColl.get().getAllOnline())
|
||||
{
|
||||
uplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, uplayer, true), newLeader.describeTo(uplayer), targetFaction.describeTo(uplayer));
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -17,7 +16,6 @@ public class CmdFactionsLeave extends FCommand
|
||||
this.addAliases("leave");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.LEAVE.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ import java.util.List;
|
||||
|
||||
import com.massivecraft.factions.FactionListComparator;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -28,7 +27,6 @@ public class CmdFactionsList extends FCommand
|
||||
this.addOptionalArg("page", "1");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.LIST.node));
|
||||
}
|
||||
|
||||
@ -45,7 +43,7 @@ public class CmdFactionsList extends FCommand
|
||||
// Create Messages
|
||||
List<String> lines = new ArrayList<String>();
|
||||
|
||||
ArrayList<Faction> factionList = new ArrayList<Faction>(FactionColls.get().get(sender).getAll(null, FactionListComparator.get()));
|
||||
ArrayList<Faction> factionList = new ArrayList<Faction>(FactionColl.get().getAll(null, FactionListComparator.get()));
|
||||
|
||||
final int pageheight = 9;
|
||||
|
||||
@ -65,7 +63,7 @@ public class CmdFactionsList extends FCommand
|
||||
{
|
||||
if (faction.isNone())
|
||||
{
|
||||
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColls.get().get(sender).getNone().getUPlayersWhereOnline(true).size()));
|
||||
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColl.get().getNone().getUPlayersWhereOnline(true).size()));
|
||||
continue;
|
||||
}
|
||||
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
@ -23,7 +22,6 @@ public class CmdFactionsMap extends FCommand
|
||||
this.addOptionalArg("on/off", "once");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MAP.node));
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
}
|
||||
@ -60,7 +58,7 @@ public class CmdFactionsMap extends FCommand
|
||||
|
||||
public void showMap()
|
||||
{
|
||||
sendMessage(BoardColls.get().getMap(usenderFaction, PS.valueOf(me), me.getLocation().getYaw()));
|
||||
sendMessage(BoardColl.get().getMap(usenderFaction, PS.valueOf(me), me.getLocation().getYaw()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsMoney extends FCommand
|
||||
@ -36,7 +35,6 @@ public class CmdFactionsMoney extends FCommand
|
||||
this.addAliases("money");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqBankCommandsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MONEY.node));
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Perm;
|
||||
@ -23,7 +22,6 @@ public class CmdFactionsMoneyBalance extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MONEY_BALANCE.node));
|
||||
this.addRequirements(ReqBankCommandsEnabled.get());
|
||||
}
|
||||
@ -35,7 +33,7 @@ public class CmdFactionsMoneyBalance extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
Faction faction = this.arg(0, ARFaction.get(sender), usenderFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
if (faction != usenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
@ -31,7 +30,6 @@ public class CmdFactionsMoneyDeposit extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MONEY_DEPOSIT.node));
|
||||
this.addRequirements(ReqBankCommandsEnabled.get());
|
||||
}
|
||||
@ -46,7 +44,7 @@ public class CmdFactionsMoneyDeposit extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction faction = this.arg(1, ARFaction.get(sender), usenderFaction);
|
||||
Faction faction = this.arg(1, ARFaction.get(), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(usender, usender, faction, amount);
|
||||
|
@ -3,7 +3,6 @@ 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.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -33,7 +32,6 @@ public class CmdFactionsMoneyTransferFf extends FCommand
|
||||
this.addRequiredArg("faction");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2F.node));
|
||||
this.addRequirements(ReqBankCommandsEnabled.get());
|
||||
}
|
||||
@ -48,10 +46,10 @@ public class CmdFactionsMoneyTransferFf extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction from = this.arg(1, ARFaction.get(sender));
|
||||
Faction from = this.arg(1, ARFaction.get());
|
||||
if (from == null) return;
|
||||
|
||||
Faction to = this.arg(2, ARFaction.get(sender));
|
||||
Faction to = this.arg(2, ARFaction.get());
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(usender, from, to, amount);
|
||||
|
@ -4,8 +4,7 @@ import com.massivecraft.factions.Perm;
|
||||
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.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -35,7 +34,6 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
||||
this.addRequiredArg("player");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2P.node));
|
||||
this.addRequirements(ReqBankCommandsEnabled.get());
|
||||
}
|
||||
@ -50,10 +48,10 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction from = this.arg(1, ARFaction.get(sender));
|
||||
Faction from = this.arg(1, ARFaction.get());
|
||||
if (from == null) return;
|
||||
|
||||
UPlayer to = this.arg(2, ARUPlayer.getAny(sender));
|
||||
MPlayer to = this.arg(2, ARUPlayer.getAny());
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(usender, from, to, amount);
|
||||
|
@ -4,8 +4,7 @@ import com.massivecraft.factions.Perm;
|
||||
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.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -35,7 +34,6 @@ public class CmdFactionsMoneyTransferPf extends FCommand
|
||||
this.addRequiredArg("faction");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MONEY_P2F.node));
|
||||
this.addRequirements(ReqBankCommandsEnabled.get());
|
||||
}
|
||||
@ -50,10 +48,10 @@ public class CmdFactionsMoneyTransferPf extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
UPlayer from = this.arg(1, ARUPlayer.getAny(sender));
|
||||
MPlayer from = this.arg(1, ARUPlayer.getAny());
|
||||
if (from == null) return;
|
||||
|
||||
Faction to = this.arg(2, ARFaction.get(sender));
|
||||
Faction to = this.arg(2, ARFaction.get());
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(usender, from, to, amount);
|
||||
|
@ -3,8 +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.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -33,7 +32,6 @@ public class CmdFactionsMoneyWithdraw extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.MONEY_WITHDRAW.node));
|
||||
this.addRequirements(ReqBankCommandsEnabled.get());
|
||||
}
|
||||
@ -48,10 +46,10 @@ public class CmdFactionsMoneyWithdraw extends FCommand
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction from = this.arg(1, ARFaction.get(sender), usenderFaction);
|
||||
Faction from = this.arg(1, ARFaction.get(), usenderFaction);
|
||||
if (from == null) return;
|
||||
|
||||
UPlayer to = usender;
|
||||
MPlayer to = usender;
|
||||
|
||||
boolean success = Econ.transferMoney(usender, from, to, amount);
|
||||
|
||||
|
@ -4,13 +4,11 @@ import java.util.ArrayList;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.event.EventFactionsNameChange;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -30,7 +28,6 @@ public class CmdFactionsName extends FCommand
|
||||
this.addRequiredArg("new name");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.NAME.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
@ -48,15 +45,14 @@ public class CmdFactionsName extends FCommand
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
|
||||
FactionColl factionColl = FactionColls.get().get(usenderFaction);
|
||||
if (factionColl.isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(usenderFaction.getComparisonName()))
|
||||
if (FactionColl.get().isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(usenderFaction.getComparisonName()))
|
||||
{
|
||||
msg("<b>That name is already taken");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
errors.addAll(factionColl.validateName(newName));
|
||||
errors.addAll(FactionColl.get().validateName(newName));
|
||||
if (errors.size() > 0)
|
||||
{
|
||||
sendMessage(errors);
|
||||
@ -76,8 +72,8 @@ public class CmdFactionsName extends FCommand
|
||||
// Inform
|
||||
usenderFaction.msg("%s<i> changed your faction name to %s", usender.describeTo(usenderFaction, true), usenderFaction.getName(usenderFaction));
|
||||
|
||||
if (!UConf.get(usender).broadcastNameChange) return;
|
||||
for (Faction faction : FactionColls.get().get(usenderFaction).getAll())
|
||||
if (!MConf.get().broadcastNameChange) return;
|
||||
for (Faction faction : FactionColl.get().getAll())
|
||||
{
|
||||
if (faction == usenderFaction)
|
||||
{
|
||||
|
@ -3,8 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -23,7 +22,6 @@ public class CmdFactionsOfficer extends FCommand
|
||||
this.addRequiredArg("player");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.OFFICER.node));
|
||||
}
|
||||
|
||||
@ -34,7 +32,7 @@ public class CmdFactionsOfficer extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
|
||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
||||
if (you == null) return;
|
||||
|
||||
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.event.EventFactionsOpenChange;
|
||||
@ -24,7 +23,6 @@ public class CmdFactionsOpen extends FCommand
|
||||
this.addOptionalArg("yes/no", "toggle");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.OPEN.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
|
@ -6,7 +6,6 @@ import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFPerm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.arg.ARRel;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -31,7 +30,6 @@ public class CmdFactionsPerm extends FCommand
|
||||
this.setErrorOnToManyArgs(false);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.PERM.node));
|
||||
}
|
||||
|
||||
@ -42,7 +40,7 @@ public class CmdFactionsPerm extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
if ( ! this.argIsSet(1))
|
||||
@ -88,7 +86,7 @@ public class CmdFactionsPerm extends FCommand
|
||||
faction.setRelationPermitted(perm, rel, val);
|
||||
|
||||
// The following is to make sure the leader always has the right to change perms if that is our goal.
|
||||
if (perm == FPerm.PERMS && FPerm.PERMS.getDefault(faction).contains(Rel.LEADER))
|
||||
if (perm == FPerm.PERMS && FPerm.PERMS.getDefault().contains(Rel.LEADER))
|
||||
{
|
||||
faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true);
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ import java.util.LinkedHashMap;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.Progressbar;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.TimeDiffUtil;
|
||||
@ -27,7 +26,6 @@ public class CmdFactionsPlayer extends FCommand
|
||||
this.addOptionalArg("player", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.PLAYER.node));
|
||||
}
|
||||
|
||||
@ -39,7 +37,7 @@ public class CmdFactionsPlayer extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender), usender);
|
||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny(), usender);
|
||||
if (uplayer == null) return;
|
||||
|
||||
// INFO: Title
|
||||
|
@ -4,8 +4,7 @@ import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -27,7 +26,6 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
this.addRequiredArg("#");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node));
|
||||
}
|
||||
|
||||
@ -58,7 +56,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getAny(sender));
|
||||
MPlayer targetPlayer = this.arg(1, ARUPlayer.getAny());
|
||||
if (targetPlayer == null) return;
|
||||
|
||||
targetPlayer.setPowerBoost(targetPower);
|
||||
@ -66,7 +64,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(sender));
|
||||
Faction targetFaction = this.arg(1, ARFaction.get());
|
||||
if (targetFaction == null) return;
|
||||
|
||||
targetFaction.setPowerBoost(targetPower);
|
||||
|
@ -3,8 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsPromote extends FCommand
|
||||
@ -22,7 +21,6 @@ public class CmdFactionsPromote extends FCommand
|
||||
this.addRequiredArg("player");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.PROMOTE.node));
|
||||
|
||||
//To promote someone from recruit -> member you must be an officer.
|
||||
@ -37,7 +35,7 @@ public class CmdFactionsPromote extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
|
||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
||||
if (you == null) return;
|
||||
|
||||
if (you.getFaction() != usenderFaction)
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.FFlag;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
@ -26,7 +25,6 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
|
||||
this.addRequiredArg("faction");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.RELATION.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
@ -40,7 +38,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction otherFaction = this.arg(0, ARFaction.get(sender));
|
||||
Faction otherFaction = this.arg(0, ARFaction.get());
|
||||
if (otherFaction == null) return;
|
||||
|
||||
Rel newRelation = targetRelation;
|
||||
|
@ -4,9 +4,8 @@ import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.event.EventFactionsHomeChange;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
@ -27,7 +26,6 @@ public class CmdFactionsSethome extends FCommand
|
||||
this.addOptionalArg("faction", "you");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node));
|
||||
}
|
||||
@ -40,13 +38,13 @@ public class CmdFactionsSethome extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
|
||||
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
PS newHome = PS.valueOf(me.getLocation());
|
||||
|
||||
// Validate
|
||||
if ( ! UConf.get(faction).homesEnabled)
|
||||
if ( ! MConf.get().homesEnabled)
|
||||
{
|
||||
usender.msg("<b>Sorry, Faction homes are disabled on this server.");
|
||||
return;
|
||||
|
@ -5,9 +5,8 @@ import org.bukkit.ChatColor;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsTitleChange;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -29,7 +28,6 @@ public class CmdFactionsTitle extends FCommand
|
||||
this.addOptionalArg("title", "");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.TITLE.node));
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
}
|
||||
@ -42,7 +40,7 @@ public class CmdFactionsTitle extends FCommand
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
|
||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
||||
if (you == null) return;
|
||||
|
||||
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
@ -21,7 +20,6 @@ public class CmdFactionsUnclaim extends FCommand
|
||||
this.addAliases("unclaim");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
@ -36,7 +34,7 @@ public class CmdFactionsUnclaim extends FCommand
|
||||
{
|
||||
// Args
|
||||
PS chunk = PS.valueOf(me).getChunk(true);
|
||||
Faction newFaction = FactionColls.get().get(me).getNone();
|
||||
Faction newFaction = FactionColl.get().getNone();
|
||||
|
||||
// Apply
|
||||
if (usender.tryClaim(newFaction, chunk, true, true)) return;
|
||||
|
@ -6,13 +6,11 @@ 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.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.event.EventFactionsChunkChange;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -30,7 +28,6 @@ public class CmdFactionsUnclaimall extends FCommand
|
||||
this.addAliases("unclaimall");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM_ALL.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
@ -45,14 +42,13 @@ public class CmdFactionsUnclaimall extends FCommand
|
||||
{
|
||||
// Args
|
||||
Faction faction = usenderFaction;
|
||||
Faction newFaction = FactionColls.get().get(faction).getNone();
|
||||
Faction newFaction = FactionColl.get().getNone();
|
||||
|
||||
// FPerm
|
||||
if (!FPerm.TERRITORY.has(usender, faction, true)) return;
|
||||
|
||||
// Apply
|
||||
BoardColl boardColl = BoardColls.get().get(faction);
|
||||
Set<PS> chunks = boardColl.getChunks(faction);
|
||||
Set<PS> chunks = BoardColl.get().getChunks(faction);
|
||||
int countTotal = chunks.size();
|
||||
int countSuccess = 0;
|
||||
int countFail = 0;
|
||||
@ -67,7 +63,7 @@ public class CmdFactionsUnclaimall extends FCommand
|
||||
else
|
||||
{
|
||||
countSuccess++;
|
||||
boardColl.setFactionAt(chunk, newFaction);
|
||||
BoardColl.get().setFactionAt(chunk, newFaction);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -15,7 +13,7 @@ public abstract class FCommand extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
public MPlayer msender;
|
||||
public UPlayer usender;
|
||||
public MPlayer usender;
|
||||
public Faction usenderFaction;
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -30,10 +28,7 @@ public abstract class FCommand extends MassiveCommand
|
||||
this.usender = null;
|
||||
this.usenderFaction = null;
|
||||
|
||||
// Check disabled
|
||||
if (UConf.isDisabled(sender)) return;
|
||||
|
||||
this.usender = UPlayer.get(this.sender);
|
||||
this.usender = MPlayer.get(this.sender);
|
||||
this.usenderFaction = this.usender.getFaction();
|
||||
}
|
||||
|
||||
@ -50,7 +45,7 @@ public abstract class FCommand extends MassiveCommand
|
||||
// COMMONLY USED LOGIC
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean canIAdministerYou(UPlayer i, UPlayer you)
|
||||
public boolean canIAdministerYou(MPlayer i, MPlayer you)
|
||||
{
|
||||
if ( ! i.getFaction().equals(you.getFaction()))
|
||||
{
|
||||
|
@ -2,11 +2,9 @@ package com.massivecraft.factions.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.FactionColls;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgReaderAbstract;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgResult;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
@ -18,18 +16,8 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ARFaction get(Object universe) { return new ARFaction(FactionColls.get().get(universe)); }
|
||||
private ARFaction(FactionColl coll)
|
||||
{
|
||||
this.coll = coll;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final FactionColl coll;
|
||||
public FactionColl getColl() { return this.coll;}
|
||||
private static ARFaction i = new ARFaction();
|
||||
public static ARFaction get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
@ -41,16 +29,16 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
||||
ArgResult<Faction> result = new ArgResult<Faction>();
|
||||
|
||||
// Faction Name Exact
|
||||
result.setResult(this.getColl().getByName(str));
|
||||
result.setResult(FactionColl.get().getByName(str));
|
||||
if (result.hasResult()) return result;
|
||||
|
||||
// Faction Name Match
|
||||
result.setResult(this.getColl().getBestNameMatch(str));
|
||||
result.setResult(FactionColl.get().getBestNameMatch(str));
|
||||
if (result.hasResult()) return result;
|
||||
|
||||
// UPlayer Name Exact
|
||||
String id = IdUtil.getId(str);
|
||||
UPlayer uplayer = UPlayerColls.get().get(this.getColl()).get(id);
|
||||
MPlayer uplayer = MPlayer.get(id);
|
||||
if (uplayer != null)
|
||||
{
|
||||
result.setResult(uplayer.getFaction());
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.cmd.arg;
|
||||
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayerColls;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayerColl;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgReader;
|
||||
|
||||
public class ARUPlayer
|
||||
@ -10,8 +10,14 @@ public class ARUPlayer
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ArgReader<UPlayer> getAny(Object o) { return UPlayerColls.get().get(o).getAREntity(); }
|
||||
public static ArgReader<MPlayer> getAny()
|
||||
{
|
||||
return MPlayerColl.get().getAREntity();
|
||||
}
|
||||
|
||||
public static ArgReader<UPlayer> getOnline(Object o) { return UPlayerColls.get().get(o).getAREntity(true); }
|
||||
public static ArgReader<MPlayer> getOnline()
|
||||
{
|
||||
return MPlayerColl.get().getAREntity(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd.req;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqAbstract;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -25,18 +25,17 @@ public class ReqBankCommandsEnabled extends ReqAbstract
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MassiveCommand command)
|
||||
{
|
||||
return UConf.get(sender).econEnabled && UConf.get(sender).bankEnabled;
|
||||
return MConf.get().econEnabled && MConf.get().bankEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createErrorMessage(CommandSender sender, MassiveCommand command)
|
||||
{
|
||||
UConf uconf = UConf.get(sender);
|
||||
if (!uconf.bankEnabled)
|
||||
if (!MConf.get().bankEnabled)
|
||||
{
|
||||
return Txt.parse("<b>Faction banks are disabled in the <h>%s <b>universe.", uconf.getUniverse());
|
||||
return Txt.parse("<b>Faction banks are disabled.");
|
||||
}
|
||||
return Txt.parse("<b>Faction economy features are disabled in the <h>%s <b>universe.", uconf.getUniverse());
|
||||
return Txt.parse("<b>Faction economy features are disabled.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
package com.massivecraft.factions.cmd.req;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqAbstract;
|
||||
|
||||
public class ReqFactionsEnabled extends ReqAbstract
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ReqFactionsEnabled i = new ReqFactionsEnabled();
|
||||
public static ReqFactionsEnabled get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MassiveCommand command)
|
||||
{
|
||||
return !UConf.isDisabled(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createErrorMessage(CommandSender sender, MassiveCommand command)
|
||||
{
|
||||
return UConf.getDisabledMessage(sender);
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd.req;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqAbstract;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -25,7 +25,7 @@ public class ReqHasFaction extends ReqAbstract
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MassiveCommand command)
|
||||
{
|
||||
return UPlayer.get(sender).hasFaction();
|
||||
return MPlayer.get(sender).hasFaction();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd.req;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqAbstract;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -25,7 +25,7 @@ public class ReqHasntFaction extends ReqAbstract
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MassiveCommand command)
|
||||
{
|
||||
return !UPlayer.get(sender).hasFaction();
|
||||
return !MPlayer.get(sender).hasFaction();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.UPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqAbstract;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -33,7 +33,7 @@ public class ReqRoleIsAtLeast extends ReqAbstract
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MassiveCommand command)
|
||||
{
|
||||
UPlayer uplayer = UPlayer.get(sender);
|
||||
MPlayer uplayer = MPlayer.get(sender);
|
||||
return uplayer.getRole().isAtLeast(this.rel);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user