mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 04:04:58 +00:00
Changes to adminmode
This commit is contained in:
parent
c2153c392f
commit
7775513286
3 changed files with 12 additions and 6 deletions
6
buildfard.sh
Executable file
6
buildfard.sh
Executable 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
|
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
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]")
|
||||
public class Command_adminmode extends FreedomCommand {
|
||||
@Override
|
||||
|
@ -18,18 +18,18 @@ public class Command_adminmode extends FreedomCommand {
|
|||
|
||||
if (args[0].equalsIgnoreCase("off")) {
|
||||
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;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
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())
|
||||
{
|
||||
if (!AdminList.isSuperAdmin(player))
|
||||
{
|
||||
player.kickPlayer("Server is now closed to non-superadmins.");
|
||||
player.kickPlayer("Server is now in adminmode.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -23,13 +23,13 @@ public class ServerListener implements Listener {
|
|||
|
||||
if (ConfigurationEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Server is closed.");
|
||||
event.setMotd(ChatColor.RED + "Server is in adminmode.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bukkit.hasWhitelist())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Whitelist enabled.");
|
||||
event.setMotd(ChatColor.RED + "Server is whitelisted.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue