From e31aea34923f3ac1f46dec96f71e67d2c60796fa Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 28 Feb 2012 11:05:48 -0800 Subject: [PATCH] Beginning work on mcremove --- Changelog.txt | 1 + .../gmail/nossr50/commands/mc/Mcremove.java | 52 +++++++++++++++++++ .../gmail/nossr50/config/LoadProperties.java | 3 +- .../java/com/gmail/nossr50/mcPermissions.java | 3 ++ src/main/resources/config.yml | 2 + src/main/resources/plugin.yml | 2 + 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/gmail/nossr50/commands/mc/Mcremove.java diff --git a/Changelog.txt b/Changelog.txt index 3b65bf0ea..cd4a3b91f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -19,6 +19,7 @@ Version 1.3.00-dev + Added size limit to Tree Feller in config as Tree Feller Threshold + Added /addlevels command + Added config values for XP multipliers for different hostile mobs + + Added mcremove commands + Re-added mcMMO reporting damage events = Fixed bug where Swords command showed Bleed Length twice instead of Bleed Chance = Fixed bug where Tree Feller wasn't checking for Tree Feller permission diff --git a/src/main/java/com/gmail/nossr50/commands/mc/Mcremove.java b/src/main/java/com/gmail/nossr50/commands/mc/Mcremove.java new file mode 100644 index 000000000..21416a68d --- /dev/null +++ b/src/main/java/com/gmail/nossr50/commands/mc/Mcremove.java @@ -0,0 +1,52 @@ +package com.gmail.nossr50.commands.mc; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.locale.mcLocale; + +public class Mcremove implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + Player player = null; + + if (sender instanceof Player) { + player = (Player) sender; + } + + if (player != null && !mcPermissions.getInstance().mcremove(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + if (!LoadProperties.mcremoveEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + if(args.length == 1) + { + sender.sendMessage("Correct usage is /mcremove [Player Name]"); + } + + //If the server is using MySQL + if(LoadProperties.useMySQL) + { + + } else { + + } + + return true; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 088bce2c3..a252c7f9e 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -42,7 +42,7 @@ public class LoadProperties { xplockEnable, xpbar, xpicon, partybar, xprateEnable, spoutEnabled, donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, - whoisEnable, mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable, + whoisEnable, mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable, mcremoveEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, addlevelsEnable, mcrefreshEnable, aEnable, pEnable, enableMotd, enableMySpawn, enableCobbleToMossy, useMySQL, toolsLoseDurabilityFromAbilities, @@ -409,6 +409,7 @@ public class LoadProperties { mcgodEnable = readBoolean("Commands.mcgod.Enabled", true); mcstatsEnable = readBoolean("Commands.mcstats.Enabled", true); mmoeditEnable = readBoolean("Commands.mmoedit.Enabled", true); + mcremoveEnable = readBoolean("Commands.mcremove.Enable", true); ptpEnable = readBoolean("Commands.ptp.Enabled", true); partyEnable = readBoolean("Commands.party.Enabled", true); myspawnEnable = readBoolean("Commands.myspawn.Enabled", true); diff --git a/src/main/java/com/gmail/nossr50/mcPermissions.java b/src/main/java/com/gmail/nossr50/mcPermissions.java index a3b93278b..f969f1738 100644 --- a/src/main/java/com/gmail/nossr50/mcPermissions.java +++ b/src/main/java/com/gmail/nossr50/mcPermissions.java @@ -31,6 +31,9 @@ public class mcPermissions public boolean mcrefresh(Player player) { return player.hasPermission("mcmmo.tools.mcrefresh"); } + public boolean mcremove(Player player) { + return player.hasPermission("mcmmo.tools.mcremove"); + } public boolean mmoedit(Player player) { return player.hasPermission("mcmmo.tools.mmoedit"); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3b19e82dc..2dfb7c374 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1126,6 +1126,8 @@ Commands: Enabled: true mcc: Enabled: true + mcremove: + Enabled: true mmoedit: Enabled: true accept: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 20bf18c39..fc975514b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -38,6 +38,8 @@ commands: permission: mcmmo.tools.mcgod mcstats: description: Shows your mcMMO stats and xp + mcremove: + description: Remove a user from the database mmoedit: description: Edit the skill values for a user permission: mcmmo.tools.mmoedit