Fixed the command blocker

This commit is contained in:
Garbage Mule
2011-06-05 07:24:56 +02:00
parent 09ff211987
commit eadcaa682b
4 changed files with 11 additions and 7 deletions
BIN
View File
Binary file not shown.
@@ -24,7 +24,10 @@ public class MADisabledCommands extends PlayerListener
if (!ArenaManager.playerSet.contains(p)) if (!ArenaManager.playerSet.contains(p))
return; return;
if (!Arrays.asList(plugin.DISABLED_COMMANDS).contains(event.getMessage().substring(1))) String[] args = event.getMessage().split(" ");
if (!plugin.DISABLED_COMMANDS.contains(event.getMessage().substring(1).trim()) &&
!plugin.DISABLED_COMMANDS.contains(args[0]))
return; return;
event.setCancelled(true); event.setCancelled(true);
+5 -5
View File
@@ -245,7 +245,7 @@ public class MAUtils
return new Configuration(configFile); return new Configuration(configFile);
} }
public static String[] getDisabledCommands() public static List<String> getDisabledCommands()
{ {
Configuration c = ArenaManager.config; Configuration c = ArenaManager.config;
c.load(); c.load();
@@ -254,11 +254,11 @@ public class MAUtils
c.setProperty("disabledcommands", commands); c.setProperty("disabledcommands", commands);
c.save(); c.save();
String[] result = commands.split(","); List<String> result = new LinkedList<String>();
for (int i = 0; i < result.length; i++) for (String s : commands.split(","))
{ {
result[i] = result[i].trim(); System.out.println(s.trim());
System.out.println(result[i]); result.add(s.trim());
} }
return result; return result;
+2 -1
View File
@@ -1,5 +1,6 @@
package com.garbagemule.MobArena; package com.garbagemule.MobArena;
import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Priority;
@@ -23,7 +24,7 @@ public class MobArena extends JavaPlugin
"ready", "notready", "enabled", "force", "config", "setwarp", "ready", "notready", "enabled", "force", "config", "setwarp",
"addspawn", "delspawn", "setregion", "expandregion", "protect", "addspawn", "delspawn", "setregion", "expandregion", "protect",
"undo", "dooooo", "reset"}; "undo", "dooooo", "reset"};
public String[] DISABLED_COMMANDS; public List<String> DISABLED_COMMANDS;
public MobArena() public MobArena()
{ {