mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Fixed exploit that allows command blocker to be bypassed.
This commit is contained in:
parent
f635af5f95
commit
3ccab5f534
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||||
@ -44,6 +45,11 @@ public class Command_cbtool extends TFM_Command
|
|||||||
}
|
}
|
||||||
matcher.appendTail(generatedCommand);
|
matcher.appendTail(generatedCommand);
|
||||||
|
|
||||||
|
if (TFM_CommandBlocker.isCommandBlocked(generatedCommand.toString(), sender, false))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
server.dispatchCommand(sender, generatedCommand.toString());
|
server.dispatchCommand(sender, generatedCommand.toString());
|
||||||
}
|
}
|
||||||
catch (SubCommandFailureException ex)
|
catch (SubCommandFailureException ex)
|
||||||
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -68,6 +69,13 @@ public class Command_nf extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
String newCommand = StringUtils.join(outputCommand, " ");
|
String newCommand = StringUtils.join(outputCommand, " ");
|
||||||
|
|
||||||
|
if (TFM_CommandBlocker.isCommandBlocked(newCommand, sender))
|
||||||
|
{
|
||||||
|
// CommandBlocker handles messages and broadcasts
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
sender.sendMessage("Sending command: \"" + newCommand + "\".");
|
sender.sendMessage("Sending command: \"" + newCommand + "\".");
|
||||||
server.dispatchCommand(sender, newCommand);
|
server.dispatchCommand(sender, newCommand);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -39,11 +40,17 @@ public class Command_wildcard extends TFM_Command
|
|||||||
return true;
|
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())
|
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);
|
playerMsg("Running Command: " + out_command);
|
||||||
server.dispatchCommand(sender, out_command);
|
server.dispatchCommand(sender, out_command);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user