Minecraft – Preventing users from teleporting on top of the nether

minecraft-bukkitminecraft-java-edition

I have users repeatedly using ender pearls to get on the roof of the nether (128 blocks+) and build up there. I want to avoid this. Currently, the only way I could think of is blacklisting ender pearls in the nether, but if possible, I want to keep the pearls and prevent it otherwise.

What I have checked already:

  • Full-height nether: I could not find a generator that would do that.
  • Worldguard regions: I was not able to create a really large region, nevermind and endless one. I could do this only for a certain area (around the nether spawn), but I would prefer to have a solution that covers the whole nether
  • Worldborder: I submitted a feature request for Worldborder since it currently only supports x/z coordinates, not y.
  • Plugins: I could not find any plugins that are half way up to date doing this.

Any other ideas? Running latest version of Spigot.

Best Answer

I made you a plugin! (It teleports them to the nether spawn if they go above that height) https://www.mediafire.com/?0cux9xl73ty3f1c Make sure the spawn isn't in any lava, as it does not account for that.

Source code:

public class main extends JavaPlugin implements Listener  
{
    public static Bukkit plugin;
    public void onEnable()
    {
        Bukkit.getServer().getPluginManager().registerEvents(this, this);

        Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "Enabled!");
    }

    public void onDisable()
    {
        getLogger();
        Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "Disabled!");
    }

    @EventHandler
    public void onPlayerMove(PlayerMoveEvent event) 
    {
        Player p = event.getPlayer();
        {
            if (event.getPlayer().getLocation().getWorld().getName().endsWith("_nether"))
            {
                if (event.getPlayer().getLocation().getY() > 127)
                {
                    World nether = Bukkit.getWorld("world_nether");
                    p.teleport(nether.getSpawnLocation());  
                }
            }
        }
    }
}