diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java index 9da5ebf5..0a68bfb2 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java @@ -10,8 +10,8 @@ import me.filoghost.fcommons.FeatureSupport; import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.Log; import me.filoghost.holographicdisplays.api.beta.HolographicDisplaysAPI; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.core.HolographicDisplaysCore; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.bridge.bungeecord.BungeeServerTracker; import me.filoghost.holographicdisplays.plugin.bridge.placeholderapi.PlaceholderAPIHook; import me.filoghost.holographicdisplays.plugin.commands.HologramCommandManager; @@ -137,7 +137,7 @@ public class HolographicDisplays extends FCommonsPlugin { for (InternalHologramConfig hologramConfig : hologramConfigs) { try { List lines = hologramConfig.deserializeLines(); - ImmutablePosition position = hologramConfig.deserializePosition(); + Position position = hologramConfig.deserializePosition(); InternalHologram hologram = internalHologramManager.createHologram(hologramConfig.getName(), position); hologram.addLines(lines); } catch (InternalHologramLoadException e) { diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/InternalHologramEditor.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/InternalHologramEditor.java index 92b36cf9..9d378441 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/InternalHologramEditor.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/InternalHologramEditor.java @@ -8,11 +8,11 @@ package me.filoghost.holographicdisplays.plugin.commands; import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.command.validation.CommandException; import me.filoghost.fcommons.command.validation.CommandValidate; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.plugin.config.ConfigManager; import me.filoghost.holographicdisplays.plugin.config.InternalHologramLineParser; import me.filoghost.holographicdisplays.plugin.config.InternalHologramLoadException; import me.filoghost.holographicdisplays.plugin.event.InternalHologramChangeEvent.ChangeType; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologram; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologramLine; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologramManager; @@ -71,7 +71,7 @@ public class InternalHologramEditor { return internalHologramManager.getHolograms(); } - public InternalHologram create(String hologramName, ImmutablePosition spawnPosition) { + public InternalHologram create(String hologramName, Position spawnPosition) { return internalHologramManager.createHologram(hologramName, spawnPosition); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java index 81f9cd77..4385d950 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java @@ -8,11 +8,11 @@ package me.filoghost.holographicdisplays.plugin.commands.subs; import me.filoghost.fcommons.command.sub.SubCommandContext; import me.filoghost.fcommons.command.validation.CommandException; import me.filoghost.fcommons.command.validation.CommandValidate; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.plugin.commands.HologramSubCommand; import me.filoghost.holographicdisplays.plugin.commands.InternalHologramEditor; import me.filoghost.holographicdisplays.plugin.event.InternalHologramChangeEvent.ChangeType; import me.filoghost.holographicdisplays.plugin.format.ColorScheme; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologram; import org.bukkit.command.CommandSender; @@ -36,19 +36,19 @@ public class AlignCommand extends HologramSubCommand { CommandValidate.check(hologram != referenceHologram, "The holograms must not be the same."); - ImmutablePosition referencePosition = referenceHologram.getPosition(); - ImmutablePosition newPosition = hologram.getPosition(); + Position referencePosition = referenceHologram.getPosition(); + Position oldPosition = hologram.getPosition(); + Position newPosition; String axis = args[0]; if (axis.equalsIgnoreCase("x")) { - newPosition = newPosition.withX(referencePosition.getX()); + newPosition = Position.of(oldPosition.getWorldName(), referencePosition.getX(), oldPosition.getY(), oldPosition.getZ()); } else if (axis.equalsIgnoreCase("y")) { - newPosition = newPosition.withY(referencePosition.getY()); + newPosition = Position.of(oldPosition.getWorldName(), oldPosition.getX(), referencePosition.getY(), oldPosition.getZ()); } else if (axis.equalsIgnoreCase("z")) { - newPosition = newPosition.withZ(referencePosition.getZ()); + newPosition = Position.of(oldPosition.getWorldName(), oldPosition.getX(), oldPosition.getY(), referencePosition.getZ()); } else if (axis.equalsIgnoreCase("xz")) { - newPosition = newPosition.withX(referencePosition.getX()); - newPosition = newPosition.withZ(referencePosition.getZ()); + newPosition = Position.of(oldPosition.getWorldName(), referencePosition.getX(), oldPosition.getY(), referencePosition.getZ()); } else { throw new CommandException("You must specify either X, Y, Z or XZ, " + axis + " is not a valid axis."); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/CreateCommand.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/CreateCommand.java index 44e4fc39..d3291286 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/CreateCommand.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/CreateCommand.java @@ -9,13 +9,13 @@ import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.command.sub.SubCommandContext; import me.filoghost.fcommons.command.validation.CommandException; import me.filoghost.fcommons.command.validation.CommandValidate; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.plugin.commands.HologramSubCommand; import me.filoghost.holographicdisplays.plugin.commands.InternalHologramEditor; -import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologramLine; import me.filoghost.holographicdisplays.plugin.event.InternalHologramChangeEvent.ChangeType; import me.filoghost.holographicdisplays.plugin.format.ColorScheme; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologram; +import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologramLine; import net.md_5.bungee.api.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -46,7 +46,7 @@ public class CreateCommand extends HologramSubCommand { "The name must contain only alphanumeric characters, underscores and hyphens."); CommandValidate.check(!hologramEditor.hologramExists(hologramName), "A hologram with that name already exists."); - ImmutablePosition spawnPosition = ImmutablePosition.of(player.getLocation()); + Position spawnPosition = Position.of(player); boolean moveUp = player.isOnGround(); if (moveUp) { diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MoveHereCommand.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MoveHereCommand.java index b033c798..adabbb87 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MoveHereCommand.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MoveHereCommand.java @@ -8,11 +8,11 @@ package me.filoghost.holographicdisplays.plugin.commands.subs; import me.filoghost.fcommons.command.sub.SubCommandContext; import me.filoghost.fcommons.command.validation.CommandException; import me.filoghost.fcommons.command.validation.CommandValidate; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.plugin.commands.HologramSubCommand; import me.filoghost.holographicdisplays.plugin.commands.InternalHologramEditor; import me.filoghost.holographicdisplays.plugin.event.InternalHologramChangeEvent.ChangeType; import me.filoghost.holographicdisplays.plugin.format.ColorScheme; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologram; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -35,7 +35,7 @@ public class MoveHereCommand extends HologramSubCommand { Player player = CommandValidate.getPlayerSender(sender); InternalHologram hologram = hologramEditor.getExistingHologram(args[0]); - hologram.setPosition(ImmutablePosition.of(player.getLocation())); + hologram.setPosition(Position.of(player)); hologramEditor.saveChanges(hologram, ChangeType.EDIT_POSITION); hologramEditor.teleportLookingDown(player, player.getLocation()); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/NearCommand.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/NearCommand.java index 80968481..ccaee2bd 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/NearCommand.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/NearCommand.java @@ -8,10 +8,10 @@ package me.filoghost.holographicdisplays.plugin.commands.subs; import me.filoghost.fcommons.command.sub.SubCommandContext; import me.filoghost.fcommons.command.validation.CommandException; import me.filoghost.fcommons.command.validation.CommandValidate; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.plugin.commands.HologramSubCommand; import me.filoghost.holographicdisplays.plugin.commands.InternalHologramEditor; import me.filoghost.holographicdisplays.plugin.format.DisplayFormat; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologram; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -41,7 +41,7 @@ public class NearCommand extends HologramSubCommand { List nearHolograms = new ArrayList<>(); for (InternalHologram hologram : hologramEditor.getHolograms()) { - ImmutablePosition position = hologram.getPosition(); + Position position = hologram.getPosition(); if (position.isInSameWorld(player) && position.distance(player) <= radius) { nearHolograms.add(hologram); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/InternalHologramConfig.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/InternalHologramConfig.java index 2b1a5c26..b1fec196 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/InternalHologramConfig.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/InternalHologramConfig.java @@ -9,7 +9,6 @@ import me.filoghost.fcommons.collection.CollectionUtils; import me.filoghost.fcommons.config.ConfigSection; import me.filoghost.fcommons.config.exception.ConfigValueException; import me.filoghost.holographicdisplays.api.beta.Position; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologram; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologramLine; @@ -77,7 +76,7 @@ public class InternalHologramConfig { return positionConfigSection; } - public ImmutablePosition deserializePosition() throws InternalHologramLoadException { + public Position deserializePosition() throws InternalHologramLoadException { ConfigSection positionConfigSection = configSection.getConfigSection("position"); if (positionConfigSection == null) { @@ -89,7 +88,7 @@ public class InternalHologramConfig { double x = positionConfigSection.getRequiredDouble("x"); double y = positionConfigSection.getRequiredDouble("y"); double z = positionConfigSection.getRequiredDouble("z"); - return new ImmutablePosition(worldName, x, y, z); + return Position.of(worldName, x, y, z); } catch (ConfigValueException e) { throw new InternalHologramLoadException("invalid position attribute \"" + e.getConfigPath() + "\"", e); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/format/DisplayFormat.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/format/DisplayFormat.java index 0dc0fb89..0dfa5a81 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/format/DisplayFormat.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/format/DisplayFormat.java @@ -7,8 +7,8 @@ package me.filoghost.holographicdisplays.plugin.format; import me.filoghost.fcommons.Colors; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.plugin.config.StaticReplacements; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologram; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; @@ -93,7 +93,7 @@ public class DisplayFormat { } public static void sendHologramSummary(CommandSender sender, InternalHologram hologram, boolean showWorld) { - ImmutablePosition position = hologram.getPosition(); + Position position = hologram.getPosition(); sender.sendMessage(ColorScheme.SECONDARY_DARK + "- " + ColorScheme.SECONDARY_BOLD + hologram.getName() + ColorScheme.SECONDARY_DARK + " (" + hologram.getLines().size() + " lines) at " + (showWorld ? "world: \"" + position.getWorldName() + "\", " : "") diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologram.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologram.java index 66e93ff1..78aff1d2 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologram.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologram.java @@ -6,11 +6,11 @@ package me.filoghost.holographicdisplays.plugin.internal.hologram; import me.filoghost.holographicdisplays.api.beta.HolographicDisplaysAPI; +import me.filoghost.holographicdisplays.api.beta.Position; import me.filoghost.holographicdisplays.api.beta.hologram.Hologram; import me.filoghost.holographicdisplays.api.beta.hologram.PlaceholderSetting; import me.filoghost.holographicdisplays.plugin.event.InternalHologramChangeEvent; import me.filoghost.holographicdisplays.plugin.event.InternalHologramChangeEvent.ChangeType; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; import org.bukkit.Bukkit; import java.util.ArrayList; @@ -21,12 +21,12 @@ public class InternalHologram { private final Hologram renderedHologram; private final String name; - private ImmutablePosition position; + private Position position; private final List lines; private final List unmodifiableLinesView; private boolean deleted; - public InternalHologram(HolographicDisplaysAPI api, String name, ImmutablePosition position) { + public InternalHologram(HolographicDisplaysAPI api, String name, Position position) { this.renderedHologram = api.createHologram(position); this.renderedHologram.setPlaceholderSetting(PlaceholderSetting.ENABLE_ALL); this.name = name; @@ -43,11 +43,11 @@ public class InternalHologram { return name; } - public ImmutablePosition getPosition() { + public Position getPosition() { return position; } - public void setPosition(ImmutablePosition position) { + public void setPosition(Position position) { checkNotDeleted(); this.position = position; updateRendering(); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologramManager.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologramManager.java index e6fefc97..cbe7e53b 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologramManager.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/hologram/InternalHologramManager.java @@ -6,7 +6,7 @@ package me.filoghost.holographicdisplays.plugin.internal.hologram; import me.filoghost.holographicdisplays.api.beta.HolographicDisplaysAPI; -import me.filoghost.holographicdisplays.core.base.ImmutablePosition; +import me.filoghost.holographicdisplays.api.beta.Position; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -32,7 +32,7 @@ public class InternalHologramManager { return null; } - public InternalHologram createHologram(String name, ImmutablePosition position) { + public InternalHologram createHologram(String name, Position position) { if (getHologramByName(name) != null) { throw new IllegalStateException("hologram named \"" + name + "\" already exists"); }