Fix debug permissions

This commit is contained in:
AlexTheCoder 2017-09-02 20:03:28 -04:00
parent 871f178419
commit 64c2c65bd0
14 changed files with 43 additions and 29 deletions

View File

@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
import mineplex.core.Managers;
import mineplex.core.account.permissions.Permission;
import mineplex.core.command.CommandBase;
import nautilus.game.arcade.ArcadeManager;
public class DebugCommand extends CommandBase<ArcadeManager>

View File

@ -537,9 +537,13 @@ public abstract class Game extends ListenerComponent implements Lifetimed
}
}
public <T extends Enum<T> & Permission> void registerDebugCommand(String commandName, T permission, DebugCommandExecutor executor)
public <T extends Enum<T> & Permission> void registerDebugCommand(String commandName, T permission, PermissionGroup defaultRank, DebugCommandExecutor executor)
{
DebugCommand command = new DebugCommand(commandName, permission, executor);
if (defaultRank != null)
{
defaultRank.setPermission(permission, true, true);
}
if (UtilServer.isTestServer())
{
PermissionGroup.QA.setPermission(permission, true, true);

View File

@ -46,6 +46,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -274,13 +275,13 @@ public class Bridge extends TeamGame implements OreObsfucation
}
}
registerDebugCommand("bridge", Perm.DEBUG_BRIDGE_COMMAND, (caller, args) ->
registerDebugCommand("bridge", Perm.DEBUG_BRIDGE_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
caller.sendMessage(F.main("Debug", "Spawning the bridges."));
_bridgeTime = 3000;
});
registerDebugCommand("bridgeinfo", Perm.DEBUG_BRIDGEINFO_COMMAND, (caller, args) ->
registerDebugCommand("bridgeinfo", Perm.DEBUG_BRIDGEINFO_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (_animation == null || !(_animation instanceof CustomBridgeAnimation))
{

View File

@ -108,7 +108,7 @@ public class EventModule extends MiniPlugin
PermissionGroup.ADMIN.setPermission(Perm.SET_HOST_COMMAND, true, true);
if (_plugin.getConfig().getString("serverstatus.name").equals("SMTestServer-1"))
{
PermissionGroup.QA.setPermission(Perm.SET_HOST_COMMAND, true, true);
PermissionGroup.SRMOD.setPermission(Perm.SET_HOST_COMMAND, true, true);
}
}

View File

@ -27,6 +27,7 @@ import com.mineplex.anticheat.checks.move.Speed;
import mineplex.core.Managers;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.Pair;
import mineplex.core.common.util.F;
@ -172,7 +173,7 @@ public class Moba extends TeamGame
.setGiveCompassToAlive(false)
.register(this);
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, (caller, args) ->
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
StringBuilder builder = new StringBuilder();

View File

@ -9,6 +9,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
@ -44,7 +45,7 @@ public class GoldManager implements Listener
_playerGold = new HashMap<>();
host.registerDebugCommand("gold", Perm.DEBUG_GOLD_COMMAND, (caller, args) ->
host.registerDebugCommand("gold", Perm.DEBUG_GOLD_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (args.length < 1)
{

View File

@ -15,6 +15,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -51,7 +52,7 @@ public class MinionManager implements Listener
_waves = new HashSet<>();
_enabled = true;
host.registerDebugCommand("removeminions", Perm.DEBUG_REMOVEMINIONS_COMMAND, (caller, args) ->
host.registerDebugCommand("removeminions", Perm.DEBUG_REMOVEMINIONS_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
for (MinionWave wave : _waves)
{

View File

@ -18,6 +18,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -67,13 +68,13 @@ public class MobaProgression implements Listener
_roleViewers = new HashMap<>();
_roleShop = new MobaRoleShop(host.getArcadeManager());
host.registerDebugCommand("fakeexp", Perm.DEBUG_FAKEEXP_COMMAND, (caller, args) ->
host.registerDebugCommand("fakeexp", Perm.DEBUG_FAKEEXP_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
int exp = Integer.parseInt(args[0]);
_host.GetGems(caller).put("Fake Exp", new GemData(exp, false));
caller.sendMessage(F.main("Debug", "Gave you " + F.elem(exp) + " fake exp."));
});
host.registerDebugCommand("setmobalevel", Perm.DEBUG_SETMOBALEVEL_COMMAND, (caller, args) ->
host.registerDebugCommand("setmobalevel", Perm.DEBUG_SETMOBALEVEL_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
MobaRole role = MobaRole.valueOf(args[0].toUpperCase());
int exp = getExpFor(Integer.parseInt(args[1]) - 1);

View File

@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -194,7 +195,7 @@ public class MobaTraining extends Moba
(int) (Math.ceil(subject.getHealth() / 2D)))
.register(this);
registerDebugCommand("skip", Perm.DEBUG_SKIP_COMMAND, (caller, args) ->
registerDebugCommand("skip", Perm.DEBUG_SKIP_COMMAND, PermissionGroup.PLAYER, (caller, args) ->
{
if (!safeFunction.apply(caller))
{

View File

@ -33,6 +33,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Sets;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -147,7 +148,7 @@ public abstract class SuperSmash extends Game
new PerkSpreadsheetModule(this, "SMASH_KITS");
registerDebugCommand("cooldown", Perm.DEBUG_COOLDOWN_COMMAND, (caller, args) ->
registerDebugCommand("cooldown", Perm.DEBUG_COOLDOWN_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
for (Player other : UtilServer.getPlayers())
{
@ -156,16 +157,16 @@ public abstract class SuperSmash extends Game
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset cooldowns!");
});
registerDebugCommand("nextsmash", Perm.DEBUG_NEXTSMASH_COMMAND, (caller, args) ->
registerDebugCommand("nextsmash", Perm.DEBUG_NEXTSMASH_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
_nextPowerup = System.currentTimeMillis() + 1000;
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " spawned a smash crystal!");
});
registerDebugCommand("smash", Perm.DEBUG_SMASH_COMMAND, (caller, args) ->
registerDebugCommand("smash", Perm.DEBUG_SMASH_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
giveSmashItem(caller);
});
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, (caller, args) ->
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
String kit = "";
@ -187,7 +188,7 @@ public abstract class SuperSmash extends Game
caller.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
});
registerDebugCommand("lives", Perm.DEBUG_LIVES_COMMAND, (caller, args) ->
registerDebugCommand("lives", Perm.DEBUG_LIVES_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset their lives!");

View File

@ -56,6 +56,7 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@ -213,7 +214,7 @@ public class SpeedBuilders extends SoloGame
.setGiveCompassToAlive(false)
.register(this);
registerDebugCommand("setnext", Perm.DEBUG_SETNEXT_COMMAND, (caller, args) ->
registerDebugCommand("setnext", Perm.DEBUG_SETNEXT_COMMAND, PermissionGroup.BUILDER, (caller, args) ->
{
if (!UtilServer.isTestServer())
{

View File

@ -29,6 +29,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.util.Vector;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -194,12 +195,12 @@ public class TypeWars extends TeamGame
.giveHotbarItem()
.register(this);
registerDebugCommand("money", Perm.DEBUG_MONEY_COMMAND, (caller, args) ->
registerDebugCommand("money", Perm.DEBUG_MONEY_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
_moneyMap.put(caller, 1000);
UtilPlayer.message(caller, F.main("Money", "You got some Money"));
});
registerDebugCommand("boss", Perm.DEBUG_BOSS_COMMAND, (caller, args) ->
registerDebugCommand("boss", Perm.DEBUG_BOSS_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
if (!IsPlaying(caller))
return;

View File

@ -71,6 +71,7 @@ import org.bukkit.scoreboard.Objective;
import org.spigotmc.ActivationRange;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.boosters.event.BoosterItemGiveEvent;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
@ -311,7 +312,7 @@ public abstract class UHC extends Game
registerQuestTrackers(new TameQuestTracker(this));
registerDebugCommand("startpvp", Perm.DEBUG_STARTPVP_COMMAND, (caller, args) ->
registerDebugCommand("startpvp", Perm.DEBUG_STARTPVP_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (!IsLive())
{
@ -331,7 +332,7 @@ public abstract class UHC extends Game
UtilPlayer.message(caller, F.main("Debug", "Started PvP"));
});
registerDebugCommand("worldinfo", Perm.DEBUG_WORLDINFO_COMMAND, (caller, args) ->
registerDebugCommand("worldinfo", Perm.DEBUG_WORLDINFO_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (args == null || args.length == 0)
{
@ -439,16 +440,16 @@ public abstract class UHC extends Game
}
return;
});
registerDebugCommand("uhcgames", Perm.DEBUG_UHCGAMES_COMMAND, (caller, args) ->
registerDebugCommand("uhcgames", Perm.DEBUG_UHCGAMES_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
UtilPlayer.message(caller, F.main("Debug", "As of now, there have been " + _gamesRun + " games played"));
});
registerDebugCommand("uhcgc", Perm.DEBUG_GC_COMMAND, (caller, args) ->
registerDebugCommand("uhcgc", Perm.DEBUG_GC_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
System.gc();
UtilPlayer.message(caller, F.main("Debug", "Cleaned up!"));
});
registerDebugCommand("setcombatlogtimeout", Perm.DEBUG_SETCOMBATLOGTIMEOUT_COMMAND, (caller, args) ->
registerDebugCommand("setcombatlogtimeout", Perm.DEBUG_SETCOMBATLOGTIMEOUT_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
CombatLogModule module = getModule(CombatLogModule.class);
if (module == null)
@ -474,14 +475,14 @@ public abstract class UHC extends Game
UtilPlayer.message(caller, F.main("Debug", "That's not a number!"));
}
});
registerDebugCommand("dm", Perm.DEBUG_DEATHMATCH_COMMAND, (caller, args) ->
registerDebugCommand("dm", Perm.DEBUG_DEATHMATCH_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
SAFE_TIME = 0;
MINING_TIME = 1000;
startPreDeathmatch();
UtilPlayer.message(caller, F.main("Debug", "Starting deathmatch"));
});
registerDebugCommand("uhcentities", Perm.DEBUG_ENTITIES_COMMAND, (caller, args) ->
registerDebugCommand("uhcentities", Perm.DEBUG_ENTITIES_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
for (Entity entity : caller.getNearbyEntities(5.0, 5.0, 5.0))
{
@ -497,7 +498,7 @@ public abstract class UHC extends Game
caller.sendMessage(debug);
}
});
registerDebugCommand("uhcchunk", Perm.DEBUG_CHUNK_COMMAND, (caller, args) ->
registerDebugCommand("uhcchunk", Perm.DEBUG_CHUNK_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftChunk) caller.getLocation().getChunk()).getHandle();
try
@ -539,7 +540,7 @@ public abstract class UHC extends Game
t.printStackTrace();
}
});
registerDebugCommand("uhcallchunks", Perm.DEBUG_CALLCHUNKS_COMMAND, (caller, args) ->
registerDebugCommand("uhcallchunks", Perm.DEBUG_CALLCHUNKS_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
for (net.minecraft.server.v1_8_R3.Chunk chunk : ((CraftWorld) caller.getWorld()).getHandle().chunkProviderServer.chunks.values())
{

View File

@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -39,7 +40,7 @@ public class RejoinModule extends Module
@Override
protected void setup()
{
getGame().registerDebugCommand("rejoin", Perm.DEBUG_REJOIN_COMMAND, (caller, args) ->
getGame().registerDebugCommand("rejoin", Perm.DEBUG_REJOIN_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (args.length < 1)
{