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!
@rickeerd120
Create a PlayerInteractEvent checking the item and then creating the animation
What steps will reproduce the problem? 1. Create an Effect 2. The console will throw an exception
What is the expected output? What do you see instead? http://pastebin.com/06jy5pGc It seems that in the latest update of Minecraft they removed the Apache Util from their Utils package. Instead you could use the org.apache.commons.lang3 class that will work.
What version of the product are you using? Latest - 3.4
Do you have an error log of what happened? http://pastebin.com/06jy5pGc
@DerFeliix
ShieldEffect shield = new ShieldEffect(Test.getInstance().getEffectManager()); shield.radius = 5; shield.iterations = 10 * 20; shield.particle = ParticleEffect.PORTAL; shield.setTarget(p.getEyeLocation()); shield.start();
Whats is "Test?
can it place on items?
@djpop4
Ancient is going to use it in its next update.
(This Command is in German) Nur mal so es wird ja bald Sponge Vanilla rauskommen und da frag ich mich ob du fĂ¼r sponge auch eine Effectlib Version machst ?
What plugins use effectlib?
I know magic does. Anything else?
Not sure if there is a method for this, however, is it possible to set who the effect is visible for? I did not see a method in the documentation, however, I could have missed something.
@Homerharry
It is an API / Lib so there are no commands.. Get a coder to make you a plugin or if you can code it by yourself
What are the commands?
@Floodeer
You can make your own effect and make a callback for if the effect hit something. The location of the current position can be obtained with "getLocation()". Just check if "getLocation()" is a block, and if there are entities nearby (Scan for 0.1f?)
@runelynx
You added the dependency EffectLib in your plugin.yml?
No matter what method I try, I get a NoClassDefFound error when I try to use this. Compiling goes fine, but runtime refuses to work. I have EffectLib-3.0.jar in my plugins folder, I've followed your maven instructions exactly, adding your dependency and repo to my pom.xml... (although ONLY following your instructions makes compile fail, so I added the EffectLib-3.0.jar to my project so it can compile. Any ideas? Here's my pastebin error: http://pastebin.com/FyZizQrp
Is there any simple way to make the effects cause damage?
uhm THIS PLUGIN HAS NO USE FOR SERVER-OWNERS Yea im a server owner and a developer XD (sorry for my bad English) butt nice effects
Sorry for the lack of support here! I think all the contribs are pretty busy, but I will try to keep a better eye on this thread.
@Valon750
The direction of the ConeEffect is determined by the direction of the source Location.
The "target" is really only used in LineEffect .. and that may be it. Most effects are based at a single location, pointing in a specific direction. The "target" is only used for effects that require two locations.
@ciaranlol
You don't want to create an EffectLib plugin instance like that. The plugin you should pass into the EffectManager constructor is your own!
@DerFeliix
See my comments above about "target"- change that to "setLocation" and it should work. Or use "setEntity" to bind it to an Entity.
Some notes about the upcoming 3.0 release!
EDIT: Just submitted!
The next release of EffectLib will fully support 1.8 particles. In an effort to get back in sync with Darkbladee12's ParticleEffect library, many of the particle names will change!
So you may have some code and/or configs that will need updating- sorry about that.
One new feature that I'm quite excited about, personally- colorized particles!
With much thanks to RingOfStorms for delving into client processing of particles, we can now colorize certain particles (SPELL_MOB, SPELL_MOB_AMBIENT and REDSTONE).
Most effects now use an additional "color" property for this, several effects may have more than one color, if they use more than one particle type. You can set this color and change the particle type to one of the colorizeable ones for custom-colored particles!
Thanks for this wonderful library!
@loandtoby
If you read the description it says in all caps "THIS PLUGIN HAS NO USE FOR SERVER-OWNERS". It is a library for other developers to use. So unless you are using another plugin that has this as a dependency there is no command to get the particles.
Hi, When I'm trying to use the EffectLib to make a LineEffect I get an error in the console. I know what the error means and it says that it can't find EffectLib (it gives a null pointer exception on the line: EffectLib lib = EffectLib.instance();). Can you tell me what I am doing wrong? CiarĂ¡n