No More ZCore

This commit is contained in:
Olof Larsson
2013-04-16 11:27:03 +02:00
parent e874ea60df
commit 97a2ed1fd8
26 changed files with 97 additions and 676 deletions

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsAdmin extends FCommand
@ -18,9 +19,12 @@ public class CmdFactionsAdmin extends FCommand
@Override
public void perform()
{
fme.setHasAdminMode(this.argAsBool(0, ! fme.hasAdminMode()));
Boolean target = this.arg(0, ARBoolean.get(), !fme.isUsingAdminMode());
if (target == null) return;
if ( fme.hasAdminMode())
fme.setUsingAdminMode(target);
if ( fme.isUsingAdminMode())
{
fme.msg("<i>You have enabled admin bypass mode.");
Factions.get().log(fme.getName() + " has ENABLED admin bypass mode.");

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
@ -21,7 +22,7 @@ public class CmdFactionsAutoClaim extends FCommand
@Override
public void perform()
{
Faction forFaction = this.argAsFaction(0, myFaction);
Faction forFaction = this.arg(0, ARFaction.get(), myFaction);
if (forFaction == null || forFaction == fme.getAutoClaimFor())
{
fme.setAutoClaimFor(null);

View File

@ -28,7 +28,7 @@ public class CmdFactionsClaim extends FCommand
@Override
public void perform()
{
Faction forFaction = this.arg(0, ARFaction.get());
final Faction forFaction = this.arg(0, ARFaction.get());
if (forFaction == null) return;
Integer radius = this.arg(1, ARInteger.get(), 1);

View File

@ -15,7 +15,6 @@ import com.massivecraft.factions.Rel;
import com.massivecraft.factions.event.FPlayerJoinEvent;
import com.massivecraft.factions.event.FactionCreateEvent;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
public class CmdFactionsCreate extends FCommand
{
@ -91,7 +90,7 @@ public class CmdFactionsCreate extends FCommand
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower));
}
msg("<i>You should now: %s", p.cmdBase.cmdFactionsDescription.getUseageTemplate());
msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
if (ConfServer.logFactionCreate)
Factions.get().log(fme.getName()+" created a new faction: "+tag);

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -31,7 +32,7 @@ public class CmdFactionsDeinvite extends FCommand
if (you.getFaction() == myFaction)
{
msg("%s<i> is already a member of %s", you.getName(), myFaction.getTag());
msg("<i>You might want to: %s", p.cmdBase.cmdFactionsKick.getUseageTemplate(false));
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
return;
}

View File

@ -3,7 +3,9 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFFlag;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
@ -37,8 +39,9 @@ public class CmdFactionsFlag extends FCommand
return;
}
FFlag flag = this.argAsFactionFlag(1);
FFlag flag = this.arg(1, ARFFlag.get());
if (flag == null) return;
if ( ! this.argIsSet(2))
{
msg(Txt.titleize("Flag for " + faction.describeTo(fme, true)));
@ -46,7 +49,7 @@ public class CmdFactionsFlag extends FCommand
return;
}
Boolean targetValue = this.argAsBool(2);
Boolean targetValue = this.arg(2, ARBoolean.get());
if (targetValue == null) return;
// Do the sender have the right to change flags?

View File

@ -13,6 +13,7 @@ import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.integration.EssentialsFeatures;
@ -53,7 +54,7 @@ public class CmdFactionsHome extends FCommand
if ( ! myFaction.hasHome())
{
fme.msg("<b>Your faction does not have a home. " + (fme.getRole().isLessThan(Rel.OFFICER) ? "<i> Ask your leader to:" : "<i>You should:"));
fme.sendMessage(p.cmdBase.cmdFactionsSethome.getUseageTemplate());
fme.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
return;
}

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
@ -33,7 +34,7 @@ public class CmdFactionsInvite extends FCommand
if (you.getFaction() == myFaction)
{
msg("%s<i> is already a member of %s", you.getName(), myFaction.getTag());
msg("<i>You might want to: " + p.cmdBase.cmdFactionsKick.getUseageTemplate(false));
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
return;
}

View File

@ -66,7 +66,7 @@ public class CmdFactionsJoin extends FCommand
return;
}
if( ! (faction.isOpen() || faction.isInvited(fplayer) || fme.hasAdminMode() || Perm.JOIN_ANY.has(sender, false)))
if( ! (faction.isOpen() || faction.isInvited(fplayer) || fme.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
{
msg("<i>This faction requires invitation.");
if (samePlayer)

View File

@ -34,11 +34,11 @@ public class CmdFactionsKick extends FCommand
if (fme == you)
{
msg("<b>You cannot kick yourself.");
msg("<i>You might want to: %s", p.cmdBase.cmdFactionsLeave.getUseageTemplate(false));
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
return;
}
if (you.getRole() == Rel.LEADER && !(this.senderIsConsole || fme.hasAdminMode()))
if (you.getRole() == Rel.LEADER && !(this.senderIsConsole || fme.isUsingAdminMode()))
{
msg("<b>The leader can not be kicked.");
return;

View File

@ -38,7 +38,7 @@ public class CmdFactionsLeader extends FCommand
FPlayer targetFactionCurrentLeader = targetFaction.getFPlayerLeader();
// We now have fplayer and the target faction
if (this.senderIsConsole || fme.hasAdminMode() || Perm.LEADER_ANY.has(sender, false))
if (this.senderIsConsole || fme.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
{
// Do whatever you wish
}

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
@ -23,34 +24,33 @@ public class CmdFactionsMap extends FCommand
@Override
public void perform()
{
if (this.argIsSet(0))
{
if (this.argAsBool(0, ! fme.isMapAutoUpdating()))
{
// Turn on
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostMap, "to show the map", "for showing the map")) return;
fme.setMapAutoUpdating(true);
msg("<i>Map auto update <green>ENABLED.");
// And show the map once
showMap();
}
else
{
// Turn off
fme.setMapAutoUpdating(false);
msg("<i>Map auto update <red>DISABLED.");
}
}
else
if (!this.argIsSet(0))
{
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostMap, "to show the map", "for showing the map")) return;
showMap();
return;
}
if (this.arg(0, ARBoolean.get(), !fme.isMapAutoUpdating()))
{
// Turn on
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostMap, "to show the map", "for showing the map")) return;
fme.setMapAutoUpdating(true);
msg("<i>Map auto update <green>ENABLED.");
// And show the map once
showMap();
}
else
{
// Turn off
fme.setMapAutoUpdating(false);
msg("<i>Map auto update <red>DISABLED.");
}
}

View File

@ -4,7 +4,10 @@ import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
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.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
@ -40,8 +43,9 @@ public class CmdFactionsPerm extends FCommand
return;
}
FPerm perm = this.argAsFactionPerm(1);
FPerm perm = this.arg(1, ARFPerm.get());
if (perm == null) return;
if ( ! this.argIsSet(2))
{
msg(Txt.titleize("Perm for " + faction.describeTo(fme, true)));
@ -53,10 +57,10 @@ public class CmdFactionsPerm extends FCommand
// Do the sender have the right to change perms for this faction?
if ( ! FPerm.PERMS.has(sender, faction, true)) return;
Rel rel = this.argAsRel(2);
Rel rel = this.arg(2, ARRel.get());
if (rel == null) return;
Boolean val = this.argAsBool(3, null);
Boolean val = this.arg(3, ARBoolean.get(), null);
if (val == null) return;
// Do the change

View File

@ -4,6 +4,9 @@ import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsPowerBoost extends FCommand
@ -35,32 +38,29 @@ public class CmdFactionsPowerBoost extends FCommand
return;
}
Double targetPower = this.argAsDouble(2);
if (targetPower == null)
{
msg("<b>You must specify a valid numeric value for the power bonus/penalty amount.");
return;
}
Double targetPower = this.arg(2, ARDouble.get());
if (targetPower == null) return;
String target;
if (doPlayer)
{
FPlayer targetPlayer = this.argAsBestFPlayerMatch(1);
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny());
if (targetPlayer == null) return;
targetPlayer.setPowerBoost(targetPower);
target = "Player \""+targetPlayer.getName()+"\"";
}
else
{
Faction targetFaction = this.argAsFaction(1);
Faction targetFaction = this.arg(1, ARFaction.get());
if (targetFaction == null) return;
targetFaction.setPowerBoost(targetPower);
target = "Faction \""+targetFaction.getTag()+"\"";
}
msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels.");
if (!senderIsConsole)
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
}
}

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -40,7 +41,7 @@ public class CmdFactionsSethome extends FCommand
// Can the player set the faction home HERE?
if
(
! fme.hasAdminMode()
! fme.isUsingAdminMode()
&&
ConfServer.homesMustBeInClaimedTerritory
&&
@ -57,7 +58,7 @@ public class CmdFactionsSethome extends FCommand
faction.setHome(me.getLocation());
faction.msg("%s<i> set the home for your faction. You can now use:", fme.describeTo(myFaction, true));
faction.sendMessage(p.cmdBase.cmdFactionsHome.getUseageTemplate());
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
if (faction != myFaction)
{
fme.msg("<b>You have set the home for the "+faction.getTag(fme)+"<i> faction.");

View File

@ -64,7 +64,7 @@ public abstract class FCommand extends MCommand
// if economy is enabled and they're not on the bypass list, make 'em pay; returns true unless person can't afford the cost
public boolean payForCommand(double cost, String toDoThis, String forDoingThis)
{
if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.hasAdminMode()) return true;
if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isUsingAdminMode()) return true;
if(ConfServer.bankEnabled && ConfServer.bankFactionPaysCosts && fme.hasFaction())
return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis);
@ -75,7 +75,7 @@ public abstract class FCommand extends MCommand
// like above, but just make sure they can pay; returns true unless person can't afford the cost
public boolean canAffordCommand(double cost, String toDoThis)
{
if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.hasAdminMode()) return true;
if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isUsingAdminMode()) return true;
if(ConfServer.bankEnabled && ConfServer.bankFactionPaysCosts && fme.hasFaction())
return Econ.hasAtLeast(myFaction, cost, toDoThis);