EffectLib
EffectLib
Wiki https://github.com/elBukkit/EffectLib/wiki
Support on Discord: https://discord.gg/fWJ3W3kMjG
Forum (Outdated): http://forums.bukkit.org/threads/effectlib-manage-your-effects-the-nice-way.259879/
Description
THIS PLUGIN HAS NO USE FOR SERVER-OWNERS
This library is a possibility for developers to out-source their effect-managment. This library comes with a handy collection of customizable effects, but you can easily add your own effects and manage them in the library.
Usage
- See documentation for Maven-based instructions.
- OR Add the EffectLib.jar to you project and to the plugins in your server.
- Create a new EffectManager to handle your effects.
EffectManager em = new EffectManager(plugin);
- Create a new Effect and start it.
Effect effect = new BleedEffect(em); effect.setEntity(target); effect.start();
- Dispose of the EffectManager after when you are completely done with it.
em.dispose();
Demo
This demo creates a bleed-effect when a player joins. After 15 seconds, the effect runs out and the callback is called, that kills the player and sends them a message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
package com.yourdomain.yourplugin; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; import de.slikey.effectlib.EffectManager; import de.slikey.effectlib.effect.BleedEffect; public class EffectLibTest extends JavaPlugin implements Listener { private EffectManager effectManager; @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); // Initialize a new EffectManager effectManager = new EffectManager(this); } @Override public void onDisable() { // Dispose of the EffectManager effectManager.dispose(); HandlerList.unregisterAll((Listener) this); } @EventHandler public void onPlayerJoin(final PlayerJoinEvent event) { // Create the Effect and attach it to the Player BleedEffect bleedEffect = new BleedEffect(effectManager); bleedEffect.setEntity(event.getPlayer()); // Add a callback to the effect bleedEffect.callback = new Runnable() { @Override public void run() { event.getPlayer().sendMessage("You bled out.."); event.getPlayer().setHealth(0d); } }; // Bleeding takes 15 seconds // period * iterations = time of effect bleedEffect.iterations = 15 * 20; bleedEffect.start(); } } |
Effects Control
All effects can attach to a Location (setLocation) or an Entity (setEntity). Some Effects (like LineEffect) can work with two locations- use setTargetEntity and setTarget to control the "second point".
You can cancel all running effects of an EffectManager by cancel(boolean callback).
Configuration-Driven Effects
There is also a Configuration-driven interface you may use, EffectManager.start.
You may pass in the Effect class as a String, and additional parameters as a ConfigurationSection. This can be a fully-qualified path (for custom externally-defined Effects) or a simple class name for the builtin classes. For example:
summon: class: VortexEffect iterations: 4 particle: smoke helixes: 16 circles: 7 grow: 0.1 radius: 1
And then to use it, something like this:
ConfigurationSection effectConfig = getConfig().getConfigurationSection("summon"); String clasName = effectConfig.getString("class"); effectManager.start(className, effectConfig, player);
There are several different versions of the start() method as of 3.4, the longest one would look like this:
effectManager.start(className, effectConfig, player.getLocation(), player, null, null, null);
The latter three parameters are optional, the two "target" parameters used only in certain FX. The last line can be used for the TextEffect to have parameterizable text messages- for instance, if you wish to insert the Player's name in a Configuration-drive text message.
Current Effects
- ArcEffect - Create architectual correct arc of particles
- AtomEffect - Create the orbital-model of the atom
- BigBangEffect - Create a large cluster of fireworks.
- BleedEffect - Let the target entity bleed.
- ConeEffect - Cast a cone in all possible directions
- EarthEffect - Create a model of the Earth
- DnaEffect - Create DNA molecule
- ExplodeEffect - Create a explosion at location.
- FlameEffect - Let the target entity burn.
- FountainEffect - Create a foundtain for you well
- GridEffect - Customizable grid for you signwall
- HelixEffect - Create a customizable static helix.
- JumpEffect - Forces an entity to jump naturally.
- LineEffect - Draw line from A to B
- LoveEffect - The target entity is in love.
- MusicEffect - Circle of notes appeares above the entity.
- MusicEffect - Circle of notes appeares at a location.
- ShieldEffect - Spherical Shield around an entity.
- SkyRocketEffect - Foces an entity to fly into the sky.
- SmokeEffect - Let the target entity smoke.
- StarEffect - Create fully customizable 3D star
- TextEffect - Create particle-text with custom font, size and text
- TraceEffect - Create a trace along an entitys path.
- TurnPlayerEffect - Forces the player to turn in a circle.
- VortexEffect - Create a vortex of particles at location
- WarpEffect - Create a warp-effect around an entity
- WaveEffect - Create waves with surf.
- Feel free to send me your effects if you have coded up some custom ones of your own!
All effects have the ability to be changed. Let the effect repeat, increase duration or change period of iterations.
Any Effect will work when attached to a static location, or to an Entity. If both are provided, it will attach at the target Location, but move relative to that along with the entity (great for tagging hit locations, or attaching to an Entity's head or other body part specifically!)
Source
Get the source on GitHub!
@hyWse
Unfortunately that part of the BleedEffect wasn't configurable.
I just added a "height" parameter, you'll need to grab a dev build to try it out until next release. Build#95 or higher on my Jenkins server.
@WindUnwaken
Working great for me on 1.10.2, about 4 particles dont work though
http://hastebin.com/ekuzurewoy.vhdl
Bug report :D ^^
Will it going to update for 1.10 ? Thanks, we all have patience to wait for it.
How can i set the maximum height (BloodEffect)?
@MarshmallowSwirl
Try setting visibleRange low, something like 1 or 2.
@pokerman981
Not sure, it's very odd for it to be looking for the 1.8 versions of classes on a 1.9 server.
What server software are you using, specifically? And what plugin is using EffectLib?
Is there a way so that only one player can see the particles? for instance if I have the particles set to display on a command, how can I only display them to the player that ran the command?
Hi when ever I go to start my server I get this error: http://prntscr.com/axbgjg How would I go about to fix this?
@max2222du94
@TheLexoPlexx
Sorry for the API confusion- I just released 4.2, which adds the setEntity and setLocation methods back to Effect.
If you're using Maven, you can update to 4.2 immediately.
It also adds a new EquationEffect, which lets you use math equations to create your own custom FX!
See the documentation for more info:
http://jenkins.elmakers.com/job/EffectLib/doxygen/classde_1_1slikey_1_1effectlib_1_1effect_1_1_equation_effect.html#a81c700fdd92e387220b27ed1f8ddc724
It's great if accompanied by sound effects and pop during the press / tp <player>. :) If you can help me a wonderful fig thanks!
Hello, how to spawn enchant table effect around a player with LoveEffect, then fly to player just like normal enchant table effect fly to the enchant table from the book shelf?
@max2222du94
"method undefined" means it doesn't exist and since EffectLib Version 3.(?). Locations are handled with DynamicLocations. Create a new DynamicLocation and use setDynamicLocation/setDynamicTarget
I use effectlib for the LineEffect But I have errors http://pastebin.com/pPymNBNk line 46 and 47 The method setLocation(Location) is undefined for the type LineEffect The method setTarget(Location) is undefined for the type LineEffect Can you help me ? (I am a french student, I begin on Java)
@PhantomMarth
Spell:
spell-class: ".instant.ParticleProjectileSpell"
name: Spell
projectile-velocity: 5
tick-interval: 1
range: 20
hug-surface: true
special-effect-interval: 1
spell:
effects:
1:
position: special
effect: effectlib
effectlib:
class: SphereEffect
particle: SMOKE
iterations: 1
radius: .5
yOffset: -1
particles: 50
period: 50
visibleRange: 625
Anyone, I need help! Please post the steps for installing it into my server to work with the plugin Magicspells. I drop and drag the EffectLib.jar into my plugin folder, then added the codes to the spell in Magicspells, but still do not see any particles!
@assasinsheep
I don't think this plugin will ever have any commands, sorry! I is strictly an API/Lib.
Honestly at this point it should be used by devs with Maven and probably doesn't need to be a stand-alone plugin jar at all.
hi would you be able to add commands for the effects since I do not know how to code at all.
Amazing plugin ! I use it for TextParticle
Love you :D