How To Add Kits
How To Add Kits
Creating a Kit
Creating a kit is currently only possible via code. This means you'll have to create a plugin and load the DomHG instance (tutorials on how to create plugins and load access other plugins can be found on the Bukkit forums).
Here is an example on how you can create your own kit:
// At first we create a list of items containing one pair of leather boots and two ender pearls. // You can add as many items as you want. // You can also add potions. List<ItemStack> runnerItems = Arrays.asList(new ItemStack(Material.LEATHER_BOOTS, 1), new ItemStack(Material.ENDER_PEARL), 2); // Then we create a kit. A kit is constructed like this: // new Kit(String kitName, List<ItemStack> kitItems, boolean kitHasItems, boolean devKit, String description, boolean buyable); // kitHasItems determines if the kit has any items. If this is set to false the player won't get any items, even if you provided a list of items. // devKit is for debugging purposes only. Set it to false to be on the safe side. // description will be shown to players if they type /kit [name]. You should explain the abilities of the kit here // buyable requires players to have the permission domhg.[kitname], otherwise they won't be able to use the kit Kit runner = new Kit("Runner", runnerItems, true, false, "The Runner runs really fast.", false); // And finally we add the kit to the game. Kit.addKit(runner);
Players will now be able to use the kit "Runner" by typing /kit runner in the game.
IMPORTANT: Kit names may NEVER contain spaces!
Checking If a User Has a Kit
Sometimes you might want to check if a player has a kit, perhaps if you want to give every user who has that kit an ability, like strength.
That is done simply by evaluating the following line:
// We are using the following method: // boolean Kit.hasPlayerKit(Player p, String kit) if(Kit.hasPlayerKit(player, "vampire")) { // do something if player has the kit } else { // perhaps even do something if not }
So in this example the result will be true if the player has the kit vampire and false if not. This method does not check for permission, but for the currently active kit of the player.
There are many ways to implement this into your server, for example if a player hits water and has the kit "neptune", give them strength. Be creative!
Comments