diff --git a/Legacy/pom.xml b/Legacy/pom.xml
new file mode 100644
index 00000000..abb24014
--- /dev/null
+++ b/Legacy/pom.xml
@@ -0,0 +1,43 @@
+
+
+ 4.0.0
+
+
+ com.gmail.filoghost.holographicdisplays
+ holographicdisplays-parent
+ 2.4.2-SNAPSHOT
+
+
+ holographicdisplays-legacy
+ HolographicDisplays Legacy
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+
+
+
+ ${project.groupId}
+ holographicdisplays-api
+ 2.4.2-SNAPSHOT
+
+
+
+ ${project.groupId}
+ holographicdisplays-utils
+ 2.4.2-SNAPSHOT
+
+
+
+ org.spigotmc
+ spigot-api
+ ${spigot-api.version}
+ provided
+
+
+
+
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/FloatingItem.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/FloatingItem.java
similarity index 100%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/FloatingItem.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/FloatingItem.java
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/Hologram.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/Hologram.java
similarity index 100%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/Hologram.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/Hologram.java
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java
similarity index 61%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java
index ab51e515..85051636 100644
--- a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java
+++ b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/HolographicDisplaysAPI.java
@@ -14,7 +14,9 @@
*/
package com.gmail.filoghost.holograms.api;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -28,12 +30,10 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
-import com.gmail.filoghost.holograms.api.replacements.FakeFloatingItem;
+import com.gmail.filoghost.holograms.api.adapter.FloatingItemAdapter;
+import com.gmail.filoghost.holograms.api.adapter.HologramAdapter;
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
-import com.gmail.filoghost.holographicdisplays.api.internal.BackendAPI;
-import com.gmail.filoghost.holographicdisplays.object.CraftHologram;
-import com.gmail.filoghost.holographicdisplays.object.PluginHologram;
-import com.gmail.filoghost.holographicdisplays.object.PluginHologramManager;
+import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.util.Validator;
/**
@@ -45,6 +45,8 @@ public class HolographicDisplaysAPI {
private static Set notifiedPlugins = new HashSet<>();
private static void notifyOldAPI(Plugin plugin) {
+ Validator.notNull(plugin, "plugin");
+
if (notifiedPlugins.add(plugin.getName())) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[Holographic Displays] The plugin \"" + plugin.getName() + "\" is still using the old API of Holographic Displays. "
+ "Please notify the author and ask them to update it, the old API will be removed soon.");
@@ -54,40 +56,42 @@ public class HolographicDisplaysAPI {
@Deprecated
public static Hologram createHologram(Plugin plugin, Location source, String... lines) {
notifyOldAPI(plugin);
- CraftHologram hologram = (CraftHologram) BackendAPI.getImplementation().createHologram(plugin, source);
+
+ validateLocation(source);
+
+ com.gmail.filoghost.holographicdisplays.api.Hologram hologram = HologramsAPI.createHologram(plugin, source);
for (String line : lines) {
hologram.appendTextLine(line);
}
- return hologram;
+ return new HologramAdapter(plugin, hologram);
}
@Deprecated
public static FloatingItem createFloatingItem(Plugin plugin, Location source, ItemStack itemstack) {
notifyOldAPI(plugin);
- Validator.notNull(itemstack, "itemstack");
- Validator.isTrue(itemstack.getType() != Material.AIR, "itemstack cannot be AIR");
- CraftHologram hologram = (CraftHologram) BackendAPI.getImplementation().createHologram(plugin, source);
- hologram.appendItemLine(itemstack);
- return new FakeFloatingItem(hologram, itemstack);
+ validateLocation(source);
+ validateItem(itemstack);
+
+ com.gmail.filoghost.holographicdisplays.api.Hologram hologram = HologramsAPI.createHologram(plugin, source);
+ ItemLine itemLine = hologram.appendItemLine(itemstack);
+ return new FloatingItemAdapter(plugin, hologram, itemLine);
}
-
+
@Deprecated
public static Hologram createIndividualHologram(Plugin plugin, Location source, Player whoCanSee, String... lines) {
notifyOldAPI(plugin);
- List whoCanSeeList = new ArrayList<>();
- whoCanSeeList.add(whoCanSee);
- return createIndividualHologram(plugin, source, whoCanSeeList, lines);
+
+ return createIndividualHologram(plugin, source, Arrays.asList(whoCanSee), lines);
}
@Deprecated
public static Hologram createIndividualHologram(Plugin plugin, Location source, List whoCanSee, String... lines) {
notifyOldAPI(plugin);
- Validator.notNull(plugin, "plugin");
- Validator.notNull(source, "source");
- Validator.notNull(source.getWorld(), "source's world");
- CraftHologram hologram = (CraftHologram) BackendAPI.getImplementation().createHologram(plugin, source);
+ validateLocation(source);
+
+ com.gmail.filoghost.holographicdisplays.api.Hologram hologram = HologramsAPI.createHologram(plugin, source);
hologram.getVisibilityManager().setVisibleByDefault(false);
if (whoCanSee != null) {
@@ -100,28 +104,25 @@ public class HolographicDisplaysAPI {
hologram.appendTextLine(line);
}
- return hologram;
+ return new HologramAdapter(plugin, hologram);
}
@Deprecated
public static FloatingItem createIndividualFloatingItem(Plugin plugin, Location source, Player whoCanSee, ItemStack itemstack) {
notifyOldAPI(plugin);
- List whoCanSeeList = new ArrayList<>();
- whoCanSeeList.add(whoCanSee);
- return createIndividualFloatingItem(plugin, source, whoCanSeeList, itemstack);
+
+ return createIndividualFloatingItem(plugin, source, Arrays.asList(whoCanSee), itemstack);
}
@Deprecated
public static FloatingItem createIndividualFloatingItem(Plugin plugin, Location source, List whoCanSee, ItemStack itemstack) {
notifyOldAPI(plugin);
- Validator.notNull(plugin, "plugin cannot be null");
- Validator.notNull(source, "source cannot be null");
- Validator.notNull(source.getWorld(), "source's world cannot be null");
- Validator.notNull(itemstack, "itemstack cannot be null");
- Validator.isTrue(itemstack.getType() != Material.AIR, "itemstack cannot be AIR");
- CraftHologram hologram = (CraftHologram) BackendAPI.getImplementation().createHologram(plugin, source);
- hologram.appendItemLine(itemstack);
+ validateLocation(source);
+ validateItem(itemstack);
+
+ com.gmail.filoghost.holographicdisplays.api.Hologram hologram = HologramsAPI.createHologram(plugin, source);
+ ItemLine itemLine = hologram.appendItemLine(itemstack);
hologram.getVisibilityManager().setVisibleByDefault(false);
if (whoCanSee != null) {
@@ -130,34 +131,38 @@ public class HolographicDisplaysAPI {
}
}
- return new FakeFloatingItem(hologram, itemstack);
+ return new FloatingItemAdapter(plugin, hologram, itemLine);
}
@Deprecated
public static Hologram[] getHolograms(Plugin plugin) {
notifyOldAPI(plugin);
- Validator.notNull(plugin, "plugin cannot be null");
- List pluginHolograms = new ArrayList<>();;
- for (PluginHologram pluginHologram : PluginHologramManager.getHolograms()) {
- if (pluginHologram.getOwner().equals(plugin)) {
- pluginHolograms.add(pluginHologram);
- }
- }
-
- return pluginHolograms.toArray(new Hologram[0]);
+ Collection pluginHolograms = HologramAdapter.activeHolograms.getOrDefault(plugin, Collections.emptyList());
+ return pluginHolograms.toArray(new HologramAdapter[0]);
}
@Deprecated
public static FloatingItem[] getFloatingItems(Plugin plugin) {
notifyOldAPI(plugin);
- Validator.notNull(plugin, "plugin cannot be null");
- return new FloatingItem[0];
+
+ Collection pluginFloatingItems = FloatingItemAdapter.activeFloatingItems.getOrDefault(plugin, Collections.emptyList());
+ return pluginFloatingItems.toArray(new FloatingItemAdapter[0]);
}
@Deprecated
public static boolean isHologramEntity(Entity bukkitEntity) {
return HologramsAPI.isHologramEntity(bukkitEntity);
}
+
+ private static void validateLocation(Location loc) {
+ Validator.notNull(loc, "location");
+ Validator.notNull(loc.getWorld(), "location's world");
+ }
+
+ private static void validateItem(ItemStack itemstack) {
+ Validator.notNull(itemstack, "itemstack");
+ Validator.isTrue(itemstack.getType() != Material.AIR, "itemstack cannot be AIR");
+ }
}
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/ItemTouchHandler.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/ItemTouchHandler.java
similarity index 100%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/ItemTouchHandler.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/ItemTouchHandler.java
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/PickupHandler.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/PickupHandler.java
similarity index 100%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/PickupHandler.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/PickupHandler.java
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/TouchHandler.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/TouchHandler.java
similarity index 100%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/TouchHandler.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/TouchHandler.java
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/FakeFloatingItem.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/FloatingItemAdapter.java
similarity index 59%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/FakeFloatingItem.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/FloatingItemAdapter.java
index 92d3ef73..d005ce9a 100644
--- a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/FakeFloatingItem.java
+++ b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/FloatingItemAdapter.java
@@ -12,30 +12,41 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.gmail.filoghost.holograms.api.replacements;
+package com.gmail.filoghost.holograms.api.adapter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
import com.gmail.filoghost.holograms.api.FloatingItem;
import com.gmail.filoghost.holograms.api.ItemTouchHandler;
import com.gmail.filoghost.holograms.api.PickupHandler;
-import com.gmail.filoghost.holographicdisplays.object.CraftHologram;
-import com.gmail.filoghost.holographicdisplays.object.line.CraftItemLine;
+import com.gmail.filoghost.holographicdisplays.api.Hologram;
+import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
-/**
- * Do not use this class!
- */
@SuppressWarnings("deprecation")
-public class FakeFloatingItem implements FloatingItem {
+public class FloatingItemAdapter implements FloatingItem {
- public CraftHologram hologram;
- private CraftItemLine mainLine;
+ public static Map> activeFloatingItems = new HashMap<>();
- public FakeFloatingItem(CraftHologram hologram, ItemStack item) {
- this.hologram = hologram;
- mainLine = hologram.appendItemLine(item);
+ private Plugin plugin;
+ public Hologram hologram;
+ private ItemLine itemLine;
+ private ItemTouchHandler touchHandler;
+ private PickupHandler pickupHandler;
+
+ public FloatingItemAdapter(Plugin plugin, Hologram delegateHologram, ItemLine delegateItemLine) {
+ this.plugin = plugin;
+ this.hologram = delegateHologram;
+ this.itemLine = delegateItemLine;
+
+ activeFloatingItems.computeIfAbsent(plugin, __ -> new ArrayList<>()).add(this);
}
@Override
@@ -50,12 +61,12 @@ public class FakeFloatingItem implements FloatingItem {
@Override
public void setItemStack(ItemStack itemstack) {
- mainLine.setItemStack(itemstack);
+ itemLine.setItemStack(itemstack);
}
@Override
public ItemStack getItemStack() {
- return mainLine.getItemStack();
+ return itemLine.getItemStack();
}
@Override
@@ -90,40 +101,44 @@ public class FakeFloatingItem implements FloatingItem {
@Override
public void setTouchHandler(ItemTouchHandler handler) {
+ this.touchHandler = handler;
+
if (handler != null) {
- mainLine.setTouchHandler(new OldItemTouchHandlerWrapper(this, handler));
+ itemLine.setTouchHandler(new ItemTouchHandlerAdapter(this, handler));
} else {
- mainLine.setTouchHandler(null);
+ itemLine.setTouchHandler(null);
}
}
@Override
public ItemTouchHandler getTouchHandler() {
- return ((OldItemTouchHandlerWrapper) mainLine.getTouchHandler()).oldHandler;
+ return touchHandler;
}
@Override
public boolean hasTouchHandler() {
- return mainLine.getTouchHandler() != null;
+ return touchHandler != null;
}
@Override
public void setPickupHandler(PickupHandler handler) {
+ this.pickupHandler = handler;
+
if (handler != null) {
- mainLine.setPickupHandler(new OldPickupHandlerWrapper(this, handler));
+ itemLine.setPickupHandler(new PickupHandlerAdapter(this, handler));
} else {
- mainLine.setPickupHandler(null);
+ itemLine.setPickupHandler(null);
}
}
@Override
public PickupHandler getPickupHandler() {
- return ((OldPickupHandlerWrapper) mainLine.getPickupHandler()).oldHandler;
+ return pickupHandler;
}
@Override
public boolean hasPickupHandler() {
- return mainLine.getPickupHandler() != null;
+ return pickupHandler != null;
}
@Override
@@ -134,6 +149,8 @@ public class FakeFloatingItem implements FloatingItem {
@Override
public void delete() {
hologram.delete();
+
+ activeFloatingItems.get(plugin).remove(this);
}
@Override
diff --git a/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/HologramAdapter.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/HologramAdapter.java
new file mode 100644
index 00000000..f2d796e0
--- /dev/null
+++ b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/HologramAdapter.java
@@ -0,0 +1,202 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.gmail.filoghost.holograms.api.adapter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.plugin.Plugin;
+
+import com.gmail.filoghost.holograms.api.Hologram;
+import com.gmail.filoghost.holograms.api.TouchHandler;
+import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
+import com.gmail.filoghost.holographicdisplays.api.line.TextLine;
+import com.gmail.filoghost.holographicdisplays.api.line.TouchableLine;
+
+@SuppressWarnings("deprecation")
+public class HologramAdapter implements Hologram {
+
+ public static Map> activeHolograms = new HashMap<>();
+
+ private Plugin plugin;
+ private com.gmail.filoghost.holographicdisplays.api.Hologram hologram;
+ private TouchHandler touchHandler;
+
+ public HologramAdapter(Plugin plugin, com.gmail.filoghost.holographicdisplays.api.Hologram delegate) {
+ this.plugin = plugin;
+ this.hologram = delegate;
+
+ activeHolograms.computeIfAbsent(plugin, __ -> new ArrayList<>()).add(this);
+ }
+
+ @Override
+ @Deprecated
+ public boolean update() {
+ return true;
+ }
+
+ @Override
+ @Deprecated
+ public void hide() {
+
+ }
+
+ @Override
+ @Deprecated
+ public void addLine(String text) {
+ hologram.appendTextLine(text);
+ updateTouchHandler();
+ }
+
+ @Override
+ @Deprecated
+ public void setLine(int index, String text) {
+ hologram.removeLine(index);
+ hologram.insertTextLine(index, text);
+ updateTouchHandler();
+ }
+
+ @Override
+ @Deprecated
+ public void insertLine(int index, String text) {
+ hologram.insertTextLine(index, text);
+ updateTouchHandler();
+ }
+
+ @Override
+ @Deprecated
+ public String[] getLines() {
+ String[] lines = new String[hologram.size()];
+ for (int i = 0; i < lines.length; i++) {
+ HologramLine lineObject = hologram.getLine(i);
+ if (lineObject instanceof TextLine) {
+ lines[i] = ((TextLine) lineObject).getText();
+ } else {
+ lines[i] = "";
+ }
+ }
+ return lines;
+ }
+
+ @Override
+ @Deprecated
+ public int getLinesLength() {
+ return hologram.size();
+ }
+
+ @Override
+ @Deprecated
+ public void setLocation(Location location) {
+ hologram.teleport(location);
+ }
+
+ @Override
+ @Deprecated
+ public void setTouchHandler(TouchHandler handler) {
+ this.touchHandler = handler;
+ updateTouchHandler();
+ }
+
+ private void updateTouchHandler() {
+ for (int i = 0; i < hologram.size(); i++) {
+ HologramLine line = hologram.getLine(i);
+ if (!(line instanceof TouchableLine)) {
+ continue;
+ }
+
+ TouchableLine touchableLine = (TouchableLine) line;
+
+ if (touchHandler != null) {
+ touchableLine.setTouchHandler(new HologramTouchHandlerAdapter(this, touchHandler));
+ } else {
+ touchableLine.setTouchHandler(null);
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public TouchHandler getTouchHandler() {
+ return touchHandler;
+ }
+
+ @Override
+ @Deprecated
+ public boolean hasTouchHandler() {
+ return touchHandler != null;
+ }
+
+ @Override
+ public void removeLine(int index) {
+ hologram.removeLine(index);
+ }
+
+ @Override
+ public void clearLines() {
+ hologram.clearLines();
+ }
+
+ @Override
+ public Location getLocation() {
+ return hologram.getLocation();
+ }
+
+ @Override
+ public double getX() {
+ return hologram.getX();
+ }
+
+ @Override
+ public double getY() {
+ return hologram.getY();
+ }
+
+ @Override
+ public double getZ() {
+ return hologram.getZ();
+ }
+
+ @Override
+ public World getWorld() {
+ return hologram.getWorld();
+ }
+
+ @Override
+ public void teleport(Location location) {
+ hologram.teleport(location);
+ }
+
+ @Override
+ public long getCreationTimestamp() {
+ return hologram.getCreationTimestamp();
+ }
+
+ @Override
+ public void delete() {
+ hologram.delete();
+
+ activeHolograms.get(plugin).remove(this);
+ }
+
+ @Override
+ public boolean isDeleted() {
+ return hologram.isDeleted();
+ }
+
+}
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldTouchHandlerWrapper.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/HologramTouchHandlerAdapter.java
similarity index 70%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldTouchHandlerWrapper.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/HologramTouchHandlerAdapter.java
index 3ec50de2..8c911ee8 100644
--- a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldTouchHandlerWrapper.java
+++ b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/HologramTouchHandlerAdapter.java
@@ -12,20 +12,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.gmail.filoghost.holograms.api.replacements;
+package com.gmail.filoghost.holograms.api.adapter;
import org.bukkit.entity.Player;
+import com.gmail.filoghost.holograms.api.Hologram;
import com.gmail.filoghost.holograms.api.TouchHandler;
-import com.gmail.filoghost.holographicdisplays.object.CraftHologram;
@SuppressWarnings("deprecation")
-public class OldTouchHandlerWrapper implements com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler {
+public class HologramTouchHandlerAdapter implements com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler {
- public TouchHandler oldHandler;
- private CraftHologram hologram;
+ protected TouchHandler oldHandler;
+ private Hologram hologram;
- public OldTouchHandlerWrapper(CraftHologram hologram, TouchHandler oldHandler) {
+ public HologramTouchHandlerAdapter(Hologram hologram, TouchHandler oldHandler) {
this.hologram = hologram;
this.oldHandler = oldHandler;
}
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldItemTouchHandlerWrapper.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/ItemTouchHandlerAdapter.java
similarity index 75%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldItemTouchHandlerWrapper.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/ItemTouchHandlerAdapter.java
index aa8e2c3f..b51bd8e8 100644
--- a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldItemTouchHandlerWrapper.java
+++ b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/ItemTouchHandlerAdapter.java
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.gmail.filoghost.holograms.api.replacements;
+package com.gmail.filoghost.holograms.api.adapter;
import org.bukkit.entity.Player;
@@ -20,12 +20,12 @@ import com.gmail.filoghost.holograms.api.FloatingItem;
import com.gmail.filoghost.holograms.api.ItemTouchHandler;
@SuppressWarnings("deprecation")
-public class OldItemTouchHandlerWrapper implements com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler {
+public class ItemTouchHandlerAdapter implements com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler {
- public ItemTouchHandler oldHandler;
+ protected ItemTouchHandler oldHandler;
private FloatingItem item;
- public OldItemTouchHandlerWrapper(FloatingItem item, ItemTouchHandler oldHandler) {
+ public ItemTouchHandlerAdapter(FloatingItem item, ItemTouchHandler oldHandler) {
this.item = item;
this.oldHandler = oldHandler;
}
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldPickupHandlerWrapper.java b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/PickupHandlerAdapter.java
similarity index 78%
rename from Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldPickupHandlerWrapper.java
rename to Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/PickupHandlerAdapter.java
index c14f7112..983473ba 100644
--- a/Plugin/src/main/java/com/gmail/filoghost/holograms/api/replacements/OldPickupHandlerWrapper.java
+++ b/Legacy/src/main/java/com/gmail/filoghost/holograms/api/adapter/PickupHandlerAdapter.java
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.gmail.filoghost.holograms.api.replacements;
+package com.gmail.filoghost.holograms.api.adapter;
import org.bukkit.entity.Player;
@@ -20,12 +20,12 @@ import com.gmail.filoghost.holograms.api.FloatingItem;
import com.gmail.filoghost.holograms.api.PickupHandler;
@SuppressWarnings("deprecation")
-public class OldPickupHandlerWrapper implements com.gmail.filoghost.holographicdisplays.api.handler.PickupHandler {
+public class PickupHandlerAdapter implements com.gmail.filoghost.holographicdisplays.api.handler.PickupHandler {
public PickupHandler oldHandler;
private FloatingItem item;
- public OldPickupHandlerWrapper(FloatingItem item, PickupHandler oldPickupHandler) {
+ public PickupHandlerAdapter(FloatingItem item, PickupHandler oldPickupHandler) {
this.item = item;
this.oldHandler = oldPickupHandler;
}
diff --git a/Plugin/pom.xml b/Plugin/pom.xml
index 16e464e3..d0515285 100644
--- a/Plugin/pom.xml
+++ b/Plugin/pom.xml
@@ -41,6 +41,12 @@
holographicdisplays-utils
2.4.2-SNAPSHOT
+
+
+ ${project.groupId}
+ holographicdisplays-legacy
+ 2.4.2-SNAPSHOT
+
${project.groupId}
diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/object/CraftHologram.java b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/object/CraftHologram.java
index 4cae1536..554e7edd 100644
--- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/object/CraftHologram.java
+++ b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/object/CraftHologram.java
@@ -22,10 +22,7 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
-import com.gmail.filoghost.holograms.api.TouchHandler;
-import com.gmail.filoghost.holograms.api.replacements.OldTouchHandlerWrapper;
import com.gmail.filoghost.holographicdisplays.api.Hologram;
-import com.gmail.filoghost.holographicdisplays.api.line.TouchableLine;
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
import com.gmail.filoghost.holographicdisplays.object.line.CraftHologramLine;
import com.gmail.filoghost.holographicdisplays.object.line.CraftItemLine;
@@ -36,10 +33,8 @@ import com.gmail.filoghost.holographicdisplays.util.Validator;
/**
* This class is only used by the plugin itself. Do not attempt to use it.
- * It still implements the old API, but it's temporary.
*/
-@SuppressWarnings("deprecation")
-public class CraftHologram implements Hologram, com.gmail.filoghost.holograms.api.Hologram {
+public class CraftHologram implements Hologram {
// Position variables.
private World world;
@@ -356,85 +351,6 @@ public class CraftHologram implements Hologram, com.gmail.filoghost.holograms.ap
public String toString() {
return "CraftHologram [world=" + world + ", x=" + x + ", y=" + y + ", z=" + z + ", lines=" + lines + ", deleted=" + deleted + "]";
}
-
- /**
- * Old API methods, will be removed soon
- */
-
- @Override
- @Deprecated
- public boolean update() {
- return true;
- }
-
- @Override
- @Deprecated
- public void hide() {
-
- }
-
- @Override
- @Deprecated
- public void addLine(String text) {
- appendTextLine(text);
- }
-
- @Override
- @Deprecated
- public void setLine(int index, String text) {
- lines.get(index).despawn();
- lines.set(index, new CraftTextLine(this, text));
- }
-
- @Override
- @Deprecated
- public void insertLine(int index, String text) {
- insertLine(index, text);
- }
-
- @Override
- @Deprecated
- public String[] getLines() {
- return null;
- }
-
- @Override
- @Deprecated
- public int getLinesLength() {
- return size();
- }
-
- @Override
- @Deprecated
- public void setLocation(Location location) {
- teleport(location);
- }
-
- @Override
- @Deprecated
- public void setTouchHandler(TouchHandler handler) {
- if (size() > 0) {
- TouchableLine line0 = ((TouchableLine) getLine(0));
-
- if (handler != null) {
- line0.setTouchHandler(new OldTouchHandlerWrapper(this, handler));
- } else {
- line0.setTouchHandler(null);
- }
- }
- }
-
- @Override
- @Deprecated
- public TouchHandler getTouchHandler() {
- return null;
- }
-
- @Override
- @Deprecated
- public boolean hasTouchHandler() {
- return false;
- }
/**
* About: equals() and hashcode()
diff --git a/pom.xml b/pom.xml
index ec807500..4b28d0b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,6 +32,7 @@
API
Utils
Config
+ Legacy
NMS/Interfaces
NMS/v1_8_R2
NMS/v1_8_R3