Make sure you have a full set of leather armor matching your team's color.
Things you should check for:
1. You cannot break blocks
2. You cannot place blocks
3. You can't switch the item in your hand
4. You cannot move items around your inventory
5. You cannot drop items
6. Your food level does not change after running
7. You don't take damage from fire or falling
Choose where you want the powerups to spawn and place a block of your choice in those positions to mark them. In this example I will use emerald blocks to mark the powerup spawn points because the powerups will be emeralds. Feel free to choose a different item and/or block for your powerups.
Here is a video of me marking my powerup locations. You don't need to place them in these exact locations, this is just a suggestion.
Make sure ALL of the locations in the
powerUpLocs array have a dropped emerald!
Let's talk a bit about the
newPotionEffect(effect, duration, strength) function so it is easier for you to customize the powerup effects in your game.
newPotionEffect() function takes three parameters:
effect - the type of potion effect to create
duration - the number of seconds the effect will last
strength - the power level of the effect
This will result in a Speed IV effect that lasts for 30 seconds
Here is a list of all possible effect types: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html
NOTE: Not all of these will be useful or detrimental during a capture the flag minigame so try to pick effects that will help or harm the players in the context of the game!
Make sure you are granted a random effect when you pick up an emerald. The emerald should also be removed from your inventory immediately upon picking it up.
You may notice that when you are granted invisibility your armor is still visible so it doesn't help very much! In the next step we will temporarily remove the players armor when they get an invisibility effect.
This code will remove all armor from a player when they are granted the invisibility effect. It also gives them a new set of armor of the correct color after 30 seconds (when the invisibility effect ends). If you changed the duration of your invisibility effect make sure this delay matches the amount of time the invisibility effect lasts.
Make sure your armor is removed when you get an invisibility effect and the right color armor is returned to you when the effect ends.
Here are so ideas to get you started:
Things to consider modifying
- Fire rate of snowballs
- Effect types, duration, strength (i.e. short duration flight effect)
- Number of powerups and their locations
- Number of flag captures required to win
Things to add
- Take multiple hits to be sent to jail
- Elimination mode: players never returned to base from jail
- Your own ideas!