Skip to content
This repository was archived by the owner on Oct 11, 2020. It is now read-only.
MeLays edited this page Aug 4, 2017 · 4 revisions

MTTT Developer API

Getting the TTTApi Instance

  1. You need a softdepend or depend to MTTT in your plugin.yml
    depend: [MTTT]
    softdepend: [MTTT]
  2. Get your TTTApi Instance
TTTApi api;

public void onEnable(){
     ...
     if (Bukkit.getPluginManager().isLoaded("MTTT")){
          api = TTTApi.getInstance();
     }
     else{
          //MTTT not loaded/installed
     }
}

TTTApi object functions

getArena(String name) returns Arena - Returns Arena object with given name, null if arena is non existing.
getArena(Player player) returns Arena - Returns Arena object where the player is in, null if player is not ingame.
getPlayer(Player player) returns TTTPlayer - Returns TTTPlayer object of Player player.

TTTPlayer object functions

isPlaying() returns boolean - Returns true if player is playing.
getRole() returns String - Returns the role of the player in the current arena.
getColoredRole() returns String - Returns the colored role of the player in the current arena.
leave(boolean silent) returns nothing - Leaves the player from the current arena.
join(Arena a) returns nothing - Tries to join the player to the given arena.
getPlayer() returns Player - Returns the spigot Player object.

Events

RoleKillRoleEvent

Triggered when a player gets killed by another player ingame.

@EventHandler
public void onRoleKillRoleEvent (RoleKillRoleEvent e){
     ...
}

//Event functions
    public Arena getArena() {
    }

    public Player getKiller() {
    }

    public Player getPlayer() {
    }
    
    public String getPlayerRole() {
    }
    
    public String getKillerRole() {
    }

ArenaStateChangeEvent

Triggered when a arena changes its gamestate (waiting , ingame , end) Also triggered when a arena restarts in infinite mode (from: end , to: waiting)

@EventHandler
public void onArenaStateChangeEvent (ArenaStateChangeEvent e){
     ...
}

//Event functions
    public Arena getArena() {
    }

    public String getFrom() {
    }

    public String getTo() {
    }

Clone this wiki locally