Package org.bukkit.plugin

Examples of org.bukkit.plugin.Plugin.onCommand()


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

        // Import the first world. The world folder does not exist.
        plugin.onCommand(mockCommandSender, mockCommand, "", normalArgs);
        verify(mockCommandSender).sendMessage(ChatColor.RED + "FAILED.");
        verify(mockCommandSender).sendMessage("That world folder does not exist. These look like worlds to me:");

        // We should still have no worlds.
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());
View Full Code Here


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

        // Import the first world.
        String[] normalArgs = new String[]{ "import", "world", "normal" };
        plugin.onCommand(mockCommandSender, mockCommand, "", normalArgs);

        // We should now have one world imported!
        assertEquals(1, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Import the second world.
View Full Code Here

        // We should now have one world imported!
        assertEquals(1, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Import the second world.
        String[] netherArgs = new String[]{ "import", "world_nether", "nether" };
        plugin.onCommand(mockCommandSender, mockCommand, "", netherArgs);

        // We should now have 2 worlds imported!
        assertEquals(2, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Import the third world.
View Full Code Here

        // We should now have 2 worlds imported!
        assertEquals(2, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Import the third world.
        String[] skyArgs = new String[]{ "import", "world_the_end", "end" };
        plugin.onCommand(mockCommandSender, mockCommand, "", skyArgs);

        // We should now have 2 worlds imported!
        assertEquals(3, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Verify that the commandSender has been called 3 times.
View Full Code Here

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

        // Create the world
        String[] normalArgs = new String[]{ "create", "newworld", "normal" };
        plugin.onCommand(mockCommandSender, mockCommand, "", normalArgs);

        // We should now have one world!
        assertEquals(1, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Verify
View Full Code Here

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

        // Create the world
        String[] normalArgs = new String[]{ "create", "newworld", "normal", "-g", "BogusGen"};
        plugin.onCommand(mockCommandSender, mockCommand, "", normalArgs);

        // This command should halt, not creating any worlds
        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Verify
View Full Code Here

        assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Create the NULL world
        // The safe check is now BALLS SLOW. Use the -n to skip checking.
        String[] normalArgs = new String[]{ "create", "nullworld", "normal", "-n" };
        plugin.onCommand(mockCommandSender, mockCommand, "", normalArgs);

        // We should now have one world!
        assertEquals(1, creator.getCore().getMVWorldManager().getMVWorlds().size());

        // Verify
View Full Code Here

        // Ensure that the default mode was normal.
        assertEquals(GameMode.SURVIVAL, mainWorld.getGameMode());

        // Set the mode to creative in world.
        plugin.onCommand(mockCommandSender, mockCommand, "", new String[]{ "modify", "set", "mode", "creative", "world" });
        verify(mockCommandSender).sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + "mode" + ChatColor.WHITE + " was set to " + ChatColor.GREEN + "creative");
        // Ensure the world is now a creative world
        assertEquals(GameMode.CREATIVE, mainWorld.getGameMode());

        // More tests, with alternate syntax.
View Full Code Here

        verify(mockCommandSender).sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + "mode" + ChatColor.WHITE + " was set to " + ChatColor.GREEN + "creative");
        // Ensure the world is now a creative world
        assertEquals(GameMode.CREATIVE, mainWorld.getGameMode());

        // More tests, with alternate syntax.
        plugin.onCommand(mockCommandSender, mockCommand, "", new String[]{ "modify", "set", "gamemode", "0", "world" });
        verify(mockCommandSender).sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + "gamemode" + ChatColor.WHITE + " was set to " + ChatColor.GREEN + "0");
        assertEquals(GameMode.SURVIVAL, mainWorld.getGameMode());

        // Now fail one.
        plugin.onCommand(mockCommandSender, mockCommand, "", new String[]{ "modify", "set", "mode", "fish", "world" });
View Full Code Here

        plugin.onCommand(mockCommandSender, mockCommand, "", new String[]{ "modify", "set", "gamemode", "0", "world" });
        verify(mockCommandSender).sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + "gamemode" + ChatColor.WHITE + " was set to " + ChatColor.GREEN + "0");
        assertEquals(GameMode.SURVIVAL, mainWorld.getGameMode());

        // Now fail one.
        plugin.onCommand(mockCommandSender, mockCommand, "", new String[]{ "modify", "set", "mode", "fish", "world" });
        try {
            verify(mockCommandSender).sendMessage(ChatColor.RED + mainWorld.getPropertyHelp("mode"));
        } catch (PropertyDoesNotExistException e) {
            fail("Mode property did not exist.");
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.