Dev Examples

From MBedwars
Jump to navigation Jump to search

! Legacy Warning !

You are currently visiting a prehistoric website of the Marcely's Bedwars plugin for v4 and older.

In 2021, we released version 5 and completely overhauled the wiki. A lot of information that you find here likely won't be up-to-date anymore. You may find the updated wiki on: https://wiki.mbedwars.com

Check if this plugin is existing (v.1.6+)

if(Bukkit.getServer().getPluginManager().getPlugin("GroupManager") != null)
   // exists
else
   // deosn't exist

Get the status of an arena (v.1.6+)

String name = "example";
System.out.println("This arena is currently " + BedwarsAPI.getArena(name).getStatus().name());

Create own extra-item (v.2.2+)

ExtraItem item = new ExtraItem("TextWhenBuyingIt", new ItemStack(Material.DIRT, 1)){
   @Override
   public void onBuyEvent(BuyEvent event){
      event.getBuyer().sendMessage("OMG! It's working!");
   }
}
BedwarsAPI.registerExtraItem(item);

Create own spawner (v.2.2+)