Changes to adminmode

This commit is contained in:
ginlang 2022-03-22 18:01:37 +00:00
parent c2153c392f
commit 7775513286
3 changed files with 12 additions and 6 deletions

6
buildfard.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
rm -rfv buildtools_tmp/
mkdir buildtools_tmp
cd buildtools_tmp
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar --rev 1.8.8

View file

@ -7,7 +7,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, blockHostConsole = true) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]") @CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
public class Command_adminmode extends FreedomCommand { public class Command_adminmode extends FreedomCommand {
@Override @Override
@ -18,18 +18,18 @@ public class Command_adminmode extends FreedomCommand {
if (args[0].equalsIgnoreCase("off")) { if (args[0].equalsIgnoreCase("off")) {
ConfigurationEntry.ADMIN_ONLY_MODE.setBoolean(false); ConfigurationEntry.ADMIN_ONLY_MODE.setBoolean(false);
Utilities.adminAction(sender.getName(), "Opening the server to all players.", true); Utilities.adminAction(sender.getName(), "Deactivating adminmode.", true);
return true; return true;
} }
else if (args[0].equalsIgnoreCase("on")) else if (args[0].equalsIgnoreCase("on"))
{ {
ConfigurationEntry.ADMIN_ONLY_MODE.setBoolean(true); ConfigurationEntry.ADMIN_ONLY_MODE.setBoolean(true);
Utilities.adminAction(sender.getName(), "Closing the server to non-superadmins.", true); Utilities.adminAction(sender.getName(), "Activating adminmode.", true);
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!AdminList.isSuperAdmin(player)) if (!AdminList.isSuperAdmin(player))
{ {
player.kickPlayer("Server is now closed to non-superadmins."); player.kickPlayer("Server is now in adminmode.");
} }
} }
return true; return true;

View file

@ -23,13 +23,13 @@ public class ServerListener implements Listener {
if (ConfigurationEntry.ADMIN_ONLY_MODE.getBoolean()) if (ConfigurationEntry.ADMIN_ONLY_MODE.getBoolean())
{ {
event.setMotd(ChatColor.RED + "Server is closed."); event.setMotd(ChatColor.RED + "Server is in adminmode.");
return; return;
} }
if (Bukkit.hasWhitelist()) if (Bukkit.hasWhitelist())
{ {
event.setMotd(ChatColor.RED + "Whitelist enabled."); event.setMotd(ChatColor.RED + "Server is whitelisted.");
return; return;
} }