get world from player in PlayerInteractEvent
This commit is contained in:
parent
310758f6c7
commit
cd63a4534c
|
@ -83,7 +83,7 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
if(event.getHand() == EquipmentSlot.HAND){
|
if(event.getHand() == EquipmentSlot.HAND){
|
||||||
if (clickedBlock == null) return;
|
if (clickedBlock == null) return;
|
||||||
World world = getServer().getWorld("world");
|
World world = player.getWorld();
|
||||||
Block block = world.getBlockAt(clickedBlock.getLocation().getBlockX(), clickedBlock.getLocation().getBlockY()+1, clickedBlock.getLocation().getBlockZ());
|
Block block = world.getBlockAt(clickedBlock.getLocation().getBlockX(), clickedBlock.getLocation().getBlockY()+1, clickedBlock.getLocation().getBlockZ());
|
||||||
if(action == Action.RIGHT_CLICK_BLOCK && clickedBlock.getType() == cubeTP && block.getState() instanceof Sign){
|
if(action == Action.RIGHT_CLICK_BLOCK && clickedBlock.getType() == cubeTP && block.getState() instanceof Sign){
|
||||||
clickedCubeLoc = clickedBlock.getLocation();
|
clickedCubeLoc = clickedBlock.getLocation();
|
||||||
|
|
Loading…
Reference in New Issue