Merge remote-tracking branch 'origin/1.6.x' into 1.6.x
This commit is contained in:
commit
1531efc030
BIN
classes/artifacts/Factions_jar/Factions.jar
Normal file
BIN
classes/artifacts/Factions_jar/Factions.jar
Normal file
Binary file not shown.
@ -34,15 +34,11 @@ public class CmdBan extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
|
||||||
// Adds bypass to admins and clean permission check
|
// Simplified for clarity
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.BAN)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.BAN);
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans");
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "ban");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Good on permission checks. Now lets just ban the player.
|
// Good on permission checks. Now lets just ban the player.
|
||||||
FPlayer target = argAsFPlayer(0);
|
FPlayer target = argAsFPlayer(0);
|
||||||
|
@ -6,6 +6,7 @@ import com.massivecraft.factions.Faction;
|
|||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.struct.BanInfo;
|
import com.massivecraft.factions.struct.BanInfo;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -32,6 +33,10 @@ public class CmdBanlist extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
if (!this.hasAccess(PermissableAction.BAN)) {
|
||||||
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Faction target = myFaction;
|
Faction target = myFaction;
|
||||||
if (!args.isEmpty()) {
|
if (!args.isEmpty()) {
|
||||||
target = argAsFaction(0);
|
target = argAsFaction(0);
|
||||||
|
@ -32,13 +32,10 @@ public class CmdChest extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// This permission check is way too explicit but it's clean
|
// This permission check is way too explicit but it's clean
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.CHEST)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.CHEST);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
me.openInventory(fme.getFaction().getChest());
|
me.openInventory(fme.getFaction().getChest());
|
||||||
|
|
||||||
|
@ -37,13 +37,10 @@ public class CmdClaim extends FCommand {
|
|||||||
int radius = this.argAsInt(0, 1); // Default to 1
|
int radius = this.argAsInt(0, 1); // Default to 1
|
||||||
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
||||||
|
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.TERRITORY)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (radius < 1) {
|
if (radius < 1) {
|
||||||
|
@ -34,13 +34,10 @@ public class CmdDeinvite extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
FPlayer you = this.argAsBestFPlayerMatch(0);
|
FPlayer you = this.argAsBestFPlayerMatch(0);
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.INVITE)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (you == null) {
|
if (you == null) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : myFaction.getInvites()) {
|
for (String id : myFaction.getInvites()) {
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdDelFWarp extends FCommand {
|
public class CmdDelFWarp extends FCommand {
|
||||||
@ -22,6 +23,10 @@ public class CmdDelFWarp extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
String warp = argAsString(0);
|
String warp = argAsString(0);
|
||||||
|
if (!this.hasAccess(PermissableAction.WARP)){
|
||||||
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage warps");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (myFaction.isWarp(warp)) {
|
if (myFaction.isWarp(warp)) {
|
||||||
if (!transact(fme)) {
|
if (!transact(fme)) {
|
||||||
return;
|
return;
|
||||||
|
@ -45,13 +45,6 @@ public class CmdDisband extends FCommand {
|
|||||||
|
|
||||||
boolean isMyFaction = fme != null && faction == myFaction;
|
boolean isMyFaction = fme != null && faction == myFaction;
|
||||||
|
|
||||||
if (!fme.isAdminBypassing()) {
|
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.DISBAND);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband faction");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!faction.isNormal()) {
|
if (!faction.isNormal()) {
|
||||||
msg(TL.COMMAND_DISBAND_IMMUTABLE.toString());
|
msg(TL.COMMAND_DISBAND_IMMUTABLE.toString());
|
||||||
return;
|
return;
|
||||||
@ -60,6 +53,10 @@ public class CmdDisband extends FCommand {
|
|||||||
msg(TL.COMMAND_DISBAND_MARKEDPERMANENT.toString());
|
msg(TL.COMMAND_DISBAND_MARKEDPERMANENT.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!this.hasAccess(PermissableAction.DISBAND)) {
|
||||||
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband faction");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// check for tnt before disbanding.
|
// check for tnt before disbanding.
|
||||||
|
@ -31,13 +31,10 @@ public class CmdFWarp extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
//TODO: check if in combat.
|
//TODO: check if in combat.
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.WARP)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.WARP);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (args.size() == 0) {
|
if (args.size() == 0) {
|
||||||
|
@ -36,6 +36,7 @@ public class CmdFly extends FCommand {
|
|||||||
this.senderMustBeMember = true;
|
this.senderMustBeMember = true;
|
||||||
this.senderMustBeModerator = false;
|
this.senderMustBeModerator = false;
|
||||||
}
|
}
|
||||||
|
/// I'll optimize this later today or tomorrow
|
||||||
|
|
||||||
public static void startParticles() {
|
public static void startParticles() {
|
||||||
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() {
|
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() {
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -33,7 +34,10 @@ public class CmdGetVault extends FCommand {
|
|||||||
Location vaultLocation = fme.getFaction().getVault();
|
Location vaultLocation = fme.getFaction().getVault();
|
||||||
ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore")));
|
ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore")));
|
||||||
|
|
||||||
|
if (!this.hasAccess(PermissableAction.VAULT)) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "use vault");
|
||||||
|
return;
|
||||||
|
}
|
||||||
//check if vault is set
|
//check if vault is set
|
||||||
if (vaultLocation != null) {
|
if (vaultLocation != null) {
|
||||||
fme.msg(TL.COMMAND_GETVAULT_ALREADYSET);
|
fme.msg(TL.COMMAND_GETVAULT_ALREADYSET);
|
||||||
|
@ -49,13 +49,10 @@ public class CmdHome extends FCommand {
|
|||||||
fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
|
fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.HOME)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.HOME);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!myFaction.hasHome()) {
|
if (!myFaction.hasHome()) {
|
||||||
|
@ -22,6 +22,7 @@ public class CmdInspect extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
// Who can inspect?
|
||||||
if (fme.isInspectMode()) {
|
if (fme.isInspectMode()) {
|
||||||
fme.setInspectMode(false);
|
fme.setInspectMode(false);
|
||||||
msg(TL.COMMAND_INSPECT_DISABLED_MSG);
|
msg(TL.COMMAND_INSPECT_DISABLED_MSG);
|
||||||
|
@ -48,13 +48,10 @@ public class CmdInvite extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.INVITE)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (myFaction.isInvited(target)) {
|
if (myFaction.isInvited(target)) {
|
||||||
fme.msg(TL.COMMAND_INVITE_ALREADYINVITED, target.getName());
|
fme.msg(TL.COMMAND_INVITE_ALREADYINVITED, target.getName());
|
||||||
|
@ -79,8 +79,7 @@ public class CmdKick extends FCommand {
|
|||||||
// - Make sure the player is in the faction.
|
// - Make sure the player is in the faction.
|
||||||
// - Make sure the kicked player has lower rank than the kicker.
|
// - Make sure the kicked player has lower rank than the kicker.
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!fme.isAdminBypassing()) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
|
if (!this.hasAccess(PermissableAction.KICK, false)) {
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
|
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdLogins extends FCommand {
|
public class CmdLogins extends FCommand {
|
||||||
@ -18,6 +19,11 @@ public class CmdLogins extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
/// Perhaps add a PermissableAction later?
|
||||||
|
if (!fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "monitor joins");
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean monitor = fme.isMonitoringJoins();
|
boolean monitor = fme.isMonitoringJoins();
|
||||||
fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(!monitor));
|
fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(!monitor));
|
||||||
fme.setMonitorJoins(!monitor);
|
fme.setMonitorJoins(!monitor);
|
||||||
|
@ -37,13 +37,10 @@ public class CmdSetFWarp extends FCommand {
|
|||||||
|
|
||||||
// This statement allows us to check if they've specifically denied it, or default to
|
// This statement allows us to check if they've specifically denied it, or default to
|
||||||
// the old setting of allowing moderators to set warps.
|
// the old setting of allowing moderators to set warps.
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.SETWARP)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int maxWarps = P.p.getConfig().getInt("max-warps", 5);
|
int maxWarps = P.p.getConfig().getInt("max-warps", 5);
|
||||||
|
@ -40,13 +40,10 @@ public class CmdSethome extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!this.hasAccess(PermissableAction.SETHOME) && !Permission.SETHOME_ANY.has(sender, true)) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.SETHOME);
|
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN && !Permission.SETHOME_ANY.has(sender, true)) {
|
|
||||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home");
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Can the player set the faction home HERE?
|
// Can the player set the faction home HERE?
|
||||||
if (!Permission.BYPASS.has(me) &&
|
if (!Permission.BYPASS.has(me) &&
|
||||||
|
@ -4,6 +4,7 @@ import com.google.common.collect.ArrayListMultimap;
|
|||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdShowClaims extends FCommand {
|
public class CmdShowClaims extends FCommand {
|
||||||
@ -25,6 +26,11 @@ public class CmdShowClaims extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
// #suggestion
|
||||||
|
if (!this.hasAccess(PermissableAction.TERRITORY)) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "manage territory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
sendMessage(TL.COMMAND_SHOWCLAIMS_HEADER.toString().replace("{faction}", fme.getFaction().describeTo(fme)));
|
sendMessage(TL.COMMAND_SHOWCLAIMS_HEADER.toString().replace("{faction}", fme.getFaction().describeTo(fme)));
|
||||||
ListMultimap<String, String> chunkMap = ArrayListMultimap.create();
|
ListMultimap<String, String> chunkMap = ArrayListMultimap.create();
|
||||||
String format = TL.COMMAND_SHOWCLAIMS_CHUNKSFORMAT.toString();
|
String format = TL.COMMAND_SHOWCLAIMS_CHUNKSFORMAT.toString();
|
||||||
|
@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf;
|
|||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -21,6 +22,10 @@ public class CmdShowInvites extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
if (!this.hasAccess(PermissableAction.INVITE)) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "manage invites");
|
||||||
|
return;
|
||||||
|
}
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : myFaction.getInvites()) {
|
for (String id : myFaction.getInvites()) {
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
|
@ -5,6 +5,8 @@ import com.massivecraft.factions.integration.Econ;
|
|||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.WarmUpUtil;
|
import com.massivecraft.factions.util.WarmUpUtil;
|
||||||
import com.massivecraft.factions.zcore.MCommand;
|
import com.massivecraft.factions.zcore.MCommand;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -25,6 +27,7 @@ public abstract class FCommand extends MCommand<P> {
|
|||||||
public boolean senderMustBeModerator;
|
public boolean senderMustBeModerator;
|
||||||
public boolean senderMustBeAdmin;
|
public boolean senderMustBeAdmin;
|
||||||
public boolean senderMustBeColeader;
|
public boolean senderMustBeColeader;
|
||||||
|
protected PermissableAction actionPermission;
|
||||||
|
|
||||||
public boolean isMoneyCommand;
|
public boolean isMoneyCommand;
|
||||||
|
|
||||||
@ -43,6 +46,47 @@ public abstract class FCommand extends MCommand<P> {
|
|||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasAccess() {
|
||||||
|
if (this.permission == null || this.fme == null) return false;
|
||||||
|
if (!this.fme.isAdminBypassing()) {
|
||||||
|
Access access = myFaction.getAccess(this.fme, permission);
|
||||||
|
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public boolean hasAccess(boolean checkifAdmin) {
|
||||||
|
if (this.permission == null || this.fme == null) return false;
|
||||||
|
if (!this.fme.isAdminBypassing() && checkifAdmin) {
|
||||||
|
Access access = myFaction.getAccess(this.fme, permission);
|
||||||
|
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public boolean hasAccess(PermissableAction perm) {
|
||||||
|
if (this.permission == null || this.fme == null) return false;
|
||||||
|
if (!this.fme.isAdminBypassing()) {
|
||||||
|
Access access = myFaction.getAccess(this.fme, perm);
|
||||||
|
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public boolean hasAccess(PermissableAction perm, boolean checkifAdmin) {
|
||||||
|
if (this.permission == null || this.fme == null) return false;
|
||||||
|
if (!this.fme.isAdminBypassing() && checkifAdmin) {
|
||||||
|
Access access = myFaction.getAccess(this.fme, perm);
|
||||||
|
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
|
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
|
Loading…
Reference in New Issue
Block a user