Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (cmd.getName().equalsIgnoreCase("teleportme") && sender instanceof Player) {
- Player player = (Player) sender;
- Location originalLocation = player.getLocation();
- Random random = new Random();
- int x = random.nextInt(1000) + 1;
- Block y = block;
- int z = random.nextInt(1000) + 1;
- Block block = originalLocation.getWorld().getHighestBlockAt(x, z);
- Location add(0, 1, 0)
- Location teleportLocation = new Location(player.getWorld(), x, y, z);
- player.teleport(teleportLocation);
- player.sendMessage(ChatColor.GREEN + "You have been teleported " + (int)teleportLocation.distance(originalLocation) + " blocks away!");
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement