Allow event hosts to use /game
This commit is contained in:
parent
acae54f021
commit
b860a69d46
@ -179,9 +179,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
KIT_UNLOCK_COMMAND,
|
||||
TAUNT_COMMAND,
|
||||
GAME_COMMAND,
|
||||
SET_GAME_COMMAND,
|
||||
START_GAME_COMMAND,
|
||||
STOP_GAME_COMMAND,
|
||||
AUTO_OP,
|
||||
KIT_ACCESS,
|
||||
FEATURED_SERVER,
|
||||
@ -627,19 +624,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
PermissionGroup.CONTENT.setPermission(Perm.KIT_UNLOCK_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.TAUNT_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.GAME_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.SET_GAME_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.START_GAME_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.STOP_GAME_COMMAND, true, true);
|
||||
if (UtilServer.isTestServer())
|
||||
{
|
||||
PermissionGroup.QA.setPermission(Perm.GAME_COMMAND, true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.SET_GAME_COMMAND, true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.START_GAME_COMMAND, true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.STOP_GAME_COMMAND, true, true);
|
||||
PermissionGroup.MAPLEAD.setPermission(Perm.GAME_COMMAND, false, true);
|
||||
PermissionGroup.MAPLEAD.setPermission(Perm.SET_GAME_COMMAND, false, true);
|
||||
PermissionGroup.MAPLEAD.setPermission(Perm.START_GAME_COMMAND, false, true);
|
||||
PermissionGroup.MAPLEAD.setPermission(Perm.STOP_GAME_COMMAND, false, true);
|
||||
}
|
||||
if (UtilServer.isTestServer() || UtilServer.isDevServer())
|
||||
{
|
||||
@ -925,6 +913,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canPlayerUseGameCmd(Player player)
|
||||
{
|
||||
if (!GetClients().Get(player).hasPermission(Perm.GAME_COMMAND) && !(_gameHostManager.isEventServer() && _gameHostManager.isAdmin(player, false)))
|
||||
{
|
||||
player.sendMessage(F.main("Game", "You are not allowed to use game commands."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void StaffIncognito(IncognitoStatusChangeEvent event)
|
||||
{
|
||||
|
@ -3,6 +3,8 @@ package nautilus.game.arcade.command;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.command.MultiCommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -14,17 +16,26 @@ import static nautilus.game.arcade.command.SetCommand.SOURCE_PREFIX;
|
||||
|
||||
public class GameCommand extends MultiCommandBase<ArcadeManager>
|
||||
{
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
GAME_COMMAND_DUMMY_PERM,
|
||||
}
|
||||
|
||||
public GameCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, ArcadeManager.Perm.GAME_COMMAND, "game");
|
||||
super(plugin, Perm.GAME_COMMAND_DUMMY_PERM, "game");
|
||||
|
||||
AddCommand(new StartCommand(Plugin));
|
||||
AddCommand(new StopCommand(Plugin));
|
||||
AddCommand(new SetCommand(Plugin));
|
||||
|
||||
PermissionGroup.PLAYER.setPermission(Perm.GAME_COMMAND_DUMMY_PERM, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void Help(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.canPlayerUseGameCmd(caller))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Game", "Available Commands"));
|
||||
UtilPlayer.message(caller, F.help("/game start", "Start the current game", ChatColor.DARK_RED));
|
||||
@ -32,3 +43,4 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
|
||||
caller.sendMessage(F.help(String.format("/game set <gametype> [%s(gamemode)] [%s(mapsource)] [%s(mapname)]", MODE_PREFIX, SOURCE_PREFIX, MAP_PREFIX), "Set the current game or next game", ChatColor.DARK_RED));
|
||||
}
|
||||
}
|
||||
}
|
@ -26,12 +26,17 @@ public class SetCommand extends CommandBase<ArcadeManager>
|
||||
|
||||
public SetCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, ArcadeManager.Perm.SET_GAME_COMMAND, "set");
|
||||
super(plugin, GameCommand.Perm.GAME_COMMAND_DUMMY_PERM, "set");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.canPlayerUseGameCmd(caller))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.GetGame() == null)
|
||||
return;
|
||||
|
||||
|
@ -13,12 +13,17 @@ public class StartCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
public StartCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, ArcadeManager.Perm.START_GAME_COMMAND, "start");
|
||||
super(plugin, GameCommand.Perm.GAME_COMMAND_DUMMY_PERM, "start");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.canPlayerUseGameCmd(caller))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.GetGame() == null || Plugin.GetGame().GetState() == GameState.Loading)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Game", "The game is currently loading, it cannot be started!"));
|
||||
|
@ -14,12 +14,17 @@ public class StopCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
public StopCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, ArcadeManager.Perm.STOP_GAME_COMMAND, "stop");
|
||||
super(plugin, GameCommand.Perm.GAME_COMMAND_DUMMY_PERM, "stop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.canPlayerUseGameCmd(caller))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.GetGame() == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Game", "There is no game to stop!"));
|
||||
|
Loading…
Reference in New Issue
Block a user