Addon Documentation
This page contains everything you need to know to make an addon for GoatCraft.
Events
There are a number of events (the name says for what it is):
- GoatBlockDestroyEvent
- GoatEntityDamageEvent
- GoatJoinEvent
- GoatLeaveEvent
Data
There is some data stored in the main class (me.bram0101.goatcraft.GoatCraft). First you want to have the instance (you use this to get the data):
GoatCraft goatcraftplugin = me.bram0101.goatcraft.GoatCraft.plugin;
Then you can get to the data:
- goats (this is an arraylist of Strings that hold the names of all the players that are goats)
- sheeps (this is an hashmap with the first the name of the player and second the Sheep class)
- blacklist (this is an arraylist of Integers with all the blocks that are on the blacklist (this is changed in the config))
- craftgoats (this is an hashmap that isn't used)
- fallingblocks (this is an arraylist of UUIDs of all the fallingblock entitys that are spawned by the goat hitting a block)
- sheepuuid (this is just a hashmap just like that of sheeps but here the second the uuid of the sheep)
- VOLUME (this is a float that says how loud the sounds need to be (this is changed in the config))
- leashes (this is an hashmap with the first the name of the players and the second the uuid of the leash (that's the tongue))
voids
There are some voids in the main class:
- onEnable() (just do nothing with this)
- deserialize(String location) (this returns a location)
- serialize(Location location) (this returns a String)
- onDisable() (just do nothing with this)
- onCommand(CommandSender sender, Command command, String label, String[] args) (just do nothing with this)
- Update() (this is called every tick, just do nothing with this)
- getTargets(Player player) (this is a broken feature, just do nothing with this)
- onEntityTeleport(EntityTeleportEvent event) (just do nothing with this)
- onSheepRegrowWool (SheepRegrowWoolEvent event) (just do nothing with this)
- onEntityBlockForm(EntityChangeBlockEvent event) (just do nothing with this)
- onPlayerInteract (PlayerInteractEvent event) (just do nothing with this)
- onPlayerQuit (PlayerQuitEvent event) (just do nothing with this)
- onPlayerSpring (PlayerToggleSpringEvent event) (just do nothing with this)
- onDamageByBlock (EntityDamageByBlockEvent event) (just do nothing with this)
- onDamage (EntityDamageEvent event) (just do nothing with this)
- onComand (PlayerCommandPreprocessEvent event) (just do nothing with this)
- onServerStop (ServerCommandEvent event) (just do nothing with this)
- onMove (PlayerMoveEvent event) (just do nothing with this)
Classes
There are some classes (most of them you don't use)
- GoatCraft (main class)
- PlayerVar (this class contains some information of the player)
- spawn (this isn't used)
- Updater (this is the autoupdater, this autoupdater is currently not used)
- UpdaterTask (this is the class that calls the Update void in GoatCraft every tick)
- CraftGoat (this isn't used)
- GoatBlockDestroyEvent (this is one of the events)
- GoatEntityDamageEvent (this is one of the events)
- GoatJoinEvent (this is one of the events)
- GoatLeaveEvent (this is one of the events)
- BlockData (this is used by the regen)
- BlockSoundManager (this is the manager for all the blocksound)
- ChatManager (this is used for the custom messages)
Chat
I have a ChatManager for the chat an this is a tutorial to use it:
There are some type:
- join
- leave
- setspawn
- setlobby
- help
- regenstart
- regenstop
- blacklistadd
- blacklistremove
Set a message of a type:
me.bram0101.goatcraft.util.ChatManager.{the type}.setMessage({the message});
Send a type to a player:
me.bram0101.goatcraft.util.ChatManager.sendType(me.bram0101.goatcraft.util.ChatManager.{the type}, {the player});
Send a message to a player:
me.bram0101.goatcraft.util.ChatManager.sendMessage({message}, {the player});
And that is all you need to know to make an addon!
Comments