mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
got bored
This commit is contained in:
@ -8,7 +8,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -19,11 +18,9 @@ import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Bans the specified player.", usage = "/<command> <username> [reason] [-nrb]", aliases = "gtfo")
|
||||
@CommandParameters(description = "Bans the specified player.", usage = "/<command> <username> [reason] [-nrb | -q]", aliases = "gtfo")
|
||||
public class Command_ban extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -35,6 +32,34 @@ public class Command_ban extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
String reason = null;
|
||||
Boolean silent = false;
|
||||
Boolean cancelRollback = false;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[args.length - 1].equalsIgnoreCase("-nrb") || args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
{
|
||||
if (args[args.length - 1].equalsIgnoreCase("-nrb"))
|
||||
{
|
||||
cancelRollback = true;
|
||||
}
|
||||
|
||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
{
|
||||
silent = true;
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
}
|
||||
|
||||
final String username;
|
||||
final List<String> ips = new ArrayList<>();
|
||||
|
||||
@ -56,7 +81,7 @@ public class Command_ban extends FreedomCommand
|
||||
{
|
||||
final PlayerData entry = plugin.pl.getData(player);
|
||||
username = player.getName();
|
||||
//ips.addAll(entry.getIps());
|
||||
//ips.addAll(entry.getIps());/
|
||||
ips.add(Ips.getIp(player));
|
||||
|
||||
// Deop
|
||||
@ -68,14 +93,17 @@ public class Command_ban extends FreedomCommand
|
||||
// Clear inventory
|
||||
player.getInventory().clear();
|
||||
|
||||
// Strike with lightning
|
||||
final Location targetPos = player.getLocation();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
if (!silent)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
// Strike with lightning
|
||||
final Location targetPos = player.getLocation();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
targetPos.getWorld().strikeLightning(strike_pos);
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
targetPos.getWorld().strikeLightning(strike_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,77 +111,13 @@ public class Command_ban extends FreedomCommand
|
||||
player.setHealth(0.0);
|
||||
}
|
||||
|
||||
String reason = null;
|
||||
Boolean cancelRollback = false;
|
||||
Boolean epicFail = false;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[args.length - 1].equalsIgnoreCase("-nrb"))
|
||||
{
|
||||
cancelRollback = true;
|
||||
if (args.length >= 3)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
if (args[args.length - 1].equalsIgnoreCase("-ef"))
|
||||
{
|
||||
epicFail = true;
|
||||
if (args.length >= 3)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if CoreProtect is loaded and installed, and skips the rollback and uses CoreProtect directly
|
||||
if (!cancelRollback)
|
||||
{
|
||||
if (!plugin.cpb.isEnabled())
|
||||
{
|
||||
// Undo WorldEdits
|
||||
try
|
||||
{
|
||||
plugin.web.undo(player, 15);
|
||||
}
|
||||
catch (NoClassDefFoundError | NullPointerException ex)
|
||||
{
|
||||
}
|
||||
|
||||
// Rollback
|
||||
plugin.rb.rollback(username);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.cpb.rollback(username);
|
||||
}
|
||||
plugin.cpb.rollback(username);
|
||||
}
|
||||
|
||||
if (epicFail)
|
||||
{
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 50, 0)));
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
player.getWorld().strikeLightning(player.getLocation());
|
||||
//FUtil.
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 2L * 20L);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
if (player != null && !silent)
|
||||
{
|
||||
FUtil.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
}
|
||||
@ -166,16 +130,20 @@ public class Command_ban extends FreedomCommand
|
||||
}
|
||||
plugin.bm.addBan(ban);
|
||||
|
||||
// Broadcast
|
||||
final StringBuilder bcast = new StringBuilder()
|
||||
.append("Banning: ")
|
||||
.append(username);
|
||||
if (reason != null)
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason);
|
||||
// Broadcast
|
||||
final StringBuilder bcast = new StringBuilder()
|
||||
.append("Banning: ")
|
||||
.append(username);
|
||||
if (reason != null)
|
||||
{
|
||||
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason);
|
||||
}
|
||||
msg(sender, ChatColor.GRAY + username + " has been banned and IP is: " + StringUtils.join(ips, ", "));
|
||||
FUtil.adminAction(sender.getName(), String.format(bcast.toString()), true);
|
||||
}
|
||||
msg(sender, ChatColor.GRAY + username + " has been banned and IP is: " + StringUtils.join(ips, ", "));
|
||||
FUtil.adminAction(sender.getName(), String.format(bcast.toString()), true);
|
||||
|
||||
// Kick player and handle others on IP
|
||||
if (player != null)
|
||||
|
@ -67,7 +67,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
int counter = 0;
|
||||
for (final Player player : this.server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin((CommandSender)player))
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
final FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
playerdata.setEditBlocked(true);
|
||||
@ -82,7 +82,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
final boolean smite = args[0].equals("-s");
|
||||
if (smite)
|
||||
{
|
||||
args = (String[])ArrayUtils.subarray((Object[])args, 1, args.length);
|
||||
args = (String[])ArrayUtils.subarray(args, 1, args.length);
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
@ -99,7 +99,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join((Object[])args, " ", 1, args.length);
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
final FPlayer pd = plugin.pl.getPlayer(player2);
|
||||
@ -112,7 +112,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plugin.al.isAdmin((CommandSender)player2))
|
||||
if (plugin.al.isAdmin(player2))
|
||||
{
|
||||
msg(player2.getName() + " is an admin, and cannot have their block edits blocked.");
|
||||
return true;
|
||||
|
@ -16,12 +16,12 @@ public class Command_cartsit extends FreedomCommand
|
||||
{
|
||||
Player targetPlayer = playerSender;
|
||||
|
||||
if (args.length == 1)
|
||||
if (args.length == 1 && plugin.al.isAdmin(sender))
|
||||
{
|
||||
|
||||
targetPlayer = getPlayer(args[0]);
|
||||
|
||||
if (targetPlayer == null || plugin.al.vanished.contains(targetPlayer) && !plugin.al.isAdmin(sender))
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
@ -36,11 +36,6 @@ public class Command_cartsit extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (targetPlayer != playerSender && !isAdmin(sender))
|
||||
{
|
||||
sender.sendMessage("Only admins can select another player as a /cartsit target.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (targetPlayer.isInsideVehicle())
|
||||
{
|
||||
|
@ -1,113 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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 = "For developers only - debug things via reflection.", usage = "/<command>")
|
||||
public class Command_debug extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
String className = args[0];
|
||||
String fieldName = args[1];
|
||||
String newValue = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
|
||||
|
||||
if (className.equalsIgnoreCase("_"))
|
||||
{
|
||||
className = "me.totalfreedom.totalfreedommod.TotalFreedomMod";
|
||||
}
|
||||
|
||||
setStaticValue(className, fieldName, newValue);
|
||||
|
||||
sender.sendMessage("Debug: OK");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void setStaticValue(final String className, final String fieldName, final String newValueString) throws Exception
|
||||
{
|
||||
Class<?> forName = Class.forName(className);
|
||||
if (forName != null)
|
||||
{
|
||||
final Field field = forName.getDeclaredField(fieldName);
|
||||
if (field != null)
|
||||
{
|
||||
Object newValue;
|
||||
|
||||
Class<?> type = field.getType();
|
||||
if (type.isPrimitive())
|
||||
{
|
||||
if (type.getName().equals("int"))
|
||||
{
|
||||
newValue = Integer.parseInt(newValueString);
|
||||
}
|
||||
else if (type.getName().equals("double"))
|
||||
{
|
||||
newValue = Double.parseDouble(newValueString);
|
||||
}
|
||||
else if (type.getName().equals("boolean"))
|
||||
{
|
||||
newValue = Boolean.parseBoolean(newValueString);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Unknown primitive field type.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type.isAssignableFrom(Integer.class))
|
||||
{
|
||||
newValue = new Integer(newValueString);
|
||||
}
|
||||
else if (type.isAssignableFrom(Double.class))
|
||||
{
|
||||
newValue = new Double(newValueString);
|
||||
}
|
||||
else if (type.isAssignableFrom(Boolean.class))
|
||||
{
|
||||
newValue = Boolean.valueOf(newValueString);
|
||||
}
|
||||
else if (type.isAssignableFrom(String.class))
|
||||
{
|
||||
newValue = newValueString;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Unknown complex field type.");
|
||||
}
|
||||
}
|
||||
|
||||
field.setAccessible(true);
|
||||
|
||||
final Object oldValue = field.get(Class.forName(className));
|
||||
if (oldValue != null)
|
||||
{
|
||||
field.set(oldValue, newValue);
|
||||
}
|
||||
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -98,7 +98,7 @@ public class Command_enchant extends FreedomCommand
|
||||
|
||||
try
|
||||
{
|
||||
ench = Enchantment.getByName(args[1]);
|
||||
ench = Enchantment.getByName(args[1].toUpperCase());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1,30 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists all possible enchantments.", usage = "/<command>")
|
||||
public class Command_enchantments extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
String list = "All possible enchantments: ";
|
||||
|
||||
for (Enchantment enchantment : Enchantment.values())
|
||||
{
|
||||
list += enchantment.getName() + ", ";
|
||||
}
|
||||
|
||||
// Remove extra comma at the end of the list
|
||||
list = list.substring(0, list.length() - 2);
|
||||
|
||||
msg(list);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -6,8 +6,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Go to \"The End\".", usage = "/<command>", aliases = "end")
|
||||
public class Command_ender extends FreedomCommand
|
||||
@CommandParameters(description = "Go to \"The End\".", usage = "/<command>")
|
||||
public class Command_end extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
@ -1,150 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Executive only commands - more items will be added shortly!", usage = "/<command> [hell: <username>]", aliases = "exec")
|
||||
public class Command_executive extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!FUtil.isExecutive(sender.getName()))
|
||||
{
|
||||
msg("You aren't an executive, have a cookie instead!");
|
||||
if (!senderIsConsole)
|
||||
{
|
||||
final int firstEmpty = playerSender.getInventory().firstEmpty();
|
||||
final ItemStack cakeItem = new ItemStack(Material.COOKIE);
|
||||
playerSender.getInventory().setItem(firstEmpty, cakeItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Sorry, you're not an in-game player, so it's impossible to give you a cookie :(");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args.length > 0)
|
||||
{
|
||||
switch (args[0])
|
||||
{
|
||||
case "hell":
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
if (getPlayer(args[1]) == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
final Player player = getPlayer(args[1]);
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Calling Satan to open the gates of hell for " + player.getName(), true);
|
||||
FUtil.bcastMsg(player.getName() + " is going to have a bad time!", ChatColor.RED);
|
||||
final String IP = player.getAddress().getAddress().getHostAddress().trim();
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
admin.setActive(false);
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
}
|
||||
player.setVelocity(new Vector(0, Math.max(1.0, Math.min(150, 30)), 0));
|
||||
player.setWhitelisted(false);
|
||||
player.setOp(false);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.closeInventory();
|
||||
player.getInventory().clear();
|
||||
player.setFireTicks(10000);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_DEATH, 100, -1f);
|
||||
player.getEnderChest().clear();
|
||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.DOOM, null));
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.getWorld().strikeLightning(player.getLocation());
|
||||
}
|
||||
}.runTaskLater(plugin, 20L * 2L);
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.getWorld().strikeLightning(player.getLocation());
|
||||
}
|
||||
}.runTaskLater(plugin, 20L * 2L);
|
||||
FUtil.bcastMsg("The gates to hell have opened, let the wrath of " + sender.getName() + " condem " + player.getName() + "!", ChatColor.RED);
|
||||
player.setFireTicks(10000);
|
||||
final CommandSender cSender = sender;
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
banPlayer(player.getName(), "Get your fucking shit together and then call back kthx", true, false);
|
||||
FUtil.adminAction(cSender.getName(), "Has sent " + player.getName() + " to hell, IP: " + IP, true);
|
||||
player.kickPlayer(ChatColor.RED + "Welcome to hell you fucking cuck");
|
||||
}
|
||||
}.runTaskLater(plugin, 40L * 4L);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void banPlayer(String playerName, String reason, Boolean silent, Boolean kick)
|
||||
{
|
||||
PlayerData playerData = plugin.pl.getData(playerName);
|
||||
final List<String> ips = new ArrayList<>();
|
||||
ips.addAll(playerData.getIps());
|
||||
String username;
|
||||
final Player player = getPlayer(args[1]);
|
||||
username = playerName;
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Banning " + username, true);
|
||||
msg(sender, player.getName() + " has been banned and IP is: " + ips);
|
||||
}
|
||||
Ban ban = Ban.forPlayerName(username, sender, null, reason);
|
||||
for (String ip : ips)
|
||||
{
|
||||
ban.addIp(ip);
|
||||
ban.addIp(FUtil.getFuzzyIp(ip));
|
||||
}
|
||||
plugin.bm.addBan(ban);
|
||||
|
||||
if (player != null && kick)
|
||||
{
|
||||
player.kickPlayer(ban.bakeKickMessage(Ips.getIp(player)));
|
||||
}
|
||||
}
|
||||
}
|
@ -21,11 +21,11 @@ public class Command_invsee extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
Player player = getPlayer(args[0], true);
|
||||
|
||||
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
if (player == null)
|
||||
{
|
||||
msg("This player is not online.");
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
@ -49,6 +50,11 @@ public class Command_list extends FreedomCommand
|
||||
listFilter = ListFilter.VANISHED_ADMINS;
|
||||
break;
|
||||
}
|
||||
case "-t":
|
||||
{
|
||||
listFilter = ListFilter.TELNET_SESSIONS;
|
||||
break;
|
||||
}
|
||||
case "-i":
|
||||
{
|
||||
listFilter = ListFilter.IMPOSTORS;
|
||||
@ -71,49 +77,65 @@ public class Command_list extends FreedomCommand
|
||||
}
|
||||
StringBuilder onlineStats = new StringBuilder();
|
||||
StringBuilder onlineUsers = new StringBuilder();
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - plugin.al.vanished.size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" out of a maximum ")
|
||||
.append(ChatColor.RED)
|
||||
.append(server.getMaxPlayers())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" players online.");
|
||||
List<String> n = new ArrayList<>();
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.ADMINS && plugin.al.vanished.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.vanished.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.IMPOSTORS && !plugin.al.isAdminImpostor(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(p.getName().toLowerCase()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.PLAYERS && plugin.al.vanished.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Displayable display = plugin.rm.getDisplay(p);
|
||||
if (!senderIsConsole && plugin.al.isAdmin(playerSender) && plugin.al.getAdmin(playerSender).getOldTags())
|
||||
List<String> n = new ArrayList<>();
|
||||
|
||||
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.al.isAdmin(sender) && plugin.al.getAdmin(sender).getRank().isAtLeast(Rank.TELNET_ADMIN))
|
||||
{
|
||||
List<Admin> connectedAdmins = plugin.btb.getConnectedAdmins();
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedAdmins.size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" admins connected to telnet.");
|
||||
for (Admin admin : connectedAdmins)
|
||||
{
|
||||
n.add(getOldPrefix(display) + p.getName());
|
||||
n.add(plugin.rm.getDisplay(admin).getColoredTag() + admin.getName());
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - plugin.al.vanished.size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" out of a maximum ")
|
||||
.append(ChatColor.RED)
|
||||
.append(server.getMaxPlayers())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" players online.");
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
n.add(display.getColoredTag() + p.getName());
|
||||
if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.ADMINS && plugin.al.vanished.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.vanished.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.IMPOSTORS && !plugin.al.isAdminImpostor(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(p.getName().toLowerCase()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.PLAYERS && plugin.al.vanished.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Displayable display = plugin.rm.getDisplay(p);
|
||||
if (!senderIsConsole && plugin.al.isAdmin(playerSender) && plugin.al.getAdmin(playerSender).getOldTags())
|
||||
{
|
||||
n.add(getOldPrefix(display) + p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
n.add(display.getColoredTag() + p.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
String playerType = listFilter.toString().toLowerCase().replace('_', ' ');
|
||||
@ -158,6 +180,7 @@ public class Command_list extends FreedomCommand
|
||||
PLAYERS,
|
||||
ADMINS,
|
||||
VANISHED_ADMINS,
|
||||
TELNET_SESSIONS,
|
||||
FAMOUS_PLAYERS,
|
||||
IMPOSTORS
|
||||
}
|
||||
|
@ -18,7 +18,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> [[-s | -q] <player> [reason] | list | purge | all]", aliases = "stfu")
|
||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> <[-s | -q] <player> [reason] | list | purge | all>", aliases = "stfu")
|
||||
public class Command_mute extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -129,16 +129,21 @@ public class Command_mute extends FreedomCommand
|
||||
|
||||
if (!playerdata.isMuted())
|
||||
{
|
||||
playerdata.setMuted(true);
|
||||
player.sendTitle(ChatColor.RED + "You've been muted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||
if (reason != null)
|
||||
{
|
||||
msg(player, ChatColor.RED + "Reason: " + ChatColor.YELLOW + reason);
|
||||
}
|
||||
if (quiet)
|
||||
{
|
||||
playerdata.setMuted(true);
|
||||
playerdata.setQuietMuted(true);
|
||||
msg("Muted " + player.getName() + " quietly");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
|
||||
playerdata.setMuted(true);
|
||||
|
||||
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||
|
||||
if (smite)
|
||||
{
|
||||
@ -146,11 +151,6 @@ public class Command_mute extends FreedomCommand
|
||||
}
|
||||
|
||||
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||
player.sendTitle(ChatColor.RED + "You've been muted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||
if (reason != null)
|
||||
{
|
||||
msg(player, ChatColor.RED + "Reason: " + ChatColor.YELLOW + reason);
|
||||
}
|
||||
msg("Muted " + player.getName());
|
||||
|
||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.MUTE, reason));
|
||||
|
@ -142,16 +142,23 @@ public class Command_myadmin extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
String msg = StringUtils.join(args, " ", 1, args.length);
|
||||
if (!msg.contains("%rank%") && !msg.contains("%coloredrank%"))
|
||||
String message = StringUtils.join(args, " ", 1, args.length);
|
||||
if (!message.contains("%rank%") && !message.contains("%coloredrank%"))
|
||||
{
|
||||
msg("Your login message must contain your rank. Use either %rank% or %coloredrank% to specify where you want the rank", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
int length = message.replace("%name%", "").replace("%rank%", "").replace("%coloredrank%", "").length();
|
||||
if (length > 64)
|
||||
{
|
||||
msg("Your login message cannot be more than 64 characters (excluding your rank and your name)", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
String previewMessage = plugin.rm.craftLoginMessage(targetPlayer, message);
|
||||
FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
||||
target.setLoginMessage(msg);
|
||||
target.setLoginMessage(message);
|
||||
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: ");
|
||||
msg("> " + ChatColor.AQUA + (msg.contains("%name%") ? "" : target.getName() + " is ") + FUtil.colorize(msg).replace("%name%", targetPlayer.getName()).replace("%rank%", plugin.rm.getDisplay(target).getName()).replace("%coloredrank%", plugin.rm.getDisplay(target).getColoredName()));
|
||||
msg("> " + previewMessage);
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
|
@ -100,7 +100,7 @@ public class Command_notes extends FreedomCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("No note with the ID of " + args[2] + "exists.", ChatColor.RED);
|
||||
msg("No note with the ID of " + args[2] + " exists.", ChatColor.RED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ public class Command_potion extends FreedomCommand
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
target = getPlayer(args[1]);
|
||||
target = getPlayer(args[1], true);
|
||||
|
||||
if (target == null || plugin.al.vanished.contains(target) && !plugin.al.isAdmin(sender))
|
||||
if (target == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
|
@ -35,9 +35,9 @@ public class Command_rank extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
final Player player = getPlayer(args[0], true);
|
||||
|
||||
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
|
@ -15,7 +15,6 @@ public class Command_reactionbar extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
if (!plugin.sh.reactionString.isEmpty())
|
||||
{
|
||||
ActionBarAPI.sendActionBar(playerSender, ChatColor.BOLD + plugin.sh.reactionString, 15 * 20);
|
||||
|
@ -21,9 +21,9 @@ public class Command_report extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
Player player = getPlayer(args[0], true);
|
||||
|
||||
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
if (player == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
|
@ -1,35 +0,0 @@
|
||||
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 = "Kicks everyone and restarts the server.", usage = "/<command>")
|
||||
public class Command_restart extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!plugin.amp.enabled)
|
||||
{
|
||||
msg(ChatColor.RED + "AMP integration is not enabled. Please use /stop instead.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player.kickPlayer(ChatColor.LIGHT_PURPLE + "Server is going offline, come back in about 20 seconds.");
|
||||
}
|
||||
|
||||
plugin.amp.restartServer();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -83,8 +83,8 @@ public class Command_ride extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
final Player player = getPlayer(args[0], true);
|
||||
if (player == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
|
@ -156,10 +156,13 @@ public class Command_ro extends FreedomCommand
|
||||
if (data instanceof Waterlogged)
|
||||
{
|
||||
Waterlogged waterloggedData = (Waterlogged)data;
|
||||
waterloggedData.setWaterlogged(false);
|
||||
block.setBlockData(waterloggedData);
|
||||
affected++;
|
||||
continue;
|
||||
if (waterloggedData.isWaterlogged())
|
||||
{
|
||||
waterloggedData.setWaterlogged(false);
|
||||
block.setBlockData(waterloggedData);
|
||||
affected++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
block.setType(toMaterial);
|
||||
affected++;
|
||||
|
@ -1,85 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
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 = "Issues a rollback on a player", usage = "/<command> <[partialname] | undo [partialname] purge [partialname] | purgeall>", aliases = "rb")
|
||||
public class Command_rollback extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if ("purgeall".equals(args[0]))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Purging all rollback history", false);
|
||||
msg("Purged all rollback history for " + plugin.rb.purgeEntries() + " players.");
|
||||
}
|
||||
else
|
||||
{
|
||||
final String playerName = plugin.rb.findPlayer(args[0]);
|
||||
|
||||
if (playerName == null)
|
||||
{
|
||||
msg("That player has no entries stored.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.rb.canUndoRollback(playerName))
|
||||
{
|
||||
msg("That player has just been rolled back.");
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Rolling back player: " + playerName, false);
|
||||
msg("Rolled back " + plugin.rb.rollback(playerName) + " edits for " + playerName + ".");
|
||||
msg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
if ("purge".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
final String playerName = plugin.rb.findPlayer(args[1]);
|
||||
|
||||
if (playerName == null)
|
||||
{
|
||||
msg("That player has no entries stored.");
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Purged " + plugin.rb.purgeEntries(playerName) + " rollback history entries for " + playerName + ".");
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("undo".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
final String playerName = plugin.rb.findPlayer(args[1]);
|
||||
|
||||
if (playerName == null)
|
||||
{
|
||||
msg("That player hasn't been rolled back recently.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Reverting rollback for player: " + playerName, false);
|
||||
msg("Reverted " + plugin.rb.undoRollback(playerName) + " edits for " + playerName + ".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
@ -15,7 +16,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/<command> <player> [reason]")
|
||||
@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/<command> <player> [reason] [-q]")
|
||||
public class Command_smite extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -27,21 +28,37 @@ public class Command_smite extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
Boolean silent = false;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
{
|
||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
{
|
||||
silent = true;
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
smite(sender, player, reason);
|
||||
smite(sender, player, reason, silent);
|
||||
|
||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.SMITE, reason));
|
||||
|
||||
@ -50,10 +67,15 @@ public class Command_smite extends FreedomCommand
|
||||
|
||||
public static void smite(CommandSender sender, Player player)
|
||||
{
|
||||
smite(sender, player, null);
|
||||
smite(sender, player, null, false);
|
||||
}
|
||||
|
||||
public static void smite(CommandSender sender, Player player, String reason)
|
||||
{
|
||||
smite(sender, player, reason, false);
|
||||
}
|
||||
|
||||
public static void smite(CommandSender sender, Player player, String reason, Boolean silent)
|
||||
{
|
||||
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
||||
player.sendTitle(ChatColor.RED + "You've been smitten.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||
@ -62,7 +84,11 @@ public class Command_smite extends FreedomCommand
|
||||
{
|
||||
FUtil.bcastMsg(" Reason: " + ChatColor.YELLOW + reason, ChatColor.RED);
|
||||
}
|
||||
FUtil.bcastMsg(" Smitten by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.bcastMsg(" Smitten by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||
}
|
||||
|
||||
// Deop
|
||||
player.setOp(false);
|
||||
|
@ -10,11 +10,9 @@ 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;
|
||||
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Unbans the specified player.", usage = "/<command> <username> [-r[estore]]")
|
||||
@CommandParameters(description = "Unbans the specified player.", usage = "/<command> <username> [-r]")
|
||||
public class Command_unban extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -26,7 +24,6 @@ public class Command_unban extends FreedomCommand
|
||||
String username;
|
||||
final List<String> ips = new ArrayList<>();
|
||||
final PlayerData entry = plugin.pl.getData(args[0]);
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
@ -38,30 +35,14 @@ public class Command_unban extends FreedomCommand
|
||||
ips.addAll(entry.getIps());
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Unbanning " + username, true);
|
||||
playerMsg(sender, ChatColor.GRAY + username + " has been unbanned and IP is: " + StringUtils.join(ips, ", "));
|
||||
msg(username + " has been unbanned along with the following IPs: " + StringUtils.join(ips, ", "));
|
||||
plugin.bm.removeBan(plugin.bm.getByUsername(username));
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("-r") || args[1].equalsIgnoreCase("-restore"))
|
||||
if (args[1].equalsIgnoreCase("-r"))
|
||||
{
|
||||
if (!plugin.cpb.isEnabled())
|
||||
{
|
||||
// Redo WorldEdits
|
||||
try
|
||||
{
|
||||
plugin.web.redo(player, 15);
|
||||
}
|
||||
catch (NoClassDefFoundError | NullPointerException ex)
|
||||
{
|
||||
}
|
||||
// Rollback
|
||||
plugin.rb.undoRollback(username);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.cpb.restore(username);
|
||||
}
|
||||
plugin.cpb.restore(username);
|
||||
msg("Restored edits for: " + username);
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,9 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -58,11 +54,12 @@ public class Command_unmute extends FreedomCommand
|
||||
|
||||
if (playerdata.isMuted())
|
||||
{
|
||||
if (quiet || playerdata.isQuietMuted())
|
||||
playerdata.setMuted(false);
|
||||
msg(player, "You have been unmuted.", ChatColor.RED);
|
||||
player.sendTitle(ChatColor.RED + "You've been unmuted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||
if (quiet)
|
||||
{
|
||||
playerdata.setMuted(false);
|
||||
playerdata.setQuietMuted(false);
|
||||
msg("Unmuted " + player.getName() + " quietly");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -78,7 +75,6 @@ public class Command_unmute extends FreedomCommand
|
||||
msg(ChatColor.RED + "That player is not muted.");
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,10 @@ public class Command_vanish extends FreedomCommand
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player))
|
||||
playerMsg(player, ChatColor.YELLOW + sender.getName() + " has unvanished and is now visible to everyone." );
|
||||
player.showPlayer(plugin, playerSender);
|
||||
{
|
||||
playerMsg(player, ChatColor.YELLOW + sender.getName() + " has unvanished and is now visible to everyone.");
|
||||
player.showPlayer(plugin, playerSender);
|
||||
}
|
||||
}
|
||||
plugin.esb.setVanished(playerSender.getName(), false);
|
||||
playerSender.setPlayerListName(StringUtils.substring(displayName, 0, 16));
|
||||
|
@ -4,6 +4,7 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -27,9 +28,11 @@ public class Command_wipeflatlands extends FreedomCommand
|
||||
|
||||
FUtil.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
|
||||
|
||||
World flatlands = plugin.wm.flatlands.getWorld();
|
||||
|
||||
if (plugin.wgb.isEnabled())
|
||||
{
|
||||
plugin.wgb.wipeRegions(plugin.wm.flatlands.getWorld());
|
||||
plugin.wgb.wipeRegions(flatlands);
|
||||
}
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
@ -37,13 +40,13 @@ public class Command_wipeflatlands extends FreedomCommand
|
||||
player.kickPlayer("Server is going offline for flatlands wipe, come back in a few minutes.");
|
||||
}
|
||||
|
||||
if (!plugin.amp.enabled)
|
||||
if (plugin.cpb.isEnabled())
|
||||
{
|
||||
server.shutdown();
|
||||
plugin.cpb.clearDatabase(flatlands, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.amp.restartServer();
|
||||
server.shutdown();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -71,12 +71,6 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public List<String> tabComplete(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
return null;
|
||||
}*/
|
||||
// Doesn't need to do any starts-with checks
|
||||
protected List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) {
|
||||
return null;
|
||||
}
|
||||
@ -85,7 +79,8 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
||||
public List<String> tabComplete(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
List<String> options = getTabCompleteOptions(sender, command, alias, args);
|
||||
if (options == null) {
|
||||
if (options == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return StringUtil.copyPartialMatches(args[args.length - 1], options, Lists.<String>newArrayList());
|
||||
@ -140,6 +135,16 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
||||
return Players.getPlayer(name);
|
||||
}
|
||||
|
||||
protected Player getPlayer(String name, Boolean nullVanished)
|
||||
{
|
||||
Player player = Players.getPlayer(name);
|
||||
if (nullVanished && plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Players.getPlayer(name);
|
||||
}
|
||||
|
||||
protected void msg(final CommandSender sender, final String message, final ChatColor color)
|
||||
{
|
||||
if (sender == null)
|
||||
|
Reference in New Issue
Block a user