Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can anyone tell me how to do this?

    So, im making a minecraft plugin for my server. And im having a bit of trouble, I want it so that when you do the command it will create a new world through multiverse and then teleport you to it. But ive only made it so it teleports you to coordinates. Any help? :/


    package me.simmmatt;


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

    public class Maps extends JavaPlugin {

    @Override
    public void onEnable() {

    }

    @Override
    public void onDisable() {

    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (cmd.getName().equalsIgnoreCase("map1") && sender instanceof Player) {

    Player player = (Player) sender;





    Location teleportLocation = null;

    int x = 0;
    int y = 150;
    int z = 0;

    boolean isOnLand = false;

    while (isOnLand == false) {

    teleportLocation = new Location(player.getWorld(), x, y, z);

    if (teleportLocation.getBlock().getType() != Material.AIR) {
    isOnLand = true;
    } else y--;

    }

    player.teleport(new Location(player.getWorld(), teleportLocation.getX(), teleportLocation.getY() + 1, teleportLocation.getZ()));

    player.sendMessage(ChatColor.GREEN + "You have been teleported to map 1!");

    return true;



    } else if
    (cmd.getName().equalsIgnoreCase("map2") && sender instanceof Player) {

    Player player = (Player) sender;





    Location teleportLocation = null;

    int x = 100;
    int y = 150;
    int z = 100;

    boolean isOnLand = false;

    while (isOnLand == false) {

    teleportLocation = new Location(player.getWorld(), x, y, z);

    if (teleportLocation.getBlock().getType() != Material.AIR) {
    isOnLand = true;
    } else y--;

    }

    player.teleport(new Location(player.getWorld(), teleportLocation.getX(), teleportLocation.getY() + 1, teleportLocation.getZ()));

    player.sendMessage(ChatColor.GREEN + "You have been teleported to map 2!");

    return true;

    } else if
    (cmd.getName().equalsIgnoreCase("map3") && sender instanceof Player) {

    Player player = (Player) sender;





    Location teleportLocation = null;

    int x = 300;
    int y = 150;
    int z = 300;

    boolean isOnLand = false;

    while (isOnLand == false) {

    teleportLocation = new Location(player.getWorld(), x, y, z);

    if (teleportLocation.getBlock().getType() != Material.AIR) {
    isOnLand = true;
    } else y--;

    }

    player.teleport(new Location(player.getWorld(), teleportLocation.getX(), teleportLocation.getY() + 1, teleportLocation.getZ()));

    player.sendMessage(ChatColor.GREEN + "You have been teleported to map 3!");

    return true;

    }
    return false;
    }
    }

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,753
    Thanks
    41
    Thanked 191 Times in 190 Posts
    I could be wrong but I doubt anyone here would know this answer- is there a Minecraft add-in forum? It's just that this is a HIGHLY specific question for a platform people may-or-may not use.

    I hope someone responds with an answer for you though.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    New Coder The Noob Coder's Avatar
    Join Date
    Jul 2012
    Location
    The City that Never Sleeps
    Posts
    99
    Thanks
    1
    Thanked 0 Times in 0 Posts
    In case anyone else comes by in the future, a better place for Minecraft specific questions: Minecraft Forum


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •