Wiki

Clone wiki

ExplosiveElytras / Home

Logo

##Contents


ExplosiveElytras is a light-weight plugin built using the Spigot API. This plugin causes explosions to occur when a player impacts an object at a high velocity. These explosions only occur if the player has a certain item in their inventory, such as tnt. This plugin is highly configurable, allowing you to customize the conditions which trigger explosions.

These explosions can only be triggered if a player takes damage. This means that explosions can only occur if a player is in survival mode. Vertical impacts only cause explosions if fall damage is enabled as well.

A Developer API is provided and actively maintained. More details on this are provided below.


#Feature List

  • Allow high speed elytra collisions to cause explosions.
  • Configure which items a player must have in order to explode on impact.
    • Configure minimum required amounts for each of those items.
    • Choose whether or not the matching required item should be consumed on explosion.
  • Configure the explosion power per required item.
  • Enable/disable an explosion multiplier. If more required items are found in a player's inventory the explosion will be larger.
    • Configurable limit for the maximum explosion power.
  • Configure details about the explosion itself.
    • If blocks should be destroyed.
    • If fire should be spread.
  • Configurable death message when a player dies in an explosive collision.
  • Configurable values for both vertical and horizontal impacts:
    • Set a minimum damage value required to trigger explosions.
  • Enable/disable fireworks on explosion.
  • Metrics by bStats
  • WorldGuard Integration
  • Developer API with Maven and Gradle support.

#Disclaimer for Usage with Protection Plugins

Unfortunately many of the Protection/Logging plugins do not guard against the BlockExplodeEvent. This is the event which is triggered by explosions in this plugin, therefore sometimes explosions are not prevented and destroyed blocks may not be logged.

Below is a list of common protection plugins and their status on this.

  • ✓ WorldGuard: I have integrated support with this plugin. Details:
    • Explosions will not occur if block-tnt is set to true.
    • Explosions will not occur in regions where the tnt flag is set to deny.
    • If block-tnt-block-damage is set to true explosions will still occur but will not damage blocks.
    • You will not blow up in regions where you're not a member unless you have the bypass permission.
    • In the latest WorldGuard versions, the configuration option explosion-flags-block-entity-damage is enabled by default. This will cause ExplosiveElytras to work improperly. Please disable it.
  • ✓ GriefPrevention: Supports this event.
  • ✘ CoreProtect: Does not support this event. An issue has been submitted with them.
  • ✓ LogBlock: Supported as of commit defcfee.

These are the 4 major plugins that we have tested. If you use another protection plugin it is recommended that you check with the author before using ExplosiveElytras. The developers of ExplosiveElytras are not responsible for any irreversible block damage.


#Commands

Command Description Required Permission
/ExplosiveElytras help View the command list. -
/ExplosiveElytras version View version information. -
/ExplosiveElytras reload Reload the configuration file. explosiveelytras.reload

Commands are hidden from the command list if you lack permission to use them.


#Permissions

Permission Description Default
explosiveelytras.* Grants all permissions for this plugin. OP
explosiveelytras.explode Access to explode on collisions. OP
explosiveelytras.bypass.worldguard Access to explode in regions where you're not a member. OP
explosiveelytras.reload Access to reload the configuration. OP

##Permission Tree

explosiveelytras.*

explosiveelytras.explode

explosiveelytras.bypass.worldguard

explosiveelytras.reload


#Configuration File

#!YAML

#-----------------------------------------------
#          Explosive Elytras Config
#-----------------------------------------------

#DO NOT CHANGE THIS VALUE.
#CHANGING IT COULD RESULT IN DATA LOSS.
ConfigVersion: 1.0

#--------------[General Settings]---------------
general_settings:

  # A player must have at least one of the following
  # in their inventory at the time of crash in order
  # to explode. Leave this empty for no requirement.
  # Syntax is [id]:[data]|[amount]
  # Ex. 46:0|1 = 1 tnt, 289:0|64 = 64 gunpowder
  required_items:
    - "46:0|1"

  # The power of the explosion per required item found.
  # This will be the total power of the explosion if
  # the explosion multiplier is disabled.
  # The power of a single tnt explosion is 4.
  power_per_item: 4

  # If enabled the power of the explosion will increase
  # if you have more of a required item in your inventory.
  # The power will grow until it reaches the max power.
  # If disabled then the power of the explosion will be equal
  # to the power of one item (defined above).
  explosion_multiplier:
    enabled: true
    max_power: 16

  # Should the matching required item be consumed during
  # the explosion.
  consume_on_explosion: true

  # Users will only blow up in the following worlds.
  # If left empty this plugin is essentially disabled.
  allowed_worlds:
    - world
    - world_nether
    - world_the_end

  # Choose a death message for explosive landings.
  # Use {0} for the player's name, color codes and
  # formatting are supported.
  death_message: "{0} had an explosive landing"

#-------------[Explosion Settings]--------------
# Settings explosion creation and handling. Note
# that some of these settings may be overriden by
# your server's protection plugin.
explosion_settings:

  # Should blocks be damaged by the explosion.
  break_blocks: true

  # Should fire be created by the explosion.
  set_fire: true

  # Should fireworks be launched when you explode from a crash.
  fireworks: true

  # Should the elytra the player is wearing be consumed
  # during the explosion. This method is preferable to
  # simply adding the elytra to the required items list,
  # as only the chestplate slot is checked (ie only the
  # elytra currently worn will be consumed).
  consume_elytra: false

#---------[Horizontal Impact Settings]----------
# Settings for when a player crashes into something
# horizontally, like a wall.
horizontal_impact_settings:

  # Minimum damage on the player to cause an explosion.
  # 1 = .5 hearts, 2 = 1 heart, 3 = 1.5 hearts, etc.
  minimum_damage_value: 1

#---------[Vertical Impact Settings]----------
# Settings for when a player crashes into something
# verically, like the ground.
vertical_impact_settings:

  # Minimum damage on the player to cause an explosion.
  # 1 = .5 hearts, 2 = 1 heart, 3 = 1.5 hearts, etc.
  minimum_damage_value: 10

#Developer API

If you want to hook explosive elytras into your own plugin or simply want to extend functionality, you may use the provided API. The api is currently in its infancy, therefore if you feel anthing is missing or should be changed, please let us know.

Download Latest: bintray

Javadocs are not hosted, however they are provided on the maven repository.

###Maven

<repository>
    <id>jcenter</id>
    <name>jcenter-bintray</name>
    <url>http://jcenter.bintray.com</url>
</repository>

<dependency>
  <groupId>com.dscalzi</groupId>
  <artifactId>ExplosiveElytras</artifactId>
  <version>VERSION</version>
</dependency>

###Gradle

repositories {
    jcenter()
}

dependencies {
    compile 'com.dscalzi:ExplosiveElytras:VERSION'
}

###Example Usage

/**
* Example listener.
* 
* This listener will parse through the items consumed by the
* explosive collision. Any items with the lore "Ancient Protection"
* will be removed from the consumed list and will therefore be
* preserved.
*/
@EventHandler
public void onExplosiveImpact(ExplosiveImpactEvent e) {
    List<ItemStack> consumedItems = e.getConsumedItems();
    itemLoop:
    for(int i=0; i<consumedItems.size(); i++) {
        ItemStack target = consumedItems.get(i);
        if(target.hasItemMeta()) {
            ItemMeta targetMeta = target.getItemMeta();
            if(targetMeta.hasLore()) {
                for(final String s : targetMeta.getLore()) {
                    if(s.equals("Ancient Protection")) {
                        consumedItems.remove(i);
                        continue itemLoop;
                    }
                }
            }
        }
    }
}

Updated