Library EffectLib - Manage your effects the nice way. (Text/Image in Particles)

Discussion in 'Resources' started by Slikey, Apr 21, 2014.

Thread Status:
Not open for further replies.
  1. I know, that bukkit is not thread-safe, but i though sending lot's of packets is probably better in a second thread.
    I guess it's cleverer to send the packets in the main-thread, but would it be possible to synchronise the "playerlist" from the CraftWorld with the synchronised() annotation using the particle-sending-api included in EffectLib?
     
  2. Offline

    QuarkTheAwesome

    I've got a bit of a question:

    I'm getting a NoClassDefFoundError on init... Do you know where I'm going wrong?
    Show Spoiler

    Code:java
    1. org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: de/slikey/effectlib/EffectLib
    2. at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    3. at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    4. at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    5. at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:355) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    6. at org.bukkit.craftbukkit.v1_7_R3.CraftServer.reload(CraftServer.java:797) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    7. at org.bukkit.Bukkit.reload(Bukkit.java:288) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    8. at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    9. at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    10. at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServer.java:701) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    11. at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchServerCommand(CraftServer.java:688) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    12. at net.minecraft.server.v1_7_R3.DedicatedServer.aB(DedicatedServer.java:296) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    13. at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:261) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    14. at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    15. at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    16. at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    17. Caused by: java.lang.NoClassDefFoundError: de/slikey/effectlib/EffectLib
    18. at com.QuarkTheAwesome.BasicParticleText.BasicParticleText.<init>(BasicParticleText.java:15) ~[?:?]
    19. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_40]
    20. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[?:1.7.0_40]
    21. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.7.0_40]
    22. at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[?:1.7.0_40]
    23. at java.lang.Class.newInstance(Class.java:374) ~[?:1.7.0_40]
    24. at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    25. at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    26. ... 14 more
    27. Caused by: java.lang.ClassNotFoundException: de.slikey.effectlib.EffectLib
    28. at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[?:1.7.0_40]
    29. at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[?:1.7.0_40]
    30. at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_40]
    31. at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[?:1.7.0_40]
    32. at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    33. at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    34. at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.7.0_40]
    35. at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.7.0_40]
    36. at com.QuarkTheAwesome.BasicParticleText.BasicParticleText.<init>(BasicParticleText.java:15) ~[?:?]
    37. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_40]
    38. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[?:1.7.0_40]
    39. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.7.0_40]
    40. at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[?:1.7.0_40]
    41. at java.lang.Class.newInstance(Class.java:374) ~[?:1.7.0_40]
    42. at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    43. at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    44. ... 14 more


    I'm not really sure what's going on: I stuck the lib in the plugins folder, set the dependency to compile in Maven: I just have no idea. Anyway, line 15 of BasicParticleText.java is:
    Code:java
    1. EffectLib lib = EffectLib.instance();

    I'm really not sure, can you help?
    Thanks!

    P.S I'm using 2.1-SNAPSHOT from maven.elmakers.com/repository/
     
  3. Offline

    Slikey

    Packets are sent in an async thread anyway. That is handled by netty. So no need for you to cover that.

    Did you add the EffectLib to the plugin dependencies in the plugin.yml?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 29, 2015
  4. Offline

    QuarkTheAwesome

    Slikey You have to do that? Oops. :3

    One other thing, how do you set the location of a TextEffect? There's no location property: is it the stepX and Y?

    Thanks!
     
  5. Offline

    dNiym

    Edit:

    Nevermind. Finally figured it out on my own.
     
  6. Offline

    dNiym

    Okay... New Question...
    Is there a way to store multiple effects in a list or hashmap?
    I need to keep track of them and it seems like my variables are restricted to whatever type effect I am using.

    IE:


    Code:
    //Main Class
    ConcurrentHashmap efxmap<Player,WarpEffect> = new ConcurrentHashMap<Player, WarpEffect>();
     
    //Function
    private void dostuff() {
     
    //depending on some factors
    if(condtion1 == true) { //do this effect
    ]WarpEffect effect = new WarpEffect(plugin.getEM());
    } else { //do this effect instead...
    VortexEffect effect = new VortexEffect(plugin.getEM());
    }
     
    //now set up the effect
    effect.particle = ParticleEffect.FLAME;
    effect.start();
    }
    }
    
    The above code works until you add in the second effect, as effect is already defined as a WarpEffect but I would like to apply a different effect in the same class depending on what the user does. The ONLY part that changes in the code would be the effect type and possible a couple effect paramaters... If i cant store them differently in the hashmap I will have to create a hashmap per effect :(

    I tried doing this:
    Effect effect = null;

    then later
    effect = new VortexEffect();

    but the compiler complans and wants effect to be of the type VortexEffect instead of Effect..
     
  7. Offline

    Slikey

    @dNiymCheck your Imports. You maybe used the Bukkit Class "Effect"
     
  8. Offline

    dNiym

    You're exactly right, I did have a bukkit effect imported. That should work now!

    How about item's as particles?
    Such as if I wanted to make a smoke effect or helixeffect and spawn dropped items that vanish after a few seconds?
    theres another plugin that uses this and its called the itemspray effect. You specify the item_id and (less importantly to me)data such as color. and it "sprays" out whatever item you have selected.

    this is the effect look:
    [​IMG]
    http://prntscr.com/4o419b

    Ideally i would like to be able to spawn a ring of swords (or whatever particles) around a player and have them rotate around / fly outward before they hit the ground.
     
  9. Offline

    LCastr0

    You guys might know that I am a bit late xD
    Another bad thing in 1.8: DMCA. No fixing for the particle rendering, at least until Sponge is out. Or another system. Or if Bukkit is revived lol
     
  10. Offline

    xTrollxDudex

    Stop derailing threads, seriously.
     
  11. Offline

    dNiym

    any thoughts on the possibilities of us getting items icons as particle effects? Some of these effects would be pretty sweet as a spray of swords or diamonds :D
     
  12. Slikey How do I make that text! I so want some example code for that!
     
  13. Offline

    DevRosemberg

  14. Offline

    PlayerNerd

    Slikey How can i make a particle follow a player? I was trying to make it run for a time but only works in the first time:
    Code:java
    1. final CylinderLocationEffect effect = new CylinderLocationEffect(em, p.getLocation());
    2.  
    3. effect.particle = ParticleEffect.ENCHANTMENT_TABLE;
    4.  
    5. effect.height = 4;
    6. effect.iterations = 10;
    7.  
    8. effect.start();
    9.  
    10. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    11. public void run() {
    12. effect.start();
    13. }
    14. }, 20);
    15.  
    16. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    17. public void run() {
    18. effect.start();
    19. }
    20. }, 40);
    21.  
    22. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    23. public void run() {
    24. effect.start();
    25. }
    26. }, 60);
    27.  
    28. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    29. public void run() {
    30. effect.start();
    31. }
    32. }, 80);
    33.  
    34. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    35. public void run() {
    36. effect.start();
    37. }
    38. }, 100);
     
  15. Offline

    LCastr0

    Why do you start it 5 times...
     
  16. Offline

    PlayerNerd

    LCastr0 For "follow" de player
     
  17. Offline

    LCastr0

    But you don't need that...
     
  18. Offline

    teej107

    Use a repeating task.
     
  19. Offline

    PlayerNerd

    teej107 Could you give me an example?
     
  20. Offline

    teej107

  21. Offline

    PlayerNerd

    teej107 It only works 2 times, i need that it works 20 times. or more
     
  22. Offline

    Trolltheking

    When can we download the new plugin version with annimatedballeffect? Also, can you make it so that it follow the player and never ends unless the player turns it off? thank you for being soo awesome
     
  23. Offline

    jensdeboom

    When I try to make any effect work like this:
    Code:
    AnimatedBallEffect balleffect = new AnimatedBallEffect(em);
    balleffect.setLocation(p.getLocation());
    balleffect.start();
    It gives me a ClassNotFoundException: de.slikey.effectlib.effect.<Class of effect I'm using> when I use the command.
     
  24. Offline

    ArthurHoeke

    LCastr0 I saw your video where you showed the AnimatedBallEffect, On that post you also putted a source link on github but the link is down, Can you send me the source please? Its a very cool effect :D
     
  25. Offline

    LCastr0

    The effect wasn't made by me, and it's already on EffectLib
     
  26. Offline

    ArthurHoeke

  27. Offline

    LCastr0

    AnimatedBall
     
  28. Offline

    ArthurHoeke

    LCastr0 Im trying to create the animatedball effect, But it doesn't spawn.. I get the error: Caused by: java.lang.IllegalArgumentException: EffectManager cannot be null!
    To spawn it in I use
    Code:
                              AnimatedBallEffect balleffect = new AnimatedBallEffect(em);
                              balleffect.setLocation(player.getLocation());
                              balleffect.period = 10;
                              balleffect.particle = ParticleEffect.FIREWORKS_SPARK;
                              balleffect.start();
     
  29. Offline

    MisterErwin

  30. Offline

    ArthurHoeke

Thread Status:
Not open for further replies.

Share This Page