Fixed exploit that allows command blocker to be bypassed.

This commit is contained in:
StevenLawson 2014-07-17 17:28:32 -04:00
parent f635af5f95
commit 3ccab5f534
3 changed files with 23 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
@ -44,6 +45,11 @@ public class Command_cbtool extends TFM_Command
}
matcher.appendTail(generatedCommand);
if (TFM_CommandBlocker.isCommandBlocked(generatedCommand.toString(), sender, false))
{
return true;
}
server.dispatchCommand(sender, generatedCommand.toString());
}
catch (SubCommandFailureException ex)

View File

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -68,6 +69,13 @@ public class Command_nf extends TFM_Command
}
String newCommand = StringUtils.join(outputCommand, " ");
if (TFM_CommandBlocker.isCommandBlocked(newCommand, sender))
{
// CommandBlocker handles messages and broadcasts
return true;
}
sender.sendMessage("Sending command: \"" + newCommand + "\".");
server.dispatchCommand(sender, newCommand);

View File

@ -1,5 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -39,11 +40,17 @@ public class Command_wildcard extends TFM_Command
return true;
}
String base_command = StringUtils.join(args, " ");
String baseCommand = StringUtils.join(args, " ");
if (TFM_CommandBlocker.isCommandBlocked(baseCommand, sender))
{
// CommandBlocker handles messages and broadcasts
return true;
}
for (Player player : server.getOnlinePlayers())
{
String out_command = base_command.replaceAll("\\x3f", player.getName());
String out_command = baseCommand.replaceAll("\\x3f", player.getName());
playerMsg("Running Command: " + out_command);
server.dispatchCommand(sender, out_command);
}