API (Developers)
MobsCanTalk API
- Create your plugin folder in your editor
- Add the MobsCanTalk.jar to the build paths
- Then add this line of code:
<mob name> mob = new <mob name>(null);
To find out the mob name open "Referenced Libraries" then "MobsCanTalk.jar" then open the package "me.hammy2899.MobsSpeach" then all the mob classes are displayed.
All the methods:
mob.muted(); // Returns true/false mob.mute(true/false); // Set the mob muted or unmuted mob.speak(player); // Sends a random message from the config of that mob to the player you enter mob.speak(player, messageValue); // Sends the player you enter the message from the config from the value you enter eg:
messages: - hey there - Im over here - I can see you
// If the messageValue was 1 it would send the player "Im over here" mob.speak(player, message); // Sends the player the message you enter as the mob was talking
Events API:
- Make an event class
- Now add this line of code:
@EventHandler public void mobTalkEvent(MobTalkEvent event) { }
Event methods:
event.getMob(); // Returns the EntityType of the mob that sent the message eg:
Cow speaks. Returns: COW Ender dragon speaks. Returns: ENDER_DRAGON
event.getMessage(); // Returns a String of the message that was sent event.getMessageValue(); // Returns the Int of the message from the config // THIS IS DEPRECATED BECAUSE IT CAN RETURN NULL IF THE METHOD: mob.speak(player, message); // IS USED AS THIS DOES NOT HAVE A VALUE BECAUSE IT IS A CUSTOM MESSAGE!
Comments