Players trapped in portals

Discussion in 'Server & Community Management' started by ChrisLane, Apr 11, 2013.

  1. Hi,
    So on my PvP server we allow players to create their own portals but this unfortunately bring the issue of people being trapped in portals that are in other peoples land.
    As you may know, when you are in a portal you are unable to open chat to type /spawn or /suicide etc.

    Does anyone know of a plugin that can kill players if they log back inside a portal block or even better, a plugin that can teleport a player to a set co-ordinate like the server spawn after getting stuck in a portal?
     
  2. Bestle do you have something like this on your server? I seem to remember being on there and being able to escape being trapped in a portal, would be great if you could point me in the direction of the plugin you used if you do have this feature :)
     
  3. Bestle

    Patron

    I personally use the following code snippet in my utility plugin in the playerjoinevent.

    Code (Text):
    final Player player = event.getPlayer();
              if (player.getLocation().getBlock().getType() == Material.PORTAL) {
              plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                        @Override
                        public void run() {
                          player.teleport(Bukkit.getServer().getWorld("World").getSpawnLocation());
                        }
                    }, 2L);
              }
     
  4. Awesome, thanks a lot.
    I'll try this out tomorrow morning.