Myadmin tags and misc improvements

This commit is contained in:
ZeroEpoch1969
2018-02-21 18:22:13 -07:00
parent c8683ea489
commit 2bffcef9a9
8 changed files with 78 additions and 11 deletions

View File

@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin>")
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | settag <tag> | cleartag>")
public class Command_myadmin extends FreedomCommand
{
@ -160,6 +160,27 @@ public class Command_myadmin extends FreedomCommand
return true;
}
case "settag":
{
FUtil.adminAction(sender.getName(), "Setting personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false);
String tag = StringUtils.join(args, " ", 1, args.length);
target.setTag(tag);
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " default tag is now: " + FUtil.colorize(target.getTag()));
plugin.al.save();
plugin.al.updateTables();
return true;
}
case "cleartag":
{
FUtil.adminAction(sender.getName(), "Clearing personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false);
String tag = StringUtils.join(args, " ", 1, args.length);
target.setTag(null);
plugin.al.save();
plugin.al.updateTables();
return true;
}
default:
{
return false;

View File

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s]")
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s | -a]")
public class Command_opall extends FreedomCommand
{
@ -31,6 +31,11 @@ public class Command_opall extends FreedomCommand
doSetGamemode = true;
targetGamemode = GameMode.SURVIVAL;
}
else if (args[0].equals("-a"))
{
doSetGamemode = true;
targetGamemode = GameMode.ADVENTURE;
}
}
for (Player player : server.getOnlinePlayers())

View File

@ -2,22 +2,36 @@ package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to the default.", usage = "/<command>", aliases = "setl,swl")
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to the default limit or to a custom limit.", usage = "/<command> [limit]", aliases = "setl,swl")
public class Command_setlimit extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 2500.", true);
int amount = 2500;
if (args.length > 0)
{
try
{
amount = Math.max(1, Math.min(10000, Integer.parseInt(args[0])));
}
catch (NumberFormatException ex)
{
msg("Invalid number: " + args[0], ChatColor.RED);
return true;
}
}
FUtil.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to " + amount + ".", true);
for (final Player player : server.getOnlinePlayers())
{
plugin.web.setLimit(player, 2500);
plugin.web.setLimit(player, amount);
}
return true;
}

View File

@ -2,13 +2,14 @@ package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Kicks everyone and stops the server.", usage = "/<command>")
@CommandParameters(description = "Kicks everyone and stops the server.", usage = "/<command> [reason]")
public class Command_stop extends FreedomCommand
{
@ -17,9 +18,16 @@ public class Command_stop extends FreedomCommand
{
FUtil.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE);
String reason = "Server is going offline, come back in about 20 seconds.";
if (args.length > 0)
{
reason = StringUtils.join(args, " ", 0, args.length);
}
for (Player player : server.getOnlinePlayers())
{
player.kickPlayer("Server is going offline, come back in about 20 seconds.");
player.kickPlayer(reason);
}
server.shutdown();

View File

@ -16,7 +16,7 @@ public class Command_wipewarps extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!server.getPluginManager().isPluginEnabled("Essentials"))
if (!plugin.esb.isEssentialsEnabled())
{
msg("Essentials is not enabled on this server");
return true;