Add economy option for f warps from #126.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user