promotional bannermobile promotional banner

OneWayNether

Deny people from using the nether portal to the normal world.

Description

This plugin denies people from using the Portal in the nether to prevent griefers walking into other people's bases.

Forum

http://forums.bukkit.org/threads/one-way-nether.164270/

Config

You can change the message, people recieving when entering the portal in the config.

locale:
  deny: You are not allowed to go back from the nether!

Permission

The permission node to bypass this is

onewaynether.bypass

Source

import org.bukkit.World.Environment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class OneWayNether extends JavaPlugin implements Listener {
	public static final String LOCALE_DENY = "locale.deny";

	public void onEnable() {
		this.getServer().getPluginManager().registerEvents(this, this);

		this.getConfig().addDefault(LOCALE_DENY,
				"You are not allowed to go back from the nether!");
		this.getConfig().options().copyDefaults(true);
		this.saveConfig();
	}

	public void onDisable() {
		HandlerList.unregisterAll((Listener) this);
	}

	@EventHandler
	public void onPlayerPortal(PlayerPortalEvent event) {
		Player p = event.getPlayer();
		if (p.hasPermission("onewaynether.bypass") || p.isOp())
			return;
		if (!event.getFrom().getWorld().getEnvironment()
				.equals(Environment.NETHER))
			return;
		if (!event.getTo().getWorld().getEnvironment()
				.equals(Environment.NORMAL))
			return;
		p.sendMessage(this.getConfig().getString(LOCALE_DENY));
		this.getLogger()
				.info(p.getName()
						+ " tried to get from the nether to the normal world but was denied.");
		event.setCancelled(true);
	}

}

The OneWayNether Team

RisingBuilder tier frameprofile avatar
  • 2
    Projects
  • 536.8K
    Downloads

More from _ForgeUser6668601