当前位置: 首页>>代码示例>>Java>>正文


Java ServerCommandEvent.setCommand方法代码示例

本文整理汇总了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");
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:18,代码来源:MinigamePlugin.java

示例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;
	}
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:18,代码来源:Commands.java

示例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));
    }
}
 
开发者ID:RezzedUp,项目名称:OpGuard,代码行数:11,代码来源:CommandInterceptor.java

示例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!
  }
}
 
开发者ID:SupaHam,项目名称:SupaCommons,代码行数:10,代码来源:ServerShutdown.java

示例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);
    }
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:9,代码来源:ServerCommandPlaceholder.java

示例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.");
    }
}
 
开发者ID:WorldCretornica,项目名称:PlotMe-Core,代码行数:8,代码来源:BukkitPlotListener.java

示例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());
}
 
开发者ID:pupnewfster,项目名称:Necessities,代码行数:12,代码来源:Listeners.java

示例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("");
    }
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:10,代码来源:TFM_ServerListener.java

示例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()));
}
 
开发者ID:novucs,项目名称:factions-top,代码行数:5,代码来源:CommandListener.java

示例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");
}
 
开发者ID:TBMCPlugins,项目名称:ButtonChat,代码行数:6,代码来源:PlayerListener.java


注:本文中的org.bukkit.event.server.ServerCommandEvent.setCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。