Wizards ❱ Domination | CTF | TDM | icon

Wizards ❱ Domination | CTF | TDM | -----

Domination, CTF & TDM | Leaderboards | Classes or Kits | Special Effects/Systems | Mounts |



NEW FEATURE: Powerups
  • Added a new game feature: Powerups!
    • There are only 1 powerup type at the moment, but you can add your own powerups via the API, see below.
    • More Powerups will be added in the future, this is just a snapshot of the feature.
  • The current powerup type is POINTS
    • It will add points to the team of the player that picked it up, you can modify the amount of points and respawn delay.
      • Default delay: 180000 = 180s
      • Default points: 150
      • At Options.Game.Powerups.Points and Powerups section at language file.
  • The Powerup system is in its first days, there are no Holograms for it just yet! Hopefully we will have some more customization for non-developers soon, if you have/are a developer you can add Holograms and much more using the API.

Don't worry, your arena won't break if you don't want to use Powerups. If you find a problem please disable your Powerups and report via Private Message!

To create your own Powerup, create a new class that extends Powerup, example:
Code (Text):
public class MyPowerup extends Powerup {


    public MyPowerup(String configIdentifier, Location location, long interval) {
        super(configIdentifier, location, interval);
    }

    @Override
    protected Item respawnPowerup(Location location) {
        return null;
    }

    @Override
    protected void onPlayerPickup(Player player) {

    }
}
Now, you can create your Powerup Item and Powerup Action.

The Identifier is the name in map config and the name you will use to add the Powerup location via command.
Code (Text):
public class MyPowerup extends Powerup {


    public MyPowerup(Location location, long interval) {
        super("MYPOWERUP", location, interval);
    }

    @Override
    protected Item respawnPowerup(Location location) {
        Item item = location.getWorld().dropItem(location, new ItemStack(Material.BLAZE_POWDER));
        item.setVelocity(new Vector(0, 0, 0));
        item.teleport(location.clone().add(.5, 0, .5));
        return item;
    }

    @Override
    protected void onPlayerPickup(Player player) {
        GamePlayer.get(player).setMana(99);
        player.sendMessage(ChatColor.RED + "Filled your mana!");
    }
}
 
That's it! You now have your own powerup.

Now, you need to register the Powerup Spawn and add the powerup to your games. You will need to use the new event made for this: GameArenaLoadEvent.

You will need to access the GameArena and the Map that contains the Locations for each Powerup Type, made this way to be easier for developers.

Code (Text):

@EventHandler
public void onArenaLoad(GameArenaLoadEvent e) {
e.getGame().registerPowerupSpawn("MYPOWERUP");
e.getGame().getGameArena().getPowerups().get("MYPOWERUP").forEach(location ->
       e.getGame().getPowerups().add(new MyPowerup(location, 15000L)));
}
 
Spawns are automatically handled by the Game.

And it's done.

You can now add your powerups to the arena using the command.

For Developers, a quick note here, make sure all your Powerup names are in UPPER CASE, this is not a mechanic limitation, it is just to make it easier when setting up the arena and getting names from config files.

For admins who are setting up the arena it doesn't metter, you can use upper or lower case, it will convert to uppercase anyways.
----------, Dec 10, 2021
Resource Information
Author:
----------
Total Downloads: 135
First Release: Jul 7, 2018
Last Update: Dec 16, 2024
Category: ---------------
All-Time Rating:
20 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings