get world from player in PlayerInteractEvent

This commit is contained in:
mikx 2023-11-27 04:07:35 -05:00
parent 310758f6c7
commit cd63a4534c
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ public final class CubeTP extends JavaPlugin implements Listener {
Action action = event.getAction();
if(event.getHand() == EquipmentSlot.HAND){
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());
if(action == Action.RIGHT_CLICK_BLOCK && clickedBlock.getType() == cubeTP && block.getState() instanceof Sign){
clickedCubeLoc = clickedBlock.getLocation();