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


Java ServerCommandEvent类代码示例

本文整理汇总了Java中org.bukkit.event.server.ServerCommandEvent的典型用法代码示例。如果您正苦于以下问题:Java ServerCommandEvent类的具体用法?Java ServerCommandEvent怎么用?Java ServerCommandEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerCommandEvent类属于org.bukkit.event.server包,在下文中一共展示了ServerCommandEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onServerCmd

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler
public void onServerCmd(ServerCommandEvent e){
	String[] args = e.getCommand().replace("/", "").split(" ");
	String msg = null;
	if (e.getCommand().length() > args[0].length()+1){
		msg = e.getCommand().substring(args[0].length()+1);
	}
	
	if (UChat.get().getUCConfig().getTellAliases().contains(args[0])){
		if (args.length >= 3){
			Player p = UChat.get().getServer().getPlayer(args[1]);
			
			if (p == null || !p.isOnline()){
				UChat.get().getLang().sendMessage(e.getSender(), "listener.invalidplayer");
				return;
			}
							
			msg = msg.substring(args[1].length()+1);
			
			UChat.get().tempTellPlayers.put("CONSOLE", p.getName());
			UChat.get().command.add("CONSOLE");
			sendPreTell(UChat.get().getServer().getConsoleSender(), p, msg);
			e.setCancelled(true);				
		}
	}		
}
 
开发者ID:FabioZumbi12,项目名称:UltimateChat,代码行数:27,代码来源:UCListener.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: onCommand

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onCommand(final ConsoleCommandHook hook) {
    String command = "";
    for (String s : hook.getCommand()) {
        command += s + " ";
    }
    server.getPluginManager().callEvent(new ServerCommandEvent(new CanaryCommandSender(hook.getCaller()), command) {
        @Override
        public void setCommand(String msg) {
            super.setCommand(msg);
            // Set command
        }
    });
    if (server.dispatchCommand(new CanaryCommandSender(hook.getCaller()), command)) {
        hook.setCanceled();
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:18,代码来源:CanaryServerListener.java

示例4: aB

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
public void aB() {
    SpigotTimings.serverCommandTimer.startTiming(); // Spigot
    while (!this.j.isEmpty()) {
        ServerCommand servercommand = (ServerCommand) this.j.remove(0);

        // CraftBukkit start - ServerCommand for preprocessing
        ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
        this.server.getPluginManager().callEvent(event);
        servercommand = new ServerCommand(event.getCommand(), servercommand.source);

        // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
        this.server.dispatchServerCommand(this.console, servercommand);
        // CraftBukkit end
    }
    SpigotTimings.serverCommandTimer.stopTiming(); // Spigot
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:17,代码来源:DedicatedServer.java

示例5: onAction

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onAction(ServerCommandEvent e) {
    boolean isAction = false;
    String commandUsed = "";
    for (String start : Config.actionAliases) {
        start = start.substring(1);
        if (!e.getCommand().startsWith(start)) continue;
        commandUsed = start;
        isAction = true;
        break;
    }
    if (!isAction) return;
    String message = Config.btiAction;
    message = message.replace("{name}", e.getSender().getName());
    message = message.replace("{message}", e.getCommand().substring(commandUsed.length()));
    plugin.bh.sendMessage(message);
}
 
开发者ID:RoyalDev,项目名称:RoyalIRC,代码行数:18,代码来源:BServerListener.java

示例6: onSay

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onSay(ServerCommandEvent e) {
    boolean isAction = false;
    String commandUsed = "";
    for (String start : Config.sayAliases) {
        start = start.substring(1);
        if (!e.getCommand().startsWith(start)) continue;
        commandUsed = start;
        isAction = true;
        break;
    }
    if (!isAction) return;
    String message = Config.btiSay;
    message = message.replace("{name}", e.getSender().getName());
    message = message.replace("{message}", e.getCommand().substring(commandUsed.length()));
    plugin.bh.sendMessage(message);
}
 
开发者ID:RoyalDev,项目名称:RoyalIRC,代码行数:18,代码来源:BServerListener.java

示例7: aL

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
public void aL() {
    SpigotTimings.serverCommandTimer.startTiming(); // Spigot
    while (!this.serverCommandQueue.isEmpty()) {
        ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);

        // CraftBukkit start - ServerCommand for preprocessing
        ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
        server.getPluginManager().callEvent(event);
        if (event.isCancelled()) continue;
        servercommand = new ServerCommand(event.getCommand(), servercommand.source);

        // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
        server.dispatchServerCommand(console, servercommand);
        // CraftBukkit end
    }

    SpigotTimings.serverCommandTimer.stopTiming(); // Spigot
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:19,代码来源:DedicatedServer.java

示例8: 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

示例9: onServerCommand

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onServerCommand (ServerCommandEvent event)
  {
    String command = event.getCommand().toLowerCase();
    if (command.equals("/p reload") || command.equals("/bp reload")
        || command.equals("/perm reload")
        || command.equals("/permissions reload"))
      {
        final CommandSender sender = event.getSender();
        plugin.getServer().getScheduler()
            .scheduleSyncDelayedTask(plugin, new Runnable()
              {
                public void run ()
                  {
                    plugin.refreshCache(sender);
                  }
              }, 1L);
        return;
      }
  }
 
开发者ID:DiGitHubCap,项目名称:SimpleChat,代码行数:21,代码来源:ServerListener.java

示例10: onServerCommand

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onServerCommand(ServerCommandEvent evt) {
    evt.setCancelled(handleCommand(evt.getSender(), CommandType.SLASH, CommandType.SLASH.getPrefix() + evt.getCommand()) // Handle console commands.
            || handleCommand(evt.getSender(), CommandType.COMMAND_BLOCK, evt.getCommand())); // Command Block commands.

    if (evt.getCommand().startsWith("/ ")) {
        sendStaffChat(evt.getSender(), evt.getCommand().substring(2));
        evt.setCancelled(true);
    }
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:11,代码来源:Commands.java

示例11: onCommand

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler
public void onCommand(ServerCommandEvent event) {
	String msg = "/" + event.getCommand();
	CommandSender sender = event.getSender();
	
	this.handle(msg, sender, event);
}
 
开发者ID:redstone,项目名称:RCameraStudio,代码行数:8,代码来源:BukkitCommandManager.java

示例12: processCommands

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void processCommands(ServerCommandEvent evt) {
    if (evt.isCancelled() || evt.isAsynchronous()) return;
    
    Command cmd = CommandFactory.commands.get(evt.getCommand());
    if (cmd == null || cmd instanceof PlayerOnly) return;
    
    cmd.run(evt.getSender());
}
 
开发者ID:Recraft,项目名称:Recreator,代码行数:10,代码来源:Recreator.java

示例13: onBroadcastCommand

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onBroadcastCommand(ServerCommandEvent event) {
    String cmd = ChatColor.stripColor(event.getCommand());
    if (cmd.equals("broadcast ") || cmd.equals("bc ")) {
        String msg = cmd.split(" ", 2)[1];
        messenger.sendMessageToAllBoundChannel("\uD83D\uDCE2 " + msg);
        boolean seeBc = configsManager.getModChannelConfig().getBoolean("See_Broadcast");
        if(seeBc) {
            messenger.sendMessageToAllModChannel("\uD83D\uDCE2 " + msg );
        }
    }
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:13,代码来源:BroadcastCommandListener.java

示例14: 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

示例15: init

import org.bukkit.event.server.ServerCommandEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) {
	what = matchedPattern;
	if (!ScriptLoader.isCurrentEvent(PlayerCommandPreprocessEvent.class, ServerCommandEvent.class)) {
		if (what != ARGS) // ExprArgument has the same syntax
			Skript.error("The 'command' expression can only be used in a command event");
		return false;
	}
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:12,代码来源:ExprCommand.java


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