mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 21:43:54 +00:00
TotalFreedomMod Electrum
Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
This commit is contained in:
@ -24,7 +24,7 @@ public class CommandLoader extends FreedomService
|
||||
protected void onStart()
|
||||
{
|
||||
handler.clearCommands();
|
||||
handler.setExecutorFactory(new FreedomCommandExecutor.FreedomExecutorFactory());
|
||||
handler.setExecutorFactory(new FreedomCommandExecutor.FreedomExecutorFactory(plugin));
|
||||
handler.setCommandClassPrefix("Command_");
|
||||
handler.setPermissionMessage(ChatColor.RED + "You do not have permission to use this command.");
|
||||
handler.setOnlyConsoleMessage(ChatColor.RED + "This command can only be used from the console.");
|
||||
|
@ -33,7 +33,7 @@ public class Command_adminchat extends FreedomCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminChatMessage(sender, StringUtils.join(args, " "));
|
||||
plugin.cm.adminChat(sender, StringUtils.join(args, " "));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -0,0 +1,26 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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 = "Make an announcement", usage = "/<command> <message>")
|
||||
public class Command_announce extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
plugin.an.announce(StringUtils.join(args, " "));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -9,16 +9,12 @@ import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
|
||||
public class Command_banlist extends FreedomCommand
|
||||
{
|
||||
public class Command_banlist extends FreedomCommand {
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("purge")) {
|
||||
checkRank(Rank.SENIOR_ADMIN);
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Purging the ban list", true);
|
||||
|
@ -3,12 +3,13 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
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 = "Block all commands for a specific player.", usage = "/<command> <purge | <partialname>>", aliases = "blockcommands,blockcommand")
|
||||
@CommandParameters(description = "Block all commands for a specific player.", usage = "/<command> <-a | purge | <player>>", aliases = "blockcommands,blockcommand,bc,bcmd")
|
||||
public class Command_blockcmd extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -20,7 +21,7 @@ public class Command_blockcmd extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
if (args[0].equals("purge"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unblocking commands for all players", true);
|
||||
int counter = 0;
|
||||
@ -37,6 +38,26 @@ public class Command_blockcmd extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("-a"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Blocking commands for all non-admins", true);
|
||||
int counter = 0;
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (isAdmin(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
counter += 1;
|
||||
plugin.pl.getPlayer(player).setCommandsBlocked(true);
|
||||
msg(player, "Your commands have been blocked by an admin.", ChatColor.RED);
|
||||
}
|
||||
|
||||
msg("Blocked commands for " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
@ -45,7 +66,7 @@ public class Command_blockcmd extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isAdmin(sender))
|
||||
if (isAdmin(player))
|
||||
{
|
||||
msg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
|
||||
return true;
|
||||
|
@ -12,15 +12,19 @@ import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Essentials Interface Command - Color your current nickname.", usage = "/<command> <color>")
|
||||
public class Command_colorme extends FreedomCommand {
|
||||
public class Command_colorme extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ("list".equalsIgnoreCase(args[0])) {
|
||||
if ("list".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
msg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", "));
|
||||
return true;
|
||||
}
|
||||
@ -28,15 +32,18 @@ public class Command_colorme extends FreedomCommand {
|
||||
final String needle = args[0].trim().toLowerCase();
|
||||
ChatColor color = null;
|
||||
final Iterator<Map.Entry<String, ChatColor>> it = FUtil.CHAT_COLOR_NAMES.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Map.Entry<String, ChatColor> entry = it.next();
|
||||
if (entry.getKey().contains(needle)) {
|
||||
if (entry.getKey().contains(needle))
|
||||
{
|
||||
color = entry.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (color == null) {
|
||||
if (color == null)
|
||||
{
|
||||
msg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors.");
|
||||
return true;
|
||||
}
|
||||
|
@ -8,64 +8,49 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to creative, or define someone's username to change theirs.", usage = "/<command> [partialname]", aliases = "gmc")
|
||||
@CommandParameters(description = "Quickly change your own gamemode to creative, or define someone's username to change theirs.", usage = "/<command> <-a | [partialname]>", aliases = "gmc")
|
||||
public class Command_creative extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target user to change gamemode on.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Player player;
|
||||
if (args.length == 0)
|
||||
{
|
||||
player = playerSender;
|
||||
if (isConsole())
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target player.");
|
||||
return true;
|
||||
}
|
||||
|
||||
playerSender.setGameMode(GameMode.CREATIVE);
|
||||
msg("Gamemode set to creative.");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
checkRank(Rank.SUPER_ADMIN);
|
||||
|
||||
if (args[0].equals("-a"))
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("-a"))
|
||||
for (Player targetPlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (!isAdmin(sender))
|
||||
{
|
||||
noPerms();
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Player targetPlayer : server.getOnlinePlayers())
|
||||
{
|
||||
targetPlayer.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(senderIsConsole || isAdmin(sender)))
|
||||
{
|
||||
msg("Only superadmins can change other user's gamemode.");
|
||||
return true;
|
||||
}
|
||||
|
||||
player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
targetPlayer.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Setting " + player.getName() + " to game mode 'Creative'.");
|
||||
msg(player, sender.getName() + " set your game mode to 'Creative'.");
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Setting " + player.getName() + " to game mode creative");
|
||||
msg(player, sender.getName() + " set your game mode to creative");
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
|
||||
return true;
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "For the bad Superadmins", usage = "/<command> <playername>")
|
||||
@CommandParameters(description = "For the bad admins", usage = "/<command> <playername>")
|
||||
public class Command_doom extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -21,11 +21,11 @@ public class Command_enchant extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemInHand = playerSender.getItemInHand();
|
||||
ItemStack item = playerSender.getEquipment().getItemInMainHand();
|
||||
|
||||
if (itemInHand == null)
|
||||
if (item == null || item.getType() == Material.AIR)
|
||||
{
|
||||
msg("You are holding an invalid item.");
|
||||
msg("You have to hold an item to enchant it");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ public class Command_enchant extends FreedomCommand
|
||||
StringBuilder possible_ench = new StringBuilder("Possible enchantments for held item: ");
|
||||
for (Enchantment ench : Enchantment.values())
|
||||
{
|
||||
if (ench.canEnchantItem(itemInHand))
|
||||
if (ench.canEnchantItem(item))
|
||||
{
|
||||
has_enchantments = true;
|
||||
possible_ench.append(ench.getName()).append(", ");
|
||||
@ -58,14 +58,14 @@ public class Command_enchant extends FreedomCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ench.canEnchantItem(itemInHand))
|
||||
if (ench.canEnchantItem(item))
|
||||
{
|
||||
itemInHand.addEnchantment(ench, ench.getMaxLevel());
|
||||
item.addEnchantment(ench, ench.getMaxLevel());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.info("Error using " + ench.getName() + " on " + itemInHand.getType().name() + " held by " + playerSender.getName() + ".");
|
||||
msg("Could not add enchantment: " + ench.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,9 +73,9 @@ public class Command_enchant extends FreedomCommand
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
for (Enchantment ench : itemInHand.getEnchantments().keySet())
|
||||
for (Enchantment ench : item.getEnchantments().keySet())
|
||||
{
|
||||
itemInHand.removeEnchantment(ench);
|
||||
item.removeEnchantment(ench);
|
||||
}
|
||||
|
||||
msg("Removed all enchantments.");
|
||||
@ -105,9 +105,9 @@ public class Command_enchant extends FreedomCommand
|
||||
|
||||
if (args[0].equalsIgnoreCase("add"))
|
||||
{
|
||||
if (ench.canEnchantItem(itemInHand))
|
||||
if (ench.canEnchantItem(item))
|
||||
{
|
||||
itemInHand.addEnchantment(ench, ench.getMaxLevel());
|
||||
item.addEnchantment(ench, ench.getMaxLevel());
|
||||
|
||||
msg("Added enchantment: " + ench.getName());
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class Command_enchant extends FreedomCommand
|
||||
}
|
||||
else if (args[0].equals("remove"))
|
||||
{
|
||||
itemInHand.removeEnchantment(ench);
|
||||
item.removeEnchantment(ench);
|
||||
|
||||
msg("Removed enchantment: " + ench.getName());
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class Command_ender extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.gotoWorld(playerSender, server.getWorlds().get(0).getName() + "_the_end");
|
||||
plugin.wm.gotoWorld(playerSender, server.getWorlds().get(0).getName() + "_the_end");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,6 @@ public class Command_freeze extends FreedomCommand
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Enabling global player freeze", false);
|
||||
msg("Players are now frozen.");
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!isAdmin(player))
|
||||
@ -38,6 +36,8 @@ public class Command_freeze extends FreedomCommand
|
||||
msg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
|
||||
}
|
||||
}
|
||||
msg("Players are now frozen.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "You'll never even see it coming.", usage = "/<command>")
|
||||
@CommandParameters(description = "You'll never even see it coming.", usage = "/<command> <on [radius (default=25)] | off>")
|
||||
public class Command_fuckoff extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class Command_gadmin extends FreedomCommand
|
||||
case OP:
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), String.format("Opping %s.", target.getName()), false);
|
||||
target.setOp(false);
|
||||
target.setOp(true);
|
||||
target.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||
|
||||
break;
|
||||
|
@ -73,7 +73,7 @@ public class Command_glist extends FreedomCommand
|
||||
|
||||
final String reason = args.length > 2 ? StringUtils.join(args, " ", 2, args.length) : null;
|
||||
|
||||
Ban ban = Ban.forPlayerName(player, sender, null, reason);
|
||||
Ban ban = Ban.forPlayerName(username, sender, null, reason);
|
||||
for (String ip : ips)
|
||||
{
|
||||
ban.addIp(ip);
|
||||
|
@ -45,6 +45,12 @@ public class Command_health extends FreedomCommand
|
||||
Thread.sleep(2500);
|
||||
final double ticksPerSecond = tickMeter.stopTicking();
|
||||
|
||||
// Plugin was disabled during async task
|
||||
if (!plugin.isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
|
@ -0,0 +1,61 @@
|
||||
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 = "Kick a player.", usage = "/<command> <player> [reason]", aliases = "k")
|
||||
public class Command_kick extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isAdmin(player))
|
||||
{
|
||||
msg("Admins can not be kicked", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder()
|
||||
.append(ChatColor.RED).append("You have been kicked from the server.")
|
||||
.append("\n").append(ChatColor.RED).append("Kicked by: ").append(ChatColor.GOLD).append(sender.getName());
|
||||
|
||||
if (reason != null)
|
||||
{
|
||||
builder.append("\n").append(ChatColor.RED).append("Reason: ").append(ChatColor.GOLD).append(reason);
|
||||
FUtil.adminAction(sender.getName(), "Kicking " + player.getName() + " - Reason: " + reason, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Kicking " + player.getName(), true);
|
||||
}
|
||||
|
||||
player.kickPlayer(builder.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -2,6 +2,8 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -10,16 +12,17 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i]", aliases = "who")
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i | -f]", aliases = "who")
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
|
||||
private static enum ListFilter
|
||||
{
|
||||
|
||||
ALL,
|
||||
PLAYERS,
|
||||
ADMINS,
|
||||
FAMOUS_PLAYERS,
|
||||
IMPOSTORS;
|
||||
}
|
||||
|
||||
@ -45,22 +48,24 @@ public class Command_list extends FreedomCommand
|
||||
final ListFilter listFilter;
|
||||
if (args.length == 1)
|
||||
{
|
||||
if ("-a".equals(args[0]))
|
||||
switch (args[0])
|
||||
{
|
||||
listFilter = ListFilter.ADMINS;
|
||||
}
|
||||
else if ("-i".equals(args[0]))
|
||||
{
|
||||
listFilter = ListFilter.IMPOSTORS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
case "-a":
|
||||
listFilter = ListFilter.ADMINS;
|
||||
break;
|
||||
case "-i":
|
||||
listFilter = ListFilter.IMPOSTORS;
|
||||
break;
|
||||
case "-f":
|
||||
listFilter = ListFilter.FAMOUS_PLAYERS;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
listFilter = ListFilter.ALL;
|
||||
listFilter = ListFilter.PLAYERS;
|
||||
}
|
||||
|
||||
final StringBuilder onlineStats = new StringBuilder();
|
||||
@ -83,11 +88,20 @@ public class Command_list extends FreedomCommand
|
||||
continue;
|
||||
}
|
||||
|
||||
names.add(plugin.rm.getDisplay(player).getColoredTag() + player.getName());
|
||||
if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(player.getName().toLowerCase()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Displayable display = plugin.rm.getDisplay(player);
|
||||
|
||||
names.add(display.getColoredTag() + player.getName());
|
||||
}
|
||||
|
||||
String playerType = listFilter == null ? "players" : listFilter.toString().toLowerCase().replace('_', ' ');
|
||||
|
||||
onlineUsers.append("Connected ");
|
||||
onlineUsers.append(listFilter == ListFilter.ADMINS ? "admins: " : "players: ");
|
||||
onlineUsers.append(playerType + ": ");
|
||||
onlineUsers.append(StringUtils.join(names, ChatColor.WHITE + ", "));
|
||||
|
||||
if (senderIsConsole)
|
||||
|
@ -9,6 +9,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
@ -36,134 +37,9 @@ public class Command_logs extends FreedomCommand
|
||||
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
}
|
||||
|
||||
updateLogsRegistration(sender, playerSender, mode);
|
||||
plugin.lv.updateLogsRegistration(sender, playerSender, mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void updateLogsRegistration(final CommandSender sender, final Player target, final LogsRegistrationMode mode)
|
||||
{
|
||||
updateLogsRegistration(sender, target.getName(), target.getAddress().getAddress().getHostAddress().trim(), mode);
|
||||
}
|
||||
|
||||
public static void updateLogsRegistration(final CommandSender sender, final String targetName, final String targetIP, final LogsRegistrationMode mode)
|
||||
{
|
||||
final String logsRegisterUrl = ConfigEntry.LOGS_URL.getString();
|
||||
final String logsRegisterPassword = ConfigEntry.LOGS_SECRET.getString();
|
||||
|
||||
if (logsRegisterUrl == null || logsRegisterPassword == null || logsRegisterUrl.isEmpty() || logsRegisterPassword.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sender != null)
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "Connecting...");
|
||||
}
|
||||
|
||||
URL url = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", mode.toString())
|
||||
.addQueryParameter("password", logsRegisterPassword)
|
||||
.addQueryParameter("name", targetName)
|
||||
.addQueryParameter("ip", targetIP)
|
||||
.getURL();
|
||||
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setConnectTimeout(1000 * 5);
|
||||
connection.setReadTimeout(1000 * 5);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestMethod("HEAD");
|
||||
|
||||
final int responseCode = connection.getResponseCode();
|
||||
|
||||
if (sender != null)
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (responseCode == 200)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GREEN + "Registration " + mode.toString() + "d.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Error contacting logs registration server.");
|
||||
}
|
||||
}
|
||||
}.runTask(TotalFreedomMod.plugin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
}.runTaskAsynchronously(TotalFreedomMod.plugin);
|
||||
}
|
||||
|
||||
public static void deactivateSuperadmin(Admin superadmin)
|
||||
{
|
||||
for (String ip : superadmin.getIps())
|
||||
{
|
||||
updateLogsRegistration(null, superadmin.getName(), ip, Command_logs.LogsRegistrationMode.DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum LogsRegistrationMode
|
||||
{
|
||||
|
||||
UPDATE("update"), DELETE("delete");
|
||||
private final String mode;
|
||||
|
||||
private LogsRegistrationMode(String mode)
|
||||
{
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
private static class URLBuilder
|
||||
{
|
||||
|
||||
private final String requestPath;
|
||||
private final Map<String, String> queryStringMap = new HashMap<>();
|
||||
|
||||
public URLBuilder(String requestPath)
|
||||
{
|
||||
this.requestPath = requestPath;
|
||||
}
|
||||
|
||||
public URLBuilder addQueryParameter(String key, String value)
|
||||
{
|
||||
queryStringMap.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public URL getURL() throws MalformedURLException
|
||||
{
|
||||
List<String> pairs = new ArrayList<>();
|
||||
Iterator<Entry<String, String>> it = queryStringMap.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Entry<String, String> pair = it.next();
|
||||
pairs.add(pair.getKey() + "=" + pair.getValue());
|
||||
}
|
||||
|
||||
return new URL(requestPath + "?" + StringUtils.join(pairs, "&"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
@ -21,7 +22,7 @@ public class Command_mobpurge extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
msg("Purging all mobs...");
|
||||
FUtil.adminAction(sender.getName(), "Purging all mobs", true);
|
||||
msg(purgeMobs() + " mobs removed.");
|
||||
return true;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class Command_mp44 extends FreedomCommand
|
||||
msg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
|
||||
msg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
|
||||
|
||||
playerSender.setItemInHand(new ItemStack(Material.SULPHUR, 1));
|
||||
playerSender.getEquipment().setItemInMainHand(new ItemStack(Material.SULPHUR, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -0,0 +1,168 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.ChatUtils;
|
||||
import net.pravian.aero.util.Ips;
|
||||
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.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin>")
|
||||
public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
checkPlayer();
|
||||
checkRank(Rank.SUPER_ADMIN);
|
||||
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player init = null;
|
||||
Admin target = getAdmin(playerSender);
|
||||
Player targetPlayer = playerSender;
|
||||
String targetIp = Ips.getIp(targetPlayer);
|
||||
|
||||
// -o switch
|
||||
if (args[0].equals("-o"))
|
||||
{
|
||||
checkRank(Rank.SENIOR_ADMIN);
|
||||
init = playerSender;
|
||||
targetPlayer = getPlayer(args[1]);
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
target = getAdmin(targetPlayer);
|
||||
if (target == null)
|
||||
{
|
||||
msg("That player is not admin", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Shift 2
|
||||
args = Arrays.copyOfRange(args, 2, args.length);
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch (args[0])
|
||||
{
|
||||
case "clearips":
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false; // Double check: the player might mean "clearip"
|
||||
}
|
||||
|
||||
if (init == null)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Clearing my supered IPs", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Clearing " + target.getName() + "' supered IPs", true);
|
||||
}
|
||||
|
||||
int counter = target.getIps().size() - 1;
|
||||
target.clearIPs();
|
||||
target.addIp(targetIp);
|
||||
|
||||
plugin.al.save();
|
||||
|
||||
msg(counter + " IPs removed.");
|
||||
msg(targetPlayer, target.getIps().get(0) + " is now your only IP address");
|
||||
return true;
|
||||
}
|
||||
|
||||
case "clearip":
|
||||
{
|
||||
if (args.length != 2)
|
||||
{
|
||||
return false; // Double check: the player might mean "clearips"
|
||||
}
|
||||
|
||||
if (!target.getIps().contains(args[1]))
|
||||
{
|
||||
if (init == null)
|
||||
{
|
||||
msg("That IP is not registered to you.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("That IP does not belong to that player.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (targetIp.equals(args[1]))
|
||||
{
|
||||
if (init == null)
|
||||
{
|
||||
msg("You cannot remove your current IP.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("You cannot remove that admin's current IP.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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.updateTables();
|
||||
|
||||
msg("Removed IP " + args[1]);
|
||||
msg("Current IPs: " + StringUtils.join(target.getIps(), ", "));
|
||||
return true;
|
||||
}
|
||||
|
||||
case "setlogin":
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String msg = StringUtils.join(args, " ", 1, args.length);
|
||||
FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
||||
target.setLoginMessage(msg);
|
||||
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: ");
|
||||
msg("> " + ChatColor.AQUA + targetPlayer.getName() + " is " + ChatUtils.colorize(target.getLoginMessage()));
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
}
|
||||
|
||||
case "clearlogin":
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Clearing personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
||||
target.setLoginMessage(null);
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,7 @@ public class Command_nether extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.gotoWorld(playerSender, server.getWorlds().get(0).getName() + "_nether");
|
||||
plugin.wm.gotoWorld(playerSender, server.getWorlds().get(0).getName() + "_nether");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,12 @@ public class Command_nickclean extends FreedomCommand
|
||||
ChatColor.UNDERLINE,
|
||||
ChatColor.BLACK
|
||||
};
|
||||
private static final Pattern REGEX = Pattern.compile(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCKED, "") + "]");
|
||||
private static final Pattern REGEX = Pattern.compile(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCKED, "") + "]", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Cleaning all nicknames.", false);
|
||||
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
|
||||
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
@ -15,7 +16,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Overlord - control this server in-game", usage = "access", aliases = "ov")
|
||||
public class Command_overlord extends FreedomCommand
|
||||
public class Command_ov extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
@ -25,8 +26,8 @@ public class Command_overlord extends FreedomCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
List<?> ips = (List) MainConfig.getDefaults().get(ConfigEntry.OVERLORD_IPS.getConfigName());
|
||||
if (!ips.contains(Ips.getIp(playerSender)))
|
||||
Object ips = plugin.config.getDefaults().get(ConfigEntry.OVERLORD_IPS.getConfigName());
|
||||
if (ips instanceof Collection && !((Collection) ips).contains(Ips.getIp(playerSender)))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
@ -25,11 +25,11 @@ public class Command_permban extends FreedomCommand
|
||||
}
|
||||
|
||||
msg("Reloading permban list...", ChatColor.RED);
|
||||
plugin.pb.stop();
|
||||
plugin.pb.start();
|
||||
plugin.pm.stop();
|
||||
plugin.pm.start();
|
||||
msg("Reloaded permban list.");
|
||||
msg(plugin.pb.getPermbannedIps().size() + " IPs and "
|
||||
+ plugin.pb.getPermbannedNames().size() + " usernames loaded.");
|
||||
msg(plugin.pm.getPermbannedIps().size() + " IPs and "
|
||||
+ plugin.pm.getPermbannedNames().size() + " usernames loaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,11 @@ public class Command_premium extends FreedomCommand
|
||||
final String message = ("false".equalsIgnoreCase(in.readLine()) ? ChatColor.RED + "No" : ChatColor.DARK_GREEN + "Yes");
|
||||
in.close();
|
||||
|
||||
if (!plugin.isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -14,26 +15,26 @@ public class Command_rank extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole && args.length < 1)
|
||||
if (isConsole() && args.length == 0)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
msg(player.getName() + " is " + plugin.rm.getDisplay(player).getColoredLoginMessage());
|
||||
msg(message(player));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
msg(message(playerSender));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
msg(sender.getName() + " is " + plugin.rm.getDisplay(sender).getColoredLoginMessage(), ChatColor.AQUA);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
@ -42,8 +43,33 @@ public class Command_rank extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
msg(player.getName() + " is " + plugin.rm.getDisplay(player).getColoredLoginMessage(), ChatColor.AQUA);
|
||||
msg(message(player));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public String message(Player player)
|
||||
{
|
||||
Displayable display = plugin.rm.getDisplay(player);
|
||||
Rank rank = plugin.rm.getRank(player);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb
|
||||
.append(ChatColor.AQUA)
|
||||
.append(player.getName())
|
||||
.append(" is ")
|
||||
.append(display.getColoredLoginMessage());
|
||||
|
||||
if (rank != display)
|
||||
{
|
||||
sb
|
||||
.append(ChatColor.AQUA)
|
||||
.append(" (")
|
||||
.append(rank.getColoredName())
|
||||
.append(ChatColor.AQUA)
|
||||
.append(')');
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class Command_report extends FreedomCommand
|
||||
}
|
||||
|
||||
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
FUtil.reportAction(playerSender, player, report);
|
||||
plugin.cm.reportAction(playerSender, player, report);
|
||||
|
||||
msg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
|
||||
|
||||
|
@ -7,8 +7,10 @@ import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -42,9 +44,9 @@ public class Command_ro extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (fromMaterial == null)
|
||||
if (fromMaterial == null || fromMaterial == Material.AIR || !fromMaterial.isBlock())
|
||||
{
|
||||
msg("Invalid block: " + materialName, ChatColor.RED);
|
||||
msg("Invalid material: " + materialName, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -105,7 +107,7 @@ public class Command_ro extends FreedomCommand
|
||||
|
||||
for (final Material material : materials)
|
||||
{
|
||||
affected += FUtil.replaceBlocks(player.getLocation(), material, Material.AIR, radius);
|
||||
affected += replaceBlocks(player.getLocation(), material, Material.AIR, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,7 +118,7 @@ public class Command_ro extends FreedomCommand
|
||||
for (Material material : materials)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of " + targetPlayer.getName(), false);
|
||||
affected += FUtil.replaceBlocks(targetPlayer.getLocation(), material, Material.AIR, radius);
|
||||
affected += replaceBlocks(targetPlayer.getLocation(), material, Material.AIR, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,4 +127,32 @@ public class Command_ro extends FreedomCommand
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int replaceBlocks(Location center, Material fromMaterial, Material toMaterial, int radius)
|
||||
{
|
||||
int affected = 0;
|
||||
|
||||
Block centerBlock = center.getBlock();
|
||||
for (int xOffset = -radius; xOffset <= radius; xOffset++)
|
||||
{
|
||||
for (int yOffset = -radius; yOffset <= radius; yOffset++)
|
||||
{
|
||||
for (int zOffset = -radius; zOffset <= radius; zOffset++)
|
||||
{
|
||||
Block block = centerBlock.getRelative(xOffset, yOffset, zOffset);
|
||||
|
||||
if (block.getType().equals(fromMaterial))
|
||||
{
|
||||
if (block.getLocation().distanceSquared(center) < (radius * radius))
|
||||
{
|
||||
block.setType(toMaterial);
|
||||
affected++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return affected;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage admins.", usage = "/<command> <list | clean | reload | clearme [ip] | setrank <username> <rank> | <add | remove | info> <username>>")
|
||||
@CommandParameters(description = "Manage admins.", usage = "/<command> <list | clean | reload | | setrank <username> <rank> | <add | remove | info> <username>>")
|
||||
public class Command_saconfig extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -37,6 +37,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
case "clean":
|
||||
{
|
||||
checkConsole();
|
||||
checkRank(Rank.TELNET_ADMIN);
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Cleaning admin list", true);
|
||||
plugin.al.deactivateOldEntries(true);
|
||||
@ -55,71 +56,24 @@ public class Command_saconfig extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
case "clearme":
|
||||
{
|
||||
checkPlayer();
|
||||
checkRank(Rank.SUPER_ADMIN);
|
||||
|
||||
final Admin admin = plugin.al.getAdmin(playerSender);
|
||||
|
||||
if (admin == null)
|
||||
{
|
||||
msg("Could not find your admin entry! Please notify a developer.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String ip = Ips.getIp(playerSender);
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Cleaning my supered IPs", true);
|
||||
|
||||
int counter = admin.getIps().size() - 1;
|
||||
admin.clearIPs();
|
||||
admin.addIp(ip);
|
||||
|
||||
plugin.al.save(admin);
|
||||
|
||||
msg(counter + " IPs removed.");
|
||||
msg(admin.getIps().get(0) + " is now your only IP address");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!admin.getIps().contains(args[1]))
|
||||
{
|
||||
msg("That IP is not registered to you.");
|
||||
}
|
||||
else if (ip.equals(args[1]))
|
||||
{
|
||||
msg("You cannot remove your current IP.");
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing a supered IP", true);
|
||||
|
||||
admin.removeIp(args[1]);
|
||||
|
||||
plugin.al.save(admin);
|
||||
|
||||
msg("Removed IP " + args[1]);
|
||||
msg("Current IPs: " + StringUtils.join(admin.getIps(), ", "));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case "setrank":
|
||||
{
|
||||
checkConsole();
|
||||
checkNotHostConsole();
|
||||
checkRank(Rank.SENIOR_CONSOLE);
|
||||
|
||||
if (args.length < 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
checkConsole();
|
||||
checkRank(Rank.SENIOR_CONSOLE);
|
||||
|
||||
Rank rank = Rank.findRank(args[2]);
|
||||
if (rank == null)
|
||||
{
|
||||
msg("Unknown rank: " + rank);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!rank.isAtLeast(Rank.SUPER_ADMIN))
|
||||
{
|
||||
msg("Rank must be superadmin or higher.", ChatColor.RED);
|
||||
@ -133,8 +87,10 @@ public class Command_saconfig extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Setting " + admin.getName() + "'s rank to " + rank.getName(), true);
|
||||
|
||||
admin.setRank(rank);
|
||||
plugin.al.save(admin);
|
||||
plugin.al.save();
|
||||
|
||||
msg("Set " + admin.getName() + "'s rank to " + rank.getName());
|
||||
return true;
|
||||
@ -182,16 +138,16 @@ public class Command_saconfig extends FreedomCommand
|
||||
checkConsole();
|
||||
checkRank(Rank.TELNET_ADMIN);
|
||||
|
||||
// Player already an admin?
|
||||
final Player player = getPlayer(args[1]);
|
||||
|
||||
if (plugin.al.isAdmin(player))
|
||||
if (player != null && plugin.al.isAdmin(player))
|
||||
{
|
||||
msg("That player is already admin.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Find the old admin entry
|
||||
String name = player != null ? player.getName() : args[1];
|
||||
|
||||
Admin admin = null;
|
||||
for (Admin loopAdmin : plugin.al.getAllAdmins().values())
|
||||
{
|
||||
@ -202,29 +158,8 @@ public class Command_saconfig extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (admin != null) // Existing admin
|
||||
if (admin == null) // New admin
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Readding " + admin.getName() + " to the admin list", true);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
admin.loadFrom(player); // Reset IP, username
|
||||
}
|
||||
|
||||
admin.setActive(true);
|
||||
admin.setLastLogin(new Date());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
admin.addIp(Ips.getIp(player));
|
||||
}
|
||||
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
}
|
||||
else // New admin
|
||||
{
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
@ -233,7 +168,22 @@ public class Command_saconfig extends FreedomCommand
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the admin list", true);
|
||||
plugin.al.addAdmin(new Admin(player));
|
||||
}
|
||||
else // Existing admin
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Readding " + admin.getName() + " to the admin list", true);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
admin.setName(player.getName());
|
||||
admin.addIp(Ips.getIp(player));
|
||||
}
|
||||
|
||||
admin.setActive(true);
|
||||
admin.setLastLogin(new Date());
|
||||
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
@ -260,7 +210,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
checkRank(Rank.TELNET_ADMIN);
|
||||
|
||||
Player player = getPlayer(args[1]);
|
||||
Admin admin = player == null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]);
|
||||
Admin admin = player != null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]);
|
||||
|
||||
if (admin == null)
|
||||
{
|
||||
@ -270,7 +220,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(admin);
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.ServiceChecker.ServiceStatus;
|
||||
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.NON_OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows the status of all Mojang services", usage = "/<command>")
|
||||
public class Command_services extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
msg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE);
|
||||
|
||||
for (ServiceStatus service : plugin.sc.getAllStatuses())
|
||||
{
|
||||
msg(service.getFormattedStatus());
|
||||
}
|
||||
msg("Version" + ChatColor.WHITE + ": " + plugin.sc.getVersion(), ChatColor.DARK_PURPLE);
|
||||
msg("Last Check" + ChatColor.WHITE + ": " + plugin.sc.getLastCheck(), ChatColor.DARK_PURPLE);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -7,8 +7,8 @@ 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 500.", usage = "/<command>")
|
||||
public class Command_setl extends FreedomCommand
|
||||
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to the default.", usage = "/<command>", aliases = "setl,swl")
|
||||
public class Command_setlimit extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
@ -2,6 +2,7 @@ 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.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -11,45 +12,60 @@ 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> [playername]")
|
||||
@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/<command> <player> [reason]")
|
||||
public class Command_smite extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
smite(player);
|
||||
|
||||
smite(player, reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void smite(final Player player)
|
||||
public static void smite(Player player)
|
||||
{
|
||||
smite(player, null);
|
||||
}
|
||||
|
||||
public static void smite(Player player, String reason)
|
||||
{
|
||||
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
//Deop
|
||||
if (reason != null)
|
||||
{
|
||||
FUtil.bcastMsg(" Reason: " + reason, ChatColor.RED);
|
||||
}
|
||||
|
||||
// Deop
|
||||
player.setOp(false);
|
||||
|
||||
//Set gamemode to survival:
|
||||
// Set gamemode to survival
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
//Clear inventory:
|
||||
// Clear inventory
|
||||
player.getInventory().clear();
|
||||
|
||||
//Strike with lightning effect:
|
||||
// Strike with lightning effect
|
||||
final Location targetPos = player.getLocation();
|
||||
final World world = player.getWorld();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
@ -61,7 +77,12 @@ public class Command_smite extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
//Kill:
|
||||
// Kill
|
||||
player.setHealth(0.0);
|
||||
|
||||
if (reason != null)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You've been smitten. Reason: " + reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Make an announcement", usage = "/<command> <mobtype> [amount]")
|
||||
public class Command_spawnmob extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
EntityType type = null;
|
||||
for (EntityType loop : EntityType.values())
|
||||
{
|
||||
if (loop.getName().equalsIgnoreCase(args[0]))
|
||||
{
|
||||
type = loop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
msg("Unknown entity type: " + args[0], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!type.isSpawnable() || !type.isAlive())
|
||||
{
|
||||
msg("Can not spawn entity type: " + type.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
int amount = 1;
|
||||
if (args.length > 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
amount = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
msg("Invalid amount: " + args[1], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (amount > 10 || amount < 1)
|
||||
{
|
||||
msg("Invalid amount: " + args[1] + ". Must be 1-10.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
Location l = playerSender.getLocation();
|
||||
World w = playerSender.getWorld();
|
||||
msg("Spawning " + amount + " of " + type.getName());
|
||||
|
||||
for (int i = 0; i < amount; amount++)
|
||||
{
|
||||
w.spawnEntity(l, type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to spectator.", usage = "/<command>", aliases = "gmsp")
|
||||
public class Command_spectator extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||
msg("Gamemode set to spectator.");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -3,19 +3,22 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
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;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [<player> [-s] | list | purge | all]", aliases = "mute")
|
||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "mute")
|
||||
public class Command_stfu 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)
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -38,8 +41,11 @@ public class Command_stfu extends FreedomCommand
|
||||
{
|
||||
msg("- none");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("purge"))
|
||||
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unmuting all players.", true);
|
||||
FPlayer info;
|
||||
@ -54,8 +60,10 @@ public class Command_stfu extends FreedomCommand
|
||||
}
|
||||
}
|
||||
msg("Unmuted " + count + " players.");
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("all"))
|
||||
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Muting all non-Superadmins", true);
|
||||
|
||||
@ -72,43 +80,64 @@ public class Command_stfu extends FreedomCommand
|
||||
}
|
||||
|
||||
msg("Muted " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean smite = args[0].equals("-s");
|
||||
if (smite)
|
||||
{
|
||||
args = ArrayUtils.subarray(args, 1, args.length);
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
if (playerdata.isMuted())
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
|
||||
playerdata.setMuted(false);
|
||||
msg("Unmuted " + player.getName());
|
||||
|
||||
msg(player, "You have been unmuted.", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
msg(player.getName() + " is a superadmin, and can't be muted.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
if (playerdata.isMuted())
|
||||
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
|
||||
playerdata.setMuted(true);
|
||||
|
||||
if (smite)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
|
||||
playerdata.setMuted(false);
|
||||
msg("Unmuted " + player.getName());
|
||||
Command_smite.smite(player);
|
||||
}
|
||||
|
||||
if (reason != null)
|
||||
{
|
||||
msg(player, "You have been muted. Reason: " + reason, ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
|
||||
playerdata.setMuted(true);
|
||||
|
||||
if (args.length == 2 && args[1].equalsIgnoreCase("-s"))
|
||||
{
|
||||
Command_smite.smite(player);
|
||||
}
|
||||
|
||||
msg("Muted " + player.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(player.getName() + " is a superadmin, and can't be muted.");
|
||||
}
|
||||
msg(player, "You have been muted.", ChatColor.RED);
|
||||
}
|
||||
|
||||
msg("Muted " + player.getName());
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -15,61 +15,43 @@ public class Command_survival extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
msg("When used from the console, you must define a target user to change gamemode on.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Player player;
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
player = playerSender;
|
||||
if (isConsole())
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target player.");
|
||||
return true;
|
||||
}
|
||||
|
||||
playerSender.setGameMode(GameMode.SURVIVAL);
|
||||
msg("Gamemode set to survival.");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
checkRank(Rank.SUPER_ADMIN);
|
||||
|
||||
if (args[0].equals("-a"))
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("-a"))
|
||||
for (Player targetPlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
noPerms();
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Player targetPlayer : server.getOnlinePlayers())
|
||||
{
|
||||
targetPlayer.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to survival", false);
|
||||
return true;
|
||||
targetPlayer.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
if (senderIsConsole || plugin.al.isAdmin(sender))
|
||||
{
|
||||
player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Only superadmins can change other user's gamemode.");
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to survival", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Setting " + player.getName() + " to game mode 'Survival'.");
|
||||
player.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Setting " + player.getName() + " to game mode survival.");
|
||||
msg(player, sender.getName() + " set your game mode to survival.");
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,18 @@ public class Command_tagnyan extends FreedomCommand
|
||||
tag.append(FUtil.randomChatColor()).append(c);
|
||||
}
|
||||
|
||||
String tagStr = tag.toString();
|
||||
for (String word : Command_tag.FORBIDDEN_WORDS)
|
||||
{
|
||||
if (tagStr.contains(word))
|
||||
{
|
||||
msg("That tag contains a forbidden word.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
final FPlayer data = plugin.pl.getPlayer(playerSender);
|
||||
data.setTag(tag.toString());
|
||||
data.setTag(tagStr);
|
||||
|
||||
msg("Set tag to " + tag);
|
||||
|
||||
|
@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
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.Location;
|
||||
import org.bukkit.command.Command;
|
||||
@ -10,14 +11,14 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Temporarily bans a player for five minutes.", usage = "/<command> <partialname>", aliases = "noob")
|
||||
@CommandParameters(description = "Temporarily bans a player for five minutes.", usage = "/<command> <player> [reason]", aliases = "noob")
|
||||
public class Command_tban extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -30,6 +31,16 @@ public class Command_tban extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
String reason;
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
reason = "You have been temporarily banned for 5 minutes.";
|
||||
}
|
||||
|
||||
// strike with lightning effect:
|
||||
final Location targetPos = player.getLocation();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
@ -42,7 +53,7 @@ public class Command_tban extends FreedomCommand
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Tempbanning: " + player.getName() + " for 5 minutes.", true);
|
||||
plugin.bm.addBan(Ban.forPlayer(player, sender, FUtil.parseDateOffset("5m"), ChatColor.RED + "You have been temporarily banned for 5 minutes."));
|
||||
plugin.bm.addBan(Ban.forPlayer(player, sender, FUtil.parseDateOffset("5m"), reason));
|
||||
|
||||
player.kickPlayer(ChatColor.RED + "You have been temporarily banned for five minutes. Please read totalfreedom.me for more info.");
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.io.File;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Update server files.", usage = "/<command>")
|
||||
public class Command_tfupdate extends FreedomCommand
|
||||
{
|
||||
|
||||
public static final String[] FILES
|
||||
=
|
||||
{
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (FILES.length == 0)
|
||||
{
|
||||
msg("This command is disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.getName().equalsIgnoreCase("madgeek1450"))
|
||||
{
|
||||
noPerms();
|
||||
return true;
|
||||
}
|
||||
|
||||
for (final String url : FILES)
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
FLog.info("Downloading: " + url);
|
||||
|
||||
File file = new File("./updates/" + url.substring(url.lastIndexOf("/") + 1));
|
||||
if (file.exists())
|
||||
{
|
||||
file.delete();
|
||||
}
|
||||
if (!file.getParentFile().exists())
|
||||
{
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
FUtil.downloadFile(url, file, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -28,9 +28,9 @@ public class Command_toggle extends FreedomCommand
|
||||
msg("- prelog");
|
||||
msg("- lockdown");
|
||||
msg("- petprotect");
|
||||
msg("- droptoggle");
|
||||
msg("- nonuke");
|
||||
msg("- explosives");
|
||||
msg("- entitywipe");
|
||||
msg("- nonuke [range] [count]");
|
||||
msg("- explosives [radius]");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ public class Command_toggle extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("droptoggle"))
|
||||
if (args[0].equals("entitywipe"))
|
||||
{
|
||||
toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
return true;
|
||||
|
@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -30,7 +31,7 @@ public class Command_tossmob extends FreedomCommand
|
||||
|
||||
FPlayer playerData = plugin.pl.getPlayer(playerSender);
|
||||
|
||||
EntityType creature = EntityType.PIG;
|
||||
EntityType type = null;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if ("off".equals(args[0]))
|
||||
@ -42,19 +43,32 @@ public class Command_tossmob extends FreedomCommand
|
||||
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
msg("Supported mobs: " + StringUtils.join(FUtil.MOB_TYPES.keySet(), ", "), ChatColor.GREEN);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (EntityType loop : EntityType.values())
|
||||
{
|
||||
if (loop.isAlive())
|
||||
{
|
||||
sb.append(" ").append(DepreciationAggregator.getName_EntityType(loop));
|
||||
}
|
||||
}
|
||||
msg("Supported mobs: " + sb.toString().trim(), ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
for (EntityType loopType : EntityType.values())
|
||||
{
|
||||
creature = FUtil.getEntityType(args[0]);
|
||||
if (DepreciationAggregator.getName_EntityType(loopType).toLowerCase().equalsIgnoreCase(args[0]))
|
||||
{
|
||||
type = loopType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
msg(args[0] + " is not a supported mob type. Using a pig instead.", ChatColor.RED);
|
||||
msg("By the way, you can type /tossmob list to see all possible mobs.", ChatColor.RED);
|
||||
creature = EntityType.PIG;
|
||||
type = EntityType.PIG;
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,12 +93,12 @@ public class Command_tossmob extends FreedomCommand
|
||||
speed = 5.0;
|
||||
}
|
||||
|
||||
playerData.enableMobThrower(creature, speed);
|
||||
msg("MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".", ChatColor.GREEN);
|
||||
playerData.enableMobThrower(type, speed);
|
||||
msg("MobThrower is enabled. Creature: " + type + " - Speed: " + speed + ".", ChatColor.GREEN);
|
||||
msg("Left click while holding a " + Material.BONE.toString() + " to throw mobs!", ChatColor.GREEN);
|
||||
msg("Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN);
|
||||
|
||||
playerSender.setItemInHand(new ItemStack(Material.BONE, 1));
|
||||
playerSender.getEquipment().setItemInMainHand(new ItemStack(Material.BONE, 1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ import org.bukkit.entity.Player;
|
||||
* See https://github.com/TotalFreedom/License - This file may not be edited or removed.
|
||||
*/
|
||||
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows information about TotalFreedomMod or reloads it", usage = "/<command> [reload]")
|
||||
public class Command_tfm extends FreedomCommand
|
||||
@CommandParameters(description = "Shows information about TotalFreedomMod or reloads it", usage = "/<command> [reload]", aliases = "tfm")
|
||||
public class Command_totalfreedommod extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
@ -34,7 +34,7 @@ public class Command_tfm extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
MainConfig.load();
|
||||
plugin.config.load();
|
||||
plugin.services.stop();
|
||||
plugin.services.start();
|
||||
|
||||
@ -52,8 +52,9 @@ public class Command_tfm extends FreedomCommand
|
||||
msg("Running on " + ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
|
||||
msg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD);
|
||||
msg(String.format("Version "
|
||||
+ ChatColor.BLUE + "%s.%s " + ChatColor.GOLD + "("
|
||||
+ ChatColor.BLUE + "%s %s.%s " + ChatColor.GOLD + "("
|
||||
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ")",
|
||||
build.codename,
|
||||
build.version,
|
||||
build.number,
|
||||
build.head), ChatColor.GOLD);
|
@ -23,111 +23,21 @@ import org.bukkit.plugin.RegisteredListener;
|
||||
public class Command_trail extends FreedomCommand
|
||||
{
|
||||
|
||||
private static Listener movementListener = null;
|
||||
private static final List<Player> trailPlayers = new ArrayList<>();
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 0 && "off".equals(args[0]))
|
||||
{
|
||||
trailPlayers.remove(playerSender);
|
||||
|
||||
plugin.tr.remove(playerSender);
|
||||
msg("Trail disabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!trailPlayers.contains(playerSender))
|
||||
{
|
||||
trailPlayers.add(playerSender);
|
||||
}
|
||||
|
||||
plugin.tr.add(playerSender);
|
||||
msg("Trail enabled. Use \"/trail off\" to disable.");
|
||||
}
|
||||
|
||||
if (!trailPlayers.isEmpty())
|
||||
{
|
||||
registerMovementHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
unregisterMovementHandler();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void registerMovementHandler()
|
||||
{
|
||||
if (getRegisteredListener(movementListener) == null)
|
||||
{
|
||||
Bukkit.getPluginManager().registerEvents(movementListener = new Listener()
|
||||
{
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerMove(PlayerMoveEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if (trailPlayers.contains(player))
|
||||
{
|
||||
Block fromBlock = event.getFrom().getBlock();
|
||||
if (fromBlock.isEmpty())
|
||||
{
|
||||
Block toBlock = event.getTo().getBlock();
|
||||
if (!fromBlock.equals(toBlock))
|
||||
{
|
||||
fromBlock.setType(Material.WOOL);
|
||||
DepreciationAggregator.setData_Block(fromBlock, (byte) RANDOM.nextInt(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, TotalFreedomMod.plugin);
|
||||
}
|
||||
}
|
||||
|
||||
private static void unregisterMovementHandler()
|
||||
{
|
||||
Listener registeredListener = getRegisteredListener(movementListener);
|
||||
if (registeredListener != null)
|
||||
{
|
||||
PlayerMoveEvent.getHandlerList().unregister(registeredListener);
|
||||
}
|
||||
}
|
||||
|
||||
private static Listener getRegisteredListener(Listener listener)
|
||||
{
|
||||
RegisteredListener[] registeredListeners = PlayerMoveEvent.getHandlerList().getRegisteredListeners();
|
||||
for (RegisteredListener registeredListener : registeredListeners)
|
||||
{
|
||||
if (registeredListener.getListener() == listener)
|
||||
{
|
||||
return listener;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void startTrail(Player player)
|
||||
{
|
||||
if (!trailPlayers.contains(player))
|
||||
{
|
||||
trailPlayers.add(player);
|
||||
}
|
||||
|
||||
if (!trailPlayers.isEmpty())
|
||||
{
|
||||
registerMovementHandler();
|
||||
}
|
||||
}
|
||||
|
||||
public static void stopTrail(Player player)
|
||||
{
|
||||
trailPlayers.remove(player);
|
||||
|
||||
if (trailPlayers.isEmpty())
|
||||
{
|
||||
unregisterMovementHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class Command_wipeflatlands extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.setSavedFlag("do_wipe_flatlands", true);
|
||||
plugin.sf.setSavedFlag("do_wipe_flatlands", true);
|
||||
|
||||
FUtil.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
|
||||
|
||||
|
@ -4,8 +4,9 @@ import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.RankBase;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.command.AbstractCommandBase;
|
||||
import net.pravian.aero.util.Players;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -83,7 +84,15 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkRank(RankBase rank)
|
||||
protected void checkNotHostConsole()
|
||||
{
|
||||
if (isConsole() && FUtil.isFromHostConsole(sender.getName()))
|
||||
{
|
||||
throw new CommandFailException("This command can not be used from the host console.");
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkRank(Rank rank)
|
||||
{
|
||||
if (!plugin.rm.getRank(sender).isAtLeast(rank))
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import java.util.Arrays;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.rank.RankBase;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.command.AeroCommandBase;
|
||||
@ -20,9 +19,12 @@ import org.bukkit.entity.Player;
|
||||
public class FreedomCommandExecutor<C extends AeroCommandBase<?>> extends AbstractCommandExecutor<C>
|
||||
{
|
||||
|
||||
public FreedomCommandExecutor(AeroCommandHandler<?> handler, String name, C command)
|
||||
private final TotalFreedomMod plugin;
|
||||
|
||||
public FreedomCommandExecutor(TotalFreedomMod plugin, AeroCommandHandler<?> handler, String name, C command)
|
||||
{
|
||||
super(handler, name, command);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
protected FreedomCommand getCommand()
|
||||
@ -45,9 +47,25 @@ public class FreedomCommandExecutor<C extends AeroCommandBase<?>> extends Abstra
|
||||
return;
|
||||
}
|
||||
|
||||
pluginCommand.setAliases(Arrays.asList(params.aliases().split(",")));
|
||||
String aliasString = params.aliases();
|
||||
|
||||
if (aliasString.length() > 0)
|
||||
{
|
||||
pluginCommand.setAliases(Arrays.asList(params.aliases().split(",")));
|
||||
}
|
||||
pluginCommand.setDescription(params.description());
|
||||
pluginCommand.setUsage(params.usage());
|
||||
|
||||
// Check if permisions are correctly set up
|
||||
CommandPermissions perms = command.getPerms();
|
||||
if (perms != null)
|
||||
{
|
||||
if (perms.level().isConsole())
|
||||
{
|
||||
FLog.warning("[Command] " + pluginCommand.getName() + " - permission is set to a console rank, "
|
||||
+ "should be set to player variant with 'source = SourceType.ONLY_CONSOLE'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,7 +143,7 @@ public class FreedomCommandExecutor<C extends AeroCommandBase<?>> extends Abstra
|
||||
// Player permissions
|
||||
if (player != null)
|
||||
{
|
||||
Rank rank = TotalFreedomMod.plugin.rm.getRank(player);
|
||||
Rank rank = plugin.rm.getRank(player);
|
||||
boolean result = rank.isAtLeast(perms.level());
|
||||
if (!result && sendMsg)
|
||||
{
|
||||
@ -135,7 +153,7 @@ public class FreedomCommandExecutor<C extends AeroCommandBase<?>> extends Abstra
|
||||
}
|
||||
|
||||
// Console permissions
|
||||
RankBase rank = TotalFreedomMod.plugin.rm.getRank(sender);
|
||||
Rank rank = plugin.rm.getRank(sender);
|
||||
boolean result = rank.isAtLeast(perms.level());
|
||||
if (!result && sendMsg)
|
||||
{
|
||||
@ -147,10 +165,17 @@ public class FreedomCommandExecutor<C extends AeroCommandBase<?>> extends Abstra
|
||||
public static class FreedomExecutorFactory implements AeroCommandExecutorFactory
|
||||
{
|
||||
|
||||
private final TotalFreedomMod plugin;
|
||||
|
||||
public FreedomExecutorFactory(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AeroCommandExecutor<? extends AeroCommandBase<?>> newExecutor(AeroCommandHandler<?> handler, String name, AeroCommandBase<?> command)
|
||||
{
|
||||
return new FreedomCommandExecutor<>(handler, name, command);
|
||||
return new FreedomCommandExecutor<>(plugin, handler, name, command);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user