potionEffects;
public PlayerState(final Player player) {
- name = player.getName();
- debug.i("creating PlayerState of " + name, player);
+ this.name = player.getName();
+ debug.i("creating PlayerState of " + this.name, player);
- fireticks = player.getFireTicks();
- foodlevel = player.getFoodLevel();
- gamemode = player.getGameMode().getValue();
- health = player.getHealth();
- maxhealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
+ this.fireticks = player.getFireTicks();
+ this.foodlevel = player.getFoodLevel();
+ this.gamemode = player.getGameMode().getValue();
+ this.health = player.getHealth();
+ this.maxhealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
- exhaustion = player.getExhaustion();
- experience = player.getExp();
- explevel = player.getLevel();
- saturation = player.getSaturation();
+ this.exhaustion = player.getExhaustion();
+ this.experience = player.getExp();
+ this.explevel = player.getLevel();
+ this.saturation = player.getSaturation();
- potionEffects = player.getActivePotionEffects();
- collides = player.isCollidable();
+ this.walkSpeed = player.getWalkSpeed();
+ this.flySpeed = player.getFlySpeed();
+
+ this.potionEffects = player.getActivePotionEffects();
+ this.collides = player.isCollidable();
final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(player.getName());
final Arena arena = aPlayer.getArena();
@@ -71,7 +76,7 @@ public PlayerState(final Player player) {
aPlayer.setFlyState(player.isFlying());
if (arena.getArenaConfig().getBoolean(CFG.CHAT_COLORNICK)) {
- displayname = player.getDisplayName();
+ this.displayname = player.getDisplayName();
}
fullReset(arena, player);
@@ -82,19 +87,21 @@ public PlayerState(final Player player) {
}
public void dump(final YamlConfiguration cfg) {
- debug.i("backing up PlayerState of " + name, name);
- cfg.set("state.fireticks", fireticks);
- cfg.set("state.foodlevel", foodlevel);
- cfg.set("state.gamemode", gamemode);
- cfg.set("state.health", health);
- cfg.set("state.maxhealth", maxhealth);
- cfg.set("state.exhaustion", exhaustion);
- cfg.set("state.experience", experience);
- cfg.set("state.explevel", explevel);
- cfg.set("state.saturation", saturation);
- cfg.set("state.displayname", displayname);
- cfg.set("state.flying", ArenaPlayer.parsePlayer(name).getFlyState());
- cfg.set("state.collides", collides);
+ debug.i("backing up PlayerState of " + this.name, this.name);
+ cfg.set("state.fireticks", this.fireticks);
+ cfg.set("state.foodlevel", this.foodlevel);
+ cfg.set("state.gamemode", this.gamemode);
+ cfg.set("state.health", this.health);
+ cfg.set("state.maxhealth", this.maxhealth);
+ cfg.set("state.exhaustion", this.exhaustion);
+ cfg.set("state.experience", this.experience);
+ cfg.set("state.explevel", this.explevel);
+ cfg.set("state.saturation", this.saturation);
+ cfg.set("state.displayname", this.displayname);
+ cfg.set("state.flying", ArenaPlayer.parsePlayer(this.name).getFlyState());
+ cfg.set("state.walkSpeed", this.walkSpeed);
+ cfg.set("state.flySpeed", this.flySpeed);
+ cfg.set("state.collides", this.collides);
}
public static void fullReset(final Arena arena, final Player player) {
@@ -147,35 +154,37 @@ public static void fullReset(final Arena arena, final Player player) {
player.setDisplayName(n);
}
+ player.setWalkSpeed(0.2F);
+ player.setFlySpeed(0.2F);
}
public void unload(final boolean soft) {
- final Player player = Bukkit.getPlayerExact(name);
+ final Player player = Bukkit.getPlayerExact(this.name);
if (player == null) {
- final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(name);
+ final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(this.name);
PVPArena.instance.getAgm().disconnect(aPlayer.getArena(), aPlayer);
return;
}
- debug.i("restoring PlayerState of " + name, player);
+ debug.i("restoring PlayerState of " + this.name, player);
- player.setFireTicks(fireticks);
- player.setFoodLevel(foodlevel);
+ player.setFireTicks(this.fireticks);
+ player.setFoodLevel(this.foodlevel);
final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(player.getName());
- player.setFoodLevel(foodlevel);
+ player.setFoodLevel(this.foodlevel);
if (aPlayer.getArena().getArenaConfig().getInt(CFG.GENERAL_GAMEMODE) > -1) {
- player.setGameMode(GameMode.getByValue(gamemode));
+ player.setGameMode(GameMode.getByValue(this.gamemode));
}
if (aPlayer.getArena().getArenaConfig().getInt(CFG.PLAYER_MAXHEALTH) > 0) {
- player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxhealth);
+ player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(this.maxhealth);
}
- if (player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() == maxhealth) {
- player.setHealth(Math.min(health, maxhealth));
+ if (player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() == this.maxhealth) {
+ player.setHealth(Math.min(this.health, this.maxhealth));
} else {
- final double newHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() * health / maxhealth;
+ final double newHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() * this.health / this.maxhealth;
if (newHealth > player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue()) {
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
} else {
@@ -183,17 +192,17 @@ public void unload(final boolean soft) {
}
}
- player.setSaturation(saturation);
+ player.setSaturation(this.saturation);
if (aPlayer.getArena().getArenaConfig().getInt(CFG.GENERAL_GAMEMODE) > -1) {
- player.setGameMode(GameMode.getByValue(gamemode));
+ player.setGameMode(GameMode.getByValue(this.gamemode));
}
- player.setLevel(explevel);
- player.setExp(experience);
- player.setExhaustion(exhaustion);
+ player.setLevel(this.explevel);
+ player.setExp(this.experience);
+ player.setExhaustion(this.exhaustion);
player.setFallDistance(0);
player.setVelocity(new Vector());
if (aPlayer.getArena() != null && aPlayer.getArena().getArenaConfig().getBoolean(CFG.CHAT_COLORNICK)) {
- player.setDisplayName(displayname);
+ player.setDisplayName(this.displayname);
}
if (aPlayer.getArena() != null) {
@@ -203,7 +212,7 @@ public void unload(final boolean soft) {
removeEffects(player);
- player.addPotionEffects(potionEffects);
+ player.addPotionEffects(this.potionEffects);
aPlayer.setTelePass(false);
player.setFireTicks(0);
@@ -223,13 +232,15 @@ public void run() {
player.setNoDamageTicks(aPlayer.getArena().getArenaConfig().getInt(CFG.TIME_TELEPORTPROTECT) * 20);
}
player.resetPlayerTime();
- player.setCollidable(collides);
+ player.setCollidable(this.collides);
if (!soft) {
if (aPlayer.getFlyState() && !player.getAllowFlight()) {
player.setAllowFlight(true);
}
player.setFlying(aPlayer.getFlyState());
}
+ player.setFlySpeed(this.flySpeed);
+ player.setWalkSpeed(this.walkSpeed);
}
/**
@@ -251,20 +262,23 @@ public static void playersetHealth(final Player player, final double value) {
}
public void reset() {
- debug.i("clearing PlayerState of " + name, name);
- fireticks = 0;
- foodlevel = 0;
- gamemode = 0;
- health = 0;
- maxhealth = -1;
-
- exhaustion = 0;
- experience = 0;
- explevel = 0;
- saturation = 0;
- displayname = null;
- potionEffects = null;
- collides = false;
+ debug.i("clearing PlayerState of " + this.name, this.name);
+ this.fireticks = 0;
+ this.foodlevel = 0;
+ this.gamemode = 0;
+ this.health = 0;
+ this.maxhealth = -1;
+
+ this.exhaustion = 0;
+ this.experience = 0;
+ this.explevel = 0;
+ this.saturation = 0;
+ this.displayname = null;
+ this.potionEffects = null;
+ this.collides = false;
+ this.walkSpeed = 0.2f;
+ this.flySpeed = 0.2f;
+
}
public static void removeEffects(final Player player) {
@@ -303,7 +317,9 @@ public static PlayerState undump(final YamlConfiguration cfg, final String pName
pState.displayname = cfg.getString("state.displayname", pName);
ArenaPlayer.parsePlayer(pName).setFlyState(cfg.getBoolean("state.flying", false));
pState.collides = cfg.getBoolean("state.collides", false);
+ pState.walkSpeed = (float) cfg.getDouble("state.walkSpeed", 0.2f);
+ pState.flySpeed = (float) cfg.getDouble("state.flySpeed", 0.2f);
return pState;
}
-}
\ No newline at end of file
+}
diff --git a/src/net/slipcor/pvparena/commands/AbstractArenaCommand.java b/src/net/slipcor/pvparena/commands/AbstractArenaCommand.java
index ad7440993..42e72d9b3 100644
--- a/src/net/slipcor/pvparena/commands/AbstractArenaCommand.java
+++ b/src/net/slipcor/pvparena/commands/AbstractArenaCommand.java
@@ -5,8 +5,11 @@
import net.slipcor.pvparena.core.Language;
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.core.StringParser;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.command.CommandSender;
+import java.util.Arrays;
+
/**
*
* PVP Arena ArenaCommand class
@@ -19,19 +22,17 @@
*/
public abstract class AbstractArenaCommand implements IArenaCommandHandler {
- private final String[] perms;
+ protected final String[] perms;
AbstractArenaCommand(final String[] permissions) {
- perms = permissions.clone();
+ this.perms = permissions.clone();
}
public static boolean argCountValid(final CommandSender sender, final Arena arena,
final String[] args, final Integer[] validCounts) {
- for (final int i : validCounts) {
- if (i == args.length) {
- return true;
- }
+ if (Arrays.stream(validCounts).anyMatch(count -> count == args.length)) {
+ return true;
}
final String msg = Language.parse(arena, MSG.ERROR_INVALID_ARGUMENT_COUNT,
@@ -50,24 +51,24 @@ public static boolean argCountValid(final CommandSender sender, final Arena aren
public abstract String getName();
+ public boolean hasPerms(CommandSender sender, Arena arena) {
+ return hasPerms(sender, arena, false);
+ }
+
@Override
- public boolean hasPerms(final CommandSender sender, final Arena arena) {
- if (sender.hasPermission("pvparena.admin")) {
- return true;
- }
+ public boolean hasPerms(CommandSender sender, Arena arena, boolean silent) {
- if (arena != null && sender.hasPermission("pvparena.create")
- && sender.getName().equals(arena.getOwner())) {
+ if (arena != null && PermissionManager.hasBuilderPerm(sender, arena)) {
return true;
}
- for (final String perm : perms) {
- if (sender.hasPermission(perm)) {
- return true;
- }
+ boolean hasPermission = Arrays.stream(this.perms).anyMatch(sender::hasPermission);
+ if (!silent && !hasPermission) {
+ Arrays.stream(this.perms)
+ .forEach(perm -> Arena.pmsg(sender, PermissionManager.getMissingPermissionMessage(perm)));
}
- return false;
+ return hasPermission;
}
public abstract void displayHelp(final CommandSender sender);
diff --git a/src/net/slipcor/pvparena/commands/AbstractGlobalCommand.java b/src/net/slipcor/pvparena/commands/AbstractGlobalCommand.java
index 259359d43..cda7013db 100644
--- a/src/net/slipcor/pvparena/commands/AbstractGlobalCommand.java
+++ b/src/net/slipcor/pvparena/commands/AbstractGlobalCommand.java
@@ -1,13 +1,17 @@
package net.slipcor.pvparena.commands;
-import net.slipcor.pvparena.PVPArena;
import net.slipcor.pvparena.api.IArenaCommandHandler;
import net.slipcor.pvparena.arena.Arena;
import net.slipcor.pvparena.core.Language;
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.core.StringParser;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.command.CommandSender;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
/**
*
* PVP Arena Global Command class
@@ -23,16 +27,14 @@ public abstract class AbstractGlobalCommand implements IArenaCommandHandler {
private final String[] perms;
AbstractGlobalCommand(final String[] permissions) {
- perms = permissions.clone();
+ this.perms = permissions.clone();
}
static boolean argCountValid(final CommandSender sender, final String[] args,
final Integer[] validCounts) {
- for (final int i : validCounts) {
- if (i == args.length) {
- return true;
- }
+ if (Arrays.stream(validCounts).anyMatch(count -> count == args.length)) {
+ return true;
}
Arena.pmsg(
@@ -49,63 +51,49 @@ static boolean argCountValid(final CommandSender sender, final String[] args,
/**
* Check if the global command also exists in arena context
+ *
* @return true if there is the same command for arena context
*/
public boolean hasVersionForArena() {
return false;
}
+ public boolean hasPerms(final CommandSender sender) {
+ return hasPerms(sender, null, false);
+ }
+
@Override
- public boolean hasPerms(final CommandSender sender, final Arena arena) {
- // tabComplete check
- if (PVPArena.hasAdminPerms(sender)) {
+ public boolean hasPerms(final CommandSender sender, final Arena arena, final boolean silent) {
+
+ if (PermissionManager.hasAdminPerm(sender)) {
return true;
}
- for (final String perm : perms) {
+ boolean hasNotPermission = false;
+ List messages = new ArrayList<>();
+
+ for (String perm : this.perms) {
if (sender.hasPermission(perm)) {
return true;
}
- }
- return false;
- }
- boolean hasPerms(final CommandSender sender) {
- if (PVPArena.hasAdminPerms(sender)) {
- return true;
+ // Get the permission deny message
+ if (!silent) {
+ messages.add(PermissionManager.getMissingPermissionMessage(perm));
+ hasNotPermission = true;
+ }
}
- boolean done = false;
-
- for (final String perm : perms) {
- if (sender.hasPermission(perm)) {
- return true;
- }
- final String[] split = perm.split("\\.");
- String permString = split[1];
- try {
- if (split.length > 2) {
- permString = split[1]+"."+split[2];
- }
+ if (!silent) {
+ if (hasNotPermission) {
+ messages.forEach(message -> Arena.pmsg(sender, message));
+ } else {
+ // perms is empty
Arena.pmsg(
sender,
Language.parse(MSG.ERROR_NOPERM,
- Language.parse(MSG.getByNode("nulang.nopermto." + permString))));
- } catch (final Exception e) {
- PVPArena.instance.getLogger().warning("Unknown MSG for pvparena." + permString);
- Arena.pmsg(
- sender,
- Language.parse(MSG.ERROR_NOPERM,
- Language.parse(MSG.ERROR_NOPERM_X_USER)));
+ MSG.ERROR_NOPERM_X_ADMIN.toString()));
}
- done = true;
- }
-
- if (!done) {
- Arena.pmsg(
- sender,
- Language.parse(MSG.ERROR_NOPERM,
- MSG.ERROR_NOPERM_X_ADMIN.toString()));
}
return false;
diff --git a/src/net/slipcor/pvparena/commands/PAA_Class.java b/src/net/slipcor/pvparena/commands/PAA_Class.java
index c6769c098..ba0a5b67c 100644
--- a/src/net/slipcor/pvparena/commands/PAA_Class.java
+++ b/src/net/slipcor/pvparena/commands/PAA_Class.java
@@ -1,6 +1,5 @@
package net.slipcor.pvparena.commands;
-import net.slipcor.pvparena.PVPArena;
import net.slipcor.pvparena.arena.Arena;
import net.slipcor.pvparena.arena.ArenaClass;
import net.slipcor.pvparena.arena.ArenaPlayer;
@@ -13,7 +12,6 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -55,43 +53,45 @@ public void commit(final Arena arena, final CommandSender sender, final String[]
// /pa {arenaname} class load [name]
// /pa {arenaname} class remove [name]
- if (args.length == 1) {
- final Player player = (Player) sender;
- PVPArena.instance.getLogger().info("Exiting edit mode: " + player.getName());
-
- final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(player.getName());
-
- ArenaPlayer.reloadInventory(arena, player, false);
+ final Player player = (Player) sender;
+ final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(sender.getName());
+ String classname;
- aPlayer.setArena(null);
- return;
+ if (args.length == 1) {
+ // when no 2nd arg, save/remove/load class with name of player's current class
+ if (aPlayer.getArenaClass() == null) {
+ Arena.pmsg(player, Language.parse(arena, MSG.ERROR_CLASS_NOT_GIVEN));
+ return;
+ }
+ classname = aPlayer.getArenaClass().getName();
+ } else {
+ classname = args[1];
}
- if ("save".equalsIgnoreCase(args[0])) {
- final Player player = (Player) sender;
- final List items = new ArrayList<>();
-
- arena.getArenaConfig().setManually("classitems." + args[1] + ".items", getSerializableItemStacks(player.getInventory().getStorageContents()));
- arena.getArenaConfig().setManually("classitems." + args[1] + ".offhand", getSerializableItemStacks(player.getInventory().getItemInOffHand()));
- arena.getArenaConfig().setManually("classitems." + args[1] + ".armor", getSerializableItemStacks(player.getInventory().getArmorContents()));
- arena.getArenaConfig().save();
-
- arena.addClass(args[1], player.getInventory().getStorageContents(), player.getInventory().getItemInOffHand(), player.getInventory().getArmorContents());
- Arena.pmsg(player, Language.parse(arena, MSG.CLASS_SAVED, args[1]));
- } else if ("load".equalsIgnoreCase(args[0])) {
- final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(sender.getName());
+ if ("load".equalsIgnoreCase(args[0])) {
if(aPlayer.getArenaClass() == null) {
- ArenaPlayer.backupAndClearInventory(arena, aPlayer.get());
+ ArenaPlayer.backupAndClearInventory(arena, player);
} else {
- InventoryManager.clearInventory(aPlayer.get());
+ InventoryManager.clearInventory(player);
}
- arena.selectClass(aPlayer, args[1]);
+ arena.selectClass(aPlayer, classname);
+ } else if ("save".equalsIgnoreCase(args[0])) {
+ ItemStack[] storage = player.getInventory().getStorageContents();
+ ItemStack offhand = player.getInventory().getItemInOffHand();
+ ItemStack[] armor = player.getInventory().getArmorContents();
+
+ arena.getArenaConfig().setManually("classitems." + classname + ".items", getSerializableItemStacks(storage));
+ arena.getArenaConfig().setManually("classitems." + classname + ".offhand", getSerializableItemStacks(offhand));
+ arena.getArenaConfig().setManually("classitems." + classname + ".armor", getSerializableItemStacks(armor));
+ arena.getArenaConfig().save();
+
+ arena.addClass(classname, storage, offhand, armor);
+ Arena.pmsg(player, Language.parse(arena, MSG.CLASS_SAVED, classname));
} else if ("remove".equalsIgnoreCase(args[0])) {
- final Player player = (Player) sender;
- arena.getArenaConfig().setManually("classitems." + args[1], null);
+ arena.getArenaConfig().setManually("classitems." + classname, null);
arena.getArenaConfig().save();
- arena.removeClass(args[1]);
- Arena.pmsg(player, Language.parse(arena, MSG.CLASS_REMOVED, args[1]));
+ arena.removeClass(classname);
+ Arena.pmsg(player, Language.parse(arena, MSG.CLASS_REMOVED, classname));
}
}
diff --git a/src/net/slipcor/pvparena/commands/PAA_Create.java b/src/net/slipcor/pvparena/commands/PAA_Create.java
index c50239d34..ca5ba718b 100644
--- a/src/net/slipcor/pvparena/commands/PAA_Create.java
+++ b/src/net/slipcor/pvparena/commands/PAA_Create.java
@@ -6,6 +6,7 @@
import net.slipcor.pvparena.core.Language;
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.managers.ArenaManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -54,7 +55,7 @@ public void commit(final CommandSender sender, final String[] args) {
arena = new Arena(args[0]);
- if (!sender.hasPermission("pvparena.admin")) {
+ if (!PermissionManager.hasAdminPerm(sender)) {
// no admin perms => create perms => set owner
arena.setOwner(sender.getName());
}
diff --git a/src/net/slipcor/pvparena/commands/PAA_PlayerClass.java b/src/net/slipcor/pvparena/commands/PAA_PlayerClass.java
index 13439c8f3..a59537941 100644
--- a/src/net/slipcor/pvparena/commands/PAA_PlayerClass.java
+++ b/src/net/slipcor/pvparena/commands/PAA_PlayerClass.java
@@ -7,6 +7,7 @@
import net.slipcor.pvparena.core.Help.HELP;
import net.slipcor.pvparena.core.Language;
import net.slipcor.pvparena.core.Language.MSG;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -49,7 +50,7 @@ public void commit(final Arena arena, final CommandSender sender, final String[]
final String className;
if (args.length > 1) {
- if (PVPArena.hasCreatePerms(sender, arena)) {
+ if (PermissionManager.hasBuilderPerm(sender, arena)) {
className = args[1];
} else {
className = sender.getName();
diff --git a/src/net/slipcor/pvparena/commands/PAA_Reload.java b/src/net/slipcor/pvparena/commands/PAA_Reload.java
index c09a79587..70b4d161e 100644
--- a/src/net/slipcor/pvparena/commands/PAA_Reload.java
+++ b/src/net/slipcor/pvparena/commands/PAA_Reload.java
@@ -22,8 +22,12 @@
public class PAA_Reload extends AbstractArenaCommand {
+ public static final String CMD_RELOAD_PERM = "pvparena.cmds.reload";
+ public static final String RELOAD = "reload";
+ public static final String RELOAD_SHORT = "!rl";
+
public PAA_Reload() {
- super(new String[]{"pvparena.cmds.reload"});
+ super(new String[]{CMD_RELOAD_PERM});
}
@Override
@@ -58,12 +62,12 @@ public void displayHelp(final CommandSender sender) {
@Override
public List getMain() {
- return Collections.singletonList("reload");
+ return Collections.singletonList(RELOAD);
}
@Override
public List getShort() {
- return Collections.singletonList("!rl");
+ return Collections.singletonList(RELOAD_SHORT);
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAA_ReloadAll.java b/src/net/slipcor/pvparena/commands/PAA_ReloadAll.java
index 3e751d230..c8c192676 100644
--- a/src/net/slipcor/pvparena/commands/PAA_ReloadAll.java
+++ b/src/net/slipcor/pvparena/commands/PAA_ReloadAll.java
@@ -2,6 +2,7 @@
import net.slipcor.pvparena.PVPArena;
import net.slipcor.pvparena.arena.Arena;
+import net.slipcor.pvparena.arena.ArenaClass;
import net.slipcor.pvparena.core.Help;
import net.slipcor.pvparena.core.Help.HELP;
import net.slipcor.pvparena.core.Language;
@@ -56,6 +57,7 @@ public void commit(final CommandSender sender, final String[] args) {
scmd.commit(a, sender, emptyArray);
}
+ ArenaClass.addGlobalClasses(); // reload classes.yml
ArenaManager.load_arenas();
if (config.getBoolean("use_shortcuts") || config.getBoolean("only_shortcuts")) {
ArenaManager.readShortcuts(config.getConfigurationSection("shortcuts"));
diff --git a/src/net/slipcor/pvparena/commands/PAG_Arenaclass.java b/src/net/slipcor/pvparena/commands/PAG_Arenaclass.java
index 429ff74db..e55ab893d 100644
--- a/src/net/slipcor/pvparena/commands/PAG_Arenaclass.java
+++ b/src/net/slipcor/pvparena/commands/PAG_Arenaclass.java
@@ -12,6 +12,7 @@
import net.slipcor.pvparena.core.StringParser;
import net.slipcor.pvparena.loadables.ArenaModuleManager;
import net.slipcor.pvparena.managers.InventoryManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.bukkit.command.CommandSender;
@@ -37,7 +38,7 @@
public class PAG_Arenaclass extends AbstractArenaCommand {
public PAG_Arenaclass() {
- super(new String[]{"pvparena.user", "pvparena.cmds.arenaclass"});
+ super(new String[]{"pvparena.cmds.arenaclass"});
}
@Override
@@ -84,8 +85,7 @@ public void commit(final Arena arena, final CommandSender sender, final String[]
return;
}
- if (arena.getArenaConfig().getBoolean(CFG.PERMS_EXPLICITCLASS)
- && !sender.hasPermission("pvparena.class." + aClass.getName())) {
+ if (!PermissionManager.hasExplicitClassPerm(sender, arena, aClass)) {
arena.msg(sender,
Language.parse(arena, MSG.ERROR_NOPERM_CLASS, aClass.getName()));
return;
diff --git a/src/net/slipcor/pvparena/commands/PAG_Chat.java b/src/net/slipcor/pvparena/commands/PAG_Chat.java
index d4ee58ed5..d3a7742e0 100644
--- a/src/net/slipcor/pvparena/commands/PAG_Chat.java
+++ b/src/net/slipcor/pvparena/commands/PAG_Chat.java
@@ -26,7 +26,7 @@
public class PAG_Chat extends AbstractArenaCommand {
public PAG_Chat() {
- super(new String[]{"pvparena.user", "pvparena.cmds.chat"});
+ super(new String[]{"pvparena.cmds.chat"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAG_Join.java b/src/net/slipcor/pvparena/commands/PAG_Join.java
index 94f1c61dc..58150e8eb 100644
--- a/src/net/slipcor/pvparena/commands/PAG_Join.java
+++ b/src/net/slipcor/pvparena/commands/PAG_Join.java
@@ -1,6 +1,5 @@
package net.slipcor.pvparena.commands;
-import net.slipcor.pvparena.PVPArena;
import net.slipcor.pvparena.arena.Arena;
import net.slipcor.pvparena.arena.ArenaPlayer;
import net.slipcor.pvparena.classes.PACheck;
@@ -12,6 +11,7 @@
import net.slipcor.pvparena.loadables.ArenaRegion;
import net.slipcor.pvparena.managers.ArenaManager;
import net.slipcor.pvparena.managers.ConfigurationManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -29,15 +29,20 @@
public class PAG_Join extends AbstractArenaCommand {
+ public static final String JOIN = "join";
+ public static final String JOIN_SHORT = "-j";
+
//private final Debug debug = new Debug(200);
public PAG_Join() {
- super(new String[]{"pvparena.user", "pvparena.cmds.join"});
+ super(new String[]{"pvparena.cmds.join"});
}
@Override
public void commit(final Arena arena, final CommandSender sender, final String[] args) {
- if (!hasPerms(sender, arena)) {
+ if (!(hasPerms(sender, arena) && PermissionManager.hasExplicitArenaPerm(sender, arena, JOIN))) {
+ arena.getDebugger().i(String.join(", ", this.perms));
+ arena.msg(sender, Language.parse(arena, MSG.ERROR_NOPERM_JOIN));
return;
}
@@ -61,11 +66,6 @@ public void commit(final Arena arena, final CommandSender sender, final String[]
return;
}
- if (!PVPArena.hasPerms(sender, arena)) {
- arena.msg(sender, Language.parse(arena, MSG.ERROR_NOPERM_JOIN));
- return;
- }
-
final String error = ConfigurationManager.isSetup(arena);
if (error != null) {
arena.msg(sender, Language.parse(arena, MSG.ERROR_ERROR, error));
@@ -108,12 +108,12 @@ public void displayHelp(final CommandSender sender) {
@Override
public List getMain() {
- return Collections.singletonList("join");
+ return Collections.singletonList(JOIN);
}
@Override
public List getShort() {
- return Collections.singletonList("-j");
+ return Collections.singletonList(JOIN_SHORT);
}
@Override
@@ -129,4 +129,5 @@ public CommandTree getSubs(final Arena arena) {
}
return result;
}
+
}
diff --git a/src/net/slipcor/pvparena/commands/PAG_Leave.java b/src/net/slipcor/pvparena/commands/PAG_Leave.java
index 501eb4ff7..a5aba17e3 100644
--- a/src/net/slipcor/pvparena/commands/PAG_Leave.java
+++ b/src/net/slipcor/pvparena/commands/PAG_Leave.java
@@ -26,7 +26,7 @@
public class PAG_Leave extends AbstractArenaCommand {
public PAG_Leave() {
- super(new String[]{"pvparena.user", "pvparena.cmds.leave"});
+ super(new String[]{"pvparena.cmds.leave"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAG_Spectate.java b/src/net/slipcor/pvparena/commands/PAG_Spectate.java
index a46415d67..48936b996 100644
--- a/src/net/slipcor/pvparena/commands/PAG_Spectate.java
+++ b/src/net/slipcor/pvparena/commands/PAG_Spectate.java
@@ -25,7 +25,7 @@
public class PAG_Spectate extends AbstractArenaCommand {
public PAG_Spectate() {
- super(new String[]{"pvparena.user", "pvparena.cmds.spectate"});
+ super(new String[]{"pvparena.cmds.spectate"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAI_ArenaList.java b/src/net/slipcor/pvparena/commands/PAI_ArenaList.java
index fcdd5b628..d085422e0 100644
--- a/src/net/slipcor/pvparena/commands/PAI_ArenaList.java
+++ b/src/net/slipcor/pvparena/commands/PAI_ArenaList.java
@@ -1,6 +1,5 @@
package net.slipcor.pvparena.commands;
-import net.slipcor.pvparena.PVPArena;
import net.slipcor.pvparena.arena.Arena;
import net.slipcor.pvparena.core.Help;
import net.slipcor.pvparena.core.Help.HELP;
@@ -8,6 +7,7 @@
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.core.StringParser;
import net.slipcor.pvparena.managers.ArenaManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
@@ -26,7 +26,7 @@
public class PAI_ArenaList extends AbstractGlobalCommand {
public PAI_ArenaList() {
- super(new String[]{"pvparena.user", "pvparena.cmds.arenalist"});
+ super(new String[]{"pvparena.cmds.arenalist"});
}
@Override
@@ -40,7 +40,7 @@ public void commit(final CommandSender sender, final String[] args) {
}
final List names;
- if (!PVPArena.hasOverridePerms(sender) && ArenaManager.isUsingShortcuts()) {
+ if (!PermissionManager.hasOverridePerm(sender) && ArenaManager.isUsingShortcuts()) {
names = ArenaManager.getColoredShortcuts();
} else {
names = new ArrayList<>();
diff --git a/src/net/slipcor/pvparena/commands/PAI_GlobalStats.java b/src/net/slipcor/pvparena/commands/PAI_GlobalStats.java
index f42826180..70dc80516 100644
--- a/src/net/slipcor/pvparena/commands/PAI_GlobalStats.java
+++ b/src/net/slipcor/pvparena/commands/PAI_GlobalStats.java
@@ -21,7 +21,7 @@
public class PAI_GlobalStats extends AbstractGlobalCommand {
public PAI_GlobalStats() {
- super(new String[]{"pvparena.user", "pvparena.cmds.stats"});
+ super(new String[]{"pvparena.cmds.stats"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAI_Help.java b/src/net/slipcor/pvparena/commands/PAI_Help.java
index 8e46a7cc8..aa50fd544 100644
--- a/src/net/slipcor/pvparena/commands/PAI_Help.java
+++ b/src/net/slipcor/pvparena/commands/PAI_Help.java
@@ -23,7 +23,7 @@
public class PAI_Help extends AbstractGlobalCommand {
public PAI_Help() {
- super(new String[]{"pvparena.user", "pvparena.cmds.help"});
+ super(new String[]{"pvparena.cmds.help"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAI_Info.java b/src/net/slipcor/pvparena/commands/PAI_Info.java
index 42ce9da7b..f61ceb7d2 100644
--- a/src/net/slipcor/pvparena/commands/PAI_Info.java
+++ b/src/net/slipcor/pvparena/commands/PAI_Info.java
@@ -30,7 +30,7 @@
public class PAI_Info extends AbstractArenaCommand {
public PAI_Info() {
- super(new String[]{"pvparena.user", "pvparena.cmds.info"});
+ super(new String[]{"pvparena.cmds.info"});
}
@Override
@@ -141,7 +141,7 @@ public void commit(final Arena arena, final CommandSender sender, final String[]
if (displayMode == null || "perms".equals(displayMode)) {
arena.msg(sender, Language.parse(arena, MSG.INFO_SECTION, "perms"));
arena.msg(sender, StringParser.colorVar("explicitarena",
- arena.getArenaConfig().getBoolean(CFG.PERMS_EXPLICITARENA)) + " | " +
+ arena.getArenaConfig().getBoolean(CFG.PERMS_EXPLICIT_PER_ARENA)) + " | " +
StringParser.colorVar("explicitclass",
arena.getArenaConfig().getBoolean(CFG.PERMS_EXPLICITCLASS)) + " | " +
StringParser.colorVar("joininbattle",
diff --git a/src/net/slipcor/pvparena/commands/PAI_List.java b/src/net/slipcor/pvparena/commands/PAI_List.java
index 2a72f35ab..bd327eae3 100644
--- a/src/net/slipcor/pvparena/commands/PAI_List.java
+++ b/src/net/slipcor/pvparena/commands/PAI_List.java
@@ -24,7 +24,7 @@
public class PAI_List extends AbstractArenaCommand {
public PAI_List() {
- super(new String[]{"pvparena.user", "pvparena.cmds.list"});
+ super(new String[]{"pvparena.cmds.list"});
}
private static final Map colorMap = new HashMap<>();
diff --git a/src/net/slipcor/pvparena/commands/PAI_Ready.java b/src/net/slipcor/pvparena/commands/PAI_Ready.java
index d5b0f1623..1c5a30afa 100644
--- a/src/net/slipcor/pvparena/commands/PAI_Ready.java
+++ b/src/net/slipcor/pvparena/commands/PAI_Ready.java
@@ -30,7 +30,7 @@
public class PAI_Ready extends AbstractArenaCommand {
public PAI_Ready() {
- super(new String[]{"pvparena.user", "pvparena.cmds.ready"});
+ super(new String[]{"pvparena.cmds.ready"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAI_Shutup.java b/src/net/slipcor/pvparena/commands/PAI_Shutup.java
index dd95f4f81..4786f457e 100644
--- a/src/net/slipcor/pvparena/commands/PAI_Shutup.java
+++ b/src/net/slipcor/pvparena/commands/PAI_Shutup.java
@@ -24,7 +24,7 @@
public class PAI_Shutup extends AbstractArenaCommand {
public PAI_Shutup() {
- super(new String[]{"pvparena.user", "pvparena.cmds.shutup"});
+ super(new String[]{"pvparena.cmds.shutup"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAI_Stats.java b/src/net/slipcor/pvparena/commands/PAI_Stats.java
index 862e25942..0c381c57c 100644
--- a/src/net/slipcor/pvparena/commands/PAI_Stats.java
+++ b/src/net/slipcor/pvparena/commands/PAI_Stats.java
@@ -27,7 +27,7 @@
public class PAI_Stats extends AbstractArenaCommand {
public PAI_Stats() {
- super(new String[]{"pvparena.user", "pvparena.cmds.stats"});
+ super(new String[]{"pvparena.cmds.stats"});
}
@Override
diff --git a/src/net/slipcor/pvparena/commands/PAI_Version.java b/src/net/slipcor/pvparena/commands/PAI_Version.java
index e574d756d..db64caeff 100644
--- a/src/net/slipcor/pvparena/commands/PAI_Version.java
+++ b/src/net/slipcor/pvparena/commands/PAI_Version.java
@@ -25,7 +25,7 @@
public class PAI_Version extends AbstractGlobalCommand {
public PAI_Version() {
- super(new String[]{"pvparena.user", "pvparena.cmds.version"});
+ super(new String[]{"pvparena.cmds.version"});
}
@Override
diff --git a/src/net/slipcor/pvparena/core/ColorUtils.java b/src/net/slipcor/pvparena/core/ColorUtils.java
index abe8b17c1..c715178ff 100644
--- a/src/net/slipcor/pvparena/core/ColorUtils.java
+++ b/src/net/slipcor/pvparena/core/ColorUtils.java
@@ -1,15 +1,14 @@
package net.slipcor.pvparena.core;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.DyeColor;
-import org.bukkit.Material;
+import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
+import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -104,13 +103,18 @@ public static Material getColoredMaterial(DyeColor dyeColor, Material typeMateri
}
public static boolean isSubType(Material type, Material check) {
- return (type == check) || (isColorableMaterial(type) && getMaterialSuffix(type).equals(getMaterialSuffix(check)));
+ return (type == check) || (isColorableMaterial(type) && (getMaterialSuffix(check).equals(getMaterialSuffix(type))));
+ }
+
+ public static boolean isDroppedItemSubType(ItemStack item, Material reference) {
+ Material itemMaterial = item.getType();
+ return isSubType(itemMaterial, reference) || (Tag.BANNERS.isTagged(itemMaterial) && Tag.BANNERS.isTagged(reference));
}
private static String getMaterialSuffix(Material material) {
return getColorableSuffixes().stream()
.filter(suffix -> material.name().endsWith(suffix))
- .findFirst()
+ .max(Comparator.comparingInt(String::length)) // get the suffix with the most of common characters
.orElse("");
}
@@ -132,7 +136,7 @@ private static List getColorableSuffixes() {
*/
public static void setNewFlagColor(Block flagBlock, ChatColor flagColor) {
final BlockData originalBlockData = flagBlock.getBlockData().clone();
- Material newMaterial = ColorUtils.getColoredMaterialFromChatColor(flagColor, flagBlock.getType());
+ Material newMaterial = ColorUtils.getColoredMaterialFromChatColor(flagColor, originalBlockData.getMaterial());
BlockData newData = Bukkit.getServer().createBlockData(newMaterial);
if(originalBlockData instanceof Directional) {
diff --git a/src/net/slipcor/pvparena/core/Config.java b/src/net/slipcor/pvparena/core/Config.java
index a6af40978..3a6c5eeab 100644
--- a/src/net/slipcor/pvparena/core/Config.java
+++ b/src/net/slipcor/pvparena/core/Config.java
@@ -82,6 +82,7 @@ public enum CFG {
GOAL_ADDLIVESPERPLAYER("goal.livesPerPlayer", false, null),
ITEMS_EXCLUDEFROMDROPS("items.excludeFromDrops", new ItemStack[0], null),
+ ITEMS_ONLYDROPS("items.onlyDrops", new ItemStack[0], null),
ITEMS_KEEPONRESPAWN("items.keepOnRespawn", new ItemStack[0], null),
ITEMS_KEEPALLONRESPAWN("items.keepAllOnRespawn", false, null),
ITEMS_MINPLAYERS("items.minplayers", 2, null),
@@ -107,7 +108,7 @@ public enum CFG {
MSG_YOUJOINEDTEAM("msg.youjoinedteam", "You have joined team %1%!", null),
PERMS_ALWAYSJOININBATTLE("perms.alwaysJoinInBattle", false, null),
- PERMS_EXPLICITARENA("perms.explicitArenaNeeded", false, null),
+ PERMS_EXPLICIT_PER_ARENA("perms.explicitArenaNeeded", false, null),
PERMS_EXPLICITCLASS("perms.explicitClassNeeded", false, null),
PERMS_FLY("perms.fly", false, null),
PERMS_LOUNGEINTERACT("perms.loungeinteract", false, null),
diff --git a/src/net/slipcor/pvparena/core/Language.java b/src/net/slipcor/pvparena/core/Language.java
index f48c20caa..001c1d441 100644
--- a/src/net/slipcor/pvparena/core/Language.java
+++ b/src/net/slipcor/pvparena/core/Language.java
@@ -127,6 +127,7 @@ public enum MSG {
ERROR_CLASS_FULL("nulang.error.class.full", "The class &a%1%&r is full!"),
ERROR_CLASS_NOTENOUGHEXP("nulang.error.class.notenoughexp", "You don't have enough EXP to choose &a%1%&r!"),
ERROR_CLASS_NOT_FOUND("nulang.error.class.notfound", "Class not found: &a%1%&r"),
+ ERROR_CLASS_NOT_GIVEN("nulang.error.class.notgiven", "No class was given!"),
ERROR_COMMAND_BLOCKED("nulang.error.cmdblocked", "&cCommand blocked: %1%"),
ERROR_COMMAND_INVALID("nulang.error.invalidcmd", "Invalid command: %1%"),
ERROR_COMMAND_UNKNOWN("nulang.error.unknowncmd", "Unknown command"),
@@ -157,7 +158,7 @@ public enum MSG {
ERROR_NO_GOAL("nulang.error.nogoal", "You did not add a goal! &a/pa [arena] goal [goalname]"),
ERROR_NO_SPAWNS("nulang.error.nospawns", "No spawns set!"),
ERROR_NOPERM_CLASS("nulang.error.classperms", "You do not have permission for class &a%1%&r!"),
- ERROR_NOPERM_JOIN("nulang.error.permjoin", "You don't have permission to join the arena!"),
+ ERROR_NOPERM_JOIN("nulang.error.permjoin", "You don't have permission to join this arena!"),
ERROR_NOPERM_X_ADMIN("nulang.nopermto.madmin", "administrate"),
ERROR_NOPERM_X_CREATE("nulang.nopermto.create", "create an arena"),
diff --git a/src/net/slipcor/pvparena/goals/GoalBlockDestroy.java b/src/net/slipcor/pvparena/goals/GoalBlockDestroy.java
index d941f51c5..5cbf48c9d 100644
--- a/src/net/slipcor/pvparena/goals/GoalBlockDestroy.java
+++ b/src/net/slipcor/pvparena/goals/GoalBlockDestroy.java
@@ -21,6 +21,7 @@
import net.slipcor.pvparena.loadables.ArenaModuleManager;
import net.slipcor.pvparena.loadables.ArenaRegion;
import net.slipcor.pvparena.loadables.ArenaRegion.RegionType;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.TeamManager;
import net.slipcor.pvparena.runnables.EndRunnable;
@@ -187,8 +188,8 @@ public PACheck checkSetBlock(final PACheck res, final Player player, final Block
return res;
}
- if (!PVPArena.hasAdminPerms(player)
- && !PVPArena.hasCreatePerms(player, arena)) {
+ if (!PermissionManager.hasAdminPerm(player)
+ && !PermissionManager.hasBuilderPerm(player, arena)) {
return res;
}
res.setPriority(this, PRIORITY); // success :)
diff --git a/src/net/slipcor/pvparena/goals/GoalDomination.java b/src/net/slipcor/pvparena/goals/GoalDomination.java
index 1778a586c..797f2cf6b 100644
--- a/src/net/slipcor/pvparena/goals/GoalDomination.java
+++ b/src/net/slipcor/pvparena/goals/GoalDomination.java
@@ -14,6 +14,7 @@
import net.slipcor.pvparena.events.PAGoalEvent;
import net.slipcor.pvparena.loadables.ArenaGoal;
import net.slipcor.pvparena.loadables.ArenaModuleManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.TeamManager;
import net.slipcor.pvparena.runnables.CircleParticleRunnable;
@@ -562,8 +563,8 @@ public void commitEnd(final boolean force) {
@Override
public boolean commitSetFlag(final Player player, final Block block) {
- if (PVPArena.hasAdminPerms(player)
- || PVPArena.hasCreatePerms(player, this.arena)
+ if (PermissionManager.hasAdminPerm(player)
+ || PermissionManager.hasBuilderPerm(player, this.arena)
&& player.getInventory().getItemInMainHand().getType().toString().equals(this.arena
.getArenaConfig().getString(CFG.GENERAL_WAND))) {
diff --git a/src/net/slipcor/pvparena/goals/GoalFlags.java b/src/net/slipcor/pvparena/goals/GoalFlags.java
index ddb16dd35..cfef7fdb1 100644
--- a/src/net/slipcor/pvparena/goals/GoalFlags.java
+++ b/src/net/slipcor/pvparena/goals/GoalFlags.java
@@ -16,6 +16,7 @@
import net.slipcor.pvparena.events.PAGoalEvent;
import net.slipcor.pvparena.loadables.ArenaGoal;
import net.slipcor.pvparena.loadables.ArenaModuleManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.StatisticsManager.Type;
import net.slipcor.pvparena.managers.TeamManager;
@@ -428,7 +429,7 @@ public PACheck checkSetBlock(final PACheck res, final Player player, final Block
return res;
}
- if (!PVPArena.hasAdminPerms(player) && !PVPArena.hasCreatePerms(player, this.arena)) {
+ if (!PermissionManager.hasAdminPerm(player) && !PermissionManager.hasBuilderPerm(player, this.arena)) {
return res;
}
res.setPriority(this, PRIORITY); // success :)
@@ -511,8 +512,7 @@ public void commitCommand(final CommandSender sender, final String[] args) {
this.arena.getArenaConfig().set(CFG.GOAL_FLAGS_FLAGTYPE, mat.name());
this.arena.getArenaConfig().save();
- this.arena.msg(sender, Language.parse(this.arena, MSG.GOAL_FLAGS_TYPESET,
- CFG.GOAL_FLAGS_FLAGTYPE.toString()));
+ this.arena.msg(sender, Language.parse(this.arena, MSG.GOAL_FLAGS_TYPESET, mat.name()));
} else if ("flageffect".equalsIgnoreCase(args[0])) {
diff --git a/src/net/slipcor/pvparena/goals/GoalFood.java b/src/net/slipcor/pvparena/goals/GoalFood.java
index 42fa66c15..03b6a0646 100644
--- a/src/net/slipcor/pvparena/goals/GoalFood.java
+++ b/src/net/slipcor/pvparena/goals/GoalFood.java
@@ -18,6 +18,7 @@
import net.slipcor.pvparena.loadables.ArenaGoal;
import net.slipcor.pvparena.loadables.ArenaModuleManager;
import net.slipcor.pvparena.managers.InventoryManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.TeamManager;
import net.slipcor.pvparena.runnables.EndRunnable;
@@ -193,8 +194,8 @@ public PACheck checkSetBlock(final PACheck res, final Player player, final Block
return res;
}
- if (!PVPArena.hasAdminPerms(player)
- && !PVPArena.hasCreatePerms(player, arena)) {
+ if (!PermissionManager.hasAdminPerm(player)
+ && !PermissionManager.hasBuilderPerm(player, arena)) {
return res;
}
res.setPriority(this, PRIORITY); // success :)
@@ -549,19 +550,19 @@ public void parseStart() {
pos--;
}
int totalAmount = pAmount;
- totalAmount += tAmount / team.getTeamMembers().size();
+ totalAmount += tAmount / Math.max(team.getTeamMembers().size(), 1);
if (totalAmount < 1) {
totalAmount = 1;
}
+
for (final ArenaPlayer player : team.getTeamMembers()) {
player.get().getInventory().addItem(new ItemStack(getFoodMap().get(team), totalAmount));
player.get().updateInventory();
}
chestMap.put(SpawnManager.getBlockByExactName(arena, team.getName() + "foodchest").toLocation().getBlock(), team);
- getLifeMap().put(team.getName(),
- arena.getArenaConfig().getInt(CFG.GOAL_FOOD_FMAXITEMS));
+ getLifeMap().put(team.getName(), arena.getArenaConfig().getInt(CFG.GOAL_FOOD_FMAXITEMS));
}
}
diff --git a/src/net/slipcor/pvparena/goals/GoalLiberation.java b/src/net/slipcor/pvparena/goals/GoalLiberation.java
index 9c69998e8..032138c2d 100644
--- a/src/net/slipcor/pvparena/goals/GoalLiberation.java
+++ b/src/net/slipcor/pvparena/goals/GoalLiberation.java
@@ -16,6 +16,7 @@
import net.slipcor.pvparena.loadables.ArenaGoal;
import net.slipcor.pvparena.loadables.ArenaModuleManager;
import net.slipcor.pvparena.managers.InventoryManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.TeamManager;
import net.slipcor.pvparena.runnables.EndRunnable;
@@ -275,8 +276,8 @@ public PACheck checkSetBlock(final PACheck res, final Player player, final Block
return res;
}
- if (!PVPArena.hasAdminPerms(player)
- && !PVPArena.hasCreatePerms(player, arena)) {
+ if (!PermissionManager.hasAdminPerm(player)
+ && !PermissionManager.hasBuilderPerm(player, arena)) {
return res;
}
res.setPriority(this, PRIORITY); // success :)
diff --git a/src/net/slipcor/pvparena/goals/GoalPhysicalFlags.java b/src/net/slipcor/pvparena/goals/GoalPhysicalFlags.java
index a70793568..8148bff3a 100644
--- a/src/net/slipcor/pvparena/goals/GoalPhysicalFlags.java
+++ b/src/net/slipcor/pvparena/goals/GoalPhysicalFlags.java
@@ -16,6 +16,7 @@
import net.slipcor.pvparena.events.PAGoalEvent;
import net.slipcor.pvparena.loadables.ArenaGoal;
import net.slipcor.pvparena.loadables.ArenaModuleManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.TeamManager;
import net.slipcor.pvparena.runnables.EndRunnable;
@@ -205,7 +206,7 @@ public PACheck checkInteract(final PACheck res, final Player player, final Block
this.arena.getDebugger().i("the flag belongs to team " + flagTeam, player);
ItemStack mainHandItem = player.getInventory().getItemInMainHand();
- if (!ColorUtils.isSubType(mainHandItem.getType(), flagType)) {
+ if (!ColorUtils.isDroppedItemSubType(mainHandItem, flagType)) {
this.arena.getDebugger().i("player " + player.getName() + " is not holding the flag", player);
this.arena.msg(player, Language.parse(this.arena, MSG.GOAL_PHYSICALFLAGS_HOLDFLAG));
return res;
@@ -310,7 +311,7 @@ private void applyEffects(final Player player) {
return;
}
- player.addPotionEffect(new PotionEffect(pet, amp, 2147000));
+ player.addPotionEffect(new PotionEffect(pet, 2147000, amp));
}
@Override
@@ -358,7 +359,7 @@ public PACheck checkSetBlock(final PACheck res, final Player player, final Block
return res;
}
- if (!PVPArena.hasAdminPerms(player) && !PVPArena.hasCreatePerms(player, this.arena)) {
+ if (!PermissionManager.hasAdminPerm(player) && !PermissionManager.hasBuilderPerm(player, this.arena)) {
return res;
}
res.setPriority(this, PRIORITY); // success :)
@@ -441,8 +442,7 @@ public void commitCommand(final CommandSender sender, final String[] args) {
this.arena.getArenaConfig().set(CFG.GOAL_PFLAGS_FLAGTYPE, mat.name());
this.arena.getArenaConfig().save();
- this.arena.msg(sender, Language.parse(this.arena, MSG.GOAL_FLAGS_TYPESET,
- CFG.GOAL_PFLAGS_FLAGTYPE.toString()));
+ this.arena.msg(sender, Language.parse(this.arena, MSG.GOAL_FLAGS_TYPESET, mat.name()));
} else if ("flageffect".equalsIgnoreCase(args[0])) {
@@ -1026,7 +1026,7 @@ public void onFlagClaim(final BlockBreakEvent event) {
}
this.applyEffects(player);
this.getFlagMap().put(teamName, player.getName());
- player.getInventory().addItem(new ItemStack(block.getType()));
+ player.getInventory().addItem(block.getDrops().toArray(new ItemStack[0]));
block.setType(Material.AIR);;
event.setCancelled(true);
return;
diff --git a/src/net/slipcor/pvparena/goals/GoalPlayerKillReward.java b/src/net/slipcor/pvparena/goals/GoalPlayerKillReward.java
index 09d910d05..d4221b0e5 100644
--- a/src/net/slipcor/pvparena/goals/GoalPlayerKillReward.java
+++ b/src/net/slipcor/pvparena/goals/GoalPlayerKillReward.java
@@ -32,6 +32,7 @@
import java.util.*;
+import static net.slipcor.pvparena.core.ItemStackUtils.getItemStacksFromConfig;
import static net.slipcor.pvparena.core.Utils.getSerializableItemStacks;
/**
@@ -454,17 +455,18 @@ public void setDefaults(final YamlConfiguration config) {
}
- final ConfigurationSection cs = (ConfigurationSection) config
- .get("goal.playerkillrewards");
+ ConfigurationSection cs = (ConfigurationSection) config.get("goal.playerkillrewards");
if (cs != null) {
- for (final String line : cs.getKeys(false)) {
+ for (String line : cs.getKeys(false)) {
try {
- this.getItemMap().put(Integer.parseInt(line.substring(2)),
+ ConfigurationSection classesCfg = cs.getConfigurationSection(line);
+ int classIndex = Integer.parseInt(line.substring(2));
+ this.getItemMap().put(classIndex,
new ItemStack[][] {
- cs.getList(line + ".items").toArray(new ItemStack[0]),
- cs.getList(line + ".offhand").toArray(new ItemStack[]{new ItemStack(Material.AIR, 1)}),
- cs.getList(line + ".armor").toArray(new ItemStack[0])
+ getItemStacksFromConfig(classesCfg.getList("items")),
+ getItemStacksFromConfig(classesCfg.getList("offhand")),
+ getItemStacksFromConfig(classesCfg.getList("armor")),
});
} catch (final Exception ignored) {
}
diff --git a/src/net/slipcor/pvparena/goals/GoalSabotage.java b/src/net/slipcor/pvparena/goals/GoalSabotage.java
index 8a6d71b59..8e0478555 100644
--- a/src/net/slipcor/pvparena/goals/GoalSabotage.java
+++ b/src/net/slipcor/pvparena/goals/GoalSabotage.java
@@ -16,6 +16,7 @@
import net.slipcor.pvparena.events.PAGoalEvent;
import net.slipcor.pvparena.loadables.ArenaGoal;
import net.slipcor.pvparena.loadables.ArenaModuleManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.StatisticsManager.Type;
import net.slipcor.pvparena.runnables.EndRunnable;
@@ -259,8 +260,8 @@ public PACheck checkSetBlock(final PACheck res, final Player player, final Block
return res;
}
- if (!PVPArena.hasAdminPerms(player)
- && !PVPArena.hasCreatePerms(player, this.arena)) {
+ if (!PermissionManager.hasAdminPerm(player)
+ && !PermissionManager.hasBuilderPerm(player, this.arena)) {
return res;
}
res.setPriority(this, PRIORITY); // success :)
diff --git a/src/net/slipcor/pvparena/listeners/PlayerListener.java b/src/net/slipcor/pvparena/listeners/PlayerListener.java
index c096b4e92..33efb8bdc 100644
--- a/src/net/slipcor/pvparena/listeners/PlayerListener.java
+++ b/src/net/slipcor/pvparena/listeners/PlayerListener.java
@@ -25,6 +25,7 @@
import net.slipcor.pvparena.loadables.ArenaRegion.RegionType;
import net.slipcor.pvparena.managers.ArenaManager;
import net.slipcor.pvparena.managers.InventoryManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.managers.TeamManager;
import org.bukkit.Bukkit;
@@ -81,7 +82,7 @@ private boolean checkAndCommitCancel(final Arena arena, final Player player,
}
DEBUG.i("checkAndCommitCancel", player);
- if (arena == null || player.hasPermission("pvparena.admin")) {
+ if (arena == null || PermissionManager.hasAdminPerm(player)) {
DEBUG.i("no arena or admin", player);
DEBUG.i("> false", player);
return false;
@@ -211,8 +212,8 @@ public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
}
final Arena arena = ArenaPlayer.parsePlayer(player.getName()).getArena();
- if (arena == null || player.isOp() || PVPArena.hasAdminPerms(player)
- || PVPArena.hasCreatePerms(player, arena)) {
+ if (arena == null || player.isOp() || PermissionManager.hasAdminPerm(player)
+ || PermissionManager.hasBuilderPerm(player, arena)) {
return; // no fighting player => OUT
}
@@ -267,8 +268,8 @@ public void onPlayerCraft(final CraftItemEvent event) {
final Player player = (Player) event.getWhoClicked();
final Arena arena = ArenaPlayer.parsePlayer(player.getName()).getArena();
- if (arena == null || player.isOp() || PVPArena.hasAdminPerms(player)
- || PVPArena.hasCreatePerms(player, arena)) {
+ if (arena == null || player.isOp() || PermissionManager.hasAdminPerm(player)
+ || PermissionManager.hasBuilderPerm(player, arena)) {
return; // no fighting player => OUT
}
@@ -898,7 +899,7 @@ public void onPlayerTeleport(final PlayerTeleportEvent event) {
final Set regions = arena
.getRegionsByType(RegionType.BATTLE);
- if (regions == null || regions.size() < 0) {
+ if (regions == null || regions.isEmpty()) {
maybeFixInvisibility(arena, player);
return;
@@ -971,4 +972,4 @@ public void onPlayerVelocity(final ProjectileLaunchEvent event) {
}
}
-}
\ No newline at end of file
+}
diff --git a/src/net/slipcor/pvparena/loadables/ArenaGoal.java b/src/net/slipcor/pvparena/loadables/ArenaGoal.java
index 98058df74..36f5616fb 100644
--- a/src/net/slipcor/pvparena/loadables/ArenaGoal.java
+++ b/src/net/slipcor/pvparena/loadables/ArenaGoal.java
@@ -1,6 +1,5 @@
package net.slipcor.pvparena.loadables;
-import net.slipcor.pvparena.PVPArena;
import net.slipcor.pvparena.api.IArenaCommandHandler;
import net.slipcor.pvparena.arena.Arena;
import net.slipcor.pvparena.arena.ArenaPlayer;
@@ -10,6 +9,7 @@
import net.slipcor.pvparena.core.Config.CFG;
import net.slipcor.pvparena.core.Debug;
import net.slipcor.pvparena.core.Language;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.ncloader.NCBLoadable;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
@@ -87,11 +87,11 @@ public CommandTree getSubs(final Arena arena) {
}
@Override
- public boolean hasPerms(final CommandSender sender, final Arena arena) {
+ public boolean hasPerms(final CommandSender sender, final Arena arena, final boolean silent) {
if (arena == null) {
- return PVPArena.hasAdminPerms(sender);
+ return PermissionManager.hasAdminPerm(sender);
}
- return PVPArena.hasAdminPerms(sender) || PVPArena.hasCreatePerms(sender, arena);
+ return PermissionManager.hasAdminPerm(sender) || PermissionManager.hasBuilderPerm(sender, arena);
}
/**
diff --git a/src/net/slipcor/pvparena/loadables/ArenaModule.java b/src/net/slipcor/pvparena/loadables/ArenaModule.java
index b6999d904..960fade28 100644
--- a/src/net/slipcor/pvparena/loadables/ArenaModule.java
+++ b/src/net/slipcor/pvparena/loadables/ArenaModule.java
@@ -1,6 +1,5 @@
package net.slipcor.pvparena.loadables;
-import net.slipcor.pvparena.PVPArena;
import net.slipcor.pvparena.api.IArenaCommandHandler;
import net.slipcor.pvparena.arena.Arena;
import net.slipcor.pvparena.arena.ArenaClass;
@@ -10,6 +9,7 @@
import net.slipcor.pvparena.commands.CommandTree;
import net.slipcor.pvparena.core.Debug;
import net.slipcor.pvparena.loadables.ArenaRegion.RegionType;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.ncloader.NCBLoadable;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -99,11 +99,11 @@ public CommandTree getSubs(final Arena arena) {
}
@Override
- public boolean hasPerms(final CommandSender sender, final Arena arena) {
+ public boolean hasPerms(final CommandSender sender, final Arena arena, final boolean silent) {
if (arena == null) {
- return PVPArena.hasAdminPerms(sender);
+ return PermissionManager.hasAdminPerm(sender);
}
- return PVPArena.hasAdminPerms(sender) || PVPArena.hasCreatePerms(sender, arena);
+ return PermissionManager.hasAdminPerm(sender) || PermissionManager.hasBuilderPerm(sender, arena);
}
/**
diff --git a/src/net/slipcor/pvparena/loadables/ArenaRegion.java b/src/net/slipcor/pvparena/loadables/ArenaRegion.java
index 8aa4a4812..d137d267e 100644
--- a/src/net/slipcor/pvparena/loadables/ArenaRegion.java
+++ b/src/net/slipcor/pvparena/loadables/ArenaRegion.java
@@ -15,6 +15,7 @@
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.listeners.PlayerListener;
import net.slipcor.pvparena.managers.ArenaManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import net.slipcor.pvparena.runnables.RegionRunnable;
import org.bukkit.Bukkit;
@@ -199,7 +200,7 @@ public static boolean checkRegionSetPosition(final PlayerInteractEvent event,
}
final Arena arena = PAA_Region.activeSelections.get(player.getName());
if (arena != null
- && (PVPArena.hasAdminPerms(player) || PVPArena.hasCreatePerms(
+ && (PermissionManager.hasAdminPerm(player) || PermissionManager.hasBuilderPerm(
player, arena))
&& player.getEquipment().getItemInMainHand() != null
&& player.getEquipment().getItemInMainHand().getType().toString().equals(arena
diff --git a/src/net/slipcor/pvparena/managers/ArenaManager.java b/src/net/slipcor/pvparena/managers/ArenaManager.java
index cbfa8a2ae..d271ccdb4 100644
--- a/src/net/slipcor/pvparena/managers/ArenaManager.java
+++ b/src/net/slipcor/pvparena/managers/ArenaManager.java
@@ -389,16 +389,14 @@ public static void trySignJoin(final PlayerInteractEvent event, final Player pla
final String sName = sign.getLine(1).toLowerCase();
String[] newArgs = new String[0];
final Arena arena = ARENAS.get(sName);
- if (sign.getLine(2) != null
- && arena.getTeam(sign.getLine(2)) != null) {
- newArgs = new String[1];
- newArgs[0] = sign.getLine(2);
- }
if (arena == null) {
- Arena.pmsg(player,
- Language.parse(MSG.ERROR_ARENA_NOTFOUND, sName));
+ Arena.pmsg(player, Language.parse(MSG.ERROR_ARENA_NOTFOUND, sName));
return;
}
+ if (sign.getLine(2) != null && arena.getTeam(sign.getLine(2)) != null) {
+ newArgs = new String[1];
+ newArgs[0] = sign.getLine(2);
+ }
final AbstractArenaCommand command = new PAG_Join();
command.commit(arena, player, newArgs);
}
@@ -524,7 +522,7 @@ public static String getIndirectArenaName(final Arena arena) {
public static Arena getIndirectArenaByName(final CommandSender sender, String string) {
DEBUG.i("getIndirect(" + sender.getName() + "): " + string);
- if (!usingShortcuts || PVPArena.hasOverridePerms(sender)) {
+ if (!usingShortcuts || PermissionManager.hasOverridePerm(sender)) {
DEBUG.i("out1");
return getArenaByName(string);
}
diff --git a/src/net/slipcor/pvparena/managers/ConfigurationManager.java b/src/net/slipcor/pvparena/managers/ConfigurationManager.java
index 966cd23c5..52d69cea0 100644
--- a/src/net/slipcor/pvparena/managers/ConfigurationManager.java
+++ b/src/net/slipcor/pvparena/managers/ConfigurationManager.java
@@ -129,34 +129,7 @@ public static boolean configParse(final Arena arena, final Config cfg) {
if (config.get("classitems") == null) {
if (PVPArena.instance.getConfig().get("classitems") == null) {
- config.addDefault("classitems.Ranger.items",
- Utils.getItemStacksFromMaterials(Material.BOW, Material.ARROW));
- config.addDefault("classitems.Ranger.offhand",
- Utils.getItemStacksFromMaterials(Material.AIR));
- config.addDefault("classitems.Ranger.armor",
- Utils.getItemStacksFromMaterials(Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS));
-
- config.addDefault("classitems.Swordsman.items",
- Utils.getItemStacksFromMaterials(Material.DIAMOND_SWORD));
- config.addDefault("classitems.Swordsman.offhand",
- Utils.getItemStacksFromMaterials(Material.AIR));
- config.addDefault("classitems.Swordsman.armor",
- Utils.getItemStacksFromMaterials(Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS));
-
- config.addDefault("classitems.Tank.items",
- Utils.getItemStacksFromMaterials(Material.STONE_SWORD));
- config.addDefault("classitems.Tank.offhand",
- Utils.getItemStacksFromMaterials(Material.AIR));
- config.addDefault("classitems.Tank.armor",
- Utils.getItemStacksFromMaterials(Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS));
-
- config.addDefault("classitems.Pyro.items",
- Utils.getItemStacksFromMaterials(Material.FLINT_AND_STEEL, Material.TNT, Material.TNT, Material.TNT));
- config.addDefault("classitems.Pyro.offhand",
- Utils.getItemStacksFromMaterials(Material.AIR));
- config.addDefault("classitems.Pyro.armor",
- Utils.getItemStacksFromMaterials(Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS));
-
+ config.addDefault("classitems", generateDefaultClasses());
}
}
@@ -198,8 +171,8 @@ public static boolean configParse(final Arena arena, final Config cfg) {
ArenaClass.addGlobalClasses(arena);
for (final Map.Entry stringObjectEntry1 : classes.entrySet()) {
ItemStack[] items;
- ItemStack offHand = new ItemStack(Material.AIR, 1);
- ItemStack[] armors = new ItemStack[]{new ItemStack(Material.AIR, 1)};
+ ItemStack offHand;
+ ItemStack[] armors;
try {
items = getItemStacksFromConfig(config.getList("classitems."+stringObjectEntry1.getKey()+".items"));
@@ -303,6 +276,36 @@ public static boolean configParse(final Arena arena, final Config cfg) {
return true;
}
+ public static Map generateDefaultClasses() {
+ Map classItems = new HashMap<>();
+
+ classItems.put("Ranger", new HashMap>() {{
+ put("items", Utils.getItemStacksFromMaterials(Material.BOW, Material.ARROW));
+ put("offhand", Utils.getItemStacksFromMaterials(Material.AIR));
+ put("armor", Utils.getItemStacksFromMaterials(Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS));
+ }});
+
+ classItems.put("Swordsman", new HashMap>() {{
+ put("items", Utils.getItemStacksFromMaterials(Material.DIAMOND_SWORD));
+ put("offhand", Utils.getItemStacksFromMaterials(Material.AIR));
+ put("armor", Utils.getItemStacksFromMaterials(Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS));
+ }});
+
+ classItems.put("Tank", new HashMap>() {{
+ put("items", Utils.getItemStacksFromMaterials(Material.STONE_SWORD));
+ put("offhand", Utils.getItemStacksFromMaterials(Material.AIR));
+ put("armor", Utils.getItemStacksFromMaterials(Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS));
+ }});
+
+ classItems.put("Pyro", new HashMap>() {{
+ put("items", Utils.getItemStacksFromMaterials(Material.FLINT_AND_STEEL, Material.TNT, Material.TNT, Material.TNT));
+ put("offhand", Utils.getItemStacksFromMaterials(Material.AIR));
+ put("armor", Utils.getItemStacksFromMaterials(Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS));
+ }});
+
+ return classItems;
+ }
+
/**
* check if an arena is configured completely
*
diff --git a/src/net/slipcor/pvparena/managers/InventoryManager.java b/src/net/slipcor/pvparena/managers/InventoryManager.java
index 33c92c4b6..2133c5d72 100644
--- a/src/net/slipcor/pvparena/managers/InventoryManager.java
+++ b/src/net/slipcor/pvparena/managers/InventoryManager.java
@@ -62,6 +62,7 @@ public static List drop(final Player player) {
DEBUG.i("dropping player inventory: " + player.getName(), player);
final List exclude;
+ final List only;
final List keep;
final ArenaPlayer ap = ArenaPlayer.parsePlayer(player.getName());
@@ -71,14 +72,22 @@ public static List drop(final Player player) {
if (ap == null || ap.getArena() == null) {
exclude = new ArrayList<>();
keep = new ArrayList<>();
+ only = new ArrayList<>();
} else {
- final ItemStack[] items = ap.getArena().getArenaConfig().getItems(CFG.ITEMS_EXCLUDEFROMDROPS);
+ final ItemStack[] itemsExcluded = ap.getArena().getArenaConfig().getItems(CFG.ITEMS_EXCLUDEFROMDROPS);
exclude = new ArrayList<>();
- for (final ItemStack item : items) {
+ for (final ItemStack item : itemsExcluded) {
if (item != null) {
exclude.add(item.getType());
}
}
+ final ItemStack[] itemsOnlyDrop = ap.getArena().getArenaConfig().getItems(CFG.ITEMS_ONLYDROPS);
+ only = new ArrayList<>();
+ for (final ItemStack item : itemsOnlyDrop) {
+ if (item != null) {
+ only.add(item.getType());
+ }
+ }
keepAll = ap.getArena().getArenaConfig().getBoolean(CFG.ITEMS_KEEPALLONRESPAWN);
if (keepAll) {
keep = new ArrayList<>();
@@ -107,11 +116,14 @@ public static List drop(final Player player) {
if (exclude.contains(is.getType())) {
continue;
}
- if (keepAll) {
+ if (keepAll && (only.isEmpty() || !only.contains(is.getType()))) {
returned.add(is.clone());
continue;
}
- player.getWorld().dropItemNaturally(player.getLocation(), is);
+ if (only.isEmpty() || only.contains(is.getType())) {
+ DEBUG.i("Natural drop of: " + is.getType().name(), player);
+ player.getWorld().dropItemNaturally(player.getLocation(), is);
+ }
}
player.getInventory().clear();
ap.setMayDropInventory(false);
diff --git a/src/net/slipcor/pvparena/managers/PermissionManager.java b/src/net/slipcor/pvparena/managers/PermissionManager.java
new file mode 100644
index 000000000..575b62c1a
--- /dev/null
+++ b/src/net/slipcor/pvparena/managers/PermissionManager.java
@@ -0,0 +1,110 @@
+package net.slipcor.pvparena.managers;
+
+import net.slipcor.pvparena.PVPArena;
+import net.slipcor.pvparena.arena.Arena;
+import net.slipcor.pvparena.arena.ArenaClass;
+import net.slipcor.pvparena.core.Config;
+import net.slipcor.pvparena.core.Language;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class PermissionManager {
+
+ public static final String CREATE_PERM = "pvparena.create";
+ public static final String ADMIN_PERM = "pvparena.admin";
+
+ public static final String PERM_NODE_PREFIX = "nulang.nopermto.";
+
+
+ /**
+ * Get the permission deny message (translated and colored)
+ *
+ * @param perm permission string
+ * @return message to display to user
+ */
+ public static String getMissingPermissionMessage(String perm) {
+ String permString = perm.substring(perm.indexOf(".") + 1);
+ Language.MSG node = Language.MSG.getByNode(PERM_NODE_PREFIX + permString);
+ if (node != null) {
+ return Language.parse(Language.MSG.ERROR_NOPERM, Language.parse(node));
+ } else {
+ return Language.parse(Language.MSG.ERROR_NOPERM, Language.parse(Language.MSG.ERROR_NOPERM_X_USER));
+ }
+ }
+
+ /**
+ * Allowed player to administrate the arena if he's the owner
+ *
+ * @param sender sender
+ * @param arena arena
+ * @return true if player has builder permission for this arena
+ */
+ public static boolean hasBuilderPerm(CommandSender sender, Arena arena) {
+ return sender.hasPermission(CREATE_PERM)
+ && sender.getName().equals(arena.getOwner());
+ }
+
+ /**
+ * Check if a CommandSender has admin permissions
+ *
+ * @param sender the CommandSender to check
+ * @return true if a CommandSender has admin permissions, false otherwise
+ */
+ public static boolean hasAdminPerm(CommandSender sender) {
+ return sender.hasPermission(ADMIN_PERM);
+ }
+
+
+ /**
+ * Check if a CommandSender has permission for an arena
+ *
+ * @param sender the CommandSender to check
+ * @param arena the arena to check
+ * @return true if explicit permission not needed or granted, false
+ * otherwise
+ */
+ public static boolean hasExplicitArenaPerm(CommandSender sender, Arena arena, String command) {
+ if (arena.getArenaConfig().getBoolean(Config.CFG.PERMS_EXPLICIT_PER_ARENA)) {
+ final String perm = String.format("pvparena.%s.%s", command, arena.getName().toLowerCase());
+ arena.getDebugger().i(
+ " - explicit arena perm: " + sender.hasPermission(perm), sender);
+
+ return sender.hasPermission(perm);
+ }
+
+ // explicit permissions not enabled
+ return true;
+ }
+
+ /**
+ * Check if a CommandSender has permission for an class
+ *
+ * @param sender the CommandSender to check
+ * @param arena the arena to check
+ * @param aClass the class
+ * @return true if explicit permission not needed or granted, false
+ * otherwise
+ */
+ public static boolean hasExplicitClassPerm(CommandSender sender, Arena arena, ArenaClass aClass) {
+
+ if (arena.getArenaConfig().getBoolean(Config.CFG.PERMS_EXPLICITCLASS)) {
+ final String perm = String.format("pvparena.class.%s", aClass.getName().toLowerCase());
+ arena.getDebugger().i(
+ " - explicit class perm: " + sender.hasPermission(perm), sender);
+
+ return sender.hasPermission(perm);
+ }
+
+ // explicit permissions not enabled
+ return true;
+ }
+
+ public static boolean hasOverridePerm(final CommandSender sender) {
+ if (sender instanceof Player) {
+ return sender.hasPermission("pvparena.override");
+ }
+
+ return PVPArena.instance.getConfig().getBoolean("consoleoffduty")
+ != sender.hasPermission("pvparena.override");
+ }
+}
diff --git a/src/net/slipcor/pvparena/managers/TabManager.java b/src/net/slipcor/pvparena/managers/TabManager.java
index 3bab4489a..54f0fd422 100644
--- a/src/net/slipcor/pvparena/managers/TabManager.java
+++ b/src/net/slipcor/pvparena/managers/TabManager.java
@@ -121,7 +121,7 @@ public static List getMatches(final CommandSender sender, final List matches, final CommandSender sender, final Arena arena, final List extends IArenaCommandHandler> list, final String prefix) {
for (final IArenaCommandHandler ach : list) {
- if (ach.hasPerms(sender, arena)) {
+ if (ach.hasPerms(sender, arena, true)) {
if(prefix.startsWith("!") || prefix.startsWith("-")) {
for (final String value : ach.getShort()) {
if (startsWithIgnoreCase(value, prefix)) {
@@ -372,4 +372,4 @@ private static String getOverrideKey(final String key, final String definition,
}
return key;
}
-}
\ No newline at end of file
+}
diff --git a/src/net/slipcor/pvparena/modules/BattlefieldJoin.java b/src/net/slipcor/pvparena/modules/BattlefieldJoin.java
index dc342c798..8a1f640e9 100644
--- a/src/net/slipcor/pvparena/modules/BattlefieldJoin.java
+++ b/src/net/slipcor/pvparena/modules/BattlefieldJoin.java
@@ -14,6 +14,7 @@
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.loadables.ArenaModule;
import net.slipcor.pvparena.managers.ArenaManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.managers.SpawnManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@@ -66,9 +67,8 @@ public PACheck checkJoin(final CommandSender sender, final PACheck result, final
}
if (arena.isLocked()
- && !player.hasPermission("pvparena.admin")
- && !(player.hasPermission("pvparena.create") && arena.getOwner()
- .equals(player.getName()))) {
+ && !PermissionManager.hasAdminPerm(player)
+ && !PermissionManager.hasBuilderPerm(player, arena)) {
result.setError(this, Language.parse(arena, MSG.ERROR_DISABLED));
return result;
}
@@ -122,9 +122,9 @@ public void commitJoin(final Player sender, final ArenaTeam team) {
final Arena arena = player.getArena();
-
- player.createState(player.get());
+ // important: clear inventory before setting player state to deal with armor modifiers (like health).
ArenaPlayer.backupAndClearInventory(arena, player.get());
+ player.createState(player.get());
player.dump();
@@ -172,4 +172,4 @@ public void reset(boolean force) {
public boolean isInternal() {
return true;
}
-}
\ No newline at end of file
+}
diff --git a/src/net/slipcor/pvparena/modules/RegionTool.java b/src/net/slipcor/pvparena/modules/RegionTool.java
index cef900fe5..698c391b1 100644
--- a/src/net/slipcor/pvparena/modules/RegionTool.java
+++ b/src/net/slipcor/pvparena/modules/RegionTool.java
@@ -8,6 +8,7 @@
import net.slipcor.pvparena.loadables.ArenaModule;
import net.slipcor.pvparena.loadables.ArenaRegion;
import net.slipcor.pvparena.managers.ArenaManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.player.PlayerInteractEvent;
@@ -48,7 +49,7 @@ public boolean onPlayerInteract(final PlayerInteractEvent event) {
return false;
}
- if (!PVPArena.hasAdminPerms(event.getPlayer())) {
+ if (!PermissionManager.hasAdminPerm(event.getPlayer())) {
return false;
}
diff --git a/src/net/slipcor/pvparena/modules/StandardLounge.java b/src/net/slipcor/pvparena/modules/StandardLounge.java
index f6d77e668..8d6e67c07 100644
--- a/src/net/slipcor/pvparena/modules/StandardLounge.java
+++ b/src/net/slipcor/pvparena/modules/StandardLounge.java
@@ -13,6 +13,7 @@
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.loadables.ArenaModule;
import net.slipcor.pvparena.managers.ArenaManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -96,10 +97,8 @@ public PACheck checkJoin(final CommandSender sender, final PACheck result, final
// handle that? ignore!
}
- if (arena.isLocked()
- && !player.hasPermission("pvparena.admin")
- && !(player.hasPermission("pvparena.create") && arena.getOwner()
- .equals(player.getName()))) {
+ if (arena.isLocked() && !PermissionManager.hasAdminPerm(player)
+ && !PermissionManager.hasBuilderPerm(player, arena)) {
result.setError(this, Language.parse(arena, MSG.ERROR_DISABLED));
return result;
}
@@ -222,8 +221,10 @@ public void commitJoin(final Player sender, final ArenaTeam team) {
final Arena arena = player.getArena();
- player.createState(player.get());
+ // important: clear inventory before setting player state to deal with armor modifiers (like health).
ArenaPlayer.backupAndClearInventory(arena, player.get());
+ player.createState(player.get());
+
player.dump();
@@ -247,4 +248,4 @@ public void parseJoin(final CommandSender player, final ArenaTeam team) {
arena.countDown();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/net/slipcor/pvparena/modules/StandardSpectate.java b/src/net/slipcor/pvparena/modules/StandardSpectate.java
index 746e3a73e..7204c12b2 100644
--- a/src/net/slipcor/pvparena/modules/StandardSpectate.java
+++ b/src/net/slipcor/pvparena/modules/StandardSpectate.java
@@ -78,8 +78,9 @@ public void commitSpectate(final Player player) {
final Arena arena = aPlayer.getArena();
- aPlayer.createState(player);
+ // important: clear inventory before setting player state to deal with armor modifiers (like health).
ArenaPlayer.backupAndClearInventory(arena, player);
+ aPlayer.createState(player);
aPlayer.dump();
@@ -108,4 +109,4 @@ public boolean hasSpawn(final String string) {
public boolean isInternal() {
return true;
}
-}
\ No newline at end of file
+}
diff --git a/src/net/slipcor/pvparena/modules/WarmupJoin.java b/src/net/slipcor/pvparena/modules/WarmupJoin.java
index 90907a5c2..fd787baec 100644
--- a/src/net/slipcor/pvparena/modules/WarmupJoin.java
+++ b/src/net/slipcor/pvparena/modules/WarmupJoin.java
@@ -11,6 +11,7 @@
import net.slipcor.pvparena.core.Language.MSG;
import net.slipcor.pvparena.loadables.ArenaModule;
import net.slipcor.pvparena.managers.ArenaManager;
+import net.slipcor.pvparena.managers.PermissionManager;
import net.slipcor.pvparena.runnables.ArenaWarmupRunnable;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -67,7 +68,7 @@ public PACheck checkJoin(final CommandSender sender, final PACheck result, final
}
- if (arena.isLocked() && !player.hasPermission("pvparena.admin") && !(player.hasPermission("pvparena.create") && arena.getOwner().equals(player.getName()))) {
+ if (arena.isLocked() && !PermissionManager.hasAdminPerm(player) && !PermissionManager.hasBuilderPerm(player, arena)) {
result.setError(this, Language.parse(arena, MSG.ERROR_DISABLED));
return result;
}
diff --git a/src/net/slipcor/pvparena/updater/ModulesUpdater.java b/src/net/slipcor/pvparena/updater/ModulesUpdater.java
index e684fc3c3..bfaa658a4 100644
--- a/src/net/slipcor/pvparena/updater/ModulesUpdater.java
+++ b/src/net/slipcor/pvparena/updater/ModulesUpdater.java
@@ -46,6 +46,11 @@ protected void runUpdater() throws IOException {
JsonObject versionJson = getVersionJson(connection.getInputStream());
String onlineVersion = getOnlineVersionFromJson(versionJson);
+ if(Long.parseLong(onlineVersion.split("\\.")[0]) > 1) {
+ // Ignore modules update if 2.0 has been detected
+ return;
+ }
+
if(currentVersion == null) {
LOG.info("PVP Arena modules are not detected");
} else if(isUpToDate(currentVersion, onlineVersion)) {
diff --git a/src/net/slipcor/pvparena/updater/PluginUpdater.java b/src/net/slipcor/pvparena/updater/PluginUpdater.java
index 515998886..9e8074a7a 100644
--- a/src/net/slipcor/pvparena/updater/PluginUpdater.java
+++ b/src/net/slipcor/pvparena/updater/PluginUpdater.java
@@ -45,6 +45,14 @@ protected void runUpdater() throws IOException {
JsonObject versionJson = getVersionJson(connection.getInputStream());
String onlineVersion = getOnlineVersionFromJson(versionJson);
+ // Detect 2.0
+ if(Long.parseLong(onlineVersion.split("\\.")[0]) > 1) {
+ String msg = "PVP Arena 2.0 has been released! Please visit our Spigot page to see how to update.";
+ LOG.info(msg);
+ this.updateMsgList.add(msg);
+ return;
+ }
+
if(isUpToDate(currentVersion, onlineVersion)) {
LOG.info("PVP Arena is up to date");
} else {
diff --git a/src/plugin.yml b/src/plugin.yml
index a85f83219..aa6d1e796 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,245 +1,237 @@
name: pvparena
author: slipcor
-authors: [slipcor, Eredrim]
+authors: [ slipcor, Eredrim ]
prefix: PVP Arena
main: net.slipcor.pvparena.PVPArena
version: ${project.version}${buildVersion}
api-version: 1.13
-softdepend: [Spout,Multiverse-Core,MultiWorld,WormholeXTreme,Vault,WorldEdit,WorldGuard,LibsDisguises,DisguiseCraft,My Worlds,CrackShot]
+softdepend: [ Vault,WorldEdit,WorldGuard,LibsDisguises,DisguiseCraft,CrackShot,Multiverse-Core,MultiWorld,MyWorlds ]
description: create, manage and enhance PvP arenas
-website: http://dev.bukkit.org/server-mods/pvparena
-dev-url: http://dev.bukkit.org/server-mods/pvparena
+website: https://www.spigotmc.org/resources/pvp-arena.16584
+dev-url: https://www.spigotmc.org/resources/pvp-arena.16584
commands:
- pvparena:
- description: Base commands for the PvP arena.
- permission: pvparena.user
- aliases: ['pa']
- usage: |
- / help
- / help admin | help administrating
- / help setup | help setting up
- / help game | help ingame
- / help info | help getting information
+ pvparena:
+ description: Base commands for the PvP arena.
+ aliases: [ 'pa' ]
+ usage: |
+ / help
+ / help admin | help administrating
+ / help setup | help setting up
+ / help game | help ingame
+ / help info | help getting information
permissions:
- pvparena.*:
- description: Gives access to everything
- default: op
- children:
- pvparena.admin: true
- pvparena.override: true
- pvparena.telepass: true
- pvparena.user: true
- pvparena.cmds: true
- pvparena.admin:
- description: Allows you to administrate arenas
- default: op
- children:
- pvparena.create: true
- pvparena.cmds.*:
- description: Allows you to do all commands
- default: op
- children:
- pvparena.cmds.blacklist: true
- pvparena.cmds.check: true
- pvparena.cmds.class: true
- pvparena.cmds.create: true
- pvparena.cmds.debug: true
- pvparena.cmds.disable: true
- pvparena.cmds.duty: true
- pvparena.cmds.edit: true
- pvparena.cmds.enable: true
- pvparena.cmds.gamemode: true
- pvparena.cmds.goal: true
- pvparena.cmds.install: true
- pvparena.cmds.playerclass: true
- pvparena.cmds.playerjoin: true
- pvparena.cmds.protection: true
- pvparena.cmds.region: true
- pvparena.cmds.regionflag: true
- pvparena.cmds.regions: true
- pvparena.cmds.regiontype: true
- pvparena.cmds.reload: true
- pvparena.cmds.remove: true
- pvparena.cmds.round: true
- pvparena.cmds.set: true
- pvparena.cmds.setowner: true
- pvparena.cmds.setup: true
- pvparena.cmds.spawn: true
- pvparena.cmds.start: true
- pvparena.cmds.stop: true
- pvparena.cmds.teams: true
- pvparena.cmds.teleport: true
- pvparena.cmds.template: true
- pvparena.cmds.togglemod: true
- pvparena.cmds.uninstall: true
- pvparena.cmds.update: true
- pvparena.cmds.whitelist: true
- pvparena.cmds.arenaclass: true
- pvparena.cmds.chat: true
- pvparena.cmds.join: true
- pvparena.cmds.leave: true
- pvparena.cmds.spectate: true
- pvparena.cmds.arenalist: true
- pvparena.cmds.help: true
- pvparena.cmds.info: true
- pvparena.cmds.list: true
- pvparena.cmds.ready: true
- pvparena.cmds.shutup: true
- pvparena.cmds.stats: true
- pvparena.cmds.version: true
- pvparena.create:
- description: Allows you to create and administrate an arena
- default: op
- pvparena.override:
- description: Allows you to override some checks
- default: op
- pvparena.telepass:
- description: Allows you to teleport while in an arena
- default: op
- pvparena.user:
- description: Allows you to use the arena
- default: true
- pvparena.cmds.blacklist:
- description: Allows you to run /pvparena blacklist
- default: op
- pvparena.cmds.check:
- description: Allows you to run /pvparena check
- default: op
- pvparena.cmds.class:
- description: Allows you to run /pvparena class
- default: op
- pvparena.cmds.create:
- description: Allows you to run /pvparena create
- default: op
- pvparena.cmds.debug:
- description: Allows you to run /pvparena debug
- default: op
- pvparena.cmds.disable:
- description: Allows you to run /pvparena disable
- default: op
- pvparena.cmds.duty:
- description: Allows you to run /pvparena duty
- default: op
- pvparena.cmds.edit:
- description: Allows you to run /pvparena edit
- default: op
- pvparena.cmds.enable:
- description: Allows you to run /pvparena enable
- default: op
- pvparena.cmds.gamemode:
- description: Allows you to run /pvparena gamemode
- default: op
- pvparena.cmds.goal:
- description: Allows you to run /pvparena goal
- default: op
- pvparena.cmds.install:
- description: Allows you to run /pvparena install
- default: op
- pvparena.cmds.playerclass:
- description: Allows you to run /pvparena playerclass
- default: op
- pvparena.cmds.playerjoin:
- description: Allows you to run /pvparena playerjoin
- default: op
- pvparena.cmds.protection:
- description: Allows you to run /pvparena protection
- default: op
- pvparena.cmds.region:
- description: Allows you to run /pvparena region
- default: op
- pvparena.cmds.regionflag:
- description: Allows you to run /pvparena regionflag
- default: op
- pvparena.cmds.regions:
- description: Allows you to run /pvparena regions
- default: op
- pvparena.cmds.regiontype:
- description: Allows you to run /pvparena regiontype
- default: op
- pvparena.cmds.reload:
- description: Allows you to run /pvparena reload
- default: op
- pvparena.cmds.remove:
- description: Allows you to run /pvparena remove
- default: op
- pvparena.cmds.round:
- description: Allows you to run /pvparena round
- default: op
- pvparena.cmds.set:
- description: Allows you to run /pvparena set
- default: op
- pvparena.cmds.setowner:
- description: Allows you to run /pvparena setowner
- default: op
- pvparena.cmds.setup:
- description: Allows you to run /pvparena setup
- default: op
- pvparena.cmds.spawn:
- description: Allows you to run /pvparena spawn
- default: op
- pvparena.cmds.start:
- description: Allows you to run /pvparena start
- default: op
- pvparena.cmds.stop:
- description: Allows you to run /pvparena stop
- default: op
- pvparena.cmds.teams:
- description: Allows you to run /pvparena teams
- default: op
- pvparena.cmds.teleport:
- description: Allows you to run /pvparena teleport
- default: op
- pvparena.cmds.template:
- description: Allows you to run /pvparena template
- default: op
- pvparena.cmds.togglemod:
- description: Allows you to run /pvparena togglemod
- default: op
- pvparena.cmds.uninstall:
- description: Allows you to run /pvparena uninstall
- default: op
- pvparena.cmds.update:
- description: Allows you to run /pvparena update
- default: op
- pvparena.cmds.whitelist:
- description: Allows you to run /pvparena whitelist
- default: op
- pvparena.cmds.arenaclass:
- description: Allows you to run /pvparena arenaclass
- default: true
- pvparena.cmds.chat:
- description: Allows you to run /pvparena chat
- default: true
- pvparena.cmds.join:
- description: Allows you to run /pvparena join
- default: true
- pvparena.cmds.leave:
- description: Allows you to run /pvparena leave
- default: true
- pvparena.cmds.spectate:
- description: Allows you to run /pvparena spectate
- default: true
- pvparena.cmds.arenalist:
- description: Allows you to run /pvparena arenalist
- default: true
- pvparena.cmds.help:
- description: Allows you to run /pvparena help
- default: true
- pvparena.cmds.info:
- description: Allows you to run /pvparena info
- default: true
- pvparena.cmds.list:
- description: Allows you to run /pvparena list
- default: true
- pvparena.cmds.ready:
- description: Allows you to run /pvparena ready
- default: true
- pvparena.cmds.shutup:
- description: Allows you to run /pvparena shutup
- default: true
- pvparena.cmds.stats:
- description: Allows you to run /pvparena stats
- default: true
- pvparena.cmds.version:
- description: Allows you to run /pvparena version
- default: true
+ pvparena.*:
+ description: Allows all
+ default: false
+ children:
+ pvparena.user: true
+ pvparena.admin: true
+ pvparena.user:
+ description: Allows you to use the arena
+ default: true
+ children:
+ pvparena.cmds.arenaclass: true
+ pvparena.cmds.chat: true
+ pvparena.cmds.join: true
+ pvparena.cmds.leave: true
+ pvparena.cmds.spectate: true
+ pvparena.cmds.arenalist: true
+ pvparena.cmds.help: true
+ pvparena.cmds.ready: true
+ pvparena.cmds.shutup: true
+ pvparena.cmds.stats: true
+ pvparena.admin:
+ description: Allows you to administrate arenas
+ default: op
+ children:
+ pvparena.cmds.*: true
+ pvparena.create: true
+ pvparena.telepass: true
+ pvparena.cmds.*:
+ description: Allows you to do all commands
+ default: false
+ children:
+ pvparena.cmds.blacklist: true
+ pvparena.cmds.check: true
+ pvparena.cmds.class: true
+ pvparena.cmds.create: true
+ pvparena.cmds.debug: true
+ pvparena.cmds.disable: true
+ pvparena.cmds.edit: true
+ pvparena.cmds.enable: true
+ pvparena.cmds.gamemode: true
+ pvparena.cmds.goal: true
+ pvparena.cmds.modules: true
+ pvparena.cmds.playerjoin: true
+ pvparena.cmds.protection: true
+ pvparena.cmds.region: true
+ pvparena.cmds.regionflag: true
+ pvparena.cmds.regions: true
+ pvparena.cmds.regiontype: true
+ pvparena.cmds.reload: true
+ pvparena.cmds.remove: true
+ pvparena.cmds.set: true
+ pvparena.cmds.spawn: true
+ pvparena.cmds.start: true
+ pvparena.cmds.stop: true
+ pvparena.cmds.teams: true
+ pvparena.cmds.teleport: true
+ pvparena.cmds.template: true
+ pvparena.cmds.togglemod: true
+ pvparena.cmds.whitelist: true
+ pvparena.cmds.info: true
+ pvparena.cmds.list: true
+ pvparena.cmds.version: true
+ pvparena.create:
+ description: Allows you to create and administrate an arena
+ default: op
+ pvparena.override:
+ description: Allows you to override some checks
+ default: op
+ pvparena.telepass:
+ description: Allows you to teleport while in an arena
+ default: op
+ pvparena.cmds.blacklist:
+ description: Allows you to run /pvparena blacklist
+ default: op
+ pvparena.cmds.check:
+ description: Allows you to run /pvparena check
+ default: op
+ pvparena.cmds.class:
+ description: Allows you to run /pvparena class
+ default: op
+ pvparena.cmds.create:
+ description: Allows you to run /pvparena create
+ default: op
+ pvparena.cmds.debug:
+ description: Allows you to run /pvparena debug
+ default: op
+ pvparena.cmds.disable:
+ description: Allows you to run /pvparena disable
+ default: op
+ pvparena.cmds.duty:
+ description: Allows you to run /pvparena duty
+ default: op
+ pvparena.cmds.edit:
+ description: Allows you to run /pvparena edit
+ default: op
+ pvparena.cmds.enable:
+ description: Allows you to run /pvparena enable
+ default: op
+ pvparena.cmds.gamemode:
+ description: Allows you to run /pvparena gamemode
+ default: op
+ pvparena.cmds.goal:
+ description: Allows you to run /pvparena goal
+ default: op
+ pvparena.cmds.install:
+ description: Allows you to run /pvparena install
+ default: op
+ pvparena.cmds.playerclass:
+ description: Allows you to run /pvparena playerclass
+ default: op
+ pvparena.cmds.playerjoin:
+ description: Allows you to run /pvparena playerjoin
+ default: op
+ pvparena.cmds.protection:
+ description: Allows you to run /pvparena protection
+ default: op
+ pvparena.cmds.region:
+ description: Allows you to run /pvparena region
+ default: op
+ pvparena.cmds.regionflag:
+ description: Allows you to run /pvparena regionflag
+ default: op
+ pvparena.cmds.regions:
+ description: Allows you to run /pvparena regions
+ default: op
+ pvparena.cmds.regiontype:
+ description: Allows you to run /pvparena regiontype
+ default: op
+ pvparena.cmds.reload:
+ description: Allows you to run /pvparena reload
+ default: op
+ pvparena.cmds.remove:
+ description: Allows you to run /pvparena remove
+ default: op
+ pvparena.cmds.round:
+ description: Allows you to run /pvparena round
+ default: op
+ pvparena.cmds.set:
+ description: Allows you to run /pvparena set
+ default: op
+ pvparena.cmds.setowner:
+ description: Allows you to run /pvparena setowner
+ default: op
+ pvparena.cmds.setup:
+ description: Allows you to run /pvparena setup
+ default: op
+ pvparena.cmds.spawn:
+ description: Allows you to run /pvparena spawn
+ default: op
+ pvparena.cmds.start:
+ description: Allows you to run /pvparena start
+ default: op
+ pvparena.cmds.stop:
+ description: Allows you to run /pvparena stop
+ default: op
+ pvparena.cmds.teams:
+ description: Allows you to run /pvparena teams
+ default: op
+ pvparena.cmds.teleport:
+ description: Allows you to run /pvparena teleport
+ default: op
+ pvparena.cmds.template:
+ description: Allows you to run /pvparena template
+ default: op
+ pvparena.cmds.togglemod:
+ description: Allows you to run /pvparena togglemod
+ default: op
+ pvparena.cmds.uninstall:
+ description: Allows you to run /pvparena uninstall
+ default: op
+ pvparena.cmds.update:
+ description: Allows you to run /pvparena update
+ default: op
+ pvparena.cmds.whitelist:
+ description: Allows you to run /pvparena whitelist
+ default: op
+ pvparena.cmds.arenaclass:
+ description: Allows you to run /pvparena arenaclass
+ default: true
+ pvparena.cmds.chat:
+ description: Allows you to run /pvparena chat
+ default: true
+ pvparena.cmds.join:
+ description: Allows you to run /pvparena join
+ default: true
+ pvparena.cmds.leave:
+ description: Allows you to run /pvparena leave
+ default: true
+ pvparena.cmds.spectate:
+ description: Allows you to run /pvparena spectate
+ default: true
+ pvparena.cmds.arenalist:
+ description: Allows you to run /pvparena arenalist
+ default: true
+ pvparena.cmds.help:
+ description: Allows you to run /pvparena help
+ default: true
+ pvparena.cmds.info:
+ description: Allows you to run /pvparena info
+ default: true
+ pvparena.cmds.list:
+ description: Allows you to run /pvparena list
+ default: true
+ pvparena.cmds.ready:
+ description: Allows you to run /pvparena ready
+ default: true
+ pvparena.cmds.shutup:
+ description: Allows you to run /pvparena shutup
+ default: true
+ pvparena.cmds.stats:
+ description: Allows you to run /pvparena stats
+ default: true
+ pvparena.cmds.version:
+ description: Allows you to run /pvparena version
+ default: true