Admin commands should be available only to GM characters.
This commit is contained in:
parent
dfad468db9
commit
c905853551
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -74,9 +74,12 @@ public final class RequestBypassToServer extends GameClientPacket
|
||||
{
|
||||
if (_command.startsWith("admin_"))
|
||||
{
|
||||
// DaDummy: this way we LOGGER _every_ admincommand with all related info
|
||||
String command;
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String command;
|
||||
if (_command.contains(" "))
|
||||
{
|
||||
command = _command.substring(0, _command.indexOf(" "));
|
||||
@ -87,14 +90,9 @@ public final class RequestBypassToServer extends GameClientPacket
|
||||
}
|
||||
|
||||
final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getAdminCommandHandler(command);
|
||||
|
||||
if (ach == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command " + command + " does not exists!");
|
||||
}
|
||||
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public final class SendBypassBuildCmd extends GameClientPacket
|
||||
protected void runImpl()
|
||||
{
|
||||
final PlayerInstance player = getClient().getPlayer();
|
||||
if (player == null)
|
||||
if ((player == null) || !player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -79,16 +79,18 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
|
||||
public void useAdminCommand(PlayerInstance player, String fullCommand, boolean useConfirm)
|
||||
{
|
||||
if (!player.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String command = fullCommand.split(" ")[0];
|
||||
final String commandNoPrefix = command.substring(6);
|
||||
|
||||
final IAdminCommandHandler handler = getHandler(command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("The command '" + commandNoPrefix + "' does not exist!");
|
||||
}
|
||||
LOGGER.warning("No handler registered for admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user