mirror of
https://github.com/kaboomserver/extras.git
synced 2025-01-07 23:17:55 +00:00
Remove check for /say command
There are more commands in addition to /say that allow target selectors, and the exploit only targets Minecraft 1.12.2 and older. As those versions are over 3 years old, there isn't much point in supporting them.
This commit is contained in:
parent
9594db67af
commit
1adb54013a
3 changed files with 31 additions and 204 deletions
|
@ -1,167 +0,0 @@
|
|||
package pw.kaboom.extras.helpers;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
import org.bukkit.conversations.ConversationAbandonedEvent;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class MessageInterceptingCommandRunner implements ConsoleCommandSender {
|
||||
private final ConsoleCommandSender wrappedSender;
|
||||
private final Spigot spigotWrapper;
|
||||
|
||||
private class Spigot extends CommandSender.Spigot {
|
||||
/**
|
||||
* Sends this sender a chat component.
|
||||
*
|
||||
* @param component the components to send
|
||||
*/
|
||||
@Override
|
||||
public final void sendMessage(final @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
wrappedSender.spigot().sendMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an array of components as a single message to the sender.
|
||||
*
|
||||
* @param components the components to send
|
||||
*/
|
||||
@Override
|
||||
public final void sendMessage(final @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
wrappedSender.spigot().sendMessage(components);
|
||||
}
|
||||
}
|
||||
|
||||
public MessageInterceptingCommandRunner(final ConsoleCommandSender wrappedSenderIn) {
|
||||
this.wrappedSender = wrappedSenderIn;
|
||||
spigotWrapper = new Spigot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void sendMessage(final @NotNull String message) {
|
||||
wrappedSender.sendMessage(message.substring(0, Math.min(message.length(), 256)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void sendMessage(final @NotNull String[] messages) {
|
||||
wrappedSender.sendMessage(messages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @NotNull Server getServer() {
|
||||
return wrappedSender.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @NotNull String getName() {
|
||||
return "OrderFulfiller";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @NotNull CommandSender.Spigot spigot() {
|
||||
return spigotWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isConversing() {
|
||||
return wrappedSender.isConversing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void acceptConversationInput(final @NotNull String input) {
|
||||
wrappedSender.acceptConversationInput(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean beginConversation(final @NotNull Conversation conversation) {
|
||||
return wrappedSender.beginConversation(conversation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void abandonConversation(final @NotNull Conversation conversation) {
|
||||
wrappedSender.abandonConversation(conversation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void abandonConversation(final @NotNull Conversation conversation, final @NotNull ConversationAbandonedEvent details) {
|
||||
wrappedSender.abandonConversation(conversation, details);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void sendRawMessage(final @NotNull String message) {
|
||||
wrappedSender.sendRawMessage(message.substring(0, Math.min(message.length(), 256)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isPermissionSet(final @NotNull String name) {
|
||||
return wrappedSender.isPermissionSet(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isPermissionSet(final @NotNull Permission perm) {
|
||||
return wrappedSender.isPermissionSet(perm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasPermission(final @NotNull String name) {
|
||||
return wrappedSender.hasPermission(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasPermission(final @NotNull Permission perm) {
|
||||
return wrappedSender.hasPermission(perm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @NotNull PermissionAttachment addAttachment(final @NotNull Plugin plugin, final @NotNull String name, final boolean value) {
|
||||
return wrappedSender.addAttachment(plugin, name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @NotNull PermissionAttachment addAttachment(final @NotNull Plugin plugin) {
|
||||
return wrappedSender.addAttachment(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @Nullable PermissionAttachment addAttachment(final @NotNull Plugin plugin, final @NotNull String name, final boolean value, final int ticks) {
|
||||
return wrappedSender.addAttachment(plugin, name, value, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @Nullable PermissionAttachment addAttachment(final @NotNull Plugin plugin, final int ticks) {
|
||||
return wrappedSender.addAttachment(plugin, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void removeAttachment(final @NotNull PermissionAttachment attachment) {
|
||||
wrappedSender.removeAttachment(attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void recalculatePermissions() {
|
||||
wrappedSender.recalculatePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
return wrappedSender.getEffectivePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isOp() {
|
||||
return wrappedSender.isOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setOp(final boolean value) {
|
||||
wrappedSender.setOp(value);
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package pw.kaboom.extras.helpers;
|
||||
|
||||
public @interface NotNull {
|
||||
|
||||
}
|
|
@ -11,30 +11,31 @@ import org.bukkit.event.server.ServerCommandEvent;
|
|||
public final class ServerCommand implements Listener {
|
||||
public static boolean checkExecuteCommand(final String cmd) {
|
||||
return ("execute".equalsIgnoreCase(cmd)
|
||||
|| "clone".equalsIgnoreCase(cmd)
|
||||
|| "data".equalsIgnoreCase(cmd)
|
||||
|| "datapack".equalsIgnoreCase(cmd)
|
||||
|| "debug".equalsIgnoreCase(cmd)
|
||||
|| "fill".equalsIgnoreCase(cmd)
|
||||
|| "forceload".equalsIgnoreCase(cmd)
|
||||
|| "kick".equalsIgnoreCase(cmd)
|
||||
|| "me".equalsIgnoreCase(cmd)
|
||||
|| "msg".equalsIgnoreCase(cmd)
|
||||
|| "particle".equalsIgnoreCase(cmd)
|
||||
|| "reload".equalsIgnoreCase(cmd)
|
||||
|| "save-all".equalsIgnoreCase(cmd)
|
||||
|| "say".equalsIgnoreCase(cmd)
|
||||
|| "setblock".equalsIgnoreCase(cmd)
|
||||
|| "spreadplayers".equalsIgnoreCase(cmd)
|
||||
|| "stop".equalsIgnoreCase(cmd)
|
||||
|| "summon".equalsIgnoreCase(cmd)
|
||||
|| "teammsg".equalsIgnoreCase(cmd)
|
||||
|| "teleport".equalsIgnoreCase(cmd)
|
||||
|| "tell".equalsIgnoreCase(cmd)
|
||||
|| "tellraw".equalsIgnoreCase(cmd)
|
||||
|| "tm".equalsIgnoreCase(cmd)
|
||||
|| "tp".equalsIgnoreCase(cmd)
|
||||
|| "w".equalsIgnoreCase(cmd));
|
||||
|| "clone".equalsIgnoreCase(cmd)
|
||||
|| "data".equalsIgnoreCase(cmd)
|
||||
|| "datapack".equalsIgnoreCase(cmd)
|
||||
|| "debug".equalsIgnoreCase(cmd)
|
||||
|| "fill".equalsIgnoreCase(cmd)
|
||||
|| "forceload".equalsIgnoreCase(cmd)
|
||||
|| "kick".equalsIgnoreCase(cmd)
|
||||
|| "me".equalsIgnoreCase(cmd)
|
||||
|| "msg".equalsIgnoreCase(cmd)
|
||||
|| "particle".equalsIgnoreCase(cmd)
|
||||
|| "reload".equalsIgnoreCase(cmd)
|
||||
|| "save-all".equalsIgnoreCase(cmd)
|
||||
|| "say".equalsIgnoreCase(cmd)
|
||||
|| "setblock".equalsIgnoreCase(cmd)
|
||||
|| "spreadplayers".equalsIgnoreCase(cmd)
|
||||
|| "stop".equalsIgnoreCase(cmd)
|
||||
|| "summon".equalsIgnoreCase(cmd)
|
||||
|| "teammsg".equalsIgnoreCase(cmd)
|
||||
|| "teleport".equalsIgnoreCase(cmd)
|
||||
|| "tell".equalsIgnoreCase(cmd)
|
||||
|| "tellraw".equalsIgnoreCase(cmd)
|
||||
|| "tm".equalsIgnoreCase(cmd)
|
||||
|| "tp".equalsIgnoreCase(cmd)
|
||||
|| "w".equalsIgnoreCase(cmd)
|
||||
);
|
||||
}
|
||||
public static String checkCommand(final CommandSender sender, final String command, final boolean isConsoleCommand) {
|
||||
final String[] arr = command.split(" ");
|
||||
|
@ -126,6 +127,12 @@ public final class ServerCommand implements Listener {
|
|||
return String.join(" ", arr);
|
||||
}
|
||||
break;
|
||||
case "/minecraft:title":
|
||||
case "/title":
|
||||
if (command.contains("selector")) {
|
||||
return "cancel";
|
||||
}
|
||||
break;
|
||||
case "/viaversion:viaver":
|
||||
case "/viaversion:viaversion":
|
||||
case "/viaversion:vvbukkit":
|
||||
|
@ -137,14 +144,6 @@ public final class ServerCommand implements Listener {
|
|||
return "cancel";
|
||||
}
|
||||
break;
|
||||
case "/minecraft:say":
|
||||
case "/say":
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (arr[i].toLowerCase().contains("@")) {
|
||||
return "cancel";
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue