My Plugin Is Not Working!

Discussion in 'Plugin Development' started by SkyGlue, Feb 16, 2015.

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

    SkyGlue

    Can someone help me i cant figure this out!!!

    This plugin is supposed to launch a firework when a player joins.
    Help would be incredibly appreciated
    @mrCookieSlime



    Code:
    package me.KingMeowww.JoinWidDeFiaWorkz;
    
    import org.bukkit.Bukkit;
    import org.bukkit.Color;
    import org.bukkit.FireworkEffect;
    import org.bukkit.FireworkEffect.Type;
    import org.bukkit.entity.Firework;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.meta.FireworkMeta;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Main extends JavaPlugin implements Listener {
        
            public void onEnable(){
                    Bukkit.getServer().getPluginManager().registerEvents(this, this);
            }
        
            @EventHandler
            public void onPlayerJoin (final PlayerJoinEvent pje) {
                            Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
                                    public void run(){
                                        
                                            Firework f = (Firework) pje.getPlayer().getWorld().spawn(pje.getPlayer().getLocation(), Firework.class);
                                        
                                            FireworkMeta fm = f.getFireworkMeta();
                                            fm.addEffect(FireworkEffect.builder()
                                                            .flicker(false)
                                                            .trail(true)
                                                            .with(Type.BALL)
                                                            .with(Type.BALL_LARGE)
                                                            .with(Type.STAR)
                                                            .withColor(Color.PURPLE)
                                                            .withColor(Color.BLUE)
                                                            .with(Type.CREEPER)
                                                            .withColor(Color.LIME)
                                                            .withColor(Color.ORANGE)
                                                            .with(Type.BURST)
                                                            .withColor(Color.AQUA)
                                                            .with(Type.STAR)
                                                            .withColor(Color.GREEN)
                                                            .withColor(Color.MAROON)
                                                            .withFade(Color.RED)
                                                            .withFade(Color.NAVY)
                                                            .withFade(Color.LIME)
                                                            .build());
                                            fm.setPower(2);
                                            f.setFireworkMeta(fm);
                                        
                                    }
                            }, 20);
            }
        
    }
     
    Last edited: Feb 16, 2015
  2. can you send the error, if there is one...
    and what i thought about is that you spawn the firework and edit it after...
    i'd create a new firework, build it and afterwards spawn the firework

    hope this will help
     
  3. Offline

    tomudding

    First of all, main classes need to have "extends JavaPlugin" and take a look at this video if you still don't know how to do it
     
  4. Offline

    SkyGlue

    Thank you all :D This help alot :D
     
  5. @SkyGlue If you're problem is solved, please set this thread to "Solved" by going to Thread Tools > Edit Title > Prefix > Solved. :)
     
Thread Status:
Not open for further replies.

Share This Page