API (Developers)

MobsCanTalk API

  1. Create your plugin folder in your editor
  2. Add the MobsCanTalk.jar to the build paths
  3. 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:

  1. Make an event class
  2. 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

Posts Quoted:
Reply
Clear All Quotes