Developers

API Examples

Paintball and Spleef.

WIKI on API

Source

Add on Plugins Source

Why use Arenas as a platform?

  • No need to worry about teleportation
  • or teams
  • or who is in your event or not
  • or giving people items or prizes.
  • or spawning items/mobs
  • efficient and fast (see below)
  • Much less code to write for yourself

Essentially, you can cut out 90% of the code and worry on making your event Unique.

EVERY bukkit event can be overridden and if it has the pragma @MatchEventHandler above it, you will only get that bukkit event for players that are still INSIDE your event.

Despite its size this plugin is very efficient and uses almost zero processor time (on one day 1000+ matches happened with <2 seconds used for the entire day on the bukkit profiler). This is because the plugin removes all listeners that are not currently being used so that no cycles are used when a bukkit event doesn't need to be listened for.

The Paintball plugin takes less than 20 lines of code. The number of teams, size of teams, teleportation, inventory handling, victory prizes and loser prizes, are all configurable like normal through the config

The Spleef is slightly more complicated because you need to be able to type commands, and regenerate layers, etc. But the amount of code is very small compared to what would normally be required.

Full working Paintball plugin code

public class Paintball extends JavaPlugin{
  static int damage = 20;

  @Override
  public void onEnable(){
    BattleArena.registerMatchType(
                      this, "Paintball", "pb", PaintballArena.class);

    damage = getConfig().getInt("damage", 20);
  }

  public class PaintballArena extends Arena{
    @MatchEventHandler
    public void onEntityDamage(EntityDamageByEntityEvent event) {
      if (event.isCancelled())
        return;
      if (event.getDamager().getType() !=  EntityType.SNOWBALL)
        return;
      event.setDamage(damage);
    }
  }
}

Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes