Add economy option for f warps from #126.

This commit is contained in:
drtshock 2014-11-11 09:28:53 -06:00
parent b528b5c4db
commit 201d10ada5
5 changed files with 41 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>1.6.9.5-U0.1.11</version>
<version>1.6.9.5-U0.1.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Factions</name>

View File

@ -1,5 +1,8 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
public class CmdDelFWarp extends FCommand {
@ -20,10 +23,17 @@ public class CmdDelFWarp extends FCommand {
public void perform() {
String warp = argAsString(0);
if (myFaction.isWarp(warp)) {
if (!transact(fme)) {
return;
}
myFaction.removeWarp(warp);
fme.msg("<i>Deleted warp <a>%s", warp);
} else {
fme.msg("<i>Couldn't find warp <a>%s", warp);
}
}
private boolean transact(FPlayer player) {
return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.delwarp", 5), "to delete warp", "for deleting warp");
}
}

View File

@ -1,5 +1,8 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
public class CmdFWarp extends FCommand {
@ -29,6 +32,9 @@ public class CmdFWarp extends FCommand {
} else {
String warpName = argAsString(0);
if (myFaction.isWarp(argAsString(0))) {
if (!transact(fme)) {
return;
}
fme.getPlayer().teleport(myFaction.getWarp(warpName).getLocation());
fme.msg("<i>Warped to <a>%s", warpName);
} else {
@ -36,4 +42,8 @@ public class CmdFWarp extends FCommand {
}
}
}
private boolean transact(FPlayer player) {
return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.warp", 5), "to warp", "for warping");
}
}

View File

@ -1,6 +1,8 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.LazyLocation;
@ -31,9 +33,17 @@ public class CmdSetFWarp extends FCommand {
return;
}
if (!transact(fme)) {
return;
}
String warp = argAsString(0);
LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation());
myFaction.setWarp(warp, loc);
fme.msg("<i>Set warp <a>%s <i>to your location.", warp);
}
private boolean transact(FPlayer player) {
return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.setwarp", 5), "to set warp", "for setting warp");
}
}

View File

@ -23,6 +23,16 @@ findfactionsexploit:
# What should be the max amount of warps that a Factoin can set?
max-warps: 5
# This is the cost section for warps.
# It will charge them each time the command would be successful. (won't charge on erroneous /f warp attempts).
# You can use decimal places here.
# If enabled is set to false, it will ignore the values.
warp-cost:
enabled: false
setwarp: 5
delwarp: 5
warp: 5
# Pistons
# Should we disable pistons in Faction territory? This will prevent people from doing something like:
# http://i.gyazo.com/6a1a31222e58a5d60ff341c13f6a8404.gif