Implemented SavageFactions Warp and Perms system as requested. - Credits SavageLif3 & ProSavage

This commit is contained in:
Driftay
2019-08-05 08:05:22 -04:00
parent bc06c5ab4a
commit 8dc1e97098
28 changed files with 516 additions and 1098 deletions

View File

@@ -4,8 +4,8 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.FactionWarpsFrame;
import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.util.WarpGUI;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
@@ -42,10 +42,7 @@ public class CmdFWarp extends FCommand {
if (args.size() == 0) {
WarpGUI warpGUI = new WarpGUI(fme);
warpGUI.build();
me.openInventory(warpGUI.getInventory());
new FactionWarpsFrame(fme.getFaction()).buildGUI(fme);
} else if (args.size() > 2) {
fme.msg(TL.COMMAND_FWARP_COMMANDFORMAT);
} else {
@@ -61,9 +58,7 @@ public class CmdFWarp extends FCommand {
}
// Check transaction AFTER password check.
if (!transact(fme)) {
return;
}
if (!transact(fme)) return;
final FPlayer fPlayer = fme;
final UUID uuid = fme.getPlayer().getUniqueId();
this.doWarmUp(WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warpName, () -> {
@@ -73,9 +68,7 @@ public class CmdFWarp extends FCommand {
fPlayer.msg(TL.COMMAND_FWARP_WARPED, warpName);
}
}, this.p.getConfig().getLong("warmups.f-warp", 0));
} else {
fme.msg(TL.COMMAND_FWARP_INVALID_WARP, warpName);
}
} else { fme.msg(TL.COMMAND_FWARP_INVALID_WARP, warpName); }
}
}

View File

@@ -6,8 +6,8 @@ import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.Permissable;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.fperms.gui.PermissableActionGUI;
import com.massivecraft.factions.zcore.fperms.gui.PermissableRelationGUI;
import com.massivecraft.factions.zcore.fperms.gui.PermissableActionFrame;
import com.massivecraft.factions.zcore.fperms.gui.PermissableRelationFrame;
import com.massivecraft.factions.zcore.util.TL;
import java.util.Arrays;
@@ -41,16 +41,10 @@ public class CmdPerm extends FCommand {
@Override
public void perform() {
if (args.size() == 0) {
PermissableRelationGUI gui = new PermissableRelationGUI(fme);
gui.build();
me.openInventory(gui.getInventory());
new PermissableRelationFrame(fme.getFaction()).buildGUI(fme);
return;
} else if (args.size() == 1 && getPermissable(argAsString(0)) != null) {
PermissableActionGUI gui = new PermissableActionGUI(fme, getPermissable(argAsString(0)));
gui.build();
me.openInventory(gui.getInventory());
new PermissableActionFrame(fme.getFaction()).buildGUI(fme, getPermissable(argAsString(0)));
return;
}
@@ -103,7 +97,6 @@ public class CmdPerm extends FCommand {
fme.getFaction().setPermission(permissable, permissableAction, access);
}
}
fme.msg(TL.COMMAND_PERM_SET, argAsString(1), access.name(), argAsString(0));
P.p.log(String.format(TL.COMMAND_PERM_SET.toString(), argAsString(1), access.name(), argAsString(0)) + " for faction " + fme.getTag());
}

View File

@@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.XMaterial;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
@@ -113,8 +114,8 @@ public class CmdTnt extends FCommand {
return;
}
for (int i = 0; i <= fullStacks - 1; i++) me.getPlayer().getInventory().addItem(new ItemStack(Material.TNT, 64));
if (remainderAmt != 0) me.getPlayer().getInventory().addItem(new ItemStack(Material.TNT, remainderAmt));
for (int i = 0; i <= fullStacks - 1; i++) me.getPlayer().getInventory().addItem(new ItemStack(XMaterial.TNT.parseMaterial(), 64));
if (remainderAmt != 0) me.getPlayer().getInventory().addItem(new ItemStack(XMaterial.TNT.parseMaterial(), remainderAmt));
fme.getFaction().takeTnt(amount);
me.updateInventory();

View File

@@ -1,5 +1,6 @@
package com.massivecraft.factions.cmd.claim;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.cmd.FCommand;
import com.massivecraft.factions.struct.Permission;
@@ -31,7 +32,10 @@ public class CmdClaimAt extends FCommand {
int x = argAsInt(1);
int z = argAsInt(2);
FLocation location = new FLocation(argAsString(0), x, z);
fme.attemptClaim(myFaction, location, true);
if (!((fme.getPlayer().getLocation().getX() + (x * 16)) > (fme.getPlayer().getLocation().getX() + (Conf.mapWidth * 16))) &&
!((fme.getPlayer().getLocation().getZ() + (z * 16)) > (fme.getPlayer().getLocation().getZ() + (Conf.mapHeight * 16)))) {
fme.attemptClaim(myFaction, location, true);
} else fme.msg(TL.COMMAND_CLAIM_DENIED);
}
@Override

View File

@@ -16,6 +16,7 @@ public class CmdMoney extends FCommand {
public CmdMoney() {
super();
this.aliases.add("money");
this.aliases.add("bank");
//this.requiredArgs.add("");
//this.optionalArgs.put("","")

View File

@@ -15,6 +15,7 @@ public class CmdMoneyBalance extends FCommand {
//this.requiredArgs.add("");
this.optionalArgs.put("faction", "yours");
this.isMoneyCommand = true;
this.permission = Permission.MONEY_BALANCE.node;
this.setHelpShort(TL.COMMAND_MONEYBALANCE_SHORT.toString());

View File

@@ -20,6 +20,8 @@ public class CmdMoneyDeposit extends FCommand {
this.requiredArgs.add("amount");
this.optionalArgs.put("faction", "yours");
this.isMoneyCommand = true;
this.permission = Permission.MONEY_DEPOSIT.node;

View File

@@ -24,6 +24,8 @@ public class CmdMoneyTransferFf extends FCommand {
this.permission = Permission.MONEY_F2F.node;
this.isMoneyCommand = true;
senderMustBePlayer = false;
senderMustBeMember = false;

View File

@@ -23,6 +23,7 @@ public class CmdMoneyTransferFp extends FCommand {
this.permission = Permission.MONEY_F2P.node;
this.isMoneyCommand = true;
senderMustBePlayer = false;
senderMustBeMember = false;

View File

@@ -22,6 +22,7 @@ public class CmdMoneyTransferPf extends FCommand {
//this.optionalArgs.put("", "");
this.permission = Permission.MONEY_P2F.node;
this.isMoneyCommand = true;
senderMustBePlayer = false;

View File

@@ -22,6 +22,7 @@ public class CmdMoneyWithdraw extends FCommand {
this.optionalArgs.put("faction", "yours");
this.permission = Permission.MONEY_WITHDRAW.node;
this.isMoneyCommand = true;
senderMustBePlayer = true;