diff --git a/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/MoveHereSubCommand.java b/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/MoveHereSubCommand.java index 9c9636f..fbea4de 100644 --- a/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/MoveHereSubCommand.java +++ b/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/MoveHereSubCommand.java @@ -29,7 +29,7 @@ public void run(CommandSender sender, String[] args) { if (display != null) { Player player = (Player) sender; - display.setLocation(player.getLocation()); + display.setLocation(player.getEyeLocation()); sender.sendMessage(MessagesManager.getColoredMessage("&aThe display &e" + args[1] + " &ahas been successfully removed.", true)); } else { sender.sendMessage(MessagesManager.getColoredMessage("&cThe display &b" + args[1] + " &cdoes not exist!", true)); diff --git a/src/main/java/me/lucaaa/advanceddisplays/managers/DisplaysManager.java b/src/main/java/me/lucaaa/advanceddisplays/managers/DisplaysManager.java index 00388e4..6db41ad 100644 --- a/src/main/java/me/lucaaa/advanceddisplays/managers/DisplaysManager.java +++ b/src/main/java/me/lucaaa/advanceddisplays/managers/DisplaysManager.java @@ -65,9 +65,9 @@ public void createDisplay(Player p, DisplayType type, String name, String value) // Set properties in the display file. ConfigurationSection locationSection = displayConfig.createSection("location"); locationSection.set("world", p.getWorld().getName()); - locationSection.set("x", p.getLocation().getX()); - locationSection.set("y", p.getLocation().getY()); - locationSection.set("z", p.getLocation().getZ()); + locationSection.set("x", p.getEyeLocation().getX()); + locationSection.set("y", p.getEyeLocation().getY()); + locationSection.set("z", p.getEyeLocation().getZ()); displayConfig.set("rotationType", org.bukkit.entity.Display.Billboard.CENTER.name()); @@ -92,7 +92,7 @@ public void createDisplay(Player p, DisplayType type, String name, String value) BaseDisplay newDisplay = null; switch (type) { case BLOCK -> { - BlockDisplay blockDisplay = Objects.requireNonNull(p.getLocation().getWorld()).spawn(p.getLocation(), BlockDisplay.class); + BlockDisplay blockDisplay = Objects.requireNonNull(p.getWorld()).spawn(p.getEyeLocation(), BlockDisplay.class); try { newDisplay = new ADBlockDisplay(displayConfigManager, blockDisplay).create(Objects.requireNonNull(Material.getMaterial(value)).createBlockData()); } catch (IllegalArgumentException e) { @@ -102,11 +102,11 @@ public void createDisplay(Player p, DisplayType type, String name, String value) } } case TEXT -> { - TextDisplay textDisplay = Objects.requireNonNull(p.getLocation().getWorld()).spawn(p.getLocation(), TextDisplay.class); + TextDisplay textDisplay = Objects.requireNonNull(p.getWorld()).spawn(p.getEyeLocation(), TextDisplay.class); newDisplay = new ADTextDisplay(displayConfigManager, textDisplay).create(value); } case ITEM -> { - ItemDisplay itemDisplay = Objects.requireNonNull(p.getLocation().getWorld()).spawn(p.getLocation(), ItemDisplay.class); + ItemDisplay itemDisplay = Objects.requireNonNull(p.getWorld()).spawn(p.getEyeLocation(), ItemDisplay.class); newDisplay = new ADItemDisplay(displayConfigManager, itemDisplay).create(Objects.requireNonNull(Material.getMaterial(value))); } }