diff --git a/src/main/java/com/craftaro/skyblock/api/utils/APIUtil.java b/src/main/java/com/craftaro/skyblock/api/utils/APIUtil.java index 1ea541a1..80781e97 100644 --- a/src/main/java/com/craftaro/skyblock/api/utils/APIUtil.java +++ b/src/main/java/com/craftaro/skyblock/api/utils/APIUtil.java @@ -1,6 +1,6 @@ package com.craftaro.skyblock.api.utils; -import com.craftaro.core.world.SWorldBorder; +import com.craftaro.core.nms.world.NmsWorldBorder; import com.craftaro.skyblock.api.island.IslandBorderColor; import com.craftaro.skyblock.api.island.IslandUpgrade; import com.craftaro.skyblock.api.island.IslandWorld; @@ -191,26 +191,26 @@ public final class APIUtil { return null; } - public static SWorldBorder.Color toImplementation(IslandBorderColor color) { + public static NmsWorldBorder.BorderColor toImplementation(IslandBorderColor color) { switch (color) { case BLUE: - return SWorldBorder.Color.Blue; + return NmsWorldBorder.BorderColor.BLUE; case GREEN: - return SWorldBorder.Color.Green; + return NmsWorldBorder.BorderColor.GREEN; case RED: - return SWorldBorder.Color.Red; + return NmsWorldBorder.BorderColor.RED; } return null; } - public static IslandBorderColor fromImplementation(SWorldBorder.Color color) { + public static IslandBorderColor fromImplementation(NmsWorldBorder.BorderColor color) { switch (color) { - case Blue: + case BLUE: return IslandBorderColor.BLUE; - case Green: + case GREEN: return IslandBorderColor.GREEN; - case Red: + case RED: return IslandBorderColor.RED; } diff --git a/src/main/java/com/craftaro/skyblock/island/Island.java b/src/main/java/com/craftaro/skyblock/island/Island.java index 3907cdd1..0866d0ef 100644 --- a/src/main/java/com/craftaro/skyblock/island/Island.java +++ b/src/main/java/com/craftaro/skyblock/island/Island.java @@ -1,10 +1,10 @@ package com.craftaro.skyblock.island; import com.craftaro.core.compatibility.CompatibleBiome; +import com.craftaro.core.nms.world.NmsWorldBorder; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.core.utils.NumberUtils; import com.craftaro.core.utils.PlayerUtils; -import com.craftaro.core.world.SWorldBorder; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.api.event.island.IslandBiomeChangeEvent; import com.craftaro.skyblock.api.event.island.IslandLocationChangeEvent; @@ -150,7 +150,7 @@ public class Island { if (configLoad.getString("Border") == null) { configLoad.set("Border.Enable", mainConfigLoad.getBoolean("Island.WorldBorder.Default", false)); - configLoad.set("Border.Color", SWorldBorder.Color.Blue.name()); + configLoad.set("Border.Color", NmsWorldBorder.BorderColor.BLUE.name()); } if (configLoad.getString("Members") != null) { @@ -246,7 +246,7 @@ public class Island { configLoad.set("UUID", this.islandUUID.toString()); configLoad.set("Visitor.Status", mainConfigLoad.getString("Island.Visitor.Status").toUpperCase()); configLoad.set("Border.Enable", mainConfigLoad.getBoolean("Island.WorldBorder.Default", false)); - configLoad.set("Border.Color", SWorldBorder.Color.Blue.name()); + configLoad.set("Border.Color", NmsWorldBorder.BorderColor.BLUE.name()); configLoad.set("Biome.Type", mainConfigLoad.getString("Island.Biome.Default.Type").toUpperCase()); configLoad.set("Weather.Synchronised", mainConfigLoad.getBoolean("Island.Weather.Default.Synchronised")); // TODO: Synchronized configLoad.set("Weather.Time", mainConfigLoad.getInt("Island.Weather.Default.Time")); @@ -449,13 +449,13 @@ public class Island { .getFileConfiguration().set("Border.Enable", border); } - public SWorldBorder.Color getBorderColor() { - return SWorldBorder.Color.valueOf(this.plugin.getFileManager().getConfig( - new File(new File(this.plugin.getDataFolder(), "island-data"), this.ownerUUID.toString() + ".yml")) - .getFileConfiguration().getString("Border.Color")); + public NmsWorldBorder.BorderColor getBorderColor() { + String colorString = this.plugin.getFileManager().getConfig(new File(new File(this.plugin.getDataFolder(), "island-data"), this.ownerUUID.toString() + ".yml")) + .getFileConfiguration().getString("Border.Color"); + return NmsWorldBorder.BorderColor.valueOf(colorString.toUpperCase()); } - public void setBorderColor(SWorldBorder.Color color) { + public void setBorderColor(NmsWorldBorder.BorderColor color) { this.plugin.getFileManager().getConfig( new File(new File(this.plugin.getDataFolder(), "island-data"), this.ownerUUID.toString() + ".yml")) .getFileConfiguration().set("Border.Color", color.name()); diff --git a/src/main/java/com/craftaro/skyblock/island/IslandManager.java b/src/main/java/com/craftaro/skyblock/island/IslandManager.java index 64afc526..071d7f4a 100644 --- a/src/main/java/com/craftaro/skyblock/island/IslandManager.java +++ b/src/main/java/com/craftaro/skyblock/island/IslandManager.java @@ -6,9 +6,7 @@ import com.bekvon.bukkit.residence.protection.ClaimedResidence; import com.craftaro.core.compatibility.CompatibleBiome; import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.ServerVersion; -import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; -import com.craftaro.third_party.com.cryptomorin.xseries.XSound; -import com.craftaro.core.world.SWorldBorder; +import com.craftaro.core.nms.Nms; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.api.event.island.IslandCreateEvent; import com.craftaro.skyblock.api.event.island.IslandDeleteEvent; @@ -43,6 +41,8 @@ import com.craftaro.skyblock.utils.world.LocationUtil; import com.craftaro.skyblock.utils.world.block.BlockDegreesType; import com.craftaro.skyblock.visit.VisitManager; import com.craftaro.skyblock.world.WorldManager; +import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; +import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.eatthepath.uuid.FastUUID; import com.google.common.base.Preconditions; import io.papermc.lib.PaperLib; @@ -1511,10 +1511,10 @@ public class IslandManager { if (configLoad.getBoolean("Island.WorldBorder.Enable") && island.isBorder()) { Location islandLocation = island.getLocation(worldManager.getIslandWorld(player.getWorld()), IslandEnvironment.ISLAND); if (islandLocation != null) { - SWorldBorder.send(player, island.getBorderColor(), island.getSize(), islandLocation.clone().add(increment, 0, increment)); + Nms.getImplementations().getWorldBorder().send(player, island.getBorderColor(), island.getSize(), islandLocation.clone().add(increment, 0, increment)); } } else { - SWorldBorder.send(player, null, 1.4999992E7D, new org.bukkit.Location(player.getWorld(), 0, 0, 0)); + Nms.getImplementations().getWorldBorder().send(player, null, 1.4999992E7D, new org.bukkit.Location(player.getWorld(), 0, 0, 0)); } }); } @@ -1666,7 +1666,7 @@ public class IslandManager { if (worldList != IslandWorld.NETHER || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { Bukkit.getScheduler().runTask(this.plugin, () -> { for (Player all : getPlayersAtIsland(island)) { - SWorldBorder.send(all, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.ISLAND).clone().add(increment, 0, increment)); + Nms.getImplementations().getWorldBorder().send(all, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.ISLAND).clone().add(increment, 0, increment)); } }); } @@ -1678,7 +1678,7 @@ public class IslandManager { if (worldList != IslandWorld.NETHER || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { Bukkit.getScheduler().runTask(this.plugin, () -> { for (Player all : getPlayersAtIsland(island)) { - SWorldBorder.send(all, null, 1.4999992E7D, new Location(all.getWorld(), 0, 0, 0)); + Nms.getImplementations().getWorldBorder().send(all, null, 1.4999992E7D, new Location(all.getWorld(), 0, 0, 0)); } }); } diff --git a/src/main/java/com/craftaro/skyblock/menus/Border.java b/src/main/java/com/craftaro/skyblock/menus/Border.java index a40b710d..af16420e 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Border.java +++ b/src/main/java/com/craftaro/skyblock/menus/Border.java @@ -1,8 +1,8 @@ package com.craftaro.skyblock.menus; +import com.craftaro.core.nms.world.NmsWorldBorder; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; -import com.craftaro.core.world.SWorldBorder; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.IslandManager; @@ -82,13 +82,13 @@ public class Border { .equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Word.Blue")))))) { - if (island.getBorderColor() == SWorldBorder.Color.Blue) { + if (island.getBorderColor() == NmsWorldBorder.BorderColor.BLUE) { soundManager.playSound(player, XSound.ENTITY_CHICKEN_EGG); event.setWillClose(false); event.setWillDestroy(false); } else { - island.setBorderColor(SWorldBorder.Color.Blue); + island.setBorderColor(NmsWorldBorder.BorderColor.BLUE); islandManager.updateBorder(island); soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON); @@ -100,13 +100,13 @@ public class Border { .equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Word.Green")))))) { - if (island.getBorderColor() == SWorldBorder.Color.Green) { + if (island.getBorderColor() == NmsWorldBorder.BorderColor.GREEN) { soundManager.playSound(player, XSound.ENTITY_CHICKEN_EGG); event.setWillClose(false); event.setWillDestroy(false); } else { - island.setBorderColor(SWorldBorder.Color.Green); + island.setBorderColor(NmsWorldBorder.BorderColor.GREEN); islandManager.updateBorder(island); soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON); @@ -118,13 +118,13 @@ public class Border { .equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Word.Red")))))) { - if (island.getBorderColor() == SWorldBorder.Color.Red) { + if (island.getBorderColor() == NmsWorldBorder.BorderColor.RED) { soundManager.playSound(player, XSound.ENTITY_CHICKEN_EGG); event.setWillClose(false); event.setWillDestroy(false); } else { - island.setBorderColor(SWorldBorder.Color.Red); + island.setBorderColor(NmsWorldBorder.BorderColor.RED); islandManager.updateBorder(island); soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON); @@ -139,7 +139,7 @@ public class Border { nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(), configLoad.getString("Menu.Border.Item.Exit.Displayname"), null, null, null, null), 0); - SWorldBorder.Color borderColor = island.getBorderColor(); + NmsWorldBorder.BorderColor borderColor = island.getBorderColor(); String borderToggle; if (island.isBorder()) { @@ -152,9 +152,8 @@ public class Border { configLoad.getString("Menu.Border.Item.Toggle.Displayname"), configLoad.getStringList("Menu.Border.Item.Toggle.Lore"), new Placeholder[]{new Placeholder("%toggle", borderToggle)}, null, null), 1); - if (player.hasPermission("fabledskyblock.island.border.blue")) { - if (borderColor == SWorldBorder.Color.Blue) { + if (borderColor == NmsWorldBorder.BorderColor.BLUE) { nInv.addItem(nInv.createItem(XMaterial.LIGHT_BLUE_DYE.parseItem(), configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Word.Blue")), @@ -174,7 +173,7 @@ public class Border { "", null, null, null, null), 2); } if (player.hasPermission("fabledskyblock.island.border.green")) { - if (borderColor == SWorldBorder.Color.Green) { + if (borderColor == NmsWorldBorder.BorderColor.GREEN) { nInv.addItem(nInv.createItem(XMaterial.LIME_DYE.parseItem(), configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Word.Green")), @@ -196,7 +195,7 @@ public class Border { "", null, null, null, null), 3); } if (player.hasPermission("fabledskyblock.island.border.red")) { - if (borderColor == SWorldBorder.Color.Red) { + if (borderColor == NmsWorldBorder.BorderColor.RED) { nInv.addItem(nInv.createItem(XMaterial.RED_DYE.parseItem(), configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Word.Red")),