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

    Floodeer Epc

    it's possible to make the effects cause damage?
     
  2. Offline

    raum

    Asked this a few months back and haven't noticed a response - Any ideas?

    Just add the damage to the code you're running. There's an example that does exactly that in the main post.
     
  3. Offline

    Sm0oth_kriminal

    I am working on a new idea, LightSabers (Made of flame particles) that can cut through some blocks (glass)

    The only thing is, I do not have time to do this all the time, but I can do the math for it, and give it to the community. I think this is a VERY good idea, and I want to help out!
    (EG: You right click a stick and flame particles appear as a lightsaber, and when you swing... You get the point, it is like a lightsaber!)
     
  4. Offline

    herbertxxx

    @LCastr0
    How can i change the color of my particle effects?
    I tried using color atribute, but nothing happened.
     
  5. Offline

    LCastr0

    Well, did you create your own effect or you're using an effect that comes with the plugin?
    Could you send the code? Would be way easier to help with that :)
     
  6. Offline

    herbertxxx

    Code:
    EffectLib lib = EffectLib.instance();
    EffectManager effectManager = new EffectManager(lib);
    AnimatedBallEffect efeito = new AnimatedBallEffect(effectManager);
    efeito.setEntity(zom);
    //efeito.particle = de.slikey.effectlib.util.ParticleEffect.FIREWORKS_SPARK;
    efeito.start();
    //efeito.color = Color.GREEN;
    efeito.color = Color.fromBGR(5, 100, 220);
    efeito.infinite();
    
    sorry for being slow to respond.
     
  7. Offline

    LCastr0

    The color effect only works with the particles MOB_SPELL, MOB_SPELL_AMBIENT and RED_DUST (Redstone).
    That is something that cannot be changed by us.
     
  8. Offline

    xXCapzXx

    Can I have the code so when you right click a diamond axe it will launch a helix
     
  9. Offline

    LCastr0

    You could listen to PlayerInteractEvent, check the item in hand, and see if the action is a right-click. Then, if it is, you create the effect in front of the player :)
    (I prefer to tell you how to do instead of giving you the code, because with the code you won't learn anything :p)
     
  10. Offline

    Finn_Bueno_

    So, how would I actually use this? Sorry if I'm a big noob here, but some help would be appreciated!
     
  11. Offline

    xXCapzXx

    Wait so after the right click event, what do I do?

    This is my code

    Code:
    private EffectManager effectManager;
     
        @Override
        public void onEnable() {
            Bukkit.getPluginManager().registerEvents(this, this);
            EffectLib lib = EffectLib.instance();
            effectManager = new EffectManager(lib);
        }
     
        @Override
        public void onDisable() {
            effectManager.dispose();
            HandlerList.unregisterAll((Listener) this);
        }
     
       
    @EventHandler
        public void onPlayerInteract(final PlayerInteractEvent event) {
            Player player = event.getPlayer();
            Location loc = player.getLocation();
            ConeLocationEffect cone = new ConeLocationEffect(effectManager, (Location) event.getPlayer());
            if(event.getAction() == Action.RIGHT_CLICK_AIR) return;
            if(event.getItem().getType() == Material.STICK) return;
            effectManager.start(cone);
            cone.iterations = 8*12;
            cone.speed = 2;
       
           
    
             }
       
    }
    
    It isn't working in game

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

    LCastr0

    You're returning the method when they right click with a stick. Change the return to {
    and then after the cone.speed = 2; add }}
    (Of course, fix your formatting after adding that... :p)
    Then, when a player right clicks air with a stick, it will create the cone effect.
    Also, you should create the cone object after the if statement, to avoid creating objects that you won't need.
     
  13. Offline

    xXCapzXx

    Still doesn't work.
    @LCastr0
    Interanal error or something with ConeLocationEffect cone = new ConeLocationEffect(effectManager, (Location) event.getPlayer());
    Code:
    [LIST=1]
    [*]private EffectManager effectManager;
    [*]
    
    [*]    @Override
    [*]    public void onEnable() {
    [*]        Bukkit.getPluginManager().registerEvents(this, this);
    [*]        EffectLib lib = EffectLib.instance();
    [*]        effectManager = new EffectManager(lib);
    [*]    }
    [*]
    
    [*]    @Override
    [*]    public void onDisable() {
    [*]        effectManager.dispose();
    [*]        HandlerList.unregisterAll((Listener) this);
    [*]    }
    [*]
    
    [*]  
    [*]@EventHandler
    [*]    public void onPlayerInteract(final PlayerInteractEvent event) {
    [*]        Player player = event.getPlayer();
    [*]        Location loc = player.getLocation();
    [*]        ConeLocationEffect cone = new ConeLocationEffect(effectManager, (Location) event.getPlayer());
    [*]        if(event.getAction() == Action.RIGHT_CLICK_AIR)  {
    [*]        if(event.getItem().getType() == Material.STICK)  {
    [*]        effectManager.start(cone);
    [*]        cone.iterations = 8*12;
    [*]        cone.speed = 2;
    [*]   }
    [*]}
    [*]}
    [*]}
    [*]      
    [/LIST]
    
     
    Last edited: Jun 22, 2015
  14. Offline

    LCastr0

    You can't cast player to a location. Do event.getPlayer().getLocation() instead, and remove the (Location) in this line:
    Code:
    ConeLocationEffect cone = new ConeLocationEffect(effectManager, (Location) event.getPlayer());
    
     
  15. Offline

    xXCapzXx

    Still doesn't work :(.
    Sigh.
    Can you just make it for me please.
     
  16. Offline

    LCastr0

    I can't do it for you, you won't learn anything if I do that... Can you send me the updated code?
     
  17. Offline

    xXCapzXx

    I am trying to make it now so that when you do /helix it will do a little helix around your body.
    code:
    Code:
    package me.capz.pluigin;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import de.slikey.effectlib.EffectLib;
    import de.slikey.effectlib.EffectManager;
    import de.slikey.effectlib.effect.HelixEffect;
    import de.slikey.effectlib.util.ParticleEffect;
    
    public class Main extends JavaPlugin {
       
    private EffectManager effectManager;
        public void onEnable() {
             EffectLib lib = EffectLib.instance();
               effectManager = new EffectManager(lib);
        }
       
        public boolean onCommand(CommandSender sender,Command cmd, String commandLabel, String[] args) {
            Player player = (Player)sender;
            HelixEffect helix = new HelixEffect(effectManager);
            if(cmd.getName().equalsIgnoreCase("helix")) {
                if(sender.hasPermission("helix.use")) {
                    helix.iterations = 10;
                    helix.particle.equals(ParticleEffect.FLAME);
                    helix.period = 20;
                    helix.start();
                }
            }
            return true;
        }
       
    }
    
    
     
  18. Offline

    LCastr0

    You didn't implement CommandExecutor in your class, and you didn't register the command in your onEnable()...
     
  19. Offline

    1Rogue

    #equals is a comparison method, not a setter.
     
    LCastr0 likes this.
  20. Offline

    LCastr0

    Also, could you send your plugin.yml?
     
  21. How do I remove every single effect I've created? Thanks :D
     
  22. Offline

    Gartenzaun

    Hello,

    I want to create a TextEffect. Here's my code:

    Code:
    Player p = (Player) event.getEntity().getShooter();
                        Location location = a.getLocation();
                        TextEffect text = new TextEffect(main.em);
                        text.setLocation(location);
                        text.particle = de.slikey.effectlib.util.ParticleEffect.FLAME;
                        text.period = 1;
                        text.setTarget(p.getLocation());
                        text.visibleRange = 50F;
                        text.autoOrient = true;
                        text.text = "MyServer";
                        text.setTargetEntity(p);
                        text.start();
    'a' is an arrow projectile. The code is executed when an arrow hits a block. The problem is that the generated particle text is always rotated by 180° so I can't read it correct... Did I do something wrong?

    Thanks for your anwers and best regards!
     
  23. Offline

    Krumb069

    It changes to location's yaw and pitch you can try changing them
     
  24. Offline

    mjra007

    I want to turn the redstone effect to the rainbow color, what is the code COLOR."?"
     
  25. Offline

    andrew chi

    Correct me if I'm wrong, but using Particle Utils is far more server intensive than using PacketPlayOutWorldParticles. Since particleUtils uses reflection, it is a lot slower. Based on my testing (Spawning 500 particles per tick, for 10 seconds) with timings, the result between using particle utils vs packetplayout is ten fold. It dropped a spell that when fired 20 times a second, using 3% percent of server usage per player sent to, it was reduced to around 0.5%. While it is not version safe, I feel that writing a wrapper that you have to recode maybe every 6-8 months, for 6-10 times better performance, is totally worth it.
     
  26. Offline

    dekrosik

    hello i add EffectLib to my project (http://i.dekros.ovh/2015-10/20-10-15_21-54-07.png) and i make this:
    Code:
    
           
            TextEffect text = new TextEffect(PvPCage.getEffectManager());
            text.text = "ONE TO FREE TESTTTT";
            text.particle.equals(ParticleEffect.FLAME);
            text.duration = 100;
            text.period = 20;
            text.run();
    
    but how to change location?
    i can't use text.setLocation;/
     
  27. Offline

    dekrosik

    @Assist
    http://i.dekros.ovh/2015-10/21-10-15_18-14-48.png
    i have this error
    Code:
           
            TextEffect text = new TextEffect(PvPCage.getEffectManager());
           
            text.text = "ONE TO FREE TESTTTT";
            text.particle.equals(ParticleEffect.FLAME);
            text.period = 20;
            text.setDynamicTarget(new DynamicLocation(p.getLocation().add(5, 2, 0)));
            text.run(); // <------ THIS IS 32 LINE
           
    
     
  28. Offline

    dekrosik

    @Asist
    error :
    text.setDynamicTarget(new DynamicLocation(p.getLocation().add(5, 2, 0)));
    http://i.dekros.ovh/2015-10/21-10-15_19-21-43.png
    ;/
    imports:
    import de.slikey.effectlib.effect.TextEffect;
    import de.slikey.effectlib.util.DynamicLocation;
    import de.slikey.effectlib.util.ParticleEffect;
     
Thread Status:
Not open for further replies.

Share This Page