EventHandle is underlined red ?

Discussion in 'Plugin Development' started by TomPere02, Apr 27, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    TomPere02

    I am trying to create particle effects into a shape but when I get to the line

    Code:
    .runTaskTimer(EventHandle.getInstance(), 0, 1);
    The EventHandle is underlined red. I can't import it or anything. Here is the whole event.
    Code:
    public static void coneEffect(final Player player){
            new BukkitRunnable(){
                    double phi = 0;
                    public void run(){
                            phi = phi + Math.PI/8;                               
                            double x, y, z;               
                          
                            Location location1 = player.getLocation();
                            for (double t = 0; t <= 2*Math.PI; t = t + Math.PI/16){
                                    for (double i = 0; i <= 1; i = i + 1){
                                            x = 0.4*(2*Math.PI-t)*Math.cos(t + phi + i*Math.PI);
                                            y = 0.5*t;
                                            z = 0.4*(2*Math.PI-t)*Math.sin(t + phi + i*Math.PI);
                                            location1.add(x, y, z);
                                            ParticleEffect.BLOCK_DUST.display(location1, 0, 0, 0, 0, 1);
                                            location1.subtract(x,y,z);
                                    }
                                  
                            }             
                          
                            if(phi > 10*Math.PI){                                         
                                    this.cancel();
                            }
                    }     
            }.runTaskTimer(EventHandle.getInstance(), 0, 1);                     
    }
    Any help is much appreciated.
    TomPere02
     
  2. Offline

    timtower Administrator Administrator Moderator

    xXkguyXx likes this.
  3. Offline

    xXkguyXx

    You would need to supply your plugin, You could do Bukkit.getServer().getPluginManager().getPlugin("PLUGIN NAME HERE");
     
  4. Offline

    timtower Administrator Administrator Moderator

    @xXkguyXx Or you pass it along with the method itself.
     
    xXkguyXx likes this.
  5. Offline

    TomPere02

    look my new code is not working
    Code:
        @EventHandler
            public void blank(PlayerToggleSneakEvent event){
                final Player player = event.getPlayer();
            new BukkitRunnable() {
                double t = Math.PI/4;
                Location loc = player.getLocation();
                public void run() {
                    t= t + 0.1*Math.PI;
                    for (double theta = 0; theta <= 2*Math.PI; theta = theta + Math.PI/32){
                        double x = t*cos(theta);
                        double y = 2*Math.exp(-0.1*t) * sin(t) + 1.5;
                        double z = t*sin(theta);
                        loc.add(x,y,z);
                        ParticleEffect.FIREWORKS_SPARK.display(0,0,0,0,1,loc,20);
                        loc.subtract(x,y,z);
    
                        theta = theta + Math.PI/64;
    
                        x = t*cos(theta);
                        y = 2*Math.exp(-0.1*t) * sin(t) + 1.5;
                        z = t*sin(theta);
                        loc.add(x,y,z);
                        ParticleEffect.SPELL_WITCH.display(0,0,0,0,0,loc,20);;
                        loc.subtract(x,y,z);
                    }
                    if (t > 20){
                        this.cancel();
                }
            }
            }.runTaskTimer(Bukkit.getServer().getPluginManager().getPlugin("Elderya").getInstance(), 0, 1);
        }
    
     
    Last edited: Apr 28, 2017
  6. Offline

    Caderape2

    @TomPere02 why you dont pass your main class with the construcor ? Or create a static acces
     
  7. Offline

    Zombie_Striker

    @Caderape2
    Do not recommend using static. Static objects should almost never be used in Java and most of the time only show that you did not structure your code correctly.
     
  8. Offline

    TomPere02

    So what can I do ???
     
  9. Offline

    Zombie_Striker

    @TomPere02
     
Thread Status:
Not open for further replies.

Share This Page