portals
This commit is contained in:
parent
cdec649609
commit
a6f4195805
2 changed files with 12 additions and 0 deletions
Binary file not shown.
|
@ -2,6 +2,7 @@ package net.xuyezo.main;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -12,10 +13,21 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockExplodeEvent;
|
import org.bukkit.event.block.BlockExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPortalEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class Handler implements Listener {
|
public class Handler implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onPortalEvent(PlayerPortalEvent e) {
|
||||||
|
Random random = new Random();
|
||||||
|
Location t = e.getFrom();
|
||||||
|
t.multiply(-1);
|
||||||
|
t.add(0,256,0);
|
||||||
|
e.setTo(t);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onBlockExplode(EntityExplodeEvent e) {
|
private void onBlockExplode(EntityExplodeEvent e) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
|
Loading…
Reference in a new issue