API Help
API Help
CommandAPI
CommandAPI commander = new CommandAPI(); commander.addCommand("command", executor); // add a command to the command builder commander.initCommand("command", executor); // create a single command commander.initCommands(); // create all previously added commands
EventAPI
EventAPI event = new EventAPI(); event.addEvent(listener, plugin); // add an event class to the event builder event.registerEvent(listener, plugin); // initialize a class of events event.registerEvents(); // register all previously added events
InventoryAPI
InventoryAPI inventory = new InventoryAPI(); inventory.isFull(inv); // returns true if full, else false inventory.contains(inv, itemstack); // returns true if inventory contains the itemstack inventory.contains(inv, material); // returns true if inventory contains a single material inventory.contains(inv, material, amount); // returns true if inventory contains a certain amount of a material inventory.hasEmptySlot(inv); // returns true if inventory has a free slot inventory.getName(inv); // returns the name of the inventory inventory.getTitle(inv); // returns the title of the inventory inventory.add(inv, material); // adds one item to the inventory inventory.add(inv, material, amount); // adds a certain amount of items to the inventory, but stops if full inventory.add(player, inv, material, amount); // adds a certain amount of items to the inventory, and throws overflow on the ground inventory.addStack(inv, material); // adds a full stack of a material to a free slot in the inventory inventory.remove(inv, material, amount); // if the inventory contains a certain amount of an item, remove them inventory.removeAll(inv, material); // removes all of an item from the inventory inventory.copy(player, target); // copies one players inventory to another (this will overwrite the target inventory) inventory.copy(inv, target); // copies an inventory to a target player inventory.copy(inv, inv2); // copies an inventory to another inventory.clear(inv); // clears the inventory
LoggerAPI
LoggerAPI logger = LoggerAPI.getLogger(); logger.log(plugin, level, message); // send messages to the console with a certain level logger.info(plugin, message); // sends a message to the console with the INFO level logger.severe(plugin, message); // sends a message to the console with the SEVERE level logger.warn(plugin, message); // sends a message to the console with the WARNING level
MessagingAPI
MessagingAPI messenger = MessagingAPI.getMessenger(); messenger.broadcast(message); // broadcast a string messenger.broadcast(args); // builds a string from a string array (String[]), then broadcasts messenger.broadcast(start, args); // builds a string from a string array starting at a certain point messenger.deny(sender); // deny the sender use of a command (Just a warning message) messenger.deny(sender, message); // deny the sender use of a command (custom warning) messenger.massSend(message); // sends a message to all online players messenger.massSend(players, message); // sends a message to all online players in a player array messenger.massSend(players, message); // sends a message to all online players in a string array messenger.noTarget(sender, name); // sends a predefined player not found error messenger.noTarget(player, name); // sends a predefined player not found error messenger.send(sender, message); // send a command sender a message messenger.send(player, message); // send a player a message messenger.send(name, message); // sends a player a message if found messenger.buildString(args); // returns a string from a string array (String[]) messenger.buildString(start, args); // returns a string from a string array starting at a certain place messenger.info(message); // sends a player a gray italicized message messenger.severe(message); // sends a player a red message messenger.warn(message); // sends a player a yellow message
PlayerAPI
PlayerAPI players = new PlayerAPI(); players.addHealth(player, amount); // gives a player a certain amount of health, if it works return true, else return false players.removeHealth(player, amount); // takes a certain amount of health from a player, if it works return true, else return false players.award(player, achievement); // give a player an achievement players.burn(player); // burns a player for 20 ticks players.burn(player, ticks); // burns a player for a certain amount of ticks players.extinguish(player); // put out a burning player players.kill(player); // kill a player
TeleportAPI
TeleportAPI teleport = new TeleportAPI(); teleport.newLocation(target); // returns the location of a player teleport.newLocation(world, x, y, z); // returns the newly created location teleport.newLocation(world, x, y, z, pitch, yaw); // returns the newly created location teleport.teleport(player, target); // teleports a player to a target player teleport.teleport(player, location); // teleports a player to a location teleport.teleport(player, x, y, z); // teleports a player to coords teleport.teleport(player, world, x, y, z); // teleports a player to coords in a certain world teleport.teleport(player, world, x, y, z, pitch, yaw); // teleports a player to coords in a certain world with a pitch and yaw teleport.teleportAll(location); // teleports all online players to a location teleport.teleportAll(players, location); // teleports an array of players (Player[]) to a location teleport.teleportAll(players, location); // teleports an array of strings (String[]) to a location if a player and online
Support
If you need support post [API-NAME] as a prefix to your message. Or if you have immediate requests or problems, create a ticket on the Tickets Section. The ticket name should have the prefix [API-NAME] if the problem is with a certain API in the API package.
Example:
Quote from ExampleDev:[CommandAPI] Can you add support for ...
Comments