Add limiter for command block minecarts

This commit is contained in:
mathiascode 2020-08-02 22:48:51 +03:00
parent dbd71922d0
commit 7eaf813228

View file

@ -3,6 +3,7 @@ package pw.kaboom.extras.modules.server;
import org.bukkit.block.CommandBlock; import org.bukkit.block.CommandBlock;
import org.bukkit.command.BlockCommandSender; import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.event.server.ServerCommandEvent;
@ -144,6 +145,10 @@ public final class ServerCommand implements Listener {
commandBlock.setCommand(""); commandBlock.setCommand("");
commandBlock.update(); commandBlock.update();
} else if (sender instanceof CommandMinecart) {
final CommandMinecart commandMinecart = (CommandMinecart) sender;
commandMinecart.setCommand("");
} }
final String command = event.getCommand(); final String command = event.getCommand();