#Particles

1 messages · Page 1 of 1 (latest)

slender meteor
#

how do i run the loop

slim plume
#
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        
        if (!(sender instanceof Player)) return true;
        
        new BukkitRunnable() {

            Player player = (Player) sender;
            Location loc = player.getLocation();
            Vector direction = player.getEyeLocation().getdirection();
            
            int lifeSpan = 20;
            
            @Override
            public void run() {

                loc.add(direction);
                player.spawnParticle(Particle.FLAME, loc, 1, 0, 0, 0, 0);
                lifeSpan--;
                
                if (lifeSpan == 0 ) this.cancel();
            }
        }.runTaskTimer(plugin, 0, 5);
        return true;
    }```
slender meteor
#

woah

#

didnt think you would send me all the code directly

#

thanks

#

still confused as to how i would run the command

slim plume
#

that runs it

#

.runTaskTimer(plugin, 0, 5);

slender meteor
#

it runs it for me?

slim plume
#

executes it and repeats the run() method every 4 ticks

slender meteor
#

oh do i do this getCommand("shoot").setExecutor(new SpellCommand());

slender meteor
slim plume
#

after 20 loops it cancels itself

slender meteor
#

so the moment I reload it does it

slim plume
#

it would do it whenever you execute whatever command you have registered

slender meteor
#

ok

#

testing now

#

woah

#

thats pretty cool

#

exactly what i wanted

#

how would i go about speeding it up

#

lowering the period?

slim plume
#

change teh 5 to a 4 or less

slender meteor
#

a;right

slim plume
#

as low as 1

slender meteor
#

its coming from my feet for some reason

slim plume
#

where do you want it to come from?

slender meteor
#

oh

#

wait

#

i fixed it

slim plume
#

either use EyeLocation

#

instead of Player.getLocation()

slender meteor
#

yeah thats what i did

slim plume
#

or add 1 to Y

#

k

slender meteor
#

thanks

slim plume
#

np

slender meteor
#

how would i go about spacing it out more

#

or making it less spaced out

#

@slim plume

#

sorry for ping it just said you left thread

slim plume
#

increase teh vector you add each time

slender meteor
#

what vector

#

like multiply the direction?

slim plume
#
Vector direction = player.getEyeLocation().getdirection().multiply(1.5);```
slender meteor
#

Vector direction = player.getEyeLocation().getDirection().multiply(#);

#

oh

#

yeah that works

#

how do you do that box thing

#

to type code

slim plume
#

three back ticks `

slender meteor
#

/w/

#

ohh

#

alright

#

thank you

slim plume
#

you can do three` then java and start a new line

#

it will syntax color it

slender meteor
#

does that work anywhere or just this server

slim plume
#

all discord

slender meteor
#

oh thats cool

#

thanks for all the help

#

should be able to take it from here

slim plume
#

theres other tag, java, xml, yaml