Need Help With Plugin

Discussion in 'Bukkit Help' started by aidenkrz, Aug 19, 2013.

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

    aidenkrz

    I dont know what i am doing worng but i want my plugin to have 3 set spots and for a player to get teleported to one of the spots at random can some one help he is my code so far
    package me.Chris.Tele;

    import java.util.Random;

    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;




    public class Tele extends JavaPlugin
    {
    public void onEnable()
    {
    }

    public void onDisable()
    {
    }

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
    Player player = (Player) sender;
    if (commandLabel.equalsIgnoreCase("Tr")){
    if(args.length == 1)
    player = player.getServer().getPlayer(args[0]);
    player.getWorld();
    Location targetPlayerLocation = player.getLocation();
    player.teleport(targetPlayerLocation);
    player.teleport(new Location(null, 100, 60, 100));
    player.teleport(new Location(null, 160, 60, 160));
    player.teleport(new Location(null, 120, 60, 120));
    Random rand = new Random();
    int randInt = rand.nextInt(2);

    switch(randInt) {
    case 0: // teleport to first out of three locations
    break;

    case 1: // teleport to second out of three locations
    break;

    case 2: // teleport to third out of three locations
    break;
    }
    }


    returnfalse;
    }

    }

    CAn Some One Plzz Help Me

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  2. Offline

    mrCaveman

    There is already a plugin out there which does this exact thing: RandomTeleporter
     
Thread Status:
Not open for further replies.

Share This Page