mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 21:43:54 +00:00
SQL DB is a WIP
This commit is contained in:
@ -149,7 +149,7 @@ public class Command_ban extends FreedomCommand
|
||||
// Kick player and handle others on IP
|
||||
if (player != null)
|
||||
{
|
||||
player.kickPlayer(ban.bakeKickMessage(Ips.getIp(player)));
|
||||
player.kickPlayer(ban.bakeKickMessage());
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (Ips.getIp(p).equals(Ips.getIp(player)))
|
||||
|
@ -16,7 +16,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Place a cage around someone with certain blocks, or someone's player head.", usage = "/<command> <purge | off | <partialname> [head | block] [playername | blockname]")
|
||||
@CommandParameters(description = "Place a cage around someone with certain blocks, or someone's player head.", usage = "/<command> <purge | <partialname> [head | block] [playername | blockname]")
|
||||
public class Command_cage extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -26,14 +26,8 @@ public class Command_cage extends FreedomCommand
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String skullName = null;
|
||||
if ("off".equals(args[0]) && sender instanceof Player)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
final FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.getCageData().setCaged(false);
|
||||
return true;
|
||||
}
|
||||
if ("purge".equals(args[0]))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging all players", true);
|
||||
@ -44,13 +38,24 @@ public class Command_cage extends FreedomCommand
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
|
||||
if (fPlayer.getCageData().isCaged())
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
final FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.getCageData().setCaged(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
Material outerMaterial = Material.GLASS;
|
||||
Material innerMaterial = Material.AIR;
|
||||
if (args.length >= 2 && args[1] != null)
|
||||
@ -58,12 +63,6 @@ public class Command_cage extends FreedomCommand
|
||||
final String s = args[1];
|
||||
switch (s)
|
||||
{
|
||||
case "off":
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + player.getName(), true);
|
||||
fPlayer.getCageData().setCaged(false);
|
||||
return true;
|
||||
}
|
||||
case "head":
|
||||
{
|
||||
outerMaterial = Material.PLAYER_HEAD;
|
||||
@ -91,6 +90,7 @@ public class Command_cage extends FreedomCommand
|
||||
}
|
||||
|
||||
Location location = player.getLocation().clone().add(0.0, 1.0, 0.0);
|
||||
|
||||
if (skullName != null)
|
||||
{
|
||||
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial, skullName);
|
||||
@ -99,7 +99,9 @@ public class Command_cage extends FreedomCommand
|
||||
{
|
||||
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial);
|
||||
}
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
if (outerMaterial == Material.PLAYER_HEAD)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
|
||||
@ -130,7 +132,7 @@ public class Command_cage extends FreedomCommand
|
||||
{
|
||||
if (!args[0].equals("purge"))
|
||||
{
|
||||
return Arrays.asList("off", "head", "block");
|
||||
return Arrays.asList("head", "block");
|
||||
}
|
||||
}
|
||||
else if (args.length == 3)
|
||||
|
@ -17,7 +17,7 @@ public class Command_cmdspy extends FreedomCommand
|
||||
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
admin.setCommandSpy(!admin.getCommandSpy());
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled."));
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class Command_doom extends FreedomCommand
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing " + player.getName() + " from the admin list", true);
|
||||
admin.setActive(false);
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||
{
|
||||
|
@ -1,45 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.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, blockHostConsole = true)
|
||||
@CommandParameters(description = "Send a chat message as the specified player.", usage = "/<command> <fromname> <outmessage>")
|
||||
public class Command_gchat extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!FUtil.isExecutive(sender.getName()) && plugin.al.isAdmin(player))
|
||||
{
|
||||
msg("Only Executives may use this command on admins", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String outMessage = StringUtils.join(args, " ", 1, args.length);
|
||||
msg("Sending message as " + player.getName() + ": " + outMessage);
|
||||
player.chat(outMessage);
|
||||
msg("Message sent.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Send a command as the specified player.", usage = "/<command> <fromname> <outcommand>")
|
||||
public class Command_gcmd extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!FUtil.isExecutive(sender.getName()) && plugin.al.isAdmin(player))
|
||||
{
|
||||
msg("Only Executives may use this command on admins", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String outCommand = StringUtils.join(args, " ", 1, args.length);
|
||||
|
||||
if (plugin.cb.isCommandBlocked(outCommand, sender))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
msg("Sending command as " + player.getName() + ": " + outCommand);
|
||||
if (server.dispatchCommand(player, outCommand))
|
||||
{
|
||||
msg("Command sent.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Unknown error sending command.");
|
||||
}
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
msg("Error sending command: " + ex.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -104,7 +104,7 @@ public class Command_glist extends FreedomCommand
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.kickPlayer(playerBan.bakeKickMessage(Ips.getIp(player)));
|
||||
player.kickPlayer(playerBan.bakeKickMessage());
|
||||
}
|
||||
|
||||
plugin.pul.logPunishment(new Punishment(username, ips.get(0), sender.getName(), PunishmentType.BAN, null));
|
||||
@ -149,7 +149,7 @@ public class Command_glist extends FreedomCommand
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.kickPlayer(nameBan.bakeKickMessage(Ips.getIp(player)));
|
||||
player.kickPlayer(nameBan.bakeKickMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -0,0 +1,202 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.world.WorldTime;
|
||||
import me.totalfreedom.totalfreedommod.world.WorldWeather;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "HubWorld management stuff",
|
||||
usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]",
|
||||
aliases = "hw,hub")
|
||||
public class Command_hubworld extends FreedomCommand
|
||||
{
|
||||
|
||||
private enum CommandMode
|
||||
{
|
||||
TELEPORT, TIME, WEATHER
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
CommandMode commandMode = null;
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
commandMode = CommandMode.TELEPORT;
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
{
|
||||
if ("time".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
commandMode = CommandMode.TIME;
|
||||
}
|
||||
else if ("weather".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
commandMode = CommandMode.WEATHER;
|
||||
}
|
||||
}
|
||||
|
||||
if (commandMode == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
switch (commandMode)
|
||||
{
|
||||
case TELEPORT:
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
World hubWorld = null;
|
||||
try
|
||||
{
|
||||
hubWorld = plugin.wm.hubworld.getWorld();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (hubWorld == null || playerSender.getWorld() == hubWorld)
|
||||
{
|
||||
msg("Going to the main world.");
|
||||
playerSender.teleport(server.getWorlds().get(0).getSpawnLocation());
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Going to the hub world");
|
||||
plugin.wm.hubworld.sendToWorld(playerSender);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TIME:
|
||||
{
|
||||
assertCommandPerms(sender, playerSender);
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
WorldTime timeOfDay = WorldTime.getByAlias(args[1]);
|
||||
if (timeOfDay != null)
|
||||
{
|
||||
plugin.wm.hubworld.setTimeOfDay(timeOfDay);
|
||||
msg("Hub world time set to: " + timeOfDay.name());
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Invalid time of day. Can be: sunrise, noon, sunset, midnight");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case WEATHER:
|
||||
{
|
||||
assertCommandPerms(sender, playerSender);
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
WorldWeather weatherMode = WorldWeather.getByAlias(args[1]);
|
||||
if (weatherMode != null)
|
||||
{
|
||||
plugin.wm.hubworld.setWeatherMode(weatherMode);
|
||||
msg("Hub world weather set to: " + weatherMode.name());
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Invalid weather mode. Can be: off, rain, storm");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (PermissionDeniedException ex)
|
||||
{
|
||||
if (ex.getMessage().isEmpty())
|
||||
{
|
||||
return noPerms();
|
||||
}
|
||||
sender.sendMessage(ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (args.length == 1)
|
||||
{
|
||||
return Arrays.asList("time", "weather");
|
||||
}
|
||||
else if (args.length == 2)
|
||||
{
|
||||
if (args[0].equals("time"))
|
||||
{
|
||||
return Arrays.asList("morning", "noon", "evening", "night");
|
||||
}
|
||||
else if (args[0].equals("weather"))
|
||||
{
|
||||
return Arrays.asList("off", "rain", "storm");
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// TODO: Redo this properly
|
||||
private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null || !plugin.al.isSeniorAdmin(playerSender))
|
||||
{
|
||||
throw new PermissionDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
private class PermissionDeniedException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PermissionDeniedException()
|
||||
{
|
||||
super("");
|
||||
}
|
||||
|
||||
private PermissionDeniedException(String string)
|
||||
{
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Toggles jumppads on/off, view the status of jumppads, or make them sideways.", usage = "/<command> <on | off | info | sideways <on | off>>", aliases = "launchpads,jp")
|
||||
public class Command_jumppads extends FreedomCommand
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -95,7 +96,7 @@ public class Command_list extends FreedomCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - plugin.al.vanished.size())
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - AdminList.vanished.size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" out of a maximum ")
|
||||
.append(ChatColor.RED)
|
||||
|
@ -10,13 +10,14 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "This is evil, and I never should have wrote it - blocks specified player's input.", usage = "/<command> <all | purge | <<partialname> on | off>>")
|
||||
@CommandParameters(description = "This is evil, and I never should have wrote it - blocks specified player's input.", usage = "/<command> <all | purge | <<partialname> on | off> [-q]>")
|
||||
public class Command_lockup extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
Boolean silent = (args[args.length - 1].equalsIgnoreCase("-q"));
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
@ -56,7 +57,10 @@ public class Command_lockup extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Locking up " + player.getName(), true);
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Locking up " + player.getName(), true);
|
||||
}
|
||||
startLockup(player);
|
||||
msg("Locked up " + player.getName() + ".");
|
||||
}
|
||||
@ -70,7 +74,10 @@ public class Command_lockup extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
|
||||
}
|
||||
cancelLockup(player);
|
||||
msg("Unlocked " + player.getName() + ".");
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
target.clearIPs();
|
||||
target.addIp(targetIp);
|
||||
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
|
||||
msg(counter + " IPs removed.");
|
||||
@ -127,7 +127,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
FUtil.adminAction(sender.getName(), "Removing a supered IP" + (init == null ? "" : " from " + targetPlayer.getName() + "'s IPs"), true);
|
||||
|
||||
target.removeIp(args[1]);
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
|
||||
msg("Removed IP " + args[1]);
|
||||
@ -159,7 +159,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
target.setLoginMessage(message);
|
||||
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: ");
|
||||
msg("> " + previewMessage);
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Clearing personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
||||
target.setLoginMessage(null);
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
}
|
||||
@ -188,7 +188,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
String format = StringUtils.join(args, " ", 1, args.length);
|
||||
target.setAcFormat(format);
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY);
|
||||
String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", Rank.TELNET_ADMIN.getAbbr()).replace("%rankcolor%", Rank.TELNET_ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog.");
|
||||
@ -198,7 +198,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
case "clearacformat":
|
||||
{
|
||||
target.setAcFormat(null);
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
msg("Cleared admin chat format.", ChatColor.GRAY);
|
||||
return true;
|
||||
@ -206,7 +206,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
case "oldtags":
|
||||
{
|
||||
target.setOldTags(!target.getOldTags());
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
msg((target.getOldTags() ? "Enabled" : "Disabled") + " old tags.");
|
||||
return true;
|
||||
@ -214,7 +214,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
case "logstick":
|
||||
{
|
||||
target.setLogStick(!target.getLogStick());
|
||||
plugin.al.save();
|
||||
plugin.al.save(target);
|
||||
plugin.al.updateTables();
|
||||
msg((target.getLogStick() ? "Enabled" : "Disabled") + " log-stick lookup.");
|
||||
return true;
|
||||
|
@ -18,6 +18,8 @@ import org.bukkit.plugin.PluginManager;
|
||||
public class Command_plugincontrol extends FreedomCommand
|
||||
{
|
||||
|
||||
private final List<String> UNTOUCHABLE_PLUGINS = Arrays.asList(plugin.getName(), "BukkitTelnet");
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -88,9 +90,9 @@ public class Command_plugincontrol extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.getName().equals(plugin.getName()))
|
||||
if (UNTOUCHABLE_PLUGINS.contains(target.getName()))
|
||||
{
|
||||
msg("You cannot disable " + plugin.getName());
|
||||
msg("You cannot disable " + target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -115,9 +117,9 @@ public class Command_plugincontrol extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.getName().equals(plugin.getName()))
|
||||
if (UNTOUCHABLE_PLUGINS.contains(target.getName()))
|
||||
{
|
||||
msg("Use /tfm reload to reload instead.");
|
||||
msg("You cannot reload " + target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -157,7 +159,10 @@ public class Command_plugincontrol extends FreedomCommand
|
||||
List<String> names = new ArrayList<>();
|
||||
for (Plugin plugin : server.getPluginManager().getPlugins())
|
||||
{
|
||||
names.add(plugin.getName());
|
||||
if (!UNTOUCHABLE_PLUGINS.contains(plugin.getName()))
|
||||
{
|
||||
names.add(plugin.getName());
|
||||
}
|
||||
}
|
||||
names.remove(plugin.getName());
|
||||
return names;
|
||||
|
@ -17,7 +17,8 @@ import org.bukkit.potion.PotionEffectType;
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "Manipulate your potion effects. Duration is measured in server ticks (~20 ticks per second).",
|
||||
usage = "/<command> <list | clear [target name] | add <type> <duration> <amplifier> [target name]>")
|
||||
usage = "/<command> <list | clear [target name] | add <type> <duration> <amplifier> [target name]>",
|
||||
aliases="effect")
|
||||
public class Command_potion extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class Command_potionspy extends FreedomCommand
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
admin.setPotionSpy(!admin.getPotionSpy());
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
msg("PotionSpy is now " + (admin.getPotionSpy() ? "enabled." : "disabled."));
|
||||
return true;
|
||||
|
@ -99,7 +99,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
FUtil.adminAction(sender.getName(), "Setting " + admin.getName() + "'s rank to " + rank.getName(), true);
|
||||
|
||||
admin.setRank(rank);
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
|
||||
Player player = getPlayer(admin.getName());
|
||||
if (player != null)
|
||||
@ -175,7 +175,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
// Find the old admin entry
|
||||
String name = player != null ? player.getName() : args[1];
|
||||
Admin admin = null;
|
||||
for (Admin loopAdmin : plugin.al.getAllAdmins().values())
|
||||
for (Admin loopAdmin : plugin.al.getAllAdmins())
|
||||
{
|
||||
if (loopAdmin.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
@ -204,11 +204,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the admin list", true);
|
||||
plugin.al.addAdmin(new Admin(player));
|
||||
if (player != null)
|
||||
{
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
admin = new Admin(player);
|
||||
|
||||
// Attempt to find discord account
|
||||
if (plugin.mbl.isMasterBuilder(player))
|
||||
@ -224,6 +220,8 @@ public class Command_saconfig extends FreedomCommand
|
||||
admin.setDiscordID(vPlayer.getDiscordId());
|
||||
}
|
||||
}
|
||||
plugin.al.addAdmin(admin);
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
else // Existing admin
|
||||
{
|
||||
@ -231,7 +229,9 @@ public class Command_saconfig extends FreedomCommand
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
String oldName = admin.getName();
|
||||
admin.setName(player.getName());
|
||||
plugin.sql.updateAdminName(oldName, admin.getName());
|
||||
admin.addIp(Ips.getIp(player));
|
||||
}
|
||||
|
||||
@ -287,7 +287,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
plugin.al.verifiedNoAdminIps.remove(player.getName());
|
||||
}
|
||||
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
if (player != null)
|
||||
{
|
||||
@ -339,7 +339,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Removing " + admin.getName() + " from the admin list", true);
|
||||
admin.setActive(false);
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
if (player != null)
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ public class Command_tag extends FreedomCommand
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
admin.setTag(tag);
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
}
|
||||
else if (plugin.mbl.isMasterBuilder(player))
|
||||
|
@ -69,7 +69,7 @@ public class Command_tempban extends FreedomCommand
|
||||
}
|
||||
message.append(" until ").append(date_format.format(expires));
|
||||
|
||||
String reason = "Banned by " + sender.getName();
|
||||
String reason = null;
|
||||
if (args.length >= 3)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")";
|
||||
@ -95,7 +95,7 @@ public class Command_tempban extends FreedomCommand
|
||||
ban.addIp(ip);
|
||||
}
|
||||
plugin.bm.addBan(ban);
|
||||
player.kickPlayer(sender.getName() + " - " + message.toString());
|
||||
player.kickPlayer(ban.bakeKickMessage());
|
||||
|
||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.TEMPBAN, reason));
|
||||
|
||||
|
@ -46,6 +46,8 @@ public class Command_toggle extends FreedomCommand
|
||||
msg("- spawners");
|
||||
msg("- 4chan");
|
||||
msg("- beehives");
|
||||
msg("- autotp");
|
||||
msg("- autoclear");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -213,6 +215,16 @@ public class Command_toggle extends FreedomCommand
|
||||
toggle("Beehives are", ConfigEntry.ALLOW_BEEHIVES);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("autotp"))
|
||||
{
|
||||
toggle("Teleportation on join is", ConfigEntry.AUTO_TP);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("autoclear"))
|
||||
{
|
||||
toggle("Clearing inventories on join is", ConfigEntry.AUTO_CLEAR);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -232,7 +244,8 @@ public class Command_toggle extends FreedomCommand
|
||||
return Arrays.asList(
|
||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs",
|
||||
"bells", "armorstands", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan", "beehives");
|
||||
"bells", "armorstands", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan", "beehives",
|
||||
"autotp", "autoclear");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
|
@ -31,7 +31,7 @@ public class Command_unlinkdiscord extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
admin.setDiscordID(null);
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
msg("Your Minecraft account has been successfully unlinked from the Discord account.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [-q] <player>")
|
||||
@CommandParameters(description = "Unmutes a player", usage = "/<command> [-q] <player>")
|
||||
public class Command_unmute extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -218,7 +218,7 @@ public class Command_verify extends FreedomCommand
|
||||
|
||||
admin.setActive(true);
|
||||
admin.setLastLogin(new Date());
|
||||
plugin.al.save();
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
plugin.rm.updateDisplay(playerSender);
|
||||
playerSender.setOp(true);
|
||||
|
@ -1,35 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Reload the banned VPN IP list.", usage = "/<command> reload")
|
||||
public class Command_vpnbanlist extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!args[0].equalsIgnoreCase("reload"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
msg("Reloading VPN ban list...", ChatColor.RED);
|
||||
plugin.vn.stop();
|
||||
plugin.vn.start();
|
||||
msg("Reloaded VPN ban list.");
|
||||
msg(plugin.vn.getVPNIps().size() + " IPs loaded");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user