This is a one stop shop API supporting things from custom blocks to commands. I will describe everything you can do, currently. I will also be updating this page as I upload more content.
This is a simple Item building tool, which makes the process completely robust and fast.
To use first create the ItemBuilder object
Code (Java):
ItemBuilder builder
=new ItemBuilder
(String name, Material material, List
<String
> lore
);
***note*** ItemBuilder also will take items directly from configs in this configuration
Code (YAML):
Path:
mat: MATERIAL
lore : [] name : NAME
glow: true|false
You now are free to add pretty much anything to the item that could ever be used.
To get the Item back just use ItemBuilder#getItem();
This has the ability to give rewards to players from config files quickly and easily.
ENERGY_STORAGE_CENTER
(EnergyStorageCenter.
class,
"esc",
"Energy Storage Center",
Utils.
color("&b&lEnergy &3&lStorage &c&lCenter"),
Utils.
toList(Utils.
color("&f&l(Place in a chunk with Energy Forges to use)"),
"",
Utils.
color("&7Collects nearby energy from forges and "),
Utils.
color("&7converts it into a usable, non destructive form")), Material.
CHEST,
true,
null,
20,
true);
private Class
<?extends Block
> clazz
; privateString id
; privateString name
; privateString itemName
; private List
<String
> lore
; private Material material
; privateboolean glow
; private Map
<String, NBTBase
> tags
; privateint delay
; privateboolean show
;
ExoticBlockType
(Class
<?extends Block
> clazz,
String id,
String name,
String itemName, List
<String
> lore,
Material mat
){ this(clazz, id, name, itemName, lore, mat,
false,
null); }
public EnergyStorageCenter
(Location loc, BlockType type
){ super(loc, type
); }
public EnergyStorageCenter
(Location loc
){ super(loc, ExoticBlockType.
ENERGY_STORAGE_CENTER); }
public EnergyStorageCenter
(Map
<String, Object
> ser
){ super(ser
); }
@Override
publicvoid run
(Location loc, OfflinePlayer player
){
}
}
Now, to first understand what the constructors mean
The Lore, ItemName, glow, nbt, and Material are all for the blocks ItemStack.
The clazz is the class that defines the run method and all other methods.
The ID goes unused, but is what you would use if you were to connect it up to a client with custom textures (when I release a client later this will work)
name is what is used in maps can be named anything, pretty much doesnt matter.
delay is the delay between every time the block is updated (this corresponds to loopedRun which is another method set in the Block class). If delay = 0 then no loopedRun happens and the Run is only called once on block place.
boolean show is whether or not you want the title of the Block to be displayed over the block itself using armor stands
Methods used in Block that are optional whether or not you wish to call.
Block#onPlace(Player placer) is called when the block is placed
Block#onBreak(Player breaker) is called when the block is broken
Block#loopedRun(Location loc, OfflinePlayer player) is called on a loop where the BlockType#getDelay() determines speed.
Finally to register the block simply use BlockListener#registerBlock(BlockType type)
Basic Command. To use simply just create a class that extends Command. Fill in constructor and run (if you want to differentiate between player and commandSender use run(Player player, String[] args); along side run(CommandSender sender, String[] args) and the API will naturally differ.
This class helps the programmer create large commands seen on most servers (think factions /f create|claim|kick...). It naturally makes a Help command.
To use make a class extend BranchCommand and follow the constructor.
*** note *** SubCommands can be added later if you want as seen in this example, typically tho is not wanted and should only be added in the constructor
Note this commands automatically add Hover and Click Events to the help command.
All in all, I need to go through and add comments to all of these classes and over time I will. This code is open source so if anyone wants to make a branch and have at it, feel free too! I will update this page with more info on how to use Blocks and Commands later (plus general API uses such as the Utils class, UtilityLists, PacketManager, ExpManager, NBTManager, and more.)