Package org.bukkit.command

Examples of org.bukkit.command.Command


    super(plugin, "commands", Permissions.COMMAND_COMMANDS, new String[]{"cmds"});
    for (int i = 0; i < moreCommands.length; i++){
      moreCommands[i] = moreCommands[i].replace("<command>", "ncp");
    }
    String all = TAG + "All commands info:\n";
    Command cmd = plugin.getCommand("nocheatplus");
    if (cmd != null){
      all += cmd.getUsage().replace("<command>", "ncp");
    }
    all += StringUtil.join(Arrays.asList(moreCommands), "\n");
    allCommands = all;
  }
View Full Code Here


        final String lcMessage = message.trim().toLowerCase();
        // TODO: Remove bukkit: etc.
       
        final String[] split = lcMessage.split(" ", 2);
        final String alias = split[0].substring(1);
    final Command command = CommandUtil.getCommand(alias);
   
    final List<String> messageVars = new ArrayList<String>(); // Could as well use an array and allow null on input of SimpleCharPrefixTree.
    messageVars.add(lcMessage);
    String checkMessage = message; // Message to run chat checks on.
    if (command != null){
      messageVars.add("/" + command.getLabel().toLowerCase() + (split.length > 1 ? (" " + split[1]) : ""));
    }
        if (alias.indexOf(":") != -1) {
          final int index = message.indexOf(":") + 1;
          if (index < message.length()) {
              checkMessage = message.substring(index);
              messageVars.add(checkMessage.toLowerCase());
          }
        }
        // Prevent commands from being used by players (e.g. /op /deop /reload).
     if (cc.consoleOnlyCheck && consoleOnlyCommands.hasAnyPrefixWords(messageVars)) {
       if (command == null || command.testPermission(player)){
          player.sendMessage(cc.consoleOnlyMessage);
       }
       event.setCancelled(true);
       return;
     }
View Full Code Here

            if (plugin instanceof JavaPlugin) {
                final JavaPlugin javaPlugin = (JavaPlugin) plugin;
                final Map<String, Map<String, Object>> map = javaPlugin.getDescription().getCommands();
                if (map != null) {
                    for (String label : map.keySet()) {
                        Command command = javaPlugin.getCommand(label);
                        if (command != null) {
                            commands.add(command);
                        }
                    }
                }
View Full Code Here

     * @param alias
     * @param strict If to return null if no command is found.
     * @return The command label, if possible to find, or the alias itself (+ trim + lower-case).
     */
    public static String getCommandLabel(final String alias, final boolean strict) {
        final Command command = getCommand(alias);
        if (command == null) {
            return strict ? null : alias.trim().toLowerCase();
        }
        else {
            return command.getLabel().trim().toLowerCase();
        }
    }
View Full Code Here

        assertNotNull(plugin);

        // Make sure Core is enabled
        assertTrue(plugin.isEnabled());
        // Initialize a fake command
        Command mockCommand = mock(Command.class);
        when(mockCommand.getName()).thenReturn("mv");
        String[] normalArgs = new String[]{ "import", "world", "normal" };

        // Ensure we have a fresh copy of MV, 0 worlds.
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());
View Full Code Here

        // Make sure Core is enabled
        assertTrue(plugin.isEnabled());

        // Initialize a fake command
        Command mockCommand = mock(Command.class);
        when(mockCommand.getName()).thenReturn("mv");

        // Ensure that there are no worlds imported. This is a fresh setup.
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Import the first world.
View Full Code Here

        // Make sure Core is enabled
        assertTrue(plugin.isEnabled());

        // Initialize a fake command
        Command mockCommand = mock(Command.class);
        when(mockCommand.getName()).thenReturn("mv");

        // Ensure that there are no worlds imported. This is a fresh setup.
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Create the world
View Full Code Here

        // Make sure Core is enabled
        assertTrue(plugin.isEnabled());

        // Initialize a fake command
        Command mockCommand = mock(Command.class);
        when(mockCommand.getName()).thenReturn("mv");

        // Ensure that there are no worlds imported. This is a fresh setup.
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Create the world
View Full Code Here

        // Make sure Core is enabled
        assertTrue(plugin.isEnabled());

        // Initialize a fake command
        Command mockCommand = mock(Command.class);
        when(mockCommand.getName()).thenReturn("mv");

        // Ensure that there are no worlds imported. This is a fresh setup.
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Create the NULL world
View Full Code Here

    @Test
    // TODO Migrate this to TestWorldProperties
    public void testModifyGameMode() {
        // Pull a core instance from the server.
        Plugin plugin = mockServer.getPluginManager().getPlugin("Multiverse-Core");
        Command mockCommand = mock(Command.class);
        when(mockCommand.getName()).thenReturn("mv");

        // Ensure that there are no worlds imported. This is a fresh setup.
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());
        this.createInitialWorlds(plugin, mockCommand);
View Full Code Here

TOP

Related Classes of org.bukkit.command.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.