Permalink
Browse files

CraftIRC 2.0 Preview 5, limit console command usage to those in conso…

…le-commands[]
  • Loading branch information...
1 parent d1923f6 commit 75aaa80869a1a66c6dd8852988d087d4ccf6e3ce @Animosity committed Mar 2, 2011
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
@@ -53,7 +53,7 @@
public static final String NAME = "CraftIRC";
public static String VERSION;
protected static final Logger log = Logger.getLogger("Minecraft");
- protected static List<String> defaultConsoleCommands = Arrays.asList("kick", "ban", "pardon", "ban-ip",
+ public static List<String> defaultConsoleCommands = Arrays.asList("kick", "ban", "pardon", "ban-ip",
"pardon-ip", "op", "deop", "tp", "give", "tell", "stop", "save-all", "save-off", "save-on", "say");
//Misc class attributes
@@ -290,7 +290,7 @@ public void onMessage(String channel, String sender, String login, String hostna
}
if (ignores.contains(sender))
return;
-
+
try {
String[] splitMessage = message.split(" ");
String command = Util.combineSplit(1, splitMessage, " ");
@@ -507,8 +507,10 @@ public boolean userAuthorized(String channel, String user) {
*/
private boolean routeCommand(String fullCommand, RelayedMessage ircConCmd) {
String rootCommand = fullCommand.split(" ")[0];
- if (this.plugin.cConsoleCommands().contains(rootCommand)
- && this.plugin.defaultConsoleCommands.contains(rootCommand)) {
+ if (!this.plugin.defaultConsoleCommands.contains(rootCommand))
+ return false;
+
+ if (this.plugin.cConsoleCommands().contains(rootCommand)) {
if (this.plugin.isDebug()) {
CraftIRC.log.info(String.format(CraftIRC.NAME + " Minebot routeCommand(default) fullCommand=" + fullCommand
+ " -- rootCommand=" + rootCommand));
View
@@ -57,6 +57,7 @@ settings:
#Custom blocks define custom variables you can use within formatting strings
botname: ''
network: ''
+
# Optional: Bind to a non-default local address
# bind-address: 127.0.0.1
View
@@ -1,6 +1,6 @@
name: CraftIRC
main: com.ensifera.animosity.craftirc.CraftIRC
-version: 2.0 Preview 4
+version: 2.0 Preview 5
commands:
irc:
description: Sends a message to all IRC channels

0 comments on commit 75aaa80

Please sign in to comment.