Developer API
Developer API
Here's the current API, as far as I know it. If you have any problems, just write a ticket or send me a PM on dev.bukkit, and I'll be glad to try and help. :)
Short Version
Quote from the API Summary:Package name:
ca.agnate.EconXP
Primary JAR class path:
ca.agnate.EconXP.EconXP
Getting the current instance of EconXP:
EconXP econXP = <your plugin instance>.getServer().getPluginManager().getPlugin("EconXP");
Functions available:
econXP.setExp( player, value );
econXP.getExp( player );
econXP.hasExp( player, value );
econXP.giveExp( giver, receiver, value );
econXP.clearExp( player );
econXP.removeExp( player, value );
econXP.addExp( player, value );
econXP.multiplyExp( player, multiplier );
econXP.divideExp( player, divisor );
econXP.isValidPlayer( name );
econXP.getPlayer( name );
Long Version
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | // -------------------------------------------------------------------------------------- // Package name: // -------------------------------------------------------------------------------------- ca.agnate.EconXP // -------------------------------------------------------------------------------------- // Primary JAR class path: // -------------------------------------------------------------------------------------- ca.agnate.EconXP.EconXP // -------------------------------------------------------------------------------------- // Getting the current instance of EconXP: // -------------------------------------------------------------------------------------- EconXP econXP = <your plugin instance>.getServer().getPluginManager().getPlugin("EconXP"); // -------------------------------------------------------------------------------------- // Note: ALL EconXP functions support both Player instances AND OfflinePlayer instances, so no need to check beforehand. // -------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------- // Set the experience of a Player/OfflinePlayer. // Returns the value that the experience is set to as an INT. // Returns -1 if the value could not be set (in the case that the player doesn't exist, for example). // -------------------------------------------------------------------------------------- econXP.setExp( player, value ); // -------------------------------------------------------------------------------------- // Get the experience of a Player/OfflinePlayer. // Returns the player's experience as an INT. // Returns -1 if the value could not be set (in the case that the player doesn't exist, for example). // -------------------------------------------------------------------------------------- econXP.getExp( player ); // -------------------------------------------------------------------------------------- // Check if the Player has the requested amount of experience. // Returns a BOOLEAN (true if they have the experience, false if they do not). // -------------------------------------------------------------------------------------- econXP.hasExp( player, value ); // -------------------------------------------------------------------------------------- // Clears a Player's experience (same as doing setExp(player, 0); ). // -------------------------------------------------------------------------------------- econXP.clearExp( player ); // -------------------------------------------------------------------------------------- // Transfer experience from one Player to another Player. // Checks to make sure both players exist, and that the giver has enough experience to make the transfer. // Returns the amount of experience transferred as an INT. // Returns 0 when the giver cannot afford it or if neither the giver nor receiver exist. // -------------------------------------------------------------------------------------- econXP.giveExp( giver, receiver, value ); // -------------------------------------------------------------------------------------- // Remove experience from a Player. // Returns the amount that was removed as an INT. // -------------------------------------------------------------------------------------- econXP.removeExp( player, value ); // -------------------------------------------------------------------------------------- // Add experience to a Player. // Returns the amount that was added as an INT. // -------------------------------------------------------------------------------------- econXP.addExp( player, value ); // -------------------------------------------------------------------------------------- // Multiply the experience of a Player by a multiplier (FLOAT). // Returns the new amount of experience the Player has as an INT. // -------------------------------------------------------------------------------------- econXP.multiplyExp( player, multiplier ); // -------------------------------------------------------------------------------------- // Divide the experience of a Player by a divisor (FLOAT). // Returns the new amount of experience the Player has as an INT. // -------------------------------------------------------------------------------------- econXP.divideExp( player, divisor ); // -------------------------------------------------------------------------------------- // Check if a player's name (STRING) results in a valid Player or OfflinePlayer. // Returns a BOOLEAN (true if they exist, false if they do not). // -------------------------------------------------------------------------------------- econXP.isValidPlayer( name ); // -------------------------------------------------------------------------------------- // Gets the player instance based on their name (STRING). // If they are not online, an OfflinePlayer instance is returned. // A Player instance can be cast as an OfflinePlayer instance, so this function always returns the OfflinePlayer instance. // Returns null if the player does not exist. // -------------------------------------------------------------------------------------- econXP.getPlayer( name ); |
Comments