API

Version 2.2.0 and above has an API included for developers to work with. Remember that this API is in alpha and things are changed a lot. I've provided some examples below to work with. Don't forget to add softdepend or depend BuildingGame to your plugin.yml.

Join an arena
BuildingGame.getArena("myArena").join(myPlayer);
Leave an arena
BuildingGame.getArena("myArena").leave(myPlayer);
ArenaStartEvent
public class MyListener implements Listener {
  @EventHandler
  public void onArenaStart(ArenaStartEvent e) {
    e.getPlayer().sendMessage(ChatColor.GOLD + "Good luck with the game!");
  }
}
Theme reminder

In case your players always forget the theme (and they can't read chat, and you haven't put it in the scoreboard)

public class Main extends JavaPlugin {
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, Stirng label, String[] args) {
    if (!cmd.getName().equalsIgnoreCase("theme"))
      return true;

    if (!(sender instanceof Player)) {
      sender.sendMessage(ChatColor.RED + "Only players can execute this command");
      return true;
    }
    Player player = (Player) sender;
    Arena arena = BuildingGame.getArena(player);

    if (arena == null) {
      player.sendMessage(ChatColor.RED + "You aren't in an arena right now");
      return true;
    }
    
    player.sendMessage(ChatColor.GOLD + "The theme is: " + ChatColor.GREEN + arena.getSubject());
  }
}

These are just some examples. If you want any additional stuff for the api, please let me know


Comments

Posts Quoted:
Reply
Clear All Quotes