From 69dc87b718a4a6a332d1867990e8879b67b3bead Mon Sep 17 00:00:00 2001 From: SemvdH Date: Tue, 3 Feb 2026 21:04:12 +0100 Subject: [PATCH] Finish map and coordinates system --- .../nl/interestingcorner/coordinates/App.java | 78 +++++++++++++++++-- .../commands/AddCoordinateCommandHandler.java | 1 + .../db/CoordinatesDatabaseManager.java | 5 ++ .../coordinates/gui/CoordinatesGUI.java | 14 ---- 4 files changed, 76 insertions(+), 22 deletions(-) diff --git a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/App.java b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/App.java index bf36154..55f41c1 100644 --- a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/App.java +++ b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/App.java @@ -5,8 +5,10 @@ import org.bukkit.command.PluginCommand; import org.bukkit.plugin.java.JavaPlugin; import nl.interestingcorner.coordinates.commands.CoordinatesCommand; +import nl.interestingcorner.coordinates.db.Coordinate; import nl.interestingcorner.coordinates.db.CoordinatesDatabaseManager; import nl.interestingcorner.coordinates.listeners.MapUseListener; +import nl.interestingcorner.core.MinecraftColor; public class App extends JavaPlugin { @@ -15,10 +17,9 @@ public class App extends JavaPlugin { getLogger().info("Eyooo we boutta get lit!"); CoordinatesDatabaseManager.INSTANCE.initialize(this); getLogger().info("Successfully initialized database"); - + getServer().getPluginManager().registerEvents(new MapUseListener(), this); registerCommands(); - } @Override @@ -27,15 +28,76 @@ public class App extends JavaPlugin { } private void registerCommands() { - registerSimgleCommand("ic-coords", new CoordinatesCommand()); + registerSingleCommand("ic-coords", new CoordinatesCommand()); } - - private void registerSimgleCommand(String name, CommandExecutor executor) - { + + private void registerSingleCommand(String name, CommandExecutor executor) { PluginCommand pc = this.getCommand(name); - if (pc != null) - { + if (pc != null) { pc.setExecutor(executor); } } + + @Deprecated + private void addOldCoordinates() { + CoordinatesDatabaseManager db = CoordinatesDatabaseManager.INSTANCE; + db.addCoordinate(new Coordinate(1, "The Tower", "Teleport to the Castle of Illusion", + new Coordinate.Position(2700, 65, 450), false, "the-old-world", MinecraftColor.GOLD)); + db.addCoordinate(new Coordinate(12, "Temple of Tears", "Teleport to the temple in the sky", + new Coordinate.Position(2445, 218, -1902), false, "the-old-world", MinecraftColor.AQUA)); + db.addCoordinate(new Coordinate(13, "Big village", "Teleport to a big ass village", + new Coordinate.Position(1828, 63, -845), false, "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(14, "Other village", "Teleport to yet another village", + new Coordinate.Position(1771, 64, -1626), false, "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(15, "Acacia village", "Teleport to acacia village", + new Coordinate.Position(2287, 63, -1492), false, "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(16, "Illager castle", "Teleport to an illager castle", + new Coordinate.Position(2694, 93, -1240), false, "the-old-world", MinecraftColor.GRAY)); + db.addCoordinate(new Coordinate(17, "Huge honeycomb", "Hmmm honey", new Coordinate.Position(1650, 70, 637), + false, "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(18, "Mansion", "The big mansion next to The Tower", + new Coordinate.Position(2833, 66, 377), false, "the-old-world", MinecraftColor.DARK_AQUA)); + db.addCoordinate(new Coordinate(19, "Village with labyrinth", "Big village with a labyrinth", + new Coordinate.Position(871, 66, 884), false, "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(20, "Ravine cave entrance", "Teleport to big cave entrance", + new Coordinate.Position(2080, 105, 1135), false, "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(21, "Skeleton spawner", "Get some XP made by Sienna", + new Coordinate.Position(2278, -9, 1484), false, "the-old-world", MinecraftColor.LIGHT_PURPLE)); + db.addCoordinate(new Coordinate(22, "Nether portal", "Nether portal IN THE NETHER", + new Coordinate.Position(316, 81, 50), true, "the-old-world", MinecraftColor.RED)); + db.addCoordinate(new Coordinate(25, "Home village", "The first home village", + new Coordinate.Position(2212, 69, 926), false, "the-old-world", MinecraftColor.GREEN)); + db.addCoordinate(new Coordinate(26, "deep dark wool eiland", "ready to get your asshole ripped", + new Coordinate.Position(2626, -36, 1714), false, "the-old-world", MinecraftColor.DARK_BLUE)); + db.addCoordinate(new Coordinate(27, "2nd Nether portal", "2nd nether portal IN THE NETHER", + new Coordinate.Position(264, 43, 106), true, "the-old-world", MinecraftColor.RED)); + db.addCoordinate(new Coordinate(28, "Nether fortress", "Nether fortress IN THE NETHER", + new Coordinate.Position(85, 60, 423), true, "the-old-world", MinecraftColor.DARK_RED)); + db.addCoordinate(new Coordinate(29, "Village hidden in the sand", "Also known as Sunagakure", + new Coordinate.Position(223, 75, 688), false, "the-old-world", MinecraftColor.YELLOW)); + db.addCoordinate(new Coordinate(30, "deep dark", "deep down", new Coordinate.Position(2590, -17, -1690), false, + "the-old-world", MinecraftColor.DARK_BLUE)); + db.addCoordinate(new Coordinate(31, "Mob farm", "mob farm maken voor xp en andere stuff enzo", + new Coordinate.Position(2471, 79, -440), false, "the-old-world", MinecraftColor.RED)); + db.addCoordinate(new Coordinate(33, "Green cave", "NEW Green cave", new Coordinate.Position(10098, -10, 10076), + false, "the-old-world", MinecraftColor.GREEN)); + db.addCoordinate(new Coordinate(34, "Castle", "Beautiful castle in plains biome", + new Coordinate.Position(9678, 90, 11222), false, "the-old-world", MinecraftColor.GOLD)); + db.addCoordinate(new Coordinate(35, "RPG style city", "large village with a castle", + new Coordinate.Position(8904, 68, 11200), false, "the-old-world", MinecraftColor.AQUA)); + db.addCoordinate(new Coordinate(36, "Abandoned castle", "Abandoned castle which we conquered", + new Coordinate.Position(9071, 74, 11022), false, "the-old-world", MinecraftColor.LIGHT_PURPLE)); + db.addCoordinate(new Coordinate(37, "Portal", "New portal IN THE NETHER", + new Coordinate.Position(1136, 32, 1397), true, "the-old-world", MinecraftColor.RED)); + db.addCoordinate(new Coordinate(38, "bee boss", "ga dood lol", new Coordinate.Position(3470, 64, 227), false, + "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(39, "bee boss 2.0", "ga dood neef", new Coordinate.Position(4045, 63, 130), + false, "the-old-world", MinecraftColor.BLACK)); + db.addCoordinate(new Coordinate(40, "Ice biome", "RIP my boi titanic", new Coordinate.Position(4587, 63, 476), + false, "the-old-world", MinecraftColor.AQUA)); + db.addCoordinate(new Coordinate(41, "Onderwater gang trap ofzo", "Neem water breathing of hoedje mee ofzo", + new Coordinate.Position(6156, 63, 2228), false, "the-old-world", MinecraftColor.GRAY)); + db.addCoordinate(new Coordinate(42, "The hood", "da hood", new Coordinate.Position(8202, 70, 999580), false, + "the-old-world", MinecraftColor.GREEN)); + } } diff --git a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/commands/AddCoordinateCommandHandler.java b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/commands/AddCoordinateCommandHandler.java index 83e063c..ff388c1 100644 --- a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/commands/AddCoordinateCommandHandler.java +++ b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/commands/AddCoordinateCommandHandler.java @@ -61,6 +61,7 @@ public class AddCoordinateCommandHandler implements CoordinatesCommandHandler { return false; } + player.sendMessage(MinecraftColor.BLUE.toColorCode() + "Adding coordinate '" + name + "' at your current location..."); //TODO check if item doesnt already exist, coordinate with same values, create isEquals method for coordinate return CoordinatesDatabaseManager.INSTANCE .addCoordinate(name, // name diff --git a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/db/CoordinatesDatabaseManager.java b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/db/CoordinatesDatabaseManager.java index aa2e5b5..d157582 100644 --- a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/db/CoordinatesDatabaseManager.java +++ b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/db/CoordinatesDatabaseManager.java @@ -12,6 +12,7 @@ import org.bukkit.plugin.java.JavaPlugin; import nl.interestingcorner.core.MinecraftColor; import nl.interestingcorner.core.db.DatabaseManager; +import nl.interestingcorner.core.logging.Logger; public enum CoordinatesDatabaseManager implements nl.interestingcorner.core.db.DatabaseInitializeListener{ @@ -20,6 +21,8 @@ public enum CoordinatesDatabaseManager implements nl.interestingcorner.core.db.D private Connection connection; private JavaPlugin app; + private final String TAG = getClass().getSimpleName(); + public void initialize(JavaPlugin app) { this.app = app; DatabaseManager.INSTANCE.registerDatabaseInitializeListener(this); @@ -119,6 +122,8 @@ public enum CoordinatesDatabaseManager implements nl.interestingcorner.core.db.D this.app.getLogger().log(Level.SEVERE, "Error adding coordinate to database: {0}", e.getMessage()); return false; } + + Logger.INSTANCE.info(TAG, "Added coordinate '" + name + "' to database."); return true; } diff --git a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/gui/CoordinatesGUI.java b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/gui/CoordinatesGUI.java index 63d938d..4782afb 100644 --- a/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/gui/CoordinatesGUI.java +++ b/ic_plugin_coordinates/src/main/java/nl/interestingcorner/coordinates/gui/CoordinatesGUI.java @@ -3,10 +3,8 @@ package nl.interestingcorner.coordinates.gui; import java.util.ArrayList; import java.util.List; -import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; import nl.interestingcorner.coordinates.db.Coordinate; import nl.interestingcorner.core.gui.GUI; @@ -20,18 +18,6 @@ public class CoordinatesGUI { items.add(item); } - for (int i = 0; i < 90; i++) { - ItemStack item = new ItemStack(Material.AMETHYST_BLOCK); - ItemMeta meta = item.getItemMeta(); - if (meta == null) - { - continue; - } - meta.setDisplayName("Test Item " + (i + 1)); - item.setItemMeta(meta); - items.add(item); - } - GUI gui = new GUI("Coordinates", GUI.DEFAULT_PAGE_SIZE); gui.addItemClickListener(new TeleportItemClickListener()); gui.setItems(items);