SimplyPerms/net/crystalyx/bukkit/simplyperms/preventions/Command.java

32 lines
861 B
Java
Raw Normal View History

2012-04-29 00:11:39 +00:00
package net.crystalyx.bukkit.simplyperms.preventions;
import net.crystalyx.bukkit.simplyperms.SimplyPlugin;
import net.crystalyx.bukkit.simplyperms.SimplyPrevents;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class Command extends SimplyPrevents {
public Command(SimplyPlugin plugin) {
super(plugin);
}
@EventHandler(priority = EventPriority.LOWEST)
public void command(PlayerCommandPreprocessEvent event) {
String message = event.getMessage();
if (message.startsWith("/")) {
message = message.substring(1).trim();
int spaceIndex = message.indexOf(' ');
if (spaceIndex >= 0) {
message = message.substring(0, spaceIndex);
}
if (message.length() > 0) {
prevent(event, event.getPlayer(), "command." + message);
}
}
}
2012-04-29 00:55:03 +00:00
2012-04-29 00:11:39 +00:00
}