Teleportation Plugin Main Class Error

Discussion in 'Plugin Development' started by CrAzYoYoS, Dec 28, 2014.

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

    CrAzYoYoS

    Im making a teleportation plugin with particles like an Enderman. But im using different particles. So im doing the first part with teleporting and heres the code so far. The error will be posted in the pastebin.
    http://pastebin.com/7PMZ1r40
    Code:
    package me.CrAzYoYoS.CrazyPlugin;
    
    import java.util.logging.Logger;
    
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class CrazyPlugin extends JavaPlugin{
        public final Logger logger = Logger.getLogger("Minecraft");
        public static CrazyPlugin plugin;
     
        @Override
        public void onDisable() {
            PluginDescriptionFile pdffile = this.getDescription();
            this.logger.info(pdffile.getName() + " Has Been Disabled!");
        }
     
        @Override
        public void onEnable() {
            PluginDescriptionFile pdffile = this.getDescription();
            this.logger.info(pdffile.getName() + "Version" + pdffile.getVersion() + " Has Been Enabled!");
        }
    
     
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
            if(commandLabel.equalsIgnoreCase("ctp")){
                if(args.length == 0){
                    player.sendMessage(ChatColor.DARK_RED + "TOO LITTLE ARGUMENTS");
                }else if(args.length == 1){
                    Player targetPlayer = player.getServer().getPlayer(args[0]);
                    Location targetPlayerlocation = targetPlayer.getLocation();
                    player.teleport(targetPlayerlocation);
                }else if(args.length == 2){
                    Player targetPlayer = player.getServer().getPlayer(args[0]);
                    Player targetPlayer1 = player.getServer().getPlayer(args[1]);
                    Location targetPlayerLocation = targetPlayer.getLocation();
                    @SuppressWarnings("unused")
                    Location targetPlayer1Location = targetPlayer1.getLocation();
                    targetPlayer.teleport(targetPlayerLocation);
                }
         
            }
            return false;
        }
     
     
     
    }
    
    Also if someone can help with adding particles to the player when they teleport to the other player/location.
     
  2. Offline

    CrAzYoYoS

    @Assist Thank you very much this helped alot.
     
  3. Offline

    CrAzYoYoS

    @Assist So what would the plugin yml look like if there was
    Name:
    Main:
    Version:
    Commands:
     
Thread Status:
Not open for further replies.

Share This Page