mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-22 22:54:57 +00:00
Merge pull request #14 from LunaWasFlaggedAgain/main
Register commands through Bukkit
This commit is contained in:
commit
c69ca08b1b
111 changed files with 844 additions and 1054 deletions
|
@ -7,8 +7,7 @@ import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
|||
import me.StevenLawson.TotalFreedomMod.ban.PermbanList;
|
||||
import me.StevenLawson.TotalFreedomMod.bridge.DiscordBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.command.CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.CommandHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.Commands;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.FreedomCommand;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.deprecated.bridge.BukkitTelnetBridge;
|
||||
|
@ -23,7 +22,6 @@ import me.StevenLawson.TotalFreedomMod.world.AdminWorld;
|
|||
import me.StevenLawson.TotalFreedomMod.world.FlatlandsWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.world.ProtectedArea;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
|
@ -97,7 +95,6 @@ public class TotalFreedomMod extends JavaPlugin {
|
|||
}
|
||||
|
||||
Utilities.deleteCoreDumps();
|
||||
Utilities.deleteFolder(new File("./_deleteme"));
|
||||
|
||||
// Create backups
|
||||
Utilities.createBackups(CONFIG_FILENAME, true);
|
||||
|
@ -172,26 +169,17 @@ public class TotalFreedomMod extends JavaPlugin {
|
|||
|
||||
timer.update();
|
||||
|
||||
Log.info("Version " + pluginVersion + " for " + Server.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
|
||||
// Register commands
|
||||
Commands.registerCommands(this);
|
||||
|
||||
// Metrics @ http://mcstats.org/plugin/TotalFreedomMod
|
||||
// No longer exist!
|
||||
/*try
|
||||
{
|
||||
final Metrics metrics = new Metrics(plugin);
|
||||
metrics.start();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Log.warning("Failed to submit metrics data: " + ex.getMessage());
|
||||
}*/
|
||||
|
||||
Log.info("Version " + pluginVersion + " for " + Server.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
CommandLoader.scan();
|
||||
CommandBlocker.load();
|
||||
|
||||
// Add spawnpoints later - https://github.com/TotalFreedom/TotalFreedomMod/issues/438
|
||||
|
@ -213,33 +201,9 @@ public class TotalFreedomMod extends JavaPlugin {
|
|||
Log.info("Plugin disabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
return CommandHandler.handleCommand(sender, cmd, commandLabel, args);
|
||||
}
|
||||
|
||||
private static void setAppProperties()
|
||||
{
|
||||
try
|
||||
{
|
||||
//final InputStream in = plugin.getResource("appinfo.properties");
|
||||
Properties props = new Properties();
|
||||
|
||||
// in = plugin.getClass().getResourceAsStream("/appinfo.properties");
|
||||
//props.load(in);
|
||||
//in.close();
|
||||
|
||||
//TotalFreedomMod.buildNumber = props.getProperty("program.buildnumber");
|
||||
//TotalFreedomMod.buildDate = props.getProperty("program.builddate");
|
||||
//TotalFreedomMod.buildCreator = props.getProperty("program.buildcreator");
|
||||
TotalFreedomMod.buildNumber = "1337";
|
||||
TotalFreedomMod.buildCreator = "You!";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.severe("Could not load App properties!");
|
||||
Log.severe(ex);
|
||||
}
|
||||
TotalFreedomMod.buildNumber = "1337";
|
||||
TotalFreedomMod.buildCreator = "You!";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package me.StevenLawson.TotalFreedomMod.command;
|
|||
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
|
@ -34,7 +34,8 @@ public class CommandBlocker
|
|||
{
|
||||
BLOCKED_COMMANDS.clear();
|
||||
|
||||
final CommandMap commandMap = CommandLoader.getCommandMap();
|
||||
|
||||
final CommandMap commandMap = Utilities.getField(Bukkit.getServer().getPluginManager(), "commandMap");
|
||||
if (commandMap == null)
|
||||
{
|
||||
Log.severe("Error loading commandMap.");
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
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;
|
||||
|
||||
public class CommandHandler {
|
||||
public static final String COMMAND_PATH = FreedomCommand.class.getPackage().getName(); // "me.StevenLawson.TotalFreedomMod.Commands";
|
||||
public static final String COMMAND_PREFIX = "Command_";
|
||||
|
||||
public static boolean handleCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
final Player playerSender;
|
||||
final boolean senderIsConsole;
|
||||
|
||||
if (sender instanceof Player) {
|
||||
senderIsConsole = false;
|
||||
playerSender = (Player) sender;
|
||||
|
||||
Log.info(String.format("[PLAYER_COMMAND] %s (%s): /%s %s",
|
||||
playerSender.getName(),
|
||||
ChatColor.stripColor(playerSender.getDisplayName()),
|
||||
commandLabel,
|
||||
StringUtils.join(args, " ")), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
playerSender = null;
|
||||
|
||||
Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
||||
sender.getName(),
|
||||
commandLabel,
|
||||
StringUtils.join(args, " ")), true);
|
||||
}
|
||||
|
||||
final FreedomCommand dispatcher;
|
||||
try
|
||||
{
|
||||
final ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
|
||||
dispatcher = (FreedomCommand) classLoader.loadClass(String.format("%s.%s%s",
|
||||
COMMAND_PATH,
|
||||
COMMAND_PREFIX,
|
||||
cmd.getName().toLowerCase())).newInstance();
|
||||
dispatcher.setup(TotalFreedomMod.plugin, sender, dispatcher.getClass());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.severe("Could not load command: " + cmd.getName());
|
||||
Log.severe(ex);
|
||||
|
||||
sender.sendMessage(ChatColor.RED + "Command Error! Could not load command: " + cmd.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!dispatcher.senderHasPermission())
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return dispatcher.run(sender, playerSender, cmd, commandLabel, args, senderIsConsole);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.severe("Command Error: " + commandLabel);
|
||||
Log.severe(ex);
|
||||
sender.sendMessage(ChatColor.RED + "Command Error: " + ex.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,324 +0,0 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.CodeSource;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
public class CommandLoader {
|
||||
public static final Pattern COMMAND_PATTERN;
|
||||
private static final List<TFM_CommandInfo> COMMAND_LIST;
|
||||
|
||||
static {
|
||||
COMMAND_PATTERN = Pattern.compile(CommandHandler.COMMAND_PATH.replace('.', '/') + "/(" + CommandHandler.COMMAND_PREFIX + "[^\\$]+)\\.class");
|
||||
COMMAND_LIST = new ArrayList<TFM_CommandInfo>();
|
||||
}
|
||||
|
||||
private CommandLoader() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static void scan()
|
||||
{
|
||||
CommandMap commandMap = getCommandMap();
|
||||
if (commandMap == null)
|
||||
{
|
||||
Log.severe("Error loading commandMap.");
|
||||
return;
|
||||
}
|
||||
COMMAND_LIST.clear();
|
||||
COMMAND_LIST.addAll(getCommands());
|
||||
|
||||
for (TFM_CommandInfo commandInfo : COMMAND_LIST)
|
||||
{
|
||||
TFM_DynamicCommand dynamicCommand = new TFM_DynamicCommand(commandInfo);
|
||||
|
||||
Command existing = commandMap.getCommand(dynamicCommand.getName());
|
||||
if (existing != null)
|
||||
{
|
||||
unregisterCommand(existing, commandMap);
|
||||
}
|
||||
|
||||
commandMap.register(TotalFreedomMod.plugin.getDescription().getName(), dynamicCommand);
|
||||
}
|
||||
|
||||
Log.info("TFM commands loaded.");
|
||||
}
|
||||
|
||||
public static void unregisterCommand(String commandName)
|
||||
{
|
||||
CommandMap commandMap = getCommandMap();
|
||||
if (commandMap != null)
|
||||
{
|
||||
Command command = commandMap.getCommand(commandName.toLowerCase());
|
||||
if (command != null)
|
||||
{
|
||||
unregisterCommand(command, commandMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void unregisterCommand(Command command, CommandMap commandMap)
|
||||
{
|
||||
try
|
||||
{
|
||||
command.unregister(commandMap);
|
||||
HashMap<String, Command> knownCommands = getKnownCommands(commandMap);
|
||||
if (knownCommands != null)
|
||||
{
|
||||
knownCommands.remove(command.getName());
|
||||
for (String alias : command.getAliases())
|
||||
{
|
||||
knownCommands.remove(alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static CommandMap getCommandMap()
|
||||
{
|
||||
final Object commandMap = Utilities.getField(Bukkit.getServer().getPluginManager(), "commandMap");
|
||||
if (commandMap != null)
|
||||
{
|
||||
if (commandMap instanceof CommandMap)
|
||||
{
|
||||
return (CommandMap) commandMap;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static HashMap<String, Command> getKnownCommands(CommandMap commandMap)
|
||||
{
|
||||
Object knownCommands = Utilities.getField(commandMap, "knownCommands");
|
||||
if (knownCommands != null)
|
||||
{
|
||||
if (knownCommands instanceof HashMap)
|
||||
{
|
||||
return (HashMap<String, Command>) knownCommands;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<TFM_CommandInfo> getCommands()
|
||||
{
|
||||
List<TFM_CommandInfo> commandList = new ArrayList<TFM_CommandInfo>();
|
||||
|
||||
try
|
||||
{
|
||||
CodeSource codeSource = TotalFreedomMod.class.getProtectionDomain().getCodeSource();
|
||||
if (codeSource != null)
|
||||
{
|
||||
ZipInputStream zip = new ZipInputStream(codeSource.getLocation().openStream());
|
||||
ZipEntry zipEntry;
|
||||
while ((zipEntry = zip.getNextEntry()) != null)
|
||||
{
|
||||
String entryName = zipEntry.getName();
|
||||
Matcher matcher = COMMAND_PATTERN.matcher(entryName);
|
||||
if (matcher.find())
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> commandClass = Class.forName(CommandHandler.COMMAND_PATH + "." + matcher.group(1));
|
||||
|
||||
CommandPermissions commandPermissions = commandClass.getAnnotation(CommandPermissions.class);
|
||||
CommandParameters commandParameters = commandClass.getAnnotation(CommandParameters.class);
|
||||
|
||||
if (commandPermissions != null && commandParameters != null)
|
||||
{
|
||||
TFM_CommandInfo commandInfo = new TFM_CommandInfo(
|
||||
commandClass,
|
||||
matcher.group(1).split("_")[1],
|
||||
commandPermissions.level(),
|
||||
commandPermissions.source(),
|
||||
commandPermissions.blockHostConsole(),
|
||||
commandParameters.description(),
|
||||
commandParameters.usage(),
|
||||
commandParameters.aliases());
|
||||
|
||||
commandList.add(commandInfo);
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Log.severe(ex);
|
||||
}
|
||||
|
||||
return commandList;
|
||||
}
|
||||
|
||||
public static class TFM_CommandInfo
|
||||
{
|
||||
private final String commandName;
|
||||
private final Class<?> commandClass;
|
||||
private final AdminLevel level;
|
||||
private final SourceType source;
|
||||
private final boolean blockHostConsole;
|
||||
private final String description;
|
||||
private final String usage;
|
||||
private final List<String> aliases;
|
||||
|
||||
public TFM_CommandInfo(Class<?> commandClass, String commandName, AdminLevel level, SourceType source, boolean blockHostConsole, String description, String usage, String aliases) {
|
||||
this.commandName = commandName;
|
||||
this.commandClass = commandClass;
|
||||
this.level = level;
|
||||
this.source = source;
|
||||
this.blockHostConsole = blockHostConsole;
|
||||
this.description = description;
|
||||
this.usage = usage;
|
||||
this.aliases = ("".equals(aliases) ? new ArrayList<String>() : Arrays.asList(aliases.split(",")));
|
||||
}
|
||||
|
||||
public List<String> getAliases()
|
||||
{
|
||||
return Collections.unmodifiableList(aliases);
|
||||
}
|
||||
|
||||
public Class<?> getCommandClass()
|
||||
{
|
||||
return commandClass;
|
||||
}
|
||||
|
||||
public String getCommandName()
|
||||
{
|
||||
return commandName;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getDescriptionPermissioned()
|
||||
{
|
||||
String _description = description;
|
||||
|
||||
switch (this.getLevel())
|
||||
{
|
||||
case SENIOR:
|
||||
_description = "Senior " + (this.getSource() == SourceType.ONLY_CONSOLE ? "Console" : "") + " Command - " + _description;
|
||||
break;
|
||||
case SUPER:
|
||||
_description = "Superadmin Command - " + _description;
|
||||
break;
|
||||
case OP:
|
||||
_description = "OP Command - " + _description;
|
||||
break;
|
||||
}
|
||||
|
||||
return _description;
|
||||
}
|
||||
|
||||
public AdminLevel getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public SourceType getSource()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public String getUsage()
|
||||
{
|
||||
return usage;
|
||||
}
|
||||
|
||||
public boolean getBlockHostConsole()
|
||||
{
|
||||
return blockHostConsole;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("commandName: ").append(commandName);
|
||||
sb.append("\ncommandClass: ").append(commandClass.getName());
|
||||
sb.append("\nlevel: ").append(level);
|
||||
sb.append("\nsource: ").append(source);
|
||||
sb.append("\nblock_host_console: ").append(blockHostConsole);
|
||||
sb.append("\ndescription: ").append(description);
|
||||
sb.append("\nusage: ").append(usage);
|
||||
sb.append("\naliases: ").append(aliases);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static class TFM_DynamicCommand extends Command implements PluginIdentifiableCommand
|
||||
{
|
||||
private final TFM_CommandInfo commandInfo;
|
||||
|
||||
private TFM_DynamicCommand(TFM_CommandInfo commandInfo)
|
||||
{
|
||||
super(commandInfo.getCommandName(), commandInfo.getDescriptionPermissioned(), commandInfo.getUsage(), commandInfo.getAliases());
|
||||
|
||||
this.commandInfo = commandInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String commandLabel, String[] args)
|
||||
{
|
||||
boolean success = false;
|
||||
|
||||
if (!getPlugin().isEnabled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
success = getPlugin().onCommand(sender, this, commandLabel, args);
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + getPlugin().getDescription().getFullName(), ex);
|
||||
}
|
||||
|
||||
if (!success && getUsage().length() > 0)
|
||||
{
|
||||
for (String line : getUsage().replace("<command>", commandLabel).split("\n"))
|
||||
{
|
||||
sender.sendMessage(line);
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
return TotalFreedomMod.plugin;
|
||||
}
|
||||
|
||||
public TFM_CommandInfo getCommandInfo()
|
||||
{
|
||||
return commandInfo;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +1,8 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CommandParameters
|
||||
{
|
||||
String description();
|
||||
|
||||
String usage();
|
||||
|
||||
String aliases() default ""; // "alias1,alias2,alias3" - no spaces
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.PermbanList;
|
||||
import me.StevenLawson.TotalFreedomMod.command.CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.config.MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
public class CommandTFM extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 1) {
|
||||
if (!args[0].equals("reload")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AdminList.isSuperAdmin(sender)) {
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
MainConfig.load();
|
||||
AdminList.load();
|
||||
PermbanList.load();
|
||||
PlayerList.load();
|
||||
BanManager.load();
|
||||
CommandBlocker.load();
|
||||
|
||||
final String message = String.format("%s v%s.%s reloaded.",
|
||||
TotalFreedomMod.pluginName,
|
||||
TotalFreedomMod.pluginVersion,
|
||||
TotalFreedomMod.buildNumber);
|
||||
|
||||
playerMsg(sender, message);
|
||||
Log.info(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(sender, "TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD);
|
||||
playerMsg(sender, String.format("Version "
|
||||
+ ChatColor.BLUE + "%s.%s" + ChatColor.GOLD + ", built "
|
||||
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + " by "
|
||||
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ".",
|
||||
TotalFreedomMod.pluginVersion,
|
||||
TotalFreedomMod.buildNumber,
|
||||
TotalFreedomMod.buildDate,
|
||||
TotalFreedomMod.buildCreator), ChatColor.GOLD);
|
||||
playerMsg(sender,"Running on " + ConfigurationEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
|
||||
playerMsg(sender,"Created by Madgeek1450 and Prozza.", ChatColor.GOLD);
|
||||
playerMsg(sender,"Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
|
||||
public class Command_adminmode extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Go to the AdminWorld.", usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | on | storm>]")
|
||||
public class Command_adminworld extends FreedomCommand {
|
||||
private enum CommandMode {
|
||||
TELEPORT, GUEST, TIME, WEATHER;
|
||||
|
@ -63,19 +62,19 @@ public class Command_adminworld extends FreedomCommand {
|
|||
|
||||
if (adminWorld == null || sender_p.getWorld() == adminWorld)
|
||||
{
|
||||
playerMsg("Going to the main world.");
|
||||
playerMsg(sender, "Going to the main world.");
|
||||
sender_p.teleport(server.getWorlds().get(0).getSpawnLocation());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AdminWorld.getInstance().canAccessWorld(sender_p))
|
||||
{
|
||||
playerMsg("Going to the AdminWorld.");
|
||||
playerMsg(sender, "Going to the AdminWorld.");
|
||||
AdminWorld.getInstance().sendToWorld(sender_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("You don't have permission to access the AdminWorld.");
|
||||
playerMsg(sender, "You don't have permission to access the AdminWorld.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +86,7 @@ public class Command_adminworld extends FreedomCommand {
|
|||
{
|
||||
if ("list".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
playerMsg("AdminWorld guest list: " + AdminWorld.getInstance().guestListToString());
|
||||
playerMsg(sender, "AdminWorld guest list: " + AdminWorld.getInstance().guestListToString());
|
||||
}
|
||||
else if ("purge".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
|
@ -120,7 +119,7 @@ public class Command_adminworld extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Could not add player to guest list.");
|
||||
playerMsg(sender, "Could not add player to guest list.");
|
||||
}
|
||||
}
|
||||
else if ("remove".equals(args[1]))
|
||||
|
@ -132,7 +131,7 @@ public class Command_adminworld extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Can't find guest entry for: " + args[2]);
|
||||
playerMsg(sender, "Can't find guest entry for: " + args[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -153,11 +152,11 @@ public class Command_adminworld extends FreedomCommand {
|
|||
if (timeOfDay != null)
|
||||
{
|
||||
AdminWorld.getInstance().setTimeOfDay(timeOfDay);
|
||||
playerMsg("AdminWorld time set to: " + timeOfDay.name());
|
||||
playerMsg(sender, "AdminWorld time set to: " + timeOfDay.name());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Invalid time of day. Can be: sunrise, noon, sunset, midnight");
|
||||
playerMsg(sender, "Invalid time of day. Can be: sunrise, noon, sunset, midnight");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -177,11 +176,11 @@ public class Command_adminworld extends FreedomCommand {
|
|||
if (weatherMode != null)
|
||||
{
|
||||
AdminWorld.getInstance().setWeatherMode(weatherMode);
|
||||
playerMsg("AdminWorld weather set to: " + weatherMode.name());
|
||||
playerMsg(sender, "AdminWorld weather set to: " + weatherMode.name());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Invalid weather mode. Can be: off, rain, storm");
|
||||
playerMsg(sender, "Invalid weather mode. Can be: off, rain, storm");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Block all commands for a specific player.", usage = "/<command> <purge | <partialname>>", aliases = "blockcommands,blockcommand")
|
||||
public class Command_blockcmd extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -28,7 +27,7 @@ public class Command_blockcmd extends FreedomCommand {
|
|||
playerdata.setCommandsBlocked(false);
|
||||
}
|
||||
}
|
||||
playerMsg("Unblocked commands for " + counter + " players.");
|
||||
playerMsg(sender, "Unblocked commands for " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,13 +35,13 @@ public class Command_blockcmd extends FreedomCommand {
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
|
||||
playerMsg(sender, player.getName() + " is a Superadmin, and cannot have their commands blocked.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -51,7 +50,7 @@ public class Command_blockcmd extends FreedomCommand {
|
|||
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
|
||||
|
||||
Utilities.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
|
||||
playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
|
||||
playerMsg(sender, (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [outermaterial] [innermaterial]>")
|
||||
public class Command_cage extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||
import java.util.Random;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "For the people that are still alive.", usage = "/<command>")
|
||||
public class Command_cake extends FreedomCommand {
|
||||
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
||||
private final Random random = new Random();
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.entity.Minecart;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sit in nearest minecart. If target is in a minecart already, they will disembark.", usage = "/<command> [partialname]")
|
||||
public class Command_cartsit extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "No Description Yet", usage = "/<command>")
|
||||
public class Command_cbtool extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -28,7 +27,7 @@ public class Command_cbtool extends FreedomCommand {
|
|||
|
||||
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player) {
|
||||
Block targetBlock = DeprecationUtil.getTargetBlock(sender_p, null, 100);
|
||||
playerMsg("Your target block: " + targetBlock.getLocation().toString());
|
||||
playerMsg(sender, "Your target block: " + targetBlock.getLocation().toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Show all commands for all server plugins.", usage = "/<command>")
|
||||
public class Command_cmdlist extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -5,14 +5,13 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Spy on commands", usage = "/<command>", aliases = "commandspy")
|
||||
public class Command_cmdspy extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
||||
PlayerData playerdata = PlayerData.getPlayerData(sender_p);
|
||||
playerdata.setCommandSpy(!playerdata.cmdspyEnabled());
|
||||
playerMsg("CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled."));
|
||||
playerMsg(sender, "CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled."));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Essentials Interface Command - Color your current nickname.", usage = "/<command> <color>")
|
||||
public class Command_colorme extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -20,7 +19,7 @@ public class Command_colorme extends FreedomCommand {
|
|||
}
|
||||
|
||||
if ("list".equalsIgnoreCase(args[0])) {
|
||||
playerMsg("Colors: " + StringUtils.join(Utilities.CHAT_COLOR_NAMES.keySet(), ", "));
|
||||
playerMsg(sender, "Colors: " + StringUtils.join(Utilities.CHAT_COLOR_NAMES.keySet(), ", "));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,7 +38,7 @@ public class Command_colorme extends FreedomCommand {
|
|||
|
||||
if (color == null)
|
||||
{
|
||||
playerMsg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors.");
|
||||
playerMsg(sender, "Invalid color: " + needle + " - Use \"/colorme list\" to list colors.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -47,7 +46,7 @@ public class Command_colorme extends FreedomCommand {
|
|||
|
||||
EssentialsBridge.setNickname(sender.getName(), newNick);
|
||||
|
||||
playerMsg("Your nickname is now: " + newNick);
|
||||
playerMsg(sender, "Your nickname is now: " + newNick);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.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")
|
||||
public class Command_creative extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -45,7 +44,7 @@ public class Command_creative extends FreedomCommand {
|
|||
|
||||
if (!(senderIsConsole || AdminList.isSuperAdmin(sender)))
|
||||
{
|
||||
playerMsg("Only superadmins can change other user's gamemode.");
|
||||
playerMsg(sender, "Only superadmins can change other user's gamemode.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -59,7 +58,7 @@ public class Command_creative extends FreedomCommand {
|
|||
|
||||
}
|
||||
|
||||
playerMsg("Setting " + player.getName() + " to game mode 'Creative'.");
|
||||
playerMsg(sender, "Setting " + player.getName() + " to game mode 'Creative'.");
|
||||
playerMsg(player, sender.getName() + " set your game mode to 'Creative'.");
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Telnet command - Send a chat message with chat formatting over telnet.", usage = "/<command> <message...>")
|
||||
public class Command_csay extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import java.util.Random;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Make some noise.", usage = "/<command>")
|
||||
public class Command_deafen extends FreedomCommand {
|
||||
private static final Random random = new Random();
|
||||
public static final double STEPS = 10.0;
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import java.lang.reflect.Field;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Essentials Interface Command - Remove the nickname of all players on the server.", usage = "/<command>")
|
||||
public class Command_denick extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Deop a player.", usage = "/<command> <playername>")
|
||||
public class Command_deop extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Deop everyone on the server.", usage = "/<command>")
|
||||
public class Command_deopall extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Fill nearby dispensers with a set of items of your choice.", usage = "/<command> <radius> <comma,separated,items>")
|
||||
public class Command_dispfill extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "For the bad Super Admins", usage = "/<command> <playername>")
|
||||
public class Command_doom extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.enchantments.Enchantment;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Enchant items.", usage = "/<command> <list | addall | reset | add <name> | remove <name>>")
|
||||
public class Command_enchant extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -18,7 +17,7 @@ public class Command_enchant extends FreedomCommand {
|
|||
ItemStack itemInHand = sender_p.getItemInHand();
|
||||
|
||||
if (itemInHand == null) {
|
||||
playerMsg("You are holding an invalid item.");
|
||||
playerMsg(sender, "You are holding an invalid item.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -38,11 +37,11 @@ public class Command_enchant extends FreedomCommand {
|
|||
|
||||
if (has_enchantments)
|
||||
{
|
||||
playerMsg(possible_ench.toString());
|
||||
playerMsg(sender, possible_ench.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("The held item has no enchantments.");
|
||||
playerMsg(sender, "The held item has no enchantments.");
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("addall"))
|
||||
|
@ -62,7 +61,7 @@ public class Command_enchant extends FreedomCommand {
|
|||
}
|
||||
}
|
||||
|
||||
playerMsg("Added all possible enchantments for this item.");
|
||||
playerMsg(sender, "Added all possible enchantments for this item.");
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
|
@ -71,7 +70,7 @@ public class Command_enchant extends FreedomCommand {
|
|||
itemInHand.removeEnchantment(ench);
|
||||
}
|
||||
|
||||
playerMsg("Removed all enchantments.");
|
||||
playerMsg(sender, "Removed all enchantments.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -92,7 +91,7 @@ public class Command_enchant extends FreedomCommand {
|
|||
|
||||
if (ench == null)
|
||||
{
|
||||
playerMsg(args[1] + " is an invalid enchantment for the held item. Type \"/enchant list\" for valid enchantments for this item.");
|
||||
playerMsg(sender, args[1] + " is an invalid enchantment for the held item. Type \"/enchant list\" for valid enchantments for this item.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -102,18 +101,18 @@ public class Command_enchant extends FreedomCommand {
|
|||
{
|
||||
itemInHand.addEnchantment(ench, ench.getMaxLevel());
|
||||
|
||||
playerMsg("Added enchantment: " + ench.getName());
|
||||
playerMsg(sender, "Added enchantment: " + ench.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Can't use this enchantment on held item.");
|
||||
playerMsg(sender, "Can't use this enchantment on held item.");
|
||||
}
|
||||
}
|
||||
else if (args[0].equals("remove"))
|
||||
{
|
||||
itemInHand.removeEnchantment(ench);
|
||||
|
||||
playerMsg("Removed enchantment: " + ench.getName());
|
||||
playerMsg(sender, "Removed enchantment: " + ench.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>")
|
||||
public class Command_ender extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Push people away from you.", usage = "/<command> [radius] [strength]")
|
||||
public class Command_expel extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -73,11 +72,11 @@ public class Command_expel extends FreedomCommand {
|
|||
|
||||
if (pushedPlayers.isEmpty())
|
||||
{
|
||||
playerMsg("No players pushed.");
|
||||
playerMsg(sender, "No players pushed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Pushed " + pushedPlayers.size() + " players: " + StringUtils.join(pushedPlayers, ", "));
|
||||
playerMsg(sender, "Pushed " + pushedPlayers.size() + " players: " + StringUtils.join(pushedPlayers, ", "));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows all IPs registered to a player", usage = "/<command> <player>")
|
||||
public class Command_findip extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -19,11 +18,11 @@ public class Command_findip extends FreedomCommand {
|
|||
|
||||
if (player == null) {
|
||||
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg("Player IPs: " + StringUtils.join(PlayerList.getEntry(player).getIps(), ", "));
|
||||
playerMsg(sender, "Player IPs: " + StringUtils.join(PlayerList.getEntry(player).getIps(), ", "));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,14 +6,13 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Goto the flatlands.", usage = "/<command>")
|
||||
public class Command_flatlands extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (ConfigurationEntry.FLATLANDS_GENERATE.getBoolean()) {
|
||||
FlatlandsWorld.getInstance().sendToWorld(sender_p);
|
||||
} else {
|
||||
playerMsg("Flatlands is currently disabled.");
|
||||
playerMsg(sender, "Flatlands is currently disabled.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Freeze players (toggles on and off).", usage = "/<command> [target | purge]")
|
||||
public class Command_fr extends FreedomCommand {
|
||||
private static boolean allFrozen = false;
|
||||
|
||||
|
@ -23,13 +22,13 @@ public class Command_fr extends FreedomCommand {
|
|||
Utilities.adminAction(sender.getName(), "Freezing all players", false);
|
||||
|
||||
setAllFrozen(true);
|
||||
playerMsg("Players are now frozen.");
|
||||
playerMsg(sender, "Players are now frozen.");
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
|
||||
playerMsg( player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +36,7 @@ public class Command_fr extends FreedomCommand {
|
|||
{
|
||||
Utilities.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
setAllFrozen(false);
|
||||
playerMsg("Players are now free to move.");
|
||||
playerMsg(sender, "Players are now free to move.");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -53,14 +52,14 @@ public class Command_fr extends FreedomCommand {
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
playerdata.setFrozen(!playerdata.isFrozen());
|
||||
|
||||
playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
playerMsg(sender, player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
playerMsg(player, "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "You'll never even see it coming.", usage = "/<command>")
|
||||
public class Command_fuckoff extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -42,7 +41,7 @@ public class Command_fuckoff extends FreedomCommand {
|
|||
TotalFreedomMod.fuckoffEnabledFor.put(sender_p, new Double(fuckoff_range));
|
||||
}
|
||||
|
||||
playerMsg("Fuckoff " + (fuckoff_enabled ? ("enabled. Range: " + fuckoff_range + ".") : "disabled."));
|
||||
playerMsg(sender, "Fuckoff " + (fuckoff_enabled ? ("enabled. Range: " + fuckoff_range + ".") : "disabled."));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,6 @@ import org.bukkit.entity.Player;
|
|||
import java.util.Iterator;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci, fr, smite.",
|
||||
usage = "/<command> [list | [<kick | nameban | ipban | ban | op | deop | ci | fr | smite> <targethash>] ]")
|
||||
public class Command_gadmin extends FreedomCommand {
|
||||
private enum GadminMode {
|
||||
LIST("list"),
|
||||
|
@ -60,7 +57,7 @@ public class Command_gadmin extends FreedomCommand {
|
|||
|
||||
final GadminMode mode = GadminMode.findMode(args[0].toLowerCase());
|
||||
if (mode == null) {
|
||||
playerMsg("Invalid mode: " + args[0], ChatColor.RED);
|
||||
playerMsg(sender, "Invalid mode: " + args[0], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,7 +65,7 @@ public class Command_gadmin extends FreedomCommand {
|
|||
|
||||
if (mode == GadminMode.LIST)
|
||||
{
|
||||
playerMsg("[ Real Name ] : [ Display Name ] - Hash:");
|
||||
playerMsg(sender, "[ Real Name ] : [ Display Name ] - Hash:");
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Player player = it.next();
|
||||
|
@ -100,7 +97,7 @@ public class Command_gadmin extends FreedomCommand {
|
|||
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg("Invalid player hash: " + args[1], ChatColor.RED);
|
||||
playerMsg(sender, "Invalid player hash: " + args[1], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -181,7 +178,7 @@ public class Command_gadmin extends FreedomCommand {
|
|||
PlayerData playerdata = PlayerData.getPlayerData(target);
|
||||
playerdata.setFrozen(!playerdata.isFrozen());
|
||||
|
||||
playerMsg(target.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
playerMsg(sender, target.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
target.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
|
||||
break;
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Send a command as someone else.", usage = "/<command> <fromname> <outcommand>")
|
||||
public class Command_gcmd extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -31,19 +30,19 @@ public class Command_gcmd extends FreedomCommand {
|
|||
|
||||
try
|
||||
{
|
||||
playerMsg("Sending command as " + player.getName() + ": " + outCommand);
|
||||
playerMsg(sender, "Sending command as " + player.getName() + ": " + outCommand);
|
||||
if (server.dispatchCommand(player, outCommand))
|
||||
{
|
||||
playerMsg("Command sent.");
|
||||
playerMsg(sender, "Command sent.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Unknown error sending command.");
|
||||
playerMsg(sender, "Unknown error sending command.");
|
||||
}
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
playerMsg("Error sending command: " + ex.getMessage());
|
||||
playerMsg(sender, "Error sending command: " + ex.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Ban/Unban any player, even those who are not logged in anymore.", usage = "/<command> <purge | <ban | unban> <username>>")
|
||||
public class Command_glist extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -29,11 +28,11 @@ public class Command_glist extends FreedomCommand {
|
|||
if (AdminList.isSeniorAdmin(sender))
|
||||
{
|
||||
PlayerList.purgeAll();
|
||||
playerMsg("Purged playerbase");
|
||||
playerMsg(sender, "Purged playerbase");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Only Senior Admins may purge the userlist.");
|
||||
playerMsg(sender, "Only Senior Admins may purge the userlist.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -54,7 +53,7 @@ public class Command_glist extends FreedomCommand {
|
|||
final me.StevenLawson.TotalFreedomMod.player.Player entry = PlayerList.getEntry(UUIDManager.getUniqueId(args[1]));
|
||||
|
||||
if (entry == null) {
|
||||
playerMsg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||
playerMsg(sender, "Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes someone GTFO (deop and ip ban by username).", usage = "/<command> <partialname>")
|
||||
public class Command_gtfo extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -27,7 +26,7 @@ public class Command_gtfo extends FreedomCommand {
|
|||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Halts a player", usage = "/<command> <<partialname> | all | purge | list>")
|
||||
public class Command_halt extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -27,7 +26,7 @@ public class Command_halt extends FreedomCommand {
|
|||
counter++;
|
||||
}
|
||||
}
|
||||
playerMsg("Halted " + counter + " players.");
|
||||
playerMsg(sender, "Halted " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -44,7 +43,7 @@ public class Command_halt extends FreedomCommand {
|
|||
counter++;
|
||||
}
|
||||
}
|
||||
playerMsg("Unhalted " + counter + " players.");
|
||||
playerMsg(sender, "Unhalted " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -59,15 +58,15 @@ public class Command_halt extends FreedomCommand {
|
|||
{
|
||||
if (count == 0)
|
||||
{
|
||||
playerMsg("Halted players:");
|
||||
playerMsg(sender, "Halted players:");
|
||||
}
|
||||
playerMsg("- " + hp.getName());
|
||||
playerMsg(sender, "- " + hp.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
playerMsg("There are currently no halted players.");
|
||||
playerMsg(sender, "There are currently no halted players.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.text.DecimalFormat;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "View ticks-per-second", usage = "/<command>")
|
||||
public class Command_health extends FreedomCommand {
|
||||
private static final int BYTES_PER_MB = 1024 * 1024;
|
||||
private static final DoubleRange TPS_RANGE = new DoubleRange(20.0 - 0.1, 20.0 + 0.1);
|
||||
|
@ -23,10 +22,10 @@ public class Command_health extends FreedomCommand {
|
|||
Runtime runtime = Runtime.getRuntime();
|
||||
long usedMem = runtime.totalMemory() - runtime.freeMemory();
|
||||
|
||||
playerMsg("Reserved Memory: " + (double) runtime.totalMemory() / (double) BYTES_PER_MB + "mb");
|
||||
playerMsg("Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB) + "mb (" + new DecimalFormat("#").format(((double) usedMem / (double) runtime.totalMemory()) * 100.0) + "%)");
|
||||
playerMsg("Max Memory: " + (double) runtime.maxMemory() / (double) BYTES_PER_MB + "mb");
|
||||
playerMsg("Calculating ticks per second, please wait...");
|
||||
playerMsg(sender, "Reserved Memory: " + (double) runtime.totalMemory() / (double) BYTES_PER_MB + "mb");
|
||||
playerMsg(sender, "Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB) + "mb (" + new DecimalFormat("#").format(((double) usedMem / (double) runtime.totalMemory()) * 100.0) + "%)");
|
||||
playerMsg(sender, "Max Memory: " + (double) runtime.maxMemory() / (double) BYTES_PER_MB + "mb");
|
||||
playerMsg(sender, "Calculating ticks per second, please wait...");
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
@ -45,7 +44,7 @@ public class Command_health extends FreedomCommand {
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
playerMsg("Ticks per second: " + (TPS_RANGE.containsDouble(ticksPerSecond) ? ChatColor.GREEN : ChatColor.RED) + ticksPerSecond);
|
||||
playerMsg(sender, "Ticks per second: " + (TPS_RANGE.containsDouble(ticksPerSecond) ? ChatColor.GREEN : ChatColor.RED) + ticksPerSecond);
|
||||
}
|
||||
}.runTask(plugin);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
|
||||
public class Command_invis extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -45,17 +44,17 @@ public class Command_invis extends FreedomCommand {
|
|||
|
||||
if (players.isEmpty())
|
||||
{
|
||||
playerMsg("There are no invisible players");
|
||||
playerMsg(sender, "There are no invisible players");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (smite)
|
||||
{
|
||||
playerMsg("Smitten " + smites + " players");
|
||||
playerMsg(sender, "Smitten " + smites + " players");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Invisble players (" + players.size() + "): " + StringUtils.join(players, ", "));
|
||||
playerMsg(sender, "Invisble players (" + players.size() + "): " + StringUtils.join(players, ", "));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info | sideways <on | off> | strength <strength (1-10)>>", aliases = "launchpads,jp")
|
||||
public class Command_jumppads extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -17,9 +16,9 @@ public class Command_jumppads extends FreedomCommand {
|
|||
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("info")) {
|
||||
playerMsg("Jumppads: " + (JumpPads.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
playerMsg("Sideways: " + (JumpPads.getMode() == JumpPads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
playerMsg("Strength: " + (JumpPads.getStrength() * 10 - 1), ChatColor.BLUE);
|
||||
playerMsg(sender, "Jumppads: " + (JumpPads.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
playerMsg(sender, "Sideways: " + (JumpPads.getMode() == JumpPads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
playerMsg(sender, "Strength: " + (JumpPads.getStrength() * 10 - 1), ChatColor.BLUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -38,7 +37,7 @@ public class Command_jumppads extends FreedomCommand {
|
|||
{
|
||||
if (JumpPads.getMode() == JumpPads.JumpPadMode.OFF)
|
||||
{
|
||||
playerMsg("Jumppads are currently disabled, please enable them before changing jumppads settings.");
|
||||
playerMsg(sender, "Jumppads are currently disabled, please enable them before changing jumppads settings.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -64,13 +63,13 @@ public class Command_jumppads extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg("Invalid Strength");
|
||||
playerMsg(sender, "Invalid Strength");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strength > 10 || strength < 1)
|
||||
{
|
||||
playerMsg("Invalid Strength: The strength may be 1 through 10.");
|
||||
playerMsg(sender, "Invalid Strength: The strength may be 1 through 10.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
|
||||
public class Command_kicknoob extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -15,17 +15,16 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Set a landmine trap.", usage = "/<command>")
|
||||
public class Command_landmine extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.LANDMINES_ENABLED.getBoolean()) {
|
||||
playerMsg("The landmine is currently disabled.", ChatColor.GREEN);
|
||||
playerMsg(sender, "The landmine is currently disabled.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ConfigurationEntry.ALLOW_EXPLOSIONS.getBoolean()) {
|
||||
playerMsg("Explosions are currently disabled.", ChatColor.GREEN);
|
||||
playerMsg(sender, "Explosions are currently disabled.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -38,7 +37,7 @@ public class Command_landmine extends FreedomCommand {
|
|||
final Iterator<TFM_LandmineData> landmines = TFM_LandmineData.landmines.iterator();
|
||||
while (landmines.hasNext())
|
||||
{
|
||||
playerMsg(landmines.next().toString());
|
||||
playerMsg(sender, landmines.next().toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -56,7 +55,7 @@ public class Command_landmine extends FreedomCommand {
|
|||
landmine.setType(Material.TNT);
|
||||
TFM_LandmineData.landmines.add(new TFM_LandmineData(landmine.getLocation(), sender_p, radius));
|
||||
|
||||
playerMsg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
|
||||
playerMsg(sender, "Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Show the last command that someone used.", usage = "/<command> <player>")
|
||||
public class Command_lastcmd extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -18,7 +17,7 @@ public class Command_lastcmd extends FreedomCommand {
|
|||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,7 +30,7 @@ public class Command_lastcmd extends FreedomCommand {
|
|||
{
|
||||
lastCommand = "(none)";
|
||||
}
|
||||
playerMsg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
|
||||
playerMsg(sender, player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i]", aliases = "who")
|
||||
public class Command_list extends FreedomCommand {
|
||||
private static enum ListFilter {
|
||||
ALL,
|
||||
|
@ -33,7 +32,7 @@ public class Command_list extends FreedomCommand {
|
|||
{
|
||||
names.add(player.getName());
|
||||
}
|
||||
playerMsg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE);
|
||||
playerMsg(sender, "There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Teleport to the spawn point for the current world.", usage = "/<command>", aliases = "worldspawn,gotospawn")
|
||||
public class Command_localspawn extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
sender_p.teleport(sender_p.getWorld().getSpawnLocation());
|
||||
playerMsg("Teleported to spawnpoint for world \"" + sender_p.getWorld().getName() + "\".");
|
||||
playerMsg(sender, "Teleported to spawnpoint for world \"" + sender_p.getWorld().getName() + "\".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Block target's minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
|
||||
public class Command_lockup extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -20,7 +19,7 @@ public class Command_lockup extends FreedomCommand {
|
|||
for (Player player : server.getOnlinePlayers()) {
|
||||
startLockup(player);
|
||||
}
|
||||
playerMsg("Locked up all players.");
|
||||
playerMsg(sender, "Locked up all players.");
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
|
@ -30,7 +29,7 @@ public class Command_lockup extends FreedomCommand {
|
|||
cancelLockup(player);
|
||||
}
|
||||
|
||||
playerMsg("Unlocked all players.");
|
||||
playerMsg(sender, "Unlocked all players.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -51,7 +50,7 @@ public class Command_lockup extends FreedomCommand {
|
|||
|
||||
Utilities.adminAction(sender.getName(), "Locking up " + player.getName(), true);
|
||||
startLockup(player);
|
||||
playerMsg("Locked up " + player.getName() + ".");
|
||||
playerMsg(sender, "Locked up " + player.getName() + ".");
|
||||
}
|
||||
else if ("off".equals(args[1]))
|
||||
{
|
||||
|
@ -65,7 +64,7 @@ public class Command_lockup extends FreedomCommand {
|
|||
|
||||
Utilities.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
|
||||
cancelLockup(player);
|
||||
playerMsg("Unlocked " + player.getName() + ".");
|
||||
playerMsg(sender, "Unlocked " + player.getName() + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.*;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
||||
public class Command_logs extends FreedomCommand {
|
||||
public static void deactivateSuperadmin(Admin superadmin) {
|
||||
for (String ip : superadmin.getIps()) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Control mob rezzing parameters.", usage = "/<command> <on|off|setmax <count>|dragon|giant|ghast|slime>")
|
||||
public class Command_moblimiter extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -60,14 +59,14 @@ public class Command_moblimiter extends FreedomCommand {
|
|||
{
|
||||
sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + ConfigurationEntry.MOB_LIMITER_MAX.getInteger() + ".");
|
||||
|
||||
playerMsg("Dragon: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Giant: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Slime: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Ghast: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg(sender, "Dragon: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg(sender, "Giant: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg(sender, "Slime: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg(sender, "Ghast: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Moblimiter is disabled. No mob restrictions are in effect.");
|
||||
playerMsg(sender, "Moblimiter is disabled. No mob restrictions are in effect.");
|
||||
}
|
||||
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.DO_MOB_SPAWNING, !ConfigurationEntry.MOB_LIMITER_ENABLED.getBoolean());
|
||||
|
|
|
@ -7,12 +7,11 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.*;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command>")
|
||||
public class Command_mp extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
playerMsg("Purging all mobs...");
|
||||
playerMsg(purgeMobs() + " mobs removed.");
|
||||
playerMsg(sender, "Purging all mobs...");
|
||||
playerMsg(sender, purgeMobs() + " mobs removed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,12 +9,11 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.", usage = "/<command> <draw | sling>")
|
||||
public class Command_mp44 extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.MP44_ENABLED.getBoolean()) {
|
||||
playerMsg("The mp44 is currently disabled.", ChatColor.GREEN);
|
||||
playerMsg(sender, "The mp44 is currently disabled.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28,8 +27,8 @@ public class Command_mp44 extends FreedomCommand {
|
|||
{
|
||||
playerdata.armMP44();
|
||||
|
||||
playerMsg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
|
||||
playerMsg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
|
||||
playerMsg(sender, "mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
|
||||
playerMsg(sender, "Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
|
||||
|
||||
sender_p.setItemInHand(new ItemStack(Material.SULPHUR, 1));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Goto the nether.", usage = "/<command>")
|
||||
public class Command_nether extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "NickFilter: Prefix any command with this command to replace nicknames in that command with real names. Nicknames should be prefixed with a !.", usage = "/<command> <other_command> !<playernick>")
|
||||
public class Command_nf extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Essentials Interface Command - Remove distracting things from nicknames of all players on server.", usage = "/<command>", aliases = "nc")
|
||||
public class Command_nickclean extends FreedomCommand {
|
||||
private static final ChatColor[] BLOCKED = new ChatColor[]
|
||||
{
|
||||
|
@ -33,7 +32,7 @@ public class Command_nickclean extends FreedomCommand {
|
|||
if (matcher.find())
|
||||
{
|
||||
final String newNickName = matcher.replaceAll("");
|
||||
playerMsg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\".");
|
||||
playerMsg(sender, ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\".");
|
||||
EssentialsBridge.setNickname(playerName, newNickName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Essentials Interface Command - Nyanify your nickname.", usage = "/<command> <<nick> | off>")
|
||||
public class Command_nicknyan extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -19,7 +18,7 @@ public class Command_nicknyan extends FreedomCommand {
|
|||
|
||||
if ("off".equals(args[0])) {
|
||||
EssentialsBridge.setNickname(sender.getName(), null);
|
||||
playerMsg("Nickname cleared.");
|
||||
playerMsg(sender, "Nickname cleared.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -27,12 +26,12 @@ public class Command_nicknyan extends FreedomCommand {
|
|||
|
||||
if (!nickPlain.matches("^[a-zA-Z_0-9\u00a7]+$"))
|
||||
{
|
||||
playerMsg("That nickname contains invalid characters.");
|
||||
playerMsg(sender, "That nickname contains invalid characters.");
|
||||
return true;
|
||||
}
|
||||
else if (nickPlain.length() < 4 || nickPlain.length() > 30)
|
||||
{
|
||||
playerMsg("Your nickname must be between 4 and 30 characters long.");
|
||||
playerMsg(sender, "Your nickname must be between 4 and 30 characters long.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -44,7 +43,7 @@ public class Command_nicknyan extends FreedomCommand {
|
|||
}
|
||||
if (player.getName().equalsIgnoreCase(nickPlain) || ChatColor.stripColor(player.getDisplayName()).trim().equalsIgnoreCase(nickPlain))
|
||||
{
|
||||
playerMsg("That nickname is already in use.");
|
||||
playerMsg(sender, "That nickname is already in use.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +60,7 @@ public class Command_nicknyan extends FreedomCommand {
|
|||
|
||||
EssentialsBridge.setNickname(sender.getName(), newNick.toString());
|
||||
|
||||
playerMsg("Your nickname is now: " + newNick.toString());
|
||||
playerMsg(sender, "Your nickname is now: " + newNick.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,22 +7,18 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "AdminChat - Talk privately with other admins. Using <command> itself will toggle AdminChat on and off for all messages.",
|
||||
usage = "/<command> [message...]",
|
||||
aliases = "adminchat")
|
||||
public class Command_o extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
if (senderIsConsole) {
|
||||
playerMsg("Only in-game players can toggle AdminChat.");
|
||||
playerMsg(sender, "Only in-game players can toggle AdminChat.");
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerData userinfo = PlayerData.getPlayerData(sender_p);
|
||||
userinfo.setAdminChat(!userinfo.inAdminChat());
|
||||
playerMsg("Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + ".");
|
||||
playerMsg(sender, "Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -10,19 +10,18 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Switch server online-mode on and off.", usage = "/<command> <on | off>")
|
||||
public class Command_onlinemode extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
playerMsg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.WHITE);
|
||||
playerMsg("\"/onlinemode on\" and \"/onlinemode off\" can be used to change online mode from the console.", ChatColor.WHITE);
|
||||
playerMsg(sender, "Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.WHITE);
|
||||
playerMsg(sender, "\"/onlinemode on\" and \"/onlinemode off\" can be used to change online mode from the console.", ChatColor.WHITE);
|
||||
} else {
|
||||
boolean online_mode;
|
||||
|
||||
if (sender instanceof Player && !AdminList.isSeniorAdmin(sender, true))
|
||||
{
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
playerMsg(sender, FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes a player operator", usage = "/<command> <playername>")
|
||||
public class Command_op extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -19,7 +18,7 @@ public class Command_op extends FreedomCommand {
|
|||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone")) {
|
||||
playerMsg("Correct usage: /opall");
|
||||
playerMsg(sender, "Correct usage: /opall");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,8 +40,8 @@ public class Command_op extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("That player is not online.");
|
||||
playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
||||
playerMsg(sender, "That player is not online.");
|
||||
playerMsg(sender, "You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s]")
|
||||
public class Command_opall extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Automatically ops user.", usage = "/<command>")
|
||||
public class Command_opme extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
|
||||
public class Command_ops extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -28,9 +27,9 @@ public class Command_ops extends FreedomCommand {
|
|||
}
|
||||
}
|
||||
|
||||
playerMsg("Online OPs: " + onlineOps);
|
||||
playerMsg("Offline OPs: " + (totalOps - onlineOps));
|
||||
playerMsg("Total OPs: " + totalOps);
|
||||
playerMsg(sender, "Online OPs: " + onlineOps);
|
||||
playerMsg(sender, "Offline OPs: " + (totalOps - onlineOps));
|
||||
playerMsg(sender, "Total OPs: " + totalOps);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +38,7 @@ public class Command_ops extends FreedomCommand {
|
|||
{
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
playerMsg(sender, FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!",
|
||||
usage = "/<command> <target> [<<power> | stop>]")
|
||||
public class Command_orbit extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -22,7 +20,7 @@ public class Command_orbit extends FreedomCommand {
|
|||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,7 +32,7 @@ public class Command_orbit extends FreedomCommand {
|
|||
{
|
||||
if (args[1].equals("stop"))
|
||||
{
|
||||
playerMsg("Stopped orbiting " + player.getName());
|
||||
playerMsg(sender, "Stopped orbiting " + player.getName());
|
||||
playerdata.stopOrbiting();
|
||||
return true;
|
||||
}
|
||||
|
@ -45,7 +43,7 @@ public class Command_orbit extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
playerMsg(sender, ex.getMessage(), ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.bukkit.command.CommandSender;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Overlord - control this server in-game", usage = "access", aliases = "ov")
|
||||
public class Command_overlord extends FreedomCommand {
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +26,7 @@ public class Command_overlord extends FreedomCommand {
|
|||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
playerMsg(ChatColor.WHITE + "Unknown command. Type \"help\" for help.");
|
||||
playerMsg(sender, ChatColor.WHITE + "Unknown command. Type \"help\" for help.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -40,14 +39,14 @@ public class Command_overlord extends FreedomCommand {
|
|||
if (args[0].equals("addme"))
|
||||
{
|
||||
AdminList.addSuperadmin(sender_p);
|
||||
playerMsg("ok");
|
||||
playerMsg(sender, "ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("removeme"))
|
||||
{
|
||||
AdminList.removeSuperadmin(sender_p);
|
||||
playerMsg("ok");
|
||||
playerMsg(sender, "ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -60,7 +59,7 @@ public class Command_overlord extends FreedomCommand {
|
|||
|
||||
final String command = StringUtil.joinString(args, " ", 1);
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
playerMsg("ok");
|
||||
playerMsg(sender, "ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>")
|
||||
public class Command_permban extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -25,7 +24,7 @@ public class Command_permban extends FreedomCommand {
|
|||
sender.sendMessage(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
playerMsg("Reloading permban list...", ChatColor.RED);
|
||||
playerMsg(sender, "Reloading permban list...", ChatColor.RED);
|
||||
PermbanList.load();
|
||||
dumplist(sender);
|
||||
}
|
||||
|
@ -41,22 +40,22 @@ public class Command_permban extends FreedomCommand {
|
|||
{
|
||||
if (PermbanList.getPermbannedPlayers().isEmpty())
|
||||
{
|
||||
playerMsg("No permanently banned player names.");
|
||||
playerMsg(sender, "No permanently banned player names.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(PermbanList.getPermbannedPlayers().size() + " permanently banned players:");
|
||||
playerMsg(StringUtils.join(PermbanList.getPermbannedPlayers(), ", "));
|
||||
playerMsg(sender, PermbanList.getPermbannedPlayers().size() + " permanently banned players:");
|
||||
playerMsg(sender, StringUtils.join(PermbanList.getPermbannedPlayers(), ", "));
|
||||
}
|
||||
|
||||
if (PermbanList.getPermbannedIps().isEmpty())
|
||||
{
|
||||
playerMsg("No permanently banned IPs.");
|
||||
playerMsg(sender, "No permanently banned IPs.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(PermbanList.getPermbannedIps().size() + " permanently banned IPs:");
|
||||
playerMsg(StringUtils.join(PermbanList.getPermbannedIps(), ", "));
|
||||
playerMsg(sender, PermbanList.getPermbannedIps().size() + " permanently banned IPs:");
|
||||
playerMsg(sender, StringUtils.join(PermbanList.getPermbannedIps(), ", "));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.plugin.Plugin;
|
|||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage plugins", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
|
||||
public class Command_plugincontrol extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -24,7 +23,7 @@ public class Command_plugincontrol extends FreedomCommand {
|
|||
for (Plugin serverPlugin : pm.getPlugins())
|
||||
{
|
||||
final String version = serverPlugin.getDescription().getVersion();
|
||||
playerMsg(ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName()
|
||||
playerMsg(sender, ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName()
|
||||
+ ChatColor.GOLD + (version != null && !version.isEmpty() ? " v" + version : "") + " by "
|
||||
+ StringUtils.join(serverPlugin.getDescription().getAuthors(), ", "));
|
||||
}
|
||||
|
@ -40,13 +39,13 @@ public class Command_plugincontrol extends FreedomCommand {
|
|||
final Plugin target = getPlugin(args[1]);
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg("Plugin not found!");
|
||||
playerMsg(sender, "Plugin not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.isEnabled())
|
||||
{
|
||||
playerMsg("Plugin is already enabled.");
|
||||
playerMsg(sender, "Plugin is already enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -54,11 +53,11 @@ public class Command_plugincontrol extends FreedomCommand {
|
|||
|
||||
if (!pm.isPluginEnabled(target))
|
||||
{
|
||||
playerMsg("Error enabling plugin " + target.getName());
|
||||
playerMsg(sender, "Error enabling plugin " + target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(target.getName() + " is now enabled.");
|
||||
playerMsg(sender, target.getName() + " is now enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -67,19 +66,19 @@ public class Command_plugincontrol extends FreedomCommand {
|
|||
final Plugin target = getPlugin(args[1]);
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg("Plugin not found!");
|
||||
playerMsg(sender, "Plugin not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!target.isEnabled())
|
||||
{
|
||||
playerMsg("Plugin is already disabled.");
|
||||
playerMsg(sender, "Plugin is already disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.getName().equals(plugin.getName()))
|
||||
{
|
||||
playerMsg("You cannot disable " + plugin.getName());
|
||||
playerMsg(sender, "You cannot disable " + plugin.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -87,11 +86,11 @@ public class Command_plugincontrol extends FreedomCommand {
|
|||
|
||||
if (pm.isPluginEnabled(target))
|
||||
{
|
||||
playerMsg("Error disabling plugin " + target.getName());
|
||||
playerMsg(sender, "Error disabling plugin " + target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(target.getName() + " is now disabled.");
|
||||
playerMsg(sender, target.getName() + " is now disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -100,19 +99,19 @@ public class Command_plugincontrol extends FreedomCommand {
|
|||
final Plugin target = getPlugin(args[1]);
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg("Plugin not found!");
|
||||
playerMsg(sender, "Plugin not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.getName().equals(plugin.getName()))
|
||||
{
|
||||
playerMsg("Use /tfm reload to reload instead.");
|
||||
playerMsg(sender, "Use /tfm reload to reload instead.");
|
||||
return true;
|
||||
}
|
||||
|
||||
pm.disablePlugin(target);
|
||||
pm.enablePlugin(target);
|
||||
playerMsg(target.getName() + " reloaded.");
|
||||
playerMsg(sender, target.getName() + " reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "Manipulate potion effects. Duration is measured in server ticks (~20 ticks per second).",
|
||||
usage = "/<command> <list | clear [target name] | add <type> <duration> <amplifier> [target name]>")
|
||||
public class Command_potion extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -28,13 +25,13 @@ public class Command_potion extends FreedomCommand {
|
|||
potionEffectTypeNames.add(potion_effect_type.getName());
|
||||
}
|
||||
}
|
||||
playerMsg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA);
|
||||
playerMsg(sender, "Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("clearall"))
|
||||
{
|
||||
if (!(AdminList.isSuperAdmin(sender) || senderIsConsole))
|
||||
{
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
playerMsg(sender, FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
Utilities.adminAction(sender.getName(), "Cleared all potion effects from all players", true);
|
||||
|
@ -56,7 +53,7 @@ public class Command_potion extends FreedomCommand {
|
|||
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -65,13 +62,13 @@ public class Command_potion extends FreedomCommand {
|
|||
{
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg("Only superadmins can clear potion effects from other players.");
|
||||
playerMsg(sender, "Only superadmins can clear potion effects from other players.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (senderIsConsole)
|
||||
{
|
||||
playerMsg("You must specify a target player when using this command from the console.");
|
||||
playerMsg(sender, "You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -80,7 +77,7 @@ public class Command_potion extends FreedomCommand {
|
|||
target.removePotionEffect(potion_effect.getType());
|
||||
}
|
||||
|
||||
playerMsg("Cleared all active potion effects " + (!target.equals(sender_p) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
|
||||
playerMsg(sender, "Cleared all active potion effects " + (!target.equals(sender_p) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,7 +97,7 @@ public class Command_potion extends FreedomCommand {
|
|||
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +131,7 @@ public class Command_potion extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg("Invalid potion duration.", ChatColor.RED);
|
||||
playerMsg(sender, "Invalid potion duration.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -146,13 +143,13 @@ public class Command_potion extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg("Invalid potion amplifier.", ChatColor.RED);
|
||||
playerMsg(sender, "Invalid potion amplifier.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
PotionEffect new_effect = potion_effect_type.createEffect(duration, amplifier);
|
||||
target.addPotionEffect(new_effect, true);
|
||||
playerMsg(
|
||||
playerMsg(sender,
|
||||
"Added potion effect: " + new_effect.getType().getName()
|
||||
+ ", Duration: " + new_effect.getDuration()
|
||||
+ ", Amplifier: " + new_effect.getAmplifier()
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.net.URL;
|
|||
import java.net.URLConnection;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Validates if a given account is premium.", usage = "/<command> <player>", aliases = "prem")
|
||||
public class Command_premium extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -44,14 +43,14 @@ public class Command_premium extends FreedomCommand {
|
|||
urlConnection.disconnect();
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
playerMsg("Player " + name + " is premium: " + message);
|
||||
playerMsg(sender, "Player " + name + " is premium: " + message);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.severe(ex);
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
playerMsg("There was an error querying the mojang server.", ChatColor.RED);
|
||||
playerMsg(sender, "There was an error querying the mojang server.", ChatColor.RED);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,28 +7,25 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "Protect areas so that only superadmins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.",
|
||||
usage = "/<command> <list | clear | remove <label> | add <label> <radius>>")
|
||||
public class Command_protectarea extends FreedomCommand {
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.PROTECTAREA_ENABLED.getBoolean()) {
|
||||
playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
|
||||
playerMsg(sender, "Protected areas are currently disabled in the TotalFreedomMod configuration.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
playerMsg("Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
playerMsg(sender, "Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("clear"))
|
||||
{
|
||||
ProtectedArea.clearProtectedAreas();
|
||||
|
||||
playerMsg("Protected Areas Cleared.");
|
||||
playerMsg(sender, "Protected Areas Cleared.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -43,7 +40,7 @@ public class Command_protectarea extends FreedomCommand {
|
|||
{
|
||||
ProtectedArea.removeProtectedArea(args[1]);
|
||||
|
||||
playerMsg("Area removed. Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
playerMsg(sender, "Area removed. Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -58,7 +55,7 @@ public class Command_protectarea extends FreedomCommand {
|
|||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
playerMsg("You must be in-game to set a protected area.");
|
||||
playerMsg(sender, "You must be in-game to set a protected area.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -69,19 +66,19 @@ public class Command_protectarea extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
playerMsg("Invalid radius.");
|
||||
playerMsg(sender, "Invalid radius.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (radius > ProtectedArea.MAX_RADIUS || radius < 0.0D)
|
||||
{
|
||||
playerMsg("Invalid radius. Radius must be a positive value less than " + ProtectedArea.MAX_RADIUS + ".");
|
||||
playerMsg(sender, "Invalid radius. Radius must be a positive value less than " + ProtectedArea.MAX_RADIUS + ".");
|
||||
return true;
|
||||
}
|
||||
|
||||
ProtectedArea.addProtectedArea(args[1], sender_p.getLocation(), radius);
|
||||
|
||||
playerMsg("Area added. Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
playerMsg(sender, "Area added. Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Superadmin command - Purge everything! (except for bans).", usage = "/<command>")
|
||||
public class Command_purgeall extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quick De-Op - deop someone based on a partial name.", usage = "/<command> <partialname>")
|
||||
public class Command_qdeop extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -48,7 +47,7 @@ public class Command_qdeop extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("No targets matched.");
|
||||
playerMsg(sender, "No targets matched.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
|
||||
public class Command_qop extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -48,7 +47,7 @@ public class Command_qop extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("No targets matched.");
|
||||
playerMsg(sender, "No targets matched.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Shows nearby people sorted by distance.", usage = "/<command> [range]")
|
||||
public class Command_radar extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -34,13 +33,13 @@ public class Command_radar extends FreedomCommand {
|
|||
|
||||
if (radar_data.isEmpty())
|
||||
{
|
||||
playerMsg("You are the only player in this world. (" + ChatColor.GREEN + "Forever alone..." + ChatColor.YELLOW + ")", ChatColor.YELLOW); //lol
|
||||
playerMsg(sender, "You are the only player in this world. (" + ChatColor.GREEN + "Forever alone..." + ChatColor.YELLOW + ")", ChatColor.YELLOW); //lol
|
||||
return true;
|
||||
}
|
||||
|
||||
Collections.sort(radar_data, new TFM_RadarData());
|
||||
|
||||
playerMsg("People nearby in " + sender_pos.getWorld().getName() + ":", ChatColor.YELLOW);
|
||||
playerMsg(sender, "People nearby in " + sender_pos.getWorld().getName() + ":", ChatColor.YELLOW);
|
||||
|
||||
int countmax = 5;
|
||||
if (args.length == 1)
|
||||
|
@ -56,7 +55,7 @@ public class Command_radar extends FreedomCommand {
|
|||
|
||||
for (TFM_RadarData i : radar_data)
|
||||
{
|
||||
playerMsg(String.format("%s - %d",
|
||||
playerMsg(sender, String.format("%s - %d",
|
||||
i.player.getName(),
|
||||
Math.round(i.distance)), ChatColor.YELLOW);
|
||||
|
||||
|
|
|
@ -7,13 +7,12 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows your rank.", usage = "/<command>")
|
||||
public class Command_rank extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (senderIsConsole && args.length < 1) {
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
playerMsg(player.getName() + " is " + PlayerRank.fromSender(player).getLoginMessage());
|
||||
playerMsg(sender, player.getName() + " is " + PlayerRank.fromSender(player).getLoginMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -25,7 +24,7 @@ public class Command_rank extends FreedomCommand {
|
|||
|
||||
if (args.length == 0)
|
||||
{
|
||||
playerMsg(sender.getName() + " is " + PlayerRank.fromSender(sender).getLoginMessage(), ChatColor.AQUA);
|
||||
playerMsg(sender, sender.getName() + " is " + PlayerRank.fromSender(sender).getLoginMessage(), ChatColor.AQUA);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -37,7 +36,7 @@ public class Command_rank extends FreedomCommand {
|
|||
return true;
|
||||
}
|
||||
|
||||
playerMsg(player.getName() + " is " + PlayerRank.fromSender(player).getLoginMessage(), ChatColor.AQUA);
|
||||
playerMsg(sender, player.getName() + " is " + PlayerRank.fromSender(player).getLoginMessage(), ChatColor.AQUA);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
|
||||
public class Command_rawsay extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -5,12 +5,11 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> <carts>")
|
||||
public class Command_rd extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Removing all server entities.", true);
|
||||
playerMsg((Utilities.TFM_EntityWiper.wipeEntities(true, true)) + " entities removed.");
|
||||
playerMsg(sender, (Utilities.TFM_EntityWiper.wipeEntities(true, true)) + " entities removed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
|
||||
@CommandParameters(description = "Report a player for admins to see.", usage = "/<command> <player> <reason>")
|
||||
public class Command_report extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -21,7 +20,7 @@ public class Command_report extends FreedomCommand {
|
|||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
playerMsg(PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -29,21 +28,21 @@ public class Command_report extends FreedomCommand {
|
|||
{
|
||||
if (player.equals(sender_p))
|
||||
{
|
||||
playerMsg(ChatColor.RED + "Please, don't try to report yourself.");
|
||||
playerMsg(sender, ChatColor.RED + "Please, don't try to report yourself.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(ChatColor.RED + "You can not report an admin.");
|
||||
playerMsg(sender, ChatColor.RED + "You can not report an admin.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
Utilities.reportAction(sender_p, player, report);
|
||||
|
||||
playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
|
||||
playerMsg(sender, ChatColor.GREEN + "Thank you, your report has been successfully logged.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = false)
|
||||
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
|
||||
public class Command_ro extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -40,7 +39,7 @@ public class Command_ro extends FreedomCommand {
|
|||
|
||||
if (fromMaterial == null)
|
||||
{
|
||||
playerMsg("Invalid block: " + materialName, ChatColor.RED);
|
||||
playerMsg(sender, "Invalid block: " + materialName, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class Command_ro extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg("Invalid radius: " + args[1], ChatColor.RED);
|
||||
playerMsg(sender, "Invalid radius: " + args[1], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +66,7 @@ public class Command_ro extends FreedomCommand {
|
|||
targetPlayer = getPlayer(args[2]);
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -17,7 +16,7 @@ public class Command_rollback extends FreedomCommand {
|
|||
if (args.length == 1) {
|
||||
if ("purgeall".equals(args[0])) {
|
||||
Utilities.adminAction(sender.getName(), "Purging all rollback history", false);
|
||||
playerMsg("Purged all rollback history for " + RollbackManager.purgeEntries() + " players.");
|
||||
playerMsg(sender, "Purged all rollback history for " + RollbackManager.purgeEntries() + " players.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -25,18 +24,18 @@ public class Command_rollback extends FreedomCommand {
|
|||
|
||||
if (playerName == null)
|
||||
{
|
||||
playerMsg("That player has no entries stored.");
|
||||
playerMsg(sender, "That player has no entries stored.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (RollbackManager.canUndoRollback(playerName))
|
||||
{
|
||||
playerMsg("That player has just been rolled back.");
|
||||
playerMsg(sender, "That player has just been rolled back.");
|
||||
}
|
||||
|
||||
Utilities.adminAction(sender.getName(), "Rolling back player: " + playerName, false);
|
||||
playerMsg("Rolled back " + RollbackManager.rollback(playerName) + " edits for " + playerName + ".");
|
||||
playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
|
||||
playerMsg(sender, "Rolled back " + RollbackManager.rollback(playerName) + " edits for " + playerName + ".");
|
||||
playerMsg(sender, "If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -49,11 +48,11 @@ public class Command_rollback extends FreedomCommand {
|
|||
|
||||
if (playerName == null)
|
||||
{
|
||||
playerMsg("That player has no entries stored.");
|
||||
playerMsg(sender, "That player has no entries stored.");
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg("Purged " + RollbackManager.purgeEntries(playerName) + " rollback history entries for " + playerName + ".");
|
||||
playerMsg(sender, "Purged " + RollbackManager.purgeEntries(playerName) + " rollback history entries for " + playerName + ".");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,12 +62,12 @@ public class Command_rollback extends FreedomCommand {
|
|||
|
||||
if (playerName == null)
|
||||
{
|
||||
playerMsg("That player hasn't been rolled back recently.");
|
||||
playerMsg(sender, "That player hasn't been rolled back recently.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Utilities.adminAction(sender.getName(), "Reverting rollback for player: " + playerName, false);
|
||||
playerMsg("Reverted " + RollbackManager.undoRollback(playerName) + " edits for " + playerName + ".");
|
||||
playerMsg(sender, "Reverted " + RollbackManager.undoRollback(playerName) + " edits for " + playerName + ".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage superadmins.", usage = "/<command> <list | clean | clearme [ip] | <add | delete | info> <username>>")
|
||||
public class Command_saconfig extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -23,12 +22,12 @@ public class Command_saconfig extends FreedomCommand {
|
|||
try {
|
||||
mode = SAConfigMode.findMode(args, sender, senderIsConsole);
|
||||
} catch (final PermissionsException ex) {
|
||||
playerMsg(ex.getMessage());
|
||||
playerMsg(sender, ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
catch (final FormatException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage());
|
||||
playerMsg(sender, ex.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -36,7 +35,7 @@ public class Command_saconfig extends FreedomCommand {
|
|||
{
|
||||
case LIST:
|
||||
{
|
||||
playerMsg("Superadmins: " + StringUtils.join(AdminList.getSuperNames(), ", "), ChatColor.GOLD);
|
||||
playerMsg(sender, "Superadmins: " + StringUtils.join(AdminList.getSuperNames(), ", "), ChatColor.GOLD);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -44,7 +43,7 @@ public class Command_saconfig extends FreedomCommand {
|
|||
{
|
||||
Utilities.adminAction(sender.getName(), "Cleaning superadmin list", true);
|
||||
AdminList.cleanSuperadminList(true);
|
||||
playerMsg("Superadmins: " + StringUtils.join(AdminList.getSuperNames(), ", "), ChatColor.YELLOW);
|
||||
playerMsg(sender, "Superadmins: " + StringUtils.join(AdminList.getSuperNames(), ", "), ChatColor.YELLOW);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -54,7 +53,7 @@ public class Command_saconfig extends FreedomCommand {
|
|||
|
||||
if (admin == null)
|
||||
{
|
||||
playerMsg("Could not find your admin entry! Please notify a developer.", ChatColor.RED);
|
||||
playerMsg(sender, "Could not find your admin entry! Please notify a developer.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -70,18 +69,18 @@ public class Command_saconfig extends FreedomCommand {
|
|||
|
||||
AdminList.saveAll();
|
||||
|
||||
playerMsg(counter + " IPs removed.");
|
||||
playerMsg(admin.getIps().get(0) + " is now your only IP address");
|
||||
playerMsg(sender, counter + " IPs removed.");
|
||||
playerMsg(sender, admin.getIps().get(0) + " is now your only IP address");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!admin.getIps().contains(args[1]))
|
||||
{
|
||||
playerMsg("That IP is not registered to you.");
|
||||
playerMsg(sender, "That IP is not registered to you.");
|
||||
}
|
||||
else if (ip.equals(args[1]))
|
||||
{
|
||||
playerMsg("You cannot remove your current IP.");
|
||||
playerMsg(sender, "You cannot remove your current IP.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -91,8 +90,8 @@ public class Command_saconfig extends FreedomCommand {
|
|||
|
||||
AdminList.saveAll();
|
||||
|
||||
playerMsg("Removed IP " + args[1]);
|
||||
playerMsg("Current IPs: " + StringUtils.join(admin.getIps(), ", "));
|
||||
playerMsg(sender, "Removed IP " + args[1]);
|
||||
playerMsg(sender, "Current IPs: " + StringUtils.join(admin.getIps(), ", "));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,11 +112,11 @@ public class Command_saconfig extends FreedomCommand {
|
|||
|
||||
if (superadmin == null)
|
||||
{
|
||||
playerMsg("Superadmin not found: " + args[1]);
|
||||
playerMsg(sender, "Superadmin not found: " + args[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(superadmin.toString());
|
||||
playerMsg(sender, superadmin.toString());
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -132,7 +131,7 @@ public class Command_saconfig extends FreedomCommand {
|
|||
|
||||
if (superadmin == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -168,7 +167,7 @@ public class Command_saconfig extends FreedomCommand {
|
|||
|
||||
if (!AdminList.getLowercaseSuperNames().contains(targetName.toLowerCase()))
|
||||
{
|
||||
playerMsg("Superadmin not found: " + targetName);
|
||||
playerMsg(sender, "Superadmin not found: " + targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Broadcasts the given message as the console, includes sender name.", usage = "/<command> <message>")
|
||||
public class Command_say extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to 500.", usage = "/<command>")
|
||||
public class Command_setl extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Sets your expierence level.", usage = "/<command> [level]")
|
||||
public class Command_setlevel extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -29,13 +28,13 @@ public class Command_setlevel extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg("Invalid level.", ChatColor.RED);
|
||||
playerMsg(sender, "Invalid level.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
sender_p.setLevel(new_level);
|
||||
|
||||
playerMsg("You have been set to level " + Integer.toString(new_level), ChatColor.AQUA);
|
||||
playerMsg(sender, "You have been set to level " + Integer.toString(new_level), ChatColor.AQUA);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.bukkit.command.CommandSender;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Set the on/off state of the lever at position x, y, z in world 'worldname'.", usage = "/<command> <x> <y> <z> <worldname> <on|off>")
|
||||
public class Command_setlever extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -27,7 +26,7 @@ public class Command_setlever extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg("Invalid coordinates.");
|
||||
playerMsg(sender, "Invalid coordinates.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -45,7 +44,7 @@ public class Command_setlever extends FreedomCommand {
|
|||
|
||||
if (world == null)
|
||||
{
|
||||
playerMsg("Invalid world name.");
|
||||
playerMsg(sender, "Invalid world name.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -64,7 +63,7 @@ public class Command_setlever extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Target block " + targetBlock + " is not a lever.");
|
||||
playerMsg(sender, "Target block " + targetBlock + " is not a lever.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,14 +8,13 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Set world spawnpoint.", usage = "/<command>")
|
||||
public class Command_setspawnworld extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Location pos = sender_p.getLocation();
|
||||
sender_p.getWorld().setSpawnLocation(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
|
||||
playerMsg("Spawn location for this world set to: " + Utilities.formatLocation(sender_p.getWorld().getSpawnLocation()));
|
||||
playerMsg(sender, "Spawn location for this world set to: " + Utilities.formatLocation(sender_p.getWorld().getSpawnLocation()));
|
||||
|
||||
if (ConfigurationEntry.PROTECTAREA_ENABLED.getBoolean() && ConfigurationEntry.PROTECTAREA_SPAWNPOINTS.getBoolean()) {
|
||||
ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, ConfigurationEntry.PROTECTAREA_RADIUS.getDouble());
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/<command> [playername]")
|
||||
public class Command_smite extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -21,7 +20,7 @@ public class Command_smite extends FreedomCommand {
|
|||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to spectator, or define someone's username to change theirs.", usage = "/<command> [partialname]", aliases = "gmsp")
|
||||
public class Command_spectator extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -48,8 +47,8 @@ public class Command_spectator extends FreedomCommand {
|
|||
|
||||
}
|
||||
|
||||
playerMsg("Setting " + player.getName() + " to game mode 'Spectator'.");
|
||||
playerMsg(player, sender.getName() + " set your game mode to 'Spectator'.");
|
||||
playerMsg(sender, "Setting " + player.getName() + " to game mode 'Spectator'.");
|
||||
playerMsg(player,sender.getName() + " set your game mode to 'Spectator'.");
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Show misc. server info.", usage = "/<command>")
|
||||
public class Command_status extends FreedomCommand {
|
||||
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
|
||||
|
||||
|
@ -24,13 +23,13 @@ public class Command_status extends FreedomCommand {
|
|||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
playerMsg("For information about TotalFreedomMod, try /tfm", ChatColor.GREEN); // Temporary
|
||||
playerMsg(sender, "For information about TotalFreedomMod, try /tfm", ChatColor.GREEN); // Temporary
|
||||
|
||||
playerMsg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.YELLOW);
|
||||
playerMsg("Loaded worlds:", ChatColor.BLUE);
|
||||
playerMsg(sender, "Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.YELLOW);
|
||||
playerMsg(sender, "Loaded worlds:", ChatColor.BLUE);
|
||||
int i = 0;
|
||||
for (World world : server.getWorlds()) {
|
||||
playerMsg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
|
||||
playerMsg(sender, String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [<player> [-s] | list | purge | all]", aliases = "mute")
|
||||
public class Command_stfu extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -17,7 +16,7 @@ public class Command_stfu extends FreedomCommand {
|
|||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("list")) {
|
||||
playerMsg("Muted players:");
|
||||
playerMsg(sender, "Muted players:");
|
||||
PlayerData info;
|
||||
int count = 0;
|
||||
for (Player mp : server.getOnlinePlayers())
|
||||
|
@ -25,13 +24,13 @@ public class Command_stfu extends FreedomCommand {
|
|||
info = PlayerData.getPlayerData(mp);
|
||||
if (info.isMuted())
|
||||
{
|
||||
playerMsg("- " + mp.getName());
|
||||
playerMsg(sender, "- " + mp.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
playerMsg("- none");
|
||||
playerMsg(sender, "- none");
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("purge"))
|
||||
|
@ -48,7 +47,7 @@ public class Command_stfu extends FreedomCommand {
|
|||
count++;
|
||||
}
|
||||
}
|
||||
playerMsg("Unmuted " + count + " players.");
|
||||
playerMsg(sender, "Unmuted " + count + " players.");
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
|
@ -66,7 +65,7 @@ public class Command_stfu extends FreedomCommand {
|
|||
}
|
||||
}
|
||||
|
||||
playerMsg("Muted " + counter + " players.");
|
||||
playerMsg(sender, "Muted " + counter + " players.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -83,7 +82,7 @@ public class Command_stfu extends FreedomCommand {
|
|||
{
|
||||
Utilities.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
|
||||
playerdata.setMuted(false);
|
||||
playerMsg("Unmuted " + player.getName());
|
||||
playerMsg(sender, "Unmuted " + player.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -97,11 +96,11 @@ public class Command_stfu extends FreedomCommand {
|
|||
Command_smite.smite(player);
|
||||
}
|
||||
|
||||
playerMsg("Muted " + player.getName());
|
||||
playerMsg(sender, "Muted " + player.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(player.getName() + " is a superadmin, and can't be muted.");
|
||||
playerMsg(sender, player.getName() + " is a superadmin, and can't be muted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Kicks everyone and stops the server.", usage = "/<command>")
|
||||
public class Command_stop extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
|
|
@ -8,13 +8,12 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to survival, or define someone's username to change theirs.", usage = "/<command> <[partialname] | -a>", aliases = "gms")
|
||||
public class Command_survival extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
playerMsg("When used from the console, you must define a target user to change gamemode on.");
|
||||
playerMsg(sender, "When used from the console, you must define a target user to change gamemode on.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -50,18 +49,18 @@ public class Command_survival extends FreedomCommand {
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Only superadmins can change other user's gamemode.");
|
||||
playerMsg(sender, "Only superadmins can change other user's gamemode.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg("Setting " + player.getName() + " to game mode 'Survival'.");
|
||||
playerMsg(sender, "Setting " + player.getName() + " to game mode 'Survival'.");
|
||||
player.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> <set <tag..> | off | clear <player> | clearall>")
|
||||
public class Command_tag extends FreedomCommand {
|
||||
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]
|
||||
{
|
||||
|
@ -24,13 +23,13 @@ public class Command_tag extends FreedomCommand {
|
|||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 1) {
|
||||
if ("list".equalsIgnoreCase(args[0])) {
|
||||
playerMsg("Tags for all online players:");
|
||||
playerMsg(sender, "Tags for all online players:");
|
||||
|
||||
for (final Player player : server.getOnlinePlayers()) {
|
||||
final PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
if (playerdata.getTag() != null)
|
||||
{
|
||||
playerMsg(player.getName() + ": " + playerdata.getTag());
|
||||
playerMsg(sender, player.getName() + ": " + playerdata.getTag());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +39,7 @@ public class Command_tag extends FreedomCommand {
|
|||
{
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
playerMsg(sender, FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -57,7 +56,7 @@ public class Command_tag extends FreedomCommand {
|
|||
}
|
||||
}
|
||||
|
||||
playerMsg(count + " tag(s) removed.");
|
||||
playerMsg(sender, count + " tag(s) removed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -65,12 +64,12 @@ public class Command_tag extends FreedomCommand {
|
|||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
playerMsg("\"/tag off\" can't be used from the console. Use \"/tag clear <player>\" or \"/tag clearall\" instead.");
|
||||
playerMsg(sender, "\"/tag off\" can't be used from the console. Use \"/tag clear <player>\" or \"/tag clearall\" instead.");
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerData.getPlayerData(sender_p).setTag(null);
|
||||
playerMsg("Your tag has been removed.");
|
||||
playerMsg(sender, "Your tag has been removed.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -86,7 +85,7 @@ public class Command_tag extends FreedomCommand {
|
|||
{
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
playerMsg(sender, FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -94,12 +93,12 @@ public class Command_tag extends FreedomCommand {
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerData.getPlayerData(player).setTag(null);
|
||||
playerMsg("Removed " + player.getName() + "'s tag.");
|
||||
playerMsg(sender, "Removed " + player.getName() + "'s tag.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -122,7 +121,7 @@ public class Command_tag extends FreedomCommand {
|
|||
|
||||
if (rawTag.length() > 20)
|
||||
{
|
||||
playerMsg("That tag is too long (Max is 20 characters).");
|
||||
playerMsg(sender, "That tag is too long (Max is 20 characters).");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -130,14 +129,14 @@ public class Command_tag extends FreedomCommand {
|
|||
{
|
||||
if (rawTag.contains(word))
|
||||
{
|
||||
playerMsg("That tag contains a forbidden word.");
|
||||
playerMsg(sender, "That tag contains a forbidden word.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerData.getPlayerData(sender_p).setTag(outputTag);
|
||||
playerMsg("Tag set to '" + outputTag + "'.");
|
||||
playerMsg(sender, "Tag set to '" + outputTag + "'.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Gives you a tag with random colors", usage = "/<command> <tag>", aliases = "tn")
|
||||
public class Command_tagnyan extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -25,7 +24,7 @@ public class Command_tagnyan extends FreedomCommand {
|
|||
final PlayerData data = PlayerData.getPlayerData(sender_p);
|
||||
data.setTag(tag.toString());
|
||||
|
||||
playerMsg("Set tag to " + tag);
|
||||
playerMsg(sender, "Set tag to " + tag);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Temporarily bans a player for five minutes.", usage = "/<command> <partialname>", aliases = "noob")
|
||||
public class Command_tban extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -22,7 +21,7 @@ public class Command_tban extends FreedomCommand {
|
|||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Date;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]")
|
||||
public class Command_tempban extends FreedomCommand {
|
||||
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||
|
||||
|
@ -28,7 +27,7 @@ public class Command_tempban extends FreedomCommand {
|
|||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.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_tfbanlist extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -30,12 +29,12 @@ public class Command_tfbanlist extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("You do not have permission to purge the ban list, you may only view it.");
|
||||
playerMsg(sender, "You do not have permission to purge the ban list, you may only view it.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg(BanManager.getUuidBanList().size() + " UUID bans total");
|
||||
playerMsg(sender, BanManager.getUuidBanList().size() + " UUID bans total");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
|
||||
public class Command_tfipbanlist extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -31,12 +30,12 @@ public class Command_tfipbanlist extends FreedomCommand {
|
|||
}
|
||||
else
|
||||
{
|
||||
playerMsg("You do not have permission to purge the IP ban list, you may only view it.");
|
||||
playerMsg(sender, "You do not have permission to purge the IP ban list, you may only view it.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg(BanManager.getIpBanList().size() + " IPbans total");
|
||||
playerMsg(sender, BanManager.getIpBanList().size() + " IPbans total");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import java.io.File;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Update server files.", usage = "/<command>")
|
||||
public class Command_tfupdate extends FreedomCommand {
|
||||
public static final String[] FILES =
|
||||
{
|
||||
|
@ -18,12 +17,12 @@ public class Command_tfupdate extends FreedomCommand {
|
|||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (FILES.length == 0) {
|
||||
playerMsg("This command is disabled.");
|
||||
playerMsg(sender, "This command is disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.getName().equalsIgnoreCase("madgeek1450")) {
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
playerMsg(sender, FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,67 +9,66 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Toggles TotalFreedomMod settings", usage = "/<command> [option] [value] [value]")
|
||||
public class Command_toggle extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
playerMsg("Available toggles: ");
|
||||
playerMsg("- waterplace");
|
||||
playerMsg("- fireplace");
|
||||
playerMsg("- lavaplace");
|
||||
playerMsg("- fluidspread");
|
||||
playerMsg("- lavadmg");
|
||||
playerMsg("- firespread");
|
||||
playerMsg("- prelog");
|
||||
playerMsg("- lockdown");
|
||||
playerMsg("- petprotect");
|
||||
playerMsg("- droptoggle");
|
||||
playerMsg("- nonuke");
|
||||
playerMsg("- explosives");
|
||||
playerMsg(sender, "Available toggles: ");
|
||||
playerMsg(sender, "- waterplace");
|
||||
playerMsg(sender, "- fireplace");
|
||||
playerMsg(sender, "- lavaplace");
|
||||
playerMsg(sender, "- fluidspread");
|
||||
playerMsg(sender, "- lavadmg");
|
||||
playerMsg(sender, "- firespread");
|
||||
playerMsg(sender, "- prelog");
|
||||
playerMsg(sender, "- lockdown");
|
||||
playerMsg(sender, "- petprotect");
|
||||
playerMsg(sender, "- droptoggle");
|
||||
playerMsg(sender, "- nonuke");
|
||||
playerMsg(sender, "- explosives");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("waterplace"))
|
||||
{
|
||||
toggle("Water placement is", ConfigurationEntry.ALLOW_WATER_PLACE);
|
||||
toggle(sender, "Water placement is", ConfigurationEntry.ALLOW_WATER_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("fireplace"))
|
||||
{
|
||||
toggle("Fire placement is", ConfigurationEntry.ALLOW_FIRE_PLACE);
|
||||
toggle(sender, "Fire placement is", ConfigurationEntry.ALLOW_FIRE_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lavaplace"))
|
||||
{
|
||||
toggle("Lava placement is", ConfigurationEntry.ALLOW_LAVA_PLACE);
|
||||
toggle(sender, "Lava placement is", ConfigurationEntry.ALLOW_LAVA_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("fluidspread"))
|
||||
{
|
||||
toggle("Fluid spread is", ConfigurationEntry.ALLOW_FLUID_SPREAD);
|
||||
toggle(sender, "Fluid spread is", ConfigurationEntry.ALLOW_FLUID_SPREAD);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lavadmg"))
|
||||
{
|
||||
toggle("Lava damage is", ConfigurationEntry.ALLOW_LAVA_DAMAGE);
|
||||
toggle(sender, "Lava damage is", ConfigurationEntry.ALLOW_LAVA_DAMAGE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("firespread"))
|
||||
{
|
||||
toggle("Fire spread is", ConfigurationEntry.ALLOW_FIRE_SPREAD);
|
||||
toggle(sender, "Fire spread is", ConfigurationEntry.ALLOW_FIRE_SPREAD);
|
||||
GameRuleHandler.setGameRule(TFM_GameRule.DO_FIRE_TICK, ConfigurationEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("prelog"))
|
||||
{
|
||||
toggle("Command prelogging is", ConfigurationEntry.ENABLE_PREPROCESS_LOG);
|
||||
toggle(sender, "Command prelogging is", ConfigurationEntry.ENABLE_PREPROCESS_LOG);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -82,13 +81,13 @@ public class Command_toggle extends FreedomCommand {
|
|||
|
||||
if (args[0].equals("petprotect"))
|
||||
{
|
||||
toggle("Tamed pet protection is", ConfigurationEntry.ENABLE_PET_PROTECT);
|
||||
toggle(sender,"Tamed pet protection is", ConfigurationEntry.ENABLE_PET_PROTECT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("droptoggle"))
|
||||
{
|
||||
toggle("Automatic entity wiping is", ConfigurationEntry.AUTO_ENTITY_WIPE);
|
||||
toggle(sender,"Automatic entity wiping is", ConfigurationEntry.AUTO_ENTITY_WIPE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -116,12 +115,12 @@ public class Command_toggle extends FreedomCommand {
|
|||
}
|
||||
}
|
||||
|
||||
toggle("Nuke monitor is", ConfigurationEntry.NUKE_MONITOR_ENABLED);
|
||||
toggle(sender,"Nuke monitor is", ConfigurationEntry.NUKE_MONITOR_ENABLED);
|
||||
|
||||
if (ConfigurationEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||
{
|
||||
playerMsg("Anti-freecam range is set to " + ConfigurationEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
playerMsg("Block throttle rate is set to " + ConfigurationEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
playerMsg(sender, "Anti-freecam range is set to " + ConfigurationEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
playerMsg(sender, "Block throttle rate is set to " + ConfigurationEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -136,16 +135,16 @@ public class Command_toggle extends FreedomCommand {
|
|||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage());
|
||||
playerMsg(sender, ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
toggle("Explosions are", ConfigurationEntry.ALLOW_EXPLOSIONS);
|
||||
toggle(sender,"Explosions are", ConfigurationEntry.ALLOW_EXPLOSIONS);
|
||||
|
||||
if (ConfigurationEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
playerMsg("Radius set to " + ConfigurationEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
playerMsg(sender, "Radius set to " + ConfigurationEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -153,8 +152,8 @@ public class Command_toggle extends FreedomCommand {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void toggle(String name, ConfigurationEntry entry)
|
||||
private void toggle(CommandSender sender, String name, ConfigurationEntry entry)
|
||||
{
|
||||
playerMsg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
playerMsg(sender, name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,11 @@ import org.bukkit.entity.EntityType;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Throw a mob in the direction you are facing when you left click with a stick.",
|
||||
usage = "/<command> <mobtype [speed] | off | list>")
|
||||
public class Command_tossmob extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.TOSSMOB_ENABLED.getBoolean()) {
|
||||
playerMsg("Tossmob is currently disabled.");
|
||||
playerMsg(sender, "Tossmob is currently disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -30,13 +28,13 @@ public class Command_tossmob extends FreedomCommand {
|
|||
if ("off".equals(args[0]))
|
||||
{
|
||||
playerData.disableMobThrower();
|
||||
playerMsg("MobThrower is disabled.", ChatColor.GREEN);
|
||||
playerMsg(sender, "MobThrower is disabled.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
playerMsg("Supported mobs: " + StringUtils.join(Utilities.mobtypes.keySet(), ", "), ChatColor.GREEN);
|
||||
playerMsg(sender, "Supported mobs: " + StringUtils.join(Utilities.mobtypes.keySet(), ", "), ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -46,8 +44,8 @@ public class Command_tossmob extends FreedomCommand {
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
playerMsg(args[0] + " is not a supported mob type. Using a pig instead.", ChatColor.RED);
|
||||
playerMsg("By the way, you can type /tossmob list to see all possible mobs.", ChatColor.RED);
|
||||
playerMsg(sender, args[0] + " is not a supported mob type. Using a pig instead.", ChatColor.RED);
|
||||
playerMsg(sender, "By the way, you can type /tossmob list to see all possible mobs.", ChatColor.RED);
|
||||
creature = EntityType.PIG;
|
||||
}
|
||||
}
|
||||
|
@ -74,9 +72,9 @@ public class Command_tossmob extends FreedomCommand {
|
|||
}
|
||||
|
||||
playerData.enableMobThrower(creature, speed);
|
||||
playerMsg("MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".", ChatColor.GREEN);
|
||||
playerMsg("Left click while holding a " + Material.BONE.toString() + " to throw mobs!", ChatColor.GREEN);
|
||||
playerMsg("Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN);
|
||||
playerMsg(sender, "MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".", ChatColor.GREEN);
|
||||
playerMsg(sender, "Left click while holding a " + Material.BONE.toString() + " to throw mobs!", ChatColor.GREEN);
|
||||
playerMsg(sender, "Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN);
|
||||
|
||||
sender_p.setItemInHand(new ItemStack(Material.BONE, 1));
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Pretty rainbow trails.", usage = "/<command> [off]")
|
||||
public class Command_trail extends FreedomCommand {
|
||||
private static Listener movementListener = null;
|
||||
private static final List<Player> trailPlayers = new ArrayList<Player>();
|
||||
|
@ -30,14 +29,14 @@ public class Command_trail extends FreedomCommand {
|
|||
if (args.length > 0 && "off".equals(args[0])) {
|
||||
trailPlayers.remove(sender_p);
|
||||
|
||||
playerMsg("Trail disabled.");
|
||||
playerMsg(sender, "Trail disabled.");
|
||||
} else {
|
||||
if (!trailPlayers.contains(sender_p))
|
||||
{
|
||||
trailPlayers.add(sender_p);
|
||||
}
|
||||
|
||||
playerMsg("Trail enabled. Use \"/trail off\" to disable.");
|
||||
playerMsg(sender, "Trail enabled. Use \"/trail off\" to disable.");
|
||||
}
|
||||
|
||||
if (!trailPlayers.isEmpty())
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.bukkit.command.CommandSender;
|
|||
import java.util.*;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Provides uuid tools", usage = "/<command> <purge | recalculate>")
|
||||
public class Command_uuid extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
@ -21,13 +20,13 @@ public class Command_uuid extends FreedomCommand {
|
|||
}
|
||||
|
||||
if ("purge".equals(args[0])) {
|
||||
playerMsg("Purged " + UUIDManager.purge() + " cached UUIDs.");
|
||||
playerMsg(sender, "Purged " + UUIDManager.purge() + " cached UUIDs.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("recalculate".equals(args[0]))
|
||||
{
|
||||
playerMsg("Recalculating UUIDs...");
|
||||
playerMsg(sender, "Recalculating UUIDs...");
|
||||
|
||||
// Playerlist uuids
|
||||
final Set<Player> players = PlayerList.getAllPlayers();
|
||||
|
@ -62,7 +61,7 @@ public class Command_uuid extends FreedomCommand {
|
|||
}
|
||||
}
|
||||
|
||||
playerMsg("Recalculated " + updated + " player UUIDs");
|
||||
playerMsg(sender, "Recalculated " + updated + " player UUIDs");
|
||||
names.clear();
|
||||
|
||||
// Adminlist UUIDs
|
||||
|
@ -96,7 +95,7 @@ public class Command_uuid extends FreedomCommand {
|
|||
}
|
||||
}
|
||||
|
||||
playerMsg("Recalculated " + updated + " admin UUIDs");
|
||||
playerMsg(sender, "Recalculated " + updated + " admin UUIDs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue