Method to summon fireworks?

Discussion in 'Plugin Development' started by 360_, Oct 3, 2017.

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

    360_

    So I'm a noob dev trying to figure a way to summon fireworks at a certain xyz but i have no clue where to start other than add FireworkMeta meta; or something like that but i have no clue otherwise on how to do anything other than that.
    Code (open)

    Code:
    package me.Server.devtest.command;
    
    import java.util.logging.Handler;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Firework;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.meta.FireworkMeta;
    
    public class MagicCPCommand implements CommandExecutor {
    
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String lable, String[] args) {
            Player player = (Player) sender;
            if(sender instanceof Player){
                Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&eIn just &6&l20 Mintues&e Cresent Parks will proudly present &b&lDisneyland forever&6!&e The show will take Place at &b/warp Castle!"));
                new java.util.Timer().schedule(
                        new java.util.TimerTask() {
                            @Override
                            public void run() {
                                Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&6During the show, the lights around the Castle will Dimed. Please make the proper adjuments to your brightness level if needed."));
                            }
                        },
                        10000
                );
            new java.util.Timer().schedule(
                    new java.util.TimerTask() {
                        @Override
                        public void run() {
    
                            //Last Broadcast
                            Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&eTo listen to the show music, please connect to our audio server by running the command &b/audio&6!"));
                            //Summon firework code here or something
    
                        }
                    },
                    100000
            );
            }
            else {
                sender.sendMessage("HEY! Only players can run this");
            }
            return true;
        }
    
    }

    hope someone can help me.
     
  2. @360_
    Hey you have OnCommand , but you dont have command ... than if Player sends any command (from others Plugins )
    than will broadcast this message.... do

    Code:
    if (cmd.getName().equalsIgnoreCase("command"))
    {
    //stuff you already have ... Player player = sender ... if sender is player .. and all
    }
    than if you want do fireworks than look at thsi video :



    and code :

    https://pastebin.com/dak5DzUz


    Yes it's just Firework and add meta ...
     
  3. Offline

    360_

    Thanks for the help!
     
  4. Offline

    S1ant

    Actually, you don't need the cmd.getName().equalsIgnorecase, because this is a CommandExecutor and it's run when the command is run, therefore, you don't need the if statement you told him he had to have.

    In his main class in his onEnable he'd need:
    Code:java
    1.  
    2. getCommand("feed").setExecutor(new feedClass());
    3.  
     
Thread Status:
Not open for further replies.

Share This Page