From f7393a85c469c609473260e687a65c25449abc34 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sun, 2 Dec 2012 12:05:54 -0500 Subject: [PATCH] plugin.yml cleanup, going to do a better job of this later on (have it auto-generate the description, usage, and alias from the @CommandPermissions). Cleanup TFM main class. Added /listsync for associate servers. Added config.yml based host_sender_names list. --- src/config.yml | 6 +++ .../Commands/CommandPermissions.java | 2 +- .../Commands/Command_adminmode.java | 2 +- .../Commands/Command_kicknoob.java | 2 +- .../Commands/Command_list.java | 2 +- .../Commands/Command_listsync.java | 43 +++++++++++++++++++ .../Commands/Command_lockup.java | 2 +- .../Commands/Command_nonuke.java | 2 +- .../Commands/Command_onlinemode.java | 2 +- .../Commands/Command_permban.java | 2 +- .../Commands/Command_prelog.java | 2 +- .../Commands/Command_rawsay.java | 2 +- .../TotalFreedomMod/Commands/Command_ro.java | 2 +- .../TotalFreedomMod/Commands/Command_say.java | 2 +- .../Commands/Command_terminal.java | 2 +- .../Commands/Command_wipeflatlands.java | 2 +- .../Commands/Command_ziptool.java | 2 +- .../TotalFreedomMod/Commands/TFM_Command.java | 6 +-- .../TotalFreedomMod/TFM_Util.java | 40 ++++++----------- .../TotalFreedomMod/TotalFreedomMod.java | 38 ++++++++-------- src/plugin.yml | 15 ++++--- 21 files changed, 110 insertions(+), 68 deletions(-) create mode 100644 src/me/StevenLawson/TotalFreedomMod/Commands/Command_listsync.java diff --git a/src/config.yml b/src/config.yml index 83a5c78f..355ff44f 100644 --- a/src/config.yml +++ b/src/config.yml @@ -58,3 +58,9 @@ admin_only_mode: false protected_areas_enabled: true auto_protect_spawnpoints: true auto_protect_radius: 25.0 + +# Host Sender Names - Names that indicate automated services or host-based consoles you want to block from using some commands. +# Make sure these are all lower-case. +host_sender_names: + - rcon + - remotebukkit diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/CommandPermissions.java b/src/me/StevenLawson/TotalFreedomMod/Commands/CommandPermissions.java index 9206e353..cf08067a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/CommandPermissions.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/CommandPermissions.java @@ -10,7 +10,7 @@ public @interface CommandPermissions SOURCE_TYPE_ALLOWED source(); - boolean block_web_console() default false; + boolean block_host_console() default false; boolean ignore_permissions() default true; } diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminmode.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminmode.java index 30b6377e..3c74ab1b 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminmode.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminmode.java @@ -7,7 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_adminmode extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_kicknoob.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_kicknoob.java index 95e06bba..33a2b2b4 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_kicknoob.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_kicknoob.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.BOTH, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.BOTH, block_host_console = true, ignore_permissions = false) public class Command_kicknoob extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java index efd7fadf..0706c7c6 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java @@ -16,7 +16,7 @@ public class Command_list extends TFM_Command @Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - if (TFM_Util.isFromClanforge(sender.getName())) + if (TFM_Util.isFromHostConsole(sender.getName())) { List player_names = new ArrayList(); for (Player p : server.getOnlinePlayers()) diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_listsync.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_listsync.java new file mode 100644 index 00000000..7187a6be --- /dev/null +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_listsync.java @@ -0,0 +1,43 @@ +package me.StevenLawson.TotalFreedomMod.Commands; + +import java.io.File; +import me.StevenLawson.TotalFreedomMod.TFM_Log; +import me.StevenLawson.TotalFreedomMod.TFM_Util; +import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) +public class Command_listsync extends TFM_Command +{ + @Override + public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + TFM_Util.adminAction(sender.getName(), "Downloading superadmin and permban lists from primary TotalFreedom server.", false); + + try + { + TFM_Util.downloadFile("http://madgeekonline.com/apps/get_superadmins_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE)); + TotalFreedomMod.loadSuperadminConfig(); + TFM_Util.adminAction(sender.getName(), TotalFreedomMod.SUPERADMIN_FILE + " downloaded.", false); + } + catch (Exception ex) + { + TFM_Log.severe(ex); + } + + try + { + TFM_Util.downloadFile("http://madgeekonline.com/apps/get_permbans_raw.php", new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILE)); + TotalFreedomMod.loadPermbanConfig(); + TFM_Util.adminAction(sender.getName(), TotalFreedomMod.PERMBAN_FILE + " downloaded.", false); + } + catch (Exception ex) + { + TFM_Log.severe(ex); + } + + return true; + } +} diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_lockup.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_lockup.java index 71b435e7..62793b0f 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_lockup.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_lockup.java @@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_lockup extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nonuke.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nonuke.java index cf2cd481..73c1570c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nonuke.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nonuke.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_nonuke extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java index 639ba39f..6a36ba61 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java @@ -8,7 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_onlinemode extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_permban.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_permban.java index 4a74d547..84c25861 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_permban.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_permban.java @@ -8,7 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_permban extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_prelog.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_prelog.java index 048dfae9..8786c1a1 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_prelog.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_prelog.java @@ -5,7 +5,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_prelog extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_rawsay.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_rawsay.java index 13c143fd..5a5df00c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_rawsay.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_rawsay.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_rawsay extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ro.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ro.java index d496f4ba..828b85ff 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ro.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ro.java @@ -7,7 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, block_web_console = false, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, block_host_console = false, ignore_permissions = false) public class Command_ro extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_say.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_say.java index 5ba41305..0fc50384 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_say.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_say.java @@ -20,7 +20,7 @@ public class Command_say extends TFM_Command String message = StringUtils.join(args, " "); - if (senderIsConsole && TFM_Util.isFromClanforge(sender.getName())) + if (senderIsConsole && TFM_Util.isFromHostConsole(sender.getName())) { if (message.equalsIgnoreCase("WARNING: Server is restarting, you will be kicked")) { diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_terminal.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_terminal.java index 5ac1dbb0..2e1a9968 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_terminal.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_terminal.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_terminal extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_wipeflatlands.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_wipeflatlands.java index 0acfe4a8..07a6fbcd 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_wipeflatlands.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_wipeflatlands.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_wipeflatlands extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ziptool.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ziptool.java index 574050a4..1e8c906c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ziptool.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_ziptool.java @@ -8,7 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false) +@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_host_console = true, ignore_permissions = false) public class Command_ziptool extends TFM_Command { @Override diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java b/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java index 470a2663..25b9d3d9 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java @@ -53,9 +53,9 @@ public class TFM_Command ADMIN_LEVEL level = permissions.level(); SOURCE_TYPE_ALLOWED source = permissions.source(); - boolean block_web_console = permissions.block_web_console(); + boolean block_web_console = permissions.block_host_console(); - //TFM_Log.info("Level: " + level + ", Source: " + source + ", BWC: " + block_web_console); + //TFM_Log.info("Level: " + level + ", Source: " + source + ", BWC: " + block_host_console); Player sender_p = null; if (sender instanceof Player) @@ -73,7 +73,7 @@ public class TFM_Command { return false; } - else if (block_web_console && TFM_Util.isFromClanforge(sender.getName())) + else if (block_web_console && TFM_Util.isFromHostConsole(sender.getName())) { return false; } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java index cfe900a2..f2b99b7c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java @@ -2,6 +2,9 @@ package me.StevenLawson.TotalFreedomMod; import java.io.*; import java.net.URI; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -26,7 +29,6 @@ public class TFM_Util private static final Map eject_tracker = new HashMap(); public static final Map mobtypes = new HashMap(); public static final List stop_commands = Arrays.asList("stop", "off", "end", "halt", "die"); - public static final List restricted_senders = Arrays.asList("rcon", "remotebukkit"); static { @@ -904,9 +906,9 @@ public class TFM_Util } } - public static boolean isFromClanforge(String sender_name) + public static boolean isFromHostConsole(String sender_name) { - return restricted_senders.contains(sender_name.toLowerCase()); + return TotalFreedomMod.host_sender_names.contains(sender_name.toLowerCase()); } public static List removeDuplicates(List old_list) @@ -987,27 +989,13 @@ public class TFM_Util return affected; } -// I wrote all this before i discovered getTargetBlock >.> - might come in handy some day... -// public static final double LOOKAT_VIEW_HEIGHT = 1.65; -// public static final double LOOKAT_STEP_DISTANCE = 0.2; -// -// public static Location getLookatLocation(Player player) -// { -// Location player_loc = player.getLocation(); -// -// Vector player_pos = player_loc.toVector().add(new Vector(0.0, LOOKAT_VIEW_HEIGHT, 0.0)); -// Vector player_dir = player_loc.getDirection().normalize(); -// -// for (double offset = 0.0; offset <= 300.0; offset += LOOKAT_STEP_DISTANCE) -// { -// Location check_loc = player_pos.clone().add(player_dir.clone().multiply(offset)).toLocation(player.getWorld()); -// -// if (!check_loc.getBlock().isEmpty()) -// { -// return check_loc; -// } -// } -// -// return null; -// } + + public static void downloadFile(String url, File output_file) throws Exception + { + URL website = new URL(url); + ReadableByteChannel rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(output_file); + fos.getChannel().transferFrom(rbc, 0, 1 << 24); + fos.close(); + } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java index 1d4b936e..49fc5e55 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java @@ -24,7 +24,7 @@ import org.bukkit.plugin.java.JavaPlugin; public class TotalFreedomMod extends JavaPlugin { - private final Server server = Bukkit.getServer(); + public static final Server server = Bukkit.getServer(); public static final long HEARTBEAT_RATE = 5L; //Seconds @@ -72,12 +72,6 @@ public class TotalFreedomMod extends JavaPlugin registerEventHandlers(); - server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L); - - TFM_Log.info("Plugin Enabled - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon"); - - TFM_Util.deleteFolder(new File("./_deleteme")); - if (generateFlatlands) { TFM_Util.wipeFlatlandsIfFlagged(); @@ -100,6 +94,12 @@ public class TotalFreedomMod extends JavaPlugin TFM_ProtectedArea.loadProtectedAreas(); TFM_ProtectedArea.autoAddSpawnpoints(); } + + TFM_Util.deleteFolder(new File("./_deleteme")); + + server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L); + + TFM_Log.info("Plugin Enabled - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon"); } @Override @@ -207,13 +207,14 @@ public class TotalFreedomMod extends JavaPlugin public static boolean protectedAreasEnabled = true; public static boolean autoProtectSpawnpoints = true; public static double autoProtectRadius = 25.0D; + public static List host_sender_names = Arrays.asList("rcon", "remotebukkit"); - public void loadMainConfig() + public static void loadMainConfig() { try { - TFM_Util.createDefaultConfiguration(CONFIG_FILE, getFile()); - FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), CONFIG_FILE)); + TFM_Util.createDefaultConfiguration(CONFIG_FILE, plugin_file); + FileConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), CONFIG_FILE)); allowFirePlace = config.getBoolean("allow_fire_place", allowFirePlace); allowFireSpread = config.getBoolean("allow_fire_spread", allowFireSpread); @@ -247,6 +248,7 @@ public class TotalFreedomMod extends JavaPlugin protectedAreasEnabled = config.getBoolean("protected_areas_enabled", protectedAreasEnabled); autoProtectSpawnpoints = config.getBoolean("auto_protect_spawnpoints", autoProtectSpawnpoints); autoProtectRadius = config.getDouble("auto_protect_radius", autoProtectRadius); + host_sender_names = config.getStringList("host_sender_names"); } catch (Exception ex) { @@ -259,7 +261,7 @@ public class TotalFreedomMod extends JavaPlugin @Deprecated public static List superadmin_ips = new ArrayList(); - public void loadSuperadminConfig() + public static void loadSuperadminConfig() { try { @@ -278,12 +280,12 @@ public class TotalFreedomMod extends JavaPlugin public static List permbanned_players = new ArrayList(); public static List permbanned_ips = new ArrayList(); - public void loadPermbanConfig() + public static void loadPermbanConfig() { try { - TFM_Util.createDefaultConfiguration(PERMBAN_FILE, getFile()); - FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), PERMBAN_FILE)); + TFM_Util.createDefaultConfiguration(PERMBAN_FILE, plugin_file); + FileConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), PERMBAN_FILE)); permbanned_players = new ArrayList(); permbanned_ips = new ArrayList(); @@ -292,7 +294,7 @@ public class TotalFreedomMod extends JavaPlugin { permbanned_players.add(user.toLowerCase().trim()); - List user_ips = (List) config.getStringList(user); + List user_ips = config.getStringList(user); for (String ip : user_ips) { ip = ip.toLowerCase().trim(); @@ -309,7 +311,7 @@ public class TotalFreedomMod extends JavaPlugin } } - private void registerEventHandlers() + private static void registerEventHandlers() { PluginManager pm = server.getPluginManager(); @@ -319,14 +321,14 @@ public class TotalFreedomMod extends JavaPlugin pm.registerEvents(new TFM_WeatherListener(), plugin); } - private void setAppProperties() + private static void setAppProperties() { try { InputStream in; Properties props = new Properties(); - in = getClass().getResourceAsStream("/appinfo.properties"); + in = plugin.getClass().getResourceAsStream("/appinfo.properties"); props.load(in); in.close(); diff --git a/src/plugin.yml b/src/plugin.yml index caba8958..583625af 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -38,7 +38,7 @@ commands: description: Fill nearby dispensers with a set of items of your choice. usage: / doom: - description: Owner command - For the bad Superadmins. + description: Senior Command - For the bad Superadmins. usage: / enchant: description: Enchant items. @@ -98,11 +98,14 @@ commands: description: Lists the real names of all online players. usage: / aliases: [who] + listsync: + description: Senior Command - Download the superadmin and permban lists from the main TotalFreedom server. + usave: / lockup: description: Console command - Block target's minecraft input. This is evil, and I never should have wrote it. usage: / on | off>> moblimiter: - description: Owner command - Controll mob rezzing parameters. + description: Senior Command - Control mob rezzing parameters. usage: / |dragon|giant|ghast|slime> mp: description: Purge all mobs in all worlds. @@ -159,7 +162,7 @@ commands: description: Shows your rank. usage: / rawsay: - description: Owner Command - Broadcasts the given message with no extra formatting. + description: Senior Command - Broadcasts the given message with no extra formatting. usage: / rd: description: Superadmin command - Remove various server entities that may cause lag, such as dropped items, minecarts, and boats. @@ -168,7 +171,7 @@ commands: description: Superadmin Command - Remove all blocks of a certain type in the radius of certain players. usage: / [radius (default=50)] [player] saconfig: - description: Owner command - Manage superadmins. + description: Senior Command - Manage superadmins. usage: / > say: description: Broadcasts the given message as the console, includes sender name. @@ -226,8 +229,8 @@ commands: description: Superadmin command - Run any command on all users, username placeholder = ?. usage: / [fluff] ? [fluff] ? wipeflatlands: - description: Owner command - Wipe the flatlands map. Requires manual restart after command is used. + description: Senior Command - Wipe the flatlands map. Requires manual restart after command is used. usage: / # ziptool: -# description: Owner command - Zip and unzip files. +# description: Senior Command - Zip and unzip files. # usage: / > | >