add debug command to toggle afk kicking
This commit is contained in:
parent
7fc74fddff
commit
19f637ba30
@ -0,0 +1,40 @@
|
|||||||
|
package nautilus.game.arcade.command;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
import nautilus.game.arcade.game.GameServerConfig;
|
||||||
|
import nautilus.game.arcade.managers.IdleManager;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class ToggleAfkKickCommand extends CommandBase<ArcadeManager>
|
||||||
|
{
|
||||||
|
public ToggleAfkKickCommand (ArcadeManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, IdleManager.Perm.TOGGLE_AFK_KICK_COMMAND, "toggleafkkick", "afkkick");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleAfkKick() {
|
||||||
|
GameServerConfig config = Plugin.GetServerConfig();
|
||||||
|
|
||||||
|
config.PlayerKickIdle = !config.PlayerKickIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args) {
|
||||||
|
toggleAfkKick();
|
||||||
|
|
||||||
|
String message = C.cGray + "AFK kick is now ";
|
||||||
|
|
||||||
|
if (Plugin.IsPlayerKickIdle()) {
|
||||||
|
message += C.cGreen + "enabled";
|
||||||
|
} else {
|
||||||
|
message += C.cRed + "disabled";
|
||||||
|
}
|
||||||
|
|
||||||
|
message += C.cGray + ".";
|
||||||
|
|
||||||
|
caller.sendMessage(F.main("Game", message));
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,9 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandCenter;
|
||||||
|
import nautilus.game.arcade.command.ToggleAfkKickCommand;
|
||||||
|
import nautilus.game.arcade.game.GameServerConfig;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -33,6 +36,7 @@ public class IdleManager implements Listener
|
|||||||
public enum Perm implements Permission
|
public enum Perm implements Permission
|
||||||
{
|
{
|
||||||
BYPASS_KICK,
|
BYPASS_KICK,
|
||||||
|
TOGGLE_AFK_KICK_COMMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ArcadeManager _arcadeManager;
|
private final ArcadeManager _arcadeManager;
|
||||||
@ -46,6 +50,8 @@ public class IdleManager implements Listener
|
|||||||
_arcadeManager = manager;
|
_arcadeManager = manager;
|
||||||
UtilServer.RegisterEvents(this);
|
UtilServer.RegisterEvents(this);
|
||||||
|
|
||||||
|
CommandCenter.Instance.addCommand(new ToggleAfkKickCommand(manager));
|
||||||
|
|
||||||
generatePermissions();
|
generatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +59,12 @@ public class IdleManager implements Listener
|
|||||||
{
|
{
|
||||||
|
|
||||||
PermissionGroup.MOD.setPermission(Perm.BYPASS_KICK, true, true);
|
PermissionGroup.MOD.setPermission(Perm.BYPASS_KICK, true, true);
|
||||||
|
|
||||||
|
PermissionGroup.ADMIN.setPermission(Perm.TOGGLE_AFK_KICK_COMMAND, true, true);
|
||||||
|
|
||||||
|
if (UtilServer.isTestServer()) {
|
||||||
|
PermissionGroup.QA.setPermission(Perm.TOGGLE_AFK_KICK_COMMAND, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
Loading…
Reference in New Issue
Block a user