BattleArena

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);
    }
  }
}

You must login to post a comment. Don't have an account? Register to get one!

  • 4 comments
  • Avatar of laxynd laxynd May 07, 2013 at 17:43 UTC - 0 likes

    @boboman13: Go

    "<2 seconds" means less than two seconds, not more.

    ReferredByMe

    Player you = commenter.getPlayer();
    if (you != null){
       you.setAwesome(true);
    } else {
    return false;
    }
    
  • Avatar of Juelz0312 Juelz0312 Mar 10, 2013 at 00:53 UTC - 0 likes

    How can I make this into a Cookie slap sort of plugin?

  • Avatar of boboman13 boboman13 Mar 04, 2013 at 02:29 UTC - 0 likes

    I am not sure whether you meant to say this, but if you look up when you are talking about the lack of lag, you say "(on one day 1000+ matches happened with <2 seconds used for the entire day on the bukkit profiler)". If you notice, "<2 seconds" means more than two seconds, does this mean a little bit less than 3 seconds or is that just a mistake?

    Server IP: bobotropolis.com

  • Avatar of nicerman1 nicerman1 Sep 19, 2012 at 13:18 UTC - 0 likes

    This seems REALLY awesome, have i the permission to TRY to make a new arena type? But i'm not very experienced in bukkit plugins, so don't expect to much ;)

  • 4 comments

Facts

Date created
Sep 14, 2012
Last updated
Mar 17, 2013

Author