Browse Source

Beginning work on mcremove

nossr50 13 years ago
parent
commit
e31aea3492

+ 1 - 0
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

+ 52 - 0
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;
+    }
+}

+ 2 - 1
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);

+ 3 - 0
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");
     }

+ 2 - 0
src/main/resources/config.yml

@@ -1126,6 +1126,8 @@ Commands:
         Enabled: true
     mcc:
         Enabled: true
+    mcremove:
+        Enabled: true
     mmoedit:
         Enabled: true
     accept:

+ 2 - 0
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