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. Offline

    LCastr0

    Its not onEnable..
    Code:
    EffectManager manager;
    
    public void onEnable(){
    manager = new EffectManager(this);
    //rest of your enable
    }
    
     
  2. Offline

    worstboy32

    Thanks a lot for sharing this amazing lib/code.
    Do you guys know if there is some way to change firework particle color with packets?
    They are colored in normal fireworks so there must be some way to do it right? <3
    Because if they can be colored then there are so much more possibilities with for example the colored image effect.
     
  3. Offline

    LCastr0

    No, fireworks colors cannot be changed, sadly.
     
  4. Offline

    coco5843

    LCastr0 Maybe you can make that:
    [​IMG]
     
  5. Offline

    LCastr0

    I was thinking about doing it already :p
     
  6. Offline

    coco5843

    So , it coming soon :D
     
  7. Offline

    LCastr0

    Maybe lol
     
  8. Offline

    WarmakerT

  9. Offline

    StaticJava

    Is it just me, or do these effects not work anymore?
    Code:java
    1. package me.staticjava;
    2.  
    3. import de.slikey.effectlib.EffectLib;
    4. import de.slikey.effectlib.EffectManager;
    5. import de.slikey.effectlib.effect.FlameEffect;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.command.CommandExecutor;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.event.player.PlayerJoinEvent;
    11. import org.bukkit.plugin.java.JavaPlugin;
    12.  
    13. /**
    14. * Created by StaticJava.
    15. */
    16. public class TestProject extends JavaPlugin implements CommandExecutor, Listener {
    17. private EffectManager effectManager;
    18.  
    19. @Override
    20. public void onEnable() {
    21. getServer().getPluginManager().registerEvents(this, this);
    22. EffectLib lib = EffectLib.instance();
    23. effectManager = new EffectManager(lib);
    24. getLogger().info("TestProject has been enabled!");
    25. }
    26.  
    27. @Override
    28. public void onDisable() {
    29. effectManager.dispose();
    30. getLogger().info("TestProject has been disabled!");
    31. }
    32.  
    33. @EventHandler
    34. public void onPlayerJoin(final PlayerJoinEvent event) {
    35. event.getPlayer().sendMessage(ChatColor.GREEN + "Flame effect has started!");
    36. FlameEffect flameEffect = new FlameEffect(effectManager);
    37. flameEffect.setEntity(event.getPlayer());
    38. flameEffect.setLocation(event.getPlayer().getLocation());
    39. flameEffect.callback = new Runnable() {
    40.  
    41. @Override
    42. public void run() {
    43. event.getPlayer().sendMessage(ChatColor.RED + "Flame effect has ended!");
    44. }
    45.  
    46. };
    47. flameEffect.iterations = 600;
    48. flameEffect.start();
    49. }
    50. }

    I get both debug messages (flame effect has started/ended), but the effect never seems to show up. Any help? LCastr0
     
  10. Offline

    LCastr0

    Eh seems kinda like a noob question to ask you, did you enable particles on Video Settings?
     
  11. Offline

    StaticJava

    Not a nooby question at all! That was the issue! Thanks.
     
  12. Offline

    LCastr0

    Really? xD
     
  13. Offline

    mkezar

    When i try to make my own effect, my program HATES RandomUtil. I dont know what to do. do i change to RandomUtils?
     
  14. Offline

    StaticJava

    Yeah xD
     
  15. Offline

    LCastr0

    How does it hate it? Specify :p
     
  16. Slikey
    Hey, I am getting a NoClassDefNotFound error when I call this:

    " if (effectLib == null || !(effectLib instanceof EffectLib)) { "
    Error:
    Code:
    java.lang.NoClassDefFoundError: org/myplugin/slikey/effectlib/EffectLib
        at me.HeyAwesomePeople.KingOfHill.KingOfHill.getEffectLib(KingOfHill.java:73) ~[?:?]
        at me.HeyAwesomePeople.KingOfHill.KingOfHill.onEnable(KingOfHill.java:39) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:324) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugin(CraftServer.java:446) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.enablePlugins(CraftServer.java:380) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.n(MinecraftServer.java:352) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.g(MinecraftServer.java:326) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.a(MinecraftServer.java:282) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:182) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
    Caused by: java.lang.ClassNotFoundException: org.myplugin.slikey.effectlib.EffectLib
        at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_25]
        at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_25]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_25]
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_25]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-1-g5786276-b3085jnks]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        ... 13 more
    [22:11:27]
    This is my onEnable:
    Code:java
    1. @Override
    2. public void onEnable() {
    3. instance = this;
    4. EffectLib lib = getEffectLib();
    5. effectManager = new EffectManager(lib);
    6.  
    7. methods = new Methods();
    8. mapsconfig = new MapsConfig();
    9. mapmanager = new MapManager();
    10.  
    11. mapmanager.loadMapsFromConfig();
    12.  
    13. PluginManager manager = getServer().getPluginManager();
    14. manager.registerEvents(new PlayerListener(), this);
    15.  
    16. // Admin Commands
    17. getCommand("admin").setExecutor(new AdminCommands());
    18. getCommand("maps").setExecutor(new PlayerCommands());
    19.  
    20. // Setup maps config
    21. if (!mapsFile.exists()) {
    22. mapsconfig.getMapsConfig().set("maps.currentMap", 0);
    23. mapsconfig.saveMapsConfig();
    24. }
    25.  
    26. // repeatables
    27. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    28. public void run() {
    29. mapmanager.saveMapsToConfig();
    30. }
    31.  
    32. }, 0L, 20 * 60 * 5L);
    33.  
    34. }
    35.  
    36. public EffectLib getEffectLib() {
    37. Plugin effectLib = Bukkit.getPluginManager().getPlugin("EffectLib");
    38. if (effectLib == null || !(effectLib instanceof EffectLib)) {
    39. return null;
    40. }
    41. return (EffectLib)effectLib;
    42. }


    I was thinking there could be a problem between java compilation versions? I am running Java 8 SE Runtime and JDK to compile my plugins. Could there be an issue there?

    Calling EffectLib.instance() results in the same error as well.

    Thanks
     
  17. Offline

    LCastr0

    Can you show the full class? Though I kinda already know where the problem is..
     
    ChipDev likes this.
  18. Offline

    mkezar

    like:

    Create Class "RandomUtil"
    Replace "RandomUtils"
    ECT
    when you hover over it
     
  19. Offline

    LCastr0

    Can you show me images? Or did you import it correctly?
     
    ChipDev likes this.
  20. Offline

    mkezar

    LCastr0 i have all pics on imgur.
    http://imgur.com/ZsDL6cx,b5hNfhP,T8...VJTtA,XiYOS25,13qgfmY,GHsIm5a,Wkp5NbB,5NR4Icz

    LCastr0 what im trying to accomplish is make a particle cape. Instead of minecon capes you can have miniature particle capes floating around your back :D

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

    LCastr0

    ChipDev likes this.
  22. Offline

    mkezar

    thanks! :D :D :D

    ok replacing the PacketPlayOutWorld was a success along with the RandomUtils. But when i fix the PacketPlayOutWorld, i get an error at this line,

    Code:java
    1. ParticleType.FLAME.getParticleName()

    it says:
    The method getParticleName() is undefined for the type ParticlePacket.ParticleType

    LCastr0 and
    Code:java
    1. ParticleType.FLAME.getParticleName()

    isnt working either. The method getParticleName() is undefined for the type ParticlePacket.ParticleType

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

    LCastr0

    Why are you getting the particle name?
     
  24. Offline

    mkezar

    well i just copy pasted off of page 1 slikeys thing
     
  25. Offline

    LCastr0

    You should do it like this:
    Code:java
    1.  
    2. public void onRun(){
    3. for(int i = 0; i < 10; i++){
    4. Location location = entity.getLocation(); //Seriously, you should place it above the for loop, and like this: Location location = getLocation();
    5. location.add(RandomUtils.getRandomCircleVector [...]
    6. location.add([...]);
    7. ParticleEffect.FLAME.display(location, visibleRange);
    8. }
    9. }
    10.  
     

  26. Code:java
    1. package me.HeyAwesomePeople.KingOfHill;
    2.  
    3. import java.io.File;
    4. import java.util.logging.Logger;
    5.  
    6. import javax.annotation.Nonnull;
    7.  
    8. import me.HeyAwesomePeople.Configs.MapsConfig;
    9. import me.HeyAwesomePeople.Listeners.PlayerListener;
    10. import me.HeyAwesomePeople.MapRotator.MapManager;
    11. import me.HeyAwesomePeople.Methods.Methods;
    12.  
    13. import org.bukkit.Bukkit;
    14. import org.bukkit.plugin.Plugin;
    15. import org.bukkit.plugin.PluginManager;
    16. import org.bukkit.plugin.java.JavaPlugin;
    17.  
    18. import de.slikey.effectlib.EffectLib;
    19. import de.slikey.effectlib.EffectManager;
    20.  
    21. public class KingOfHill extends JavaPlugin {
    22. public EffectManager effectManager;
    23. /* Notes:
    24.   * The color of the chat will correspond to the type of chat:
    25.   * Warning(RED), Confirmation(AQUA), Major Error(DARK RED), Commands(AQUA), Information(GREEN/DARK GREEN)
    26.   */
    27. public final Logger logger = Logger.getLogger("Minecraft");
    28. public static KingOfHill instance;
    29.  
    30. public Methods methods;
    31. public MapManager mapmanager;
    32. public MapsConfig mapsconfig;
    33.  
    34. private File mapsFile = new File(this.getDataFolder() + "maps.yml");
    35.  
    36. @Override
    37. public void onEnable() {
    38. instance = this;
    39. EffectLib lib = getEffectLib();
    40. effectManager = new EffectManager(lib);
    41.  
    42. methods = new Methods();
    43. mapsconfig = new MapsConfig();
    44. mapmanager = new MapManager();
    45.  
    46. mapmanager.loadMapsFromConfig();
    47.  
    48. PluginManager manager = getServer().getPluginManager();
    49. manager.registerEvents(new PlayerListener(), this);
    50.  
    51. // Admin Commands
    52. getCommand("admin").setExecutor(new AdminCommands());
    53. getCommand("maps").setExecutor(new PlayerCommands());
    54.  
    55. // Setup maps config
    56. if (!mapsFile.exists()) {
    57. mapsconfig.getMapsConfig().set("maps.currentMap", 0);
    58. mapsconfig.saveMapsConfig();
    59. }
    60.  
    61. // repeatables
    62. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    63. public void run() {
    64. mapmanager.saveMapsToConfig();
    65. }
    66.  
    67. }, 0L, 20 * 60 * 5L);
    68.  
    69. }
    70.  
    71. public EffectLib getEffectLib() {
    72. Plugin effectLib = Bukkit.getPluginManager().getPlugin("EffectLib");
    73. if (effectLib == null || !(effectLib instanceof EffectLib)) {
    74. return null;
    75. }
    76. return (EffectLib)effectLib;
    77. }
    78.  
    79. @Override
    80. public void onDisable() {
    81. mapmanager.saveMapsToConfig();
    82. mapmanager.clearMapHashmaps();
    83.  
    84. effectManager.dispose();
    85. }
    86.  
    87. @Nonnull
    88. public KingOfHill getInstance() {
    89. return instance;
    90. }
    91.  
    92. @Nonnull
    93. public static KingOfHill getStaticInstance() {
    94. return instance;
    95. }
    96.  
    97. }
    98.  

    There is the full class. Calling getEffectLib() or EffectLib.instance() results in the same error message.
     
  27. Offline

    Slikey

    This getEffectLib stuff is not needed! Where did you get that? Use: EffectLib lib = EffectLib.instance();

    Why don't you read my thread? http://dev.bukkit.org/paste/9800/
    It won't get any easier.
     
    ChipDev likes this.
  28. Offline

    LCastr0

    HeyAwesomePeople
    As Slikey said, you don't need that.
    Your instance should be the last thing on your onEnable, and also, you shouldn't use "EffectLib lib = [...]".
    What you should do is: effectManager = new EffectManager(this);
     
    ChipDev likes this.
  29. LCastr0 I found the issue out. I though maven was shading EffectLib into my plugin but really it was not. Now it works perfectly, thanks!

    This said I could either use EffectLib.instance() or the getEffectLib method. I first tried the instance() one and it didn't work, neither did the getEffectLib(). But I found out the problem, it turns out maven wasn't shading EffectLib into the exported plugin. Problem solved, and thanks for the lib!

    And one more thing, I am using the shield effect but the players are not able to view the particles from more than roughly ten block away, and I have the visibility set to 250(Super high just to see if I could get it to work). Is it possible the server could be limiting the blocks a player has to be to see particles? No other plugins installed.

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

    RingOfStorms


    The server doesn't limit anything, it is the client itself. Almost all of the particles have a 8-16 block render distance. There are a few exceptions like explosions and fireworks.
     
Thread Status:
Not open for further replies.

Share This Page