本文整理汇总了Java中org.bukkit.event.server.ServerCommandEvent.setCommand方法的典型用法代码示例。如果您正苦于以下问题:Java ServerCommandEvent.setCommand方法的具体用法?Java ServerCommandEvent.setCommand怎么用?Java ServerCommandEvent.setCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.server.ServerCommandEvent
的用法示例。
在下文中一共展示了ServerCommandEvent.setCommand方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler
public final void onCommand(ServerCommandEvent e) {
String[] array = e.getCommand().split(" ");
String[] args = new String[array.length-1];
for(int i = 0; i < args.length; i++) {
args[i] = array[i+1];
}
String cmd = array[0].replaceFirst("/", "");
if(commands.containsKey(cmd.toLowerCase())) {
commands.get(cmd.toLowerCase()).execute(e.getSender(), cmd, args);
e.setCommand("emptycommand");
}
}
示例2: onServerCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@SuppressWarnings("null")
@EventHandler(priority = EventPriority.HIGHEST)
public void onServerCommand(final ServerCommandEvent e) {
if (e.getCommand() == null || e.getCommand().isEmpty())
return;
if (SkriptConfig.enableEffectCommands.value() && e.getCommand().startsWith(SkriptConfig.effectCommandToken.value())) {
if (handleEffectCommand(e.getSender(), e.getCommand())) {
e.setCommand("");
suppressUnknownCommandMessage = true;
}
return;
}
if (handleCommand(e.getSender(), e.getCommand())) {
e.setCommand("");
suppressUnknownCommandMessage = true;
}
}
示例3: on
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void on(ServerCommandEvent event)
{
String command = event.getCommand();
if (intercept(event.getSender(), command, event))
{
event.setCommand(collapse(command));
}
}
示例4: onServerCommandEvent
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onServerCommandEvent(ServerCommandEvent event) {
String command = event.getCommand();
boolean restart = command.startsWith("restart");
if (restart || command.startsWith("stop")) {
ServerShutdown.this.run(restart);
event.setCommand(""); // dont execute stop!
}
}
示例5: onCmd
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler
public void onCmd(ServerCommandEvent e) {
String cmd = e.getCommand();
String replacement = PlaceholderHandler.replacePlaceholders(e.getSender() instanceof Player ? (Player) e.getSender() : null, cmd);
if (replacement != null && !cmd.equals(replacement)) {
e.setCommand(cmd);
}
}
示例6: onCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler
public void onCommand(ServerCommandEvent event) {
if (event.getCommand().equalsIgnoreCase("/reload") || event.getCommand().equalsIgnoreCase("reload")) {
event.setCommand("");
event.getSender().sendMessage("PlotMe disabled /reload to prevent errors from occuring.");
}
}
示例7: onCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler
public void onCommand(ServerCommandEvent e) {
Console console = Necessities.getConsole();
if (console.chatToggled() && !e.getCommand().equalsIgnoreCase("togglechat") && !e.getCommand().equalsIgnoreCase("tc"))
e.setCommand("say " + e.getCommand());
e.setCommand(ChatColor.translateAlternateColorCodes('&', e.getCommand()));
Necessities.getSpy().broadcast(console.getName().replaceAll(":", "") + ChatColor.AQUA, e.getCommand());
Necessities.getBot().logConsole(e.getCommand());
if (e.getCommand().startsWith("tps"))
e.setCommand("necessities:" + e.getCommand());
}
示例8: onServerCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@Deprecated // Moved to TFM_TelnetListener
@EventHandler(priority = EventPriority.NORMAL)
public void onServerCommand(ServerCommandEvent event)
{
if (TFM_CommandBlocker.getInstance().isCommandBlocked(event.getCommand(), event.getSender()))
{
event.setCommand("");
}
}
示例9: onCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onCommand(ServerCommandEvent event) {
event.setCommand(attemptRebind(event.getCommand()));
}
示例10: onConsoleCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onConsoleCommand(ServerCommandEvent event) {
if (onCommandPreprocess(event.getSender(), event.getCommand()))
event.setCommand("dontrunthiscmd");
}