Development Assistance Spawn a custom firework, and teleport player

Discussion in 'Plugin Help/Development/Requests' started by DigiDuncan, Sep 5, 2015.

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

    DigiDuncan

    I want to make a smoke bomb plugin, in which the command /smokebomb [args] creates a smoke bomb (firework) at the players feet, immediately detonates it, and then uses the [args] to run a /tp [args] command.

    My preffered usage would be:
    /smokebomb [player] OR /smokebomb [x] [y] [z] <p> <y>, just like the /tp command.

    Can I please have some help with this? I'm really new to this. Here is my code so far.

    Code:
    package com.digiduncan.smokebomb;
    
    import org.bukkit.*;
    
    public class CommandSmokeBomb
    {
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
        {
            if (sender instanceof Player)
            {
                Player player = (Player) sender;
               
                Firework smokebomb = new Firework();
               
                smokebomb.setFireworkMeta();
            }
           
            // If the player (or console) uses our command correct, we can return true
            return true;
        }
    }
     
    Last edited: Sep 5, 2015
  2. Offline

    DigiDuncan

    Why is that? My Java teacher always said if you're using a lot of modules from a library, to use the * import syntax.
     
  3. @DigiDuncan You are importing every single Bukkit class there and only using like 4, that is NOT good. One class trying to load a ton of classes and only use 4 is really inefficient. Also your class won't work, it is not implementing CommandExecutor.
     
  4. Offline

    Gater12

    @bwfcwalshy @DigiDuncan
    I don't believe wildcard imports have any significant performance losses than specific imports, if any.

    But it is good practice to use specific imports to clearly state what classes you are using, avoid package name contradictions and etc.
     
Thread Status:
Not open for further replies.

Share This Page