diff --git a/pom.xml b/pom.xml
index 8967b9b..7941699 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,19 +12,23 @@
PlotSystem
- 21
+ 25
${java-version}
+ 3.15.0
UTF-8
- 1.21.10-R0.1-SNAPSHOT
+ [26.2.build,)
- develop-d213a081ad-1
- 5958727df9
+ develop-cd2ced40b0-1
+ main-36b0421e66-1
- 4.26.1
- 5.3.3
+ 5.2.0
+ 5.8.0
+ 7.0.18
+ 2.10.1
- 1.18.42
+ 1.18.46
+ 2.22.0
@@ -32,7 +36,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.11.0
+ ${maven.compiler.version}
@@ -135,19 +139,19 @@
com.github.BTEUK.Network
api
- ${bteuk.network.version}
+ ${btuk.network.version}
provided
com.github.BTEUK.Network
papercore
- ${bteuk.network.version}
+ ${btuk.network.version}
provided
com.github.BTEUK.BTEUKLib
Minecraft
- ${bteuk.lib.version}
+ ${btuk.lib.version}
@@ -184,13 +188,13 @@
com.sk89q.worldguard
worldguard-bukkit
- 7.0.14
+ ${worldguard.version}
provided
commons-io
commons-io
- 2.20.0
+ ${commons.io.version}
org.mvplugins.multiverse.core
@@ -207,7 +211,7 @@
com.github.decentsoftware-eu
decentholograms
- 2.9.7
+ ${decentholograms.version}
provided
diff --git a/src/main/java/net/bteuk/plotsystem/PlotSystem.java b/src/main/java/net/bteuk/plotsystem/PlotSystem.java
index 9336bb4..9520e7f 100644
--- a/src/main/java/net/bteuk/plotsystem/PlotSystem.java
+++ b/src/main/java/net/bteuk/plotsystem/PlotSystem.java
@@ -4,10 +4,7 @@
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
import lombok.Getter;
-import net.bteuk.minecraft.gui.GuiListener;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.commands.ClaimCommand;
import net.bteuk.plotsystem.commands.LocationCommand;
import net.bteuk.plotsystem.commands.PlotSystemCommand;
@@ -37,6 +34,9 @@
import net.bteuk.plotsystem.utils.PlotHologram;
import net.bteuk.plotsystem.utils.User;
import net.bteuk.plotsystem.utils.plugins.Multiverse;
+import org.btuk.minecraft.gui.GuiListener;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
@@ -115,12 +115,11 @@ public void onEnable() {
// Add save world if it does not yet exist.
// Save world name is in config.
// This implies first launch with plugin.
- if (!Multiverse.hasWorld(CONFIG.getString("save_world"))) {
+ String saveWorld = CONFIG.getString("save_world");
+ if (!Multiverse.hasWorld(saveWorld)) {
// Create save world.
- if (!Multiverse.createVoidWorld(CONFIG.getString("save_world"))) {
-
+ if (!Multiverse.createVoidWorld(saveWorld, CONFIG.getString("save_world_dimension"))) {
LOGGER.warning("Failed to create save world!");
-
}
}
diff --git a/src/main/java/net/bteuk/plotsystem/commands/ClaimCommand.java b/src/main/java/net/bteuk/plotsystem/commands/ClaimCommand.java
index 38b1c36..4d9603b 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/ClaimCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/ClaimCommand.java
@@ -2,10 +2,8 @@
import io.papermc.paper.command.brigadier.BasicCommand;
import io.papermc.paper.command.brigadier.CommandSourceStack;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.gui.ClaimGui;
import net.bteuk.plotsystem.utils.ParseUtils;
@@ -14,6 +12,8 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
diff --git a/src/main/java/net/bteuk/plotsystem/commands/CreateCommand.java b/src/main/java/net/bteuk/plotsystem/commands/CreateCommand.java
index 900aed1..81eac21 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/CreateCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/CreateCommand.java
@@ -1,12 +1,12 @@
package net.bteuk.plotsystem.commands;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.gui.CreatePlotGui;
import net.bteuk.plotsystem.gui.CreateZoneGui;
import net.bteuk.plotsystem.utils.User;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/commands/DeleteCommand.java b/src/main/java/net/bteuk/plotsystem/commands/DeleteCommand.java
index 6299e8e..b9f30c0 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/DeleteCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/DeleteCommand.java
@@ -2,7 +2,7 @@
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.plotsystem.PlotStatus;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.utils.PlotHelper;
@@ -10,7 +10,7 @@
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
-import org.bukkit.Bukkit;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -130,7 +130,7 @@ private void deletePlot(CommandSender sender, String[] args) {
}
// Get world of plot.
- World world = Bukkit.getWorld(plotAPI.getPlotLocation(plotID));
+ World world = WorldUtils.getWorld(plotAPI.getPlotLocation(plotID));
// If world is null then the plot is not on this server.
if (world == null) {
diff --git a/src/main/java/net/bteuk/plotsystem/commands/LocationCommand.java b/src/main/java/net/bteuk/plotsystem/commands/LocationCommand.java
index 0a553f4..df5e35a 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/LocationCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/LocationCommand.java
@@ -7,8 +7,8 @@
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
import net.bteuk.network.api.entity.NetworkLocation;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.network.papercore.LocationAdapter;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.CopyRegionFormat;
import net.bteuk.plotsystem.utils.Utils;
@@ -16,6 +16,7 @@
import net.bteuk.plotsystem.utils.plugins.WorldEditor;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -88,9 +89,9 @@ public void createLocation(CommandSender sender, String[] args) {
int zTransform = -(regionZMin * 512);
// Create the world and add the regions.
- Multiverse.createVoidWorld(commandArguments.location());
+ Multiverse.createVoidWorld(commandArguments.location(), commandArguments.location());
- String saveWorld = PlotSystem.getInstance().getConfig().getString("save_world");
+ String saveWorld = PlotSystem.getInstance().getConfig().getString("save_world_dimension");
if (saveWorld == null) {
sender.sendMessage(ChatUtils.error("The save world is not set in config."));
@@ -98,8 +99,8 @@ public void createLocation(CommandSender sender, String[] args) {
}
// Get worlds.
- World copy = Bukkit.getWorld(saveWorld);
- World paste = Bukkit.getWorld(commandArguments.location());
+ World copy = WorldUtils.getWorld(saveWorld);
+ World paste = WorldUtils.getWorld(commandArguments.location());
// Check that the worlds are not null, else delete the Multiverse world.
if (copy == null || paste == null) {
@@ -129,10 +130,10 @@ public void createLocation(CommandSender sender, String[] args) {
copyRegions(sender, regions);
int coordMin = coordinateAPI.addCoordinate(
- LocationAdapter.adapt(new Location(Bukkit.getWorld(commandArguments.location()), (regionXMin * 512), networkAPI.getMinY(), (regionZMin * 512), 0, 0)));
+ LocationAdapter.adapt(new Location(WorldUtils.getWorld(commandArguments.location()), (regionXMin * 512), networkAPI.getMinY(), (regionZMin * 512), 0, 0)));
int coordMax = coordinateAPI.addCoordinate(LocationAdapter.adapt(
- new Location(Bukkit.getWorld(commandArguments.location()), ((regionXMax * 512) + 511), networkAPI.getMaxY() - 1, ((regionZMax * 512) + 511), 0, 0)));
+ new Location(WorldUtils.getWorld(commandArguments.location()), ((regionXMax * 512) + 511), networkAPI.getMaxY() - 1, ((regionZMax * 512) + 511), 0, 0)));
// Add the location to the database.
if (plotAPI.createLocation(commandArguments.location, commandArguments.location, PlotSystem.SERVER_NAME, coordMin, coordMax, xTransform, zTransform)) {
@@ -211,15 +212,15 @@ public void updateLocation(CommandSender sender, String[] args) {
int zTransform = plotAPI.getZTransform(commandArguments.location());
// Get the worlds.
- String saveWorld = PlotSystem.getInstance().getConfig().getString("save_world");
+ String saveWorld = PlotSystem.getInstance().getConfig().getString("save_world_dimension");
if (saveWorld == null) {
sender.sendMessage(ChatUtils.error("The save world is not set in config."));
return;
}
// Get worlds.
- World copy = Bukkit.getWorld(saveWorld);
- World paste = Bukkit.getWorld(commandArguments.location());
+ World copy = WorldUtils.getWorld(saveWorld);
+ World paste = WorldUtils.getWorld(commandArguments.location());
// Check that the worlds are not null, else delete the Multiverse world.
if (copy == null || paste == null) {
@@ -250,7 +251,7 @@ public void updateLocation(CommandSender sender, String[] args) {
copyRegions(sender, regions);
- World world = Bukkit.getWorld(commandArguments.location());
+ World world = WorldUtils.getWorld(commandArguments.location());
coordinateAPI.updateCoordinate(minCoordinateId, LocationAdapter.adapt(new Location(world, (regionXMin * 512), world.getMinHeight(), (regionZMin * 512), 0, 0)));
coordinateAPI.updateCoordinate(maxCoordinateId,
LocationAdapter.adapt(new Location(world, ((regionXMax * 512) + 511), world.getMaxHeight() - 1, ((regionZMax * 512) + 511), 0, 0)));
@@ -307,14 +308,14 @@ public void deleteLocation(CommandSender sender, String[] args) {
// Teleport all players out of the world, so it can be deleted.
// Get the worlds.
- String saveWorldName = PlotSystem.getInstance().getConfig().getString("save_world");
+ String saveWorldName = PlotSystem.getInstance().getConfig().getString("save_world_dimension");
if (saveWorldName == null) {
sender.sendMessage(ChatUtils.error("The save world is not set in config."));
return;
}
// Get save world.
- World saveWorld = Bukkit.getWorld(saveWorldName);
+ World saveWorld = WorldUtils.getWorld(saveWorldName);
teleportPlayersFromLocation(args[2], saveWorld);
@@ -371,6 +372,9 @@ private static CommandArguments parseCommandArguments(CommandSender sender, Stri
return null;
}
+ // Ensure the location name is lowercase.
+ args[2] = args[2].toLowerCase();
+
return new CommandArguments(args[2], xmin, ymin, zmin, xmax, ymax, zmax);
}
@@ -449,7 +453,7 @@ private void teleportToLocation(CommandSender sender, String location, int coord
double z = ((coordinateAPI.getZ(coordMax) + coordinateAPI.getZ(coordMin)) / 2) + plotAPI.getZTransform(location);
// Teleport to the location.
- World world = Bukkit.getWorld(location);
+ World world = WorldUtils.getWorld(location);
double y = 64;
if (world != null) {
@@ -474,7 +478,7 @@ private void teleportPlayersFromLocation(String location, World saveWorld) {
// Teleport all players away from the location.
Location teleportLocation = new Location(saveWorld, x, Utils.getHighestYAt(saveWorld, (int) x, (int) z), z);
PlotSystem.getInstance().getServer().getOnlinePlayers().forEach(player -> {
- if (player.getWorld().getName().equals(location)) {
+ if (player.getWorld().key().asMinimalString().equals(location)) {
player.teleport(teleportLocation);
player.sendMessage(ChatUtils.success("Teleported to save world, location %s is being deleted.", location));
}
diff --git a/src/main/java/net/bteuk/plotsystem/commands/PlotSystemCommand.java b/src/main/java/net/bteuk/plotsystem/commands/PlotSystemCommand.java
index 72d8f16..949606b 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/PlotSystemCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/PlotSystemCommand.java
@@ -2,12 +2,11 @@
import io.papermc.paper.command.brigadier.BasicCommand;
import io.papermc.paper.command.brigadier.CommandSourceStack;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.CoordinateAPI;
import net.bteuk.network.api.EventAPI;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.network.papercore.LocationAdapter;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.utils.ParseUtils;
@@ -17,7 +16,8 @@
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
-import org.bukkit.Bukkit;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@@ -226,7 +226,7 @@ public void updateFlags(CommandSender sender, String[] args) {
return;
}
- World world = Bukkit.getWorld(args[1]);
+ World world = WorldUtils.getWorld(args[1]);
if (world == null) {
sender.sendMessage(ChatUtils.error("Location " + args[1] + " does not exist on this server."));
diff --git a/src/main/java/net/bteuk/plotsystem/commands/ResetCommand.java b/src/main/java/net/bteuk/plotsystem/commands/ResetCommand.java
index c684b3d..204f1d4 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/ResetCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/ResetCommand.java
@@ -1,13 +1,13 @@
package net.bteuk.plotsystem.commands;
-import net.bteuk.minecraft.component.ComponentUtils;
import net.bteuk.network.api.EventAPI;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.User;
import net.kyori.adventure.text.Component;
-import org.bukkit.Bukkit;
+import org.btuk.minecraft.component.ComponentUtils;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -103,7 +103,7 @@ private void resetPlot(CommandSender sender, String[] args) {
}
// Get world of plot.
- World world = Bukkit.getWorld(plotAPI.getPlotLocation(plotID));
+ World world = WorldUtils.getWorld(plotAPI.getPlotLocation(plotID));
// If world is null then the plot is not on this server.
if (world == null) {
diff --git a/src/main/java/net/bteuk/plotsystem/commands/ReviewCommand.java b/src/main/java/net/bteuk/plotsystem/commands/ReviewCommand.java
index fe32ee3..90092f2 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/ReviewCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/ReviewCommand.java
@@ -4,9 +4,9 @@
import io.papermc.paper.command.brigadier.CommandSourceStack;
import net.bteuk.network.api.plotsystem.ReviewCategory;
import net.bteuk.network.api.plotsystem.ReviewSelection;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.User;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
diff --git a/src/main/java/net/bteuk/plotsystem/commands/ToggleOutlines.java b/src/main/java/net/bteuk/plotsystem/commands/ToggleOutlines.java
index b2c7c63..b7551ea 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/ToggleOutlines.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/ToggleOutlines.java
@@ -3,9 +3,9 @@
import io.papermc.paper.command.brigadier.BasicCommand;
import io.papermc.paper.command.brigadier.CommandSourceStack;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.User;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
diff --git a/src/main/java/net/bteuk/plotsystem/commands/UpdateCommand.java b/src/main/java/net/bteuk/plotsystem/commands/UpdateCommand.java
index 73c466d..0502456 100644
--- a/src/main/java/net/bteuk/plotsystem/commands/UpdateCommand.java
+++ b/src/main/java/net/bteuk/plotsystem/commands/UpdateCommand.java
@@ -1,10 +1,10 @@
package net.bteuk.plotsystem.commands;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.enums.PlotDifficulties;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.kyori.adventure.text.Component;
+import org.btuk.network.lib.enums.PlotDifficulties;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/events/ClaimEvent.java b/src/main/java/net/bteuk/plotsystem/events/ClaimEvent.java
index b7cb31c..74ec016 100644
--- a/src/main/java/net/bteuk/plotsystem/events/ClaimEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/ClaimEvent.java
@@ -1,15 +1,15 @@
package net.bteuk.plotsystem.events;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.commands.ClaimCommand;
import net.bteuk.plotsystem.gui.ClaimGui;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.bteuk.plotsystem.utils.User;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/events/CloseEvent.java b/src/main/java/net/bteuk/plotsystem/events/CloseEvent.java
index ad20bf5..2d9ca51 100644
--- a/src/main/java/net/bteuk/plotsystem/events/CloseEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/CloseEvent.java
@@ -4,13 +4,14 @@
import net.bteuk.network.api.ChatAPI;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
import net.bteuk.plotsystem.utils.plugins.WorldEditor;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
@@ -50,14 +51,14 @@ public void event(String uuid, String[] event, String message) {
if (PlotSystem.SERVER_NAME.equals(zoneServer)) {
// Get worlds of plot and save location.
- String save_world = config.getString("save_world");
+ String save_world = config.getString("save_world_dimension");
if (save_world == null) {
LOGGER.warning("Save World is not defined in config, plot delete event has therefore failed!");
return;
}
- World copyWorld = Bukkit.getWorld(location);
- World pasteWorld = Bukkit.getWorld(save_world);
+ World copyWorld = WorldUtils.getWorld(location);
+ World pasteWorld = WorldUtils.getWorld(save_world);
assert (copyWorld != null);
diff --git a/src/main/java/net/bteuk/plotsystem/events/DeleteEvent.java b/src/main/java/net/bteuk/plotsystem/events/DeleteEvent.java
index f043de6..c89bdbf 100644
--- a/src/main/java/net/bteuk/plotsystem/events/DeleteEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/DeleteEvent.java
@@ -5,9 +5,7 @@
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
import net.bteuk.network.api.plotsystem.PlotStatus;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.dto.PlotMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
@@ -16,6 +14,9 @@
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.dto.PlotMessage;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
@@ -53,15 +54,15 @@ public void event(String uuid, String[] event, String message) {
String location = plotAPI.getPlotLocation(id);
// Get worlds of plot and save location.
- String save_world = PlotSystem.getInstance().getConfig().getString("save_world");
+ String save_world = PlotSystem.getInstance().getConfig().getString("save_world_dimension");
if (save_world == null) {
LOGGER.warning("Save World is not defined in config, plot delete event has therefore failed!");
return;
}
- World copyWorld = Bukkit.getWorld(save_world);
+ World copyWorld = WorldUtils.getWorld(save_world);
// Location name is the same as the world name.
- World pasteWorld = Bukkit.getWorld(location);
+ World pasteWorld = WorldUtils.getWorld(location);
if (copyWorld == null || pasteWorld == null) {
@@ -150,15 +151,15 @@ public void event(String uuid, String[] event, String message) {
String location = plotAPI.getZoneLocation(id);
// Get worlds of plot and save location.
- String save_world = PlotSystem.getInstance().getConfig().getString("save_world");
+ String save_world = PlotSystem.getInstance().getConfig().getString("save_world_dimension");
if (save_world == null) {
LOGGER.warning("Save World is not defined in config, plot delete event has therefore failed!");
return;
}
- World copyWorld = Bukkit.getWorld(save_world);
+ World copyWorld = WorldUtils.getWorld(save_world);
// Location name is the same as the world name.
- World pasteWorld = Bukkit.getWorld(location);
+ World pasteWorld = WorldUtils.getWorld(location);
if (copyWorld == null || pasteWorld == null) {
diff --git a/src/main/java/net/bteuk/plotsystem/events/JoinEvent.java b/src/main/java/net/bteuk/plotsystem/events/JoinEvent.java
index 5ed94b3..cbc0457 100644
--- a/src/main/java/net/bteuk/plotsystem/events/JoinEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/JoinEvent.java
@@ -4,14 +4,15 @@
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
import net.bteuk.network.api.entity.Event;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -59,7 +60,7 @@ public void event(String uuid, String[] event, String sMessage) {
// Add the player to the worldguard region.
try {
- WorldGuardFunctions.addMember(String.valueOf(id), uuid, Bukkit.getWorld(plotAPI.getPlotLocation(id)));
+ WorldGuardFunctions.addMember(String.valueOf(id), uuid, WorldUtils.getWorld(plotAPI.getPlotLocation(id)));
} catch (RegionManagerNotFoundException | RegionNotFoundException e) {
DirectMessage directMessage = new DirectMessage("global", uuid, "server",
@@ -98,7 +99,7 @@ public void event(String uuid, String[] event, String sMessage) {
// Add the player to the worldguard region.
try {
- WorldGuardFunctions.addMember("z" + id, uuid, Bukkit.getWorld(plotAPI.getZoneLocation(id)));
+ WorldGuardFunctions.addMember("z" + id, uuid, WorldUtils.getWorld(plotAPI.getZoneLocation(id)));
} catch (RegionManagerNotFoundException | RegionNotFoundException e) {
DirectMessage directMessage = new DirectMessage("global", uuid, "server",
ChatUtils.error("An error occurred while adding you to the zone, please contact an administrator."), false);
diff --git a/src/main/java/net/bteuk/plotsystem/events/LeaveEvent.java b/src/main/java/net/bteuk/plotsystem/events/LeaveEvent.java
index d9abed5..a68b562 100644
--- a/src/main/java/net/bteuk/plotsystem/events/LeaveEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/LeaveEvent.java
@@ -3,12 +3,13 @@
import net.bteuk.network.api.ChatAPI;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
@@ -41,7 +42,7 @@ public void event(String uuid, String[] event, String message) {
int id = Integer.parseInt(event[2]);
// Get worlds of plot.
- World world = Bukkit.getWorld(plotAPI.getPlotLocation(id));
+ World world = WorldUtils.getWorld(plotAPI.getPlotLocation(id));
if (world == null) {
@@ -83,7 +84,7 @@ public void event(String uuid, String[] event, String message) {
int id = Integer.parseInt(event[2]);
// Get worlds of plot.
- World world = Bukkit.getWorld(plotAPI.getZoneLocation(id));
+ World world = WorldUtils.getWorld(plotAPI.getZoneLocation(id));
if (world == null) {
diff --git a/src/main/java/net/bteuk/plotsystem/events/OutlinesEvent.java b/src/main/java/net/bteuk/plotsystem/events/OutlinesEvent.java
index 63a91c4..055d8d3 100644
--- a/src/main/java/net/bteuk/plotsystem/events/OutlinesEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/OutlinesEvent.java
@@ -2,9 +2,9 @@
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.User;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/events/PlotsystemKickEvent.java b/src/main/java/net/bteuk/plotsystem/events/PlotsystemKickEvent.java
index bdd503f..8aa7dd9 100644
--- a/src/main/java/net/bteuk/plotsystem/events/PlotsystemKickEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/PlotsystemKickEvent.java
@@ -4,13 +4,13 @@
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
import net.bteuk.network.api.entity.Event;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
-import org.bukkit.Bukkit;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.utils.ChatUtils;
public class PlotsystemKickEvent implements Event {
@@ -45,7 +45,7 @@ public void event(String uuid, String[] event, String message) {
// Remove the player to the worldguard region.
try {
- WorldGuardFunctions.removeMember(String.valueOf(id), uuid, Bukkit.getWorld(plotAPI.getPlotLocation(id)));
+ WorldGuardFunctions.removeMember(String.valueOf(id), uuid, WorldUtils.getWorld(plotAPI.getPlotLocation(id)));
} catch (RegionManagerNotFoundException | RegionNotFoundException e) {
DirectMessage directMessage = new DirectMessage("global", ownerId, "server",
ChatUtils.error("An error occurred while trying to kick the user from the plot, please contact an administrator."), false);
@@ -79,7 +79,7 @@ public void event(String uuid, String[] event, String message) {
// Remove the player to the worldguard region.
try {
- WorldGuardFunctions.removeMember("z" + event[2], uuid, Bukkit.getWorld(plotAPI.getZoneLocation(id)));
+ WorldGuardFunctions.removeMember("z" + event[2], uuid, WorldUtils.getWorld(plotAPI.getZoneLocation(id)));
} catch (RegionManagerNotFoundException | RegionNotFoundException e) {
DirectMessage directMessage = new DirectMessage("global", ownerId, "server",
ChatUtils.error("An error occurred while trying to kick the user from the zone, please contact an administrator."), false);
diff --git a/src/main/java/net/bteuk/plotsystem/events/PlotsystemTeleportEvent.java b/src/main/java/net/bteuk/plotsystem/events/PlotsystemTeleportEvent.java
index 3c69e28..2f43990 100644
--- a/src/main/java/net/bteuk/plotsystem/events/PlotsystemTeleportEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/PlotsystemTeleportEvent.java
@@ -6,13 +6,14 @@
import net.bteuk.network.api.ServerAPI;
import net.bteuk.network.api.entity.Event;
import net.bteuk.network.api.plotsystem.PlotStatus;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.network.papercore.PlayerAdapter;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
import net.bteuk.plotsystem.utils.Utils;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import org.apache.commons.lang3.StringUtils;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -64,7 +65,7 @@ public void event(String uuid, String[] event, String message) {
if (StringUtils.equals(server, SERVER_NAME)) {
// Get world of plot.
- World world = Bukkit.getWorld(location);
+ World world = WorldUtils.getWorld(location);
if (world == null) {
player.sendMessage(ChatUtils.error("An error occurred while teleporting to plot %s", String.valueOf(id)));
@@ -141,7 +142,7 @@ public void event(String uuid, String[] event, String message) {
if (server.equals(SERVER_NAME)) {
// Get world of zone.
- World world = Bukkit.getWorld(location);
+ World world = WorldUtils.getWorld(location);
// Get location of zone and teleport the player there.
try {
diff --git a/src/main/java/net/bteuk/plotsystem/events/RetractEvent.java b/src/main/java/net/bteuk/plotsystem/events/RetractEvent.java
index 0066157..aab013d 100644
--- a/src/main/java/net/bteuk/plotsystem/events/RetractEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/RetractEvent.java
@@ -4,11 +4,11 @@
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
import net.bteuk.network.api.plotsystem.PlotStatus;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.dto.PlotMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.kyori.adventure.text.Component;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.dto.PlotMessage;
+import org.btuk.network.lib.utils.ChatUtils;
public class RetractEvent implements Event {
diff --git a/src/main/java/net/bteuk/plotsystem/events/ReviewEvent.java b/src/main/java/net/bteuk/plotsystem/events/ReviewEvent.java
index c915cab..d0c4539 100644
--- a/src/main/java/net/bteuk/plotsystem/events/ReviewEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/ReviewEvent.java
@@ -1,12 +1,11 @@
package net.bteuk.plotsystem.events;
import io.papermc.lib.PaperLib;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
import net.bteuk.network.api.plotsystem.SubmittedStatus;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
@@ -15,6 +14,8 @@
import net.bteuk.plotsystem.utils.User;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -71,7 +72,7 @@ public void event(String uuid, String[] event, String message) {
// Get world of plot.
String location = plotAPI.getPlotLocation(id);
- World world = Bukkit.getWorld(location);
+ World world = WorldUtils.getWorld(location);
// Check if the plot is still submitted.
if (plotAPI.getPlotSubmissionStatus(id) == SubmittedStatus.SUBMITTED) {
diff --git a/src/main/java/net/bteuk/plotsystem/events/SubmitEvent.java b/src/main/java/net/bteuk/plotsystem/events/SubmitEvent.java
index ce93c18..12caf68 100644
--- a/src/main/java/net/bteuk/plotsystem/events/SubmitEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/SubmitEvent.java
@@ -5,12 +5,12 @@
import net.bteuk.network.api.SQLAPI;
import net.bteuk.network.api.entity.Event;
import net.bteuk.network.api.plotsystem.PlotStatus;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.dto.PlotMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.kyori.adventure.text.Component;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.dto.PlotMessage;
+import org.btuk.network.lib.utils.ChatUtils;
public class SubmitEvent implements Event {
diff --git a/src/main/java/net/bteuk/plotsystem/events/VerifyEvent.java b/src/main/java/net/bteuk/plotsystem/events/VerifyEvent.java
index f20f632..80190cc 100644
--- a/src/main/java/net/bteuk/plotsystem/events/VerifyEvent.java
+++ b/src/main/java/net/bteuk/plotsystem/events/VerifyEvent.java
@@ -1,12 +1,11 @@
package net.bteuk.plotsystem.events;
import io.papermc.lib.PaperLib;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.entity.Event;
import net.bteuk.network.api.plotsystem.SubmittedStatus;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
@@ -15,6 +14,8 @@
import net.bteuk.plotsystem.utils.User;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -70,7 +71,7 @@ public void event(String uuid, String[] event, String message) {
int id = Integer.parseInt(event[2]);
// Get world of plot.
- World world = Bukkit.getWorld(plotAPI.getPlotLocation(id));
+ World world = WorldUtils.getWorld(plotAPI.getPlotLocation(id));
// Check if the plot is still awaiting verification.
if (plotAPI.getPlotSubmissionStatus(id) == SubmittedStatus.AWAITING_VERIFICATION) {
diff --git a/src/main/java/net/bteuk/plotsystem/gui/ClaimGui.java b/src/main/java/net/bteuk/plotsystem/gui/ClaimGui.java
index c2e3dfd..cc195ba 100644
--- a/src/main/java/net/bteuk/plotsystem/gui/ClaimGui.java
+++ b/src/main/java/net/bteuk/plotsystem/gui/ClaimGui.java
@@ -1,10 +1,7 @@
package net.bteuk.plotsystem.gui;
-import net.bteuk.minecraft.gui.Gui;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.plotsystem.PlotStatus;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
import net.bteuk.plotsystem.utils.PlotHelper;
@@ -17,6 +14,9 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.minecraft.gui.Gui;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/gui/CreatePlotGui.java b/src/main/java/net/bteuk/plotsystem/gui/CreatePlotGui.java
index e7d5429..b21db6a 100644
--- a/src/main/java/net/bteuk/plotsystem/gui/CreatePlotGui.java
+++ b/src/main/java/net/bteuk/plotsystem/gui/CreatePlotGui.java
@@ -1,8 +1,5 @@
package net.bteuk.plotsystem.gui;
-import net.bteuk.minecraft.gui.Gui;
-import net.bteuk.minecraft.gui.GuiManager;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.PlotValues;
import net.bteuk.plotsystem.utils.User;
@@ -10,6 +7,9 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
+import org.btuk.minecraft.gui.Gui;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/gui/CreateZoneGui.java b/src/main/java/net/bteuk/plotsystem/gui/CreateZoneGui.java
index 45def70..520e452 100644
--- a/src/main/java/net/bteuk/plotsystem/gui/CreateZoneGui.java
+++ b/src/main/java/net/bteuk/plotsystem/gui/CreateZoneGui.java
@@ -1,13 +1,13 @@
package net.bteuk.plotsystem.gui;
-import net.bteuk.minecraft.gui.Gui;
-import net.bteuk.minecraft.gui.GuiManager;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.utils.User;
import net.bteuk.plotsystem.utils.Utils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
+import org.btuk.minecraft.gui.Gui;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/listeners/ClaimEnter.java b/src/main/java/net/bteuk/plotsystem/listeners/ClaimEnter.java
index 804784c..7f9f23b 100644
--- a/src/main/java/net/bteuk/plotsystem/listeners/ClaimEnter.java
+++ b/src/main/java/net/bteuk/plotsystem/listeners/ClaimEnter.java
@@ -8,11 +8,11 @@
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.User;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
diff --git a/src/main/java/net/bteuk/plotsystem/listeners/PlayerInteract.java b/src/main/java/net/bteuk/plotsystem/listeners/PlayerInteract.java
index f5f9d0e..905d748 100644
--- a/src/main/java/net/bteuk/plotsystem/listeners/PlayerInteract.java
+++ b/src/main/java/net/bteuk/plotsystem/listeners/PlayerInteract.java
@@ -1,13 +1,13 @@
package net.bteuk.plotsystem.listeners;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.utils.User;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -57,7 +57,7 @@ public void interactEvent(PlayerInteractEvent e) {
e.setCancelled(true);
// Check if they are in a world where plots are allowed to be created.
- if (!plotAPI.hasLocation(Objects.requireNonNull(e.getClickedBlock()).getWorld().getName())) {
+ if (!plotAPI.hasLocation(Objects.requireNonNull(e.getClickedBlock()).getWorld().key().asMinimalString())) {
u.player.sendMessage(ChatUtils.error("You can't create plots in this world!"));
return;
}
@@ -77,7 +77,7 @@ public void interactEvent(PlayerInteractEvent e) {
}
// Passed the checks, start a new selection at the clicked block.
- u.selectionTool.startSelection(e.getClickedBlock(), e.getClickedBlock().getWorld().getName());
+ u.selectionTool.startSelection(e.getClickedBlock(), e.getClickedBlock().getWorld().key().asMinimalString());
u.player.sendMessage(ChatUtils.success("Started a new selection at ")
.append(Component.text(e.getClickedBlock().getX(), NamedTextColor.DARK_AQUA))
.append(ChatUtils.success(", "))
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/PreviousFeedbackGui.java b/src/main/java/net/bteuk/plotsystem/reviewing/PreviousFeedbackGui.java
index 7b4aae6..929b44b 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/PreviousFeedbackGui.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/PreviousFeedbackGui.java
@@ -1,16 +1,16 @@
package net.bteuk.plotsystem.reviewing;
-import net.bteuk.minecraft.gui.Gui;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
import net.bteuk.network.api.plotsystem.ReviewFeedback;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.utils.User;
import net.bteuk.plotsystem.utils.Utils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
+import org.btuk.minecraft.gui.Gui;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/Review.java b/src/main/java/net/bteuk/plotsystem/reviewing/Review.java
index 6dcb3f5..e7f9f1e 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/Review.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/Review.java
@@ -1,12 +1,8 @@
package net.bteuk.plotsystem.reviewing;
import lombok.Getter;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.plotsystem.SubmittedStatus;
-import net.bteuk.network.lib.dto.PlotMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
-import net.bteuk.network.lib.utils.Reviewing;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
@@ -15,6 +11,10 @@
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.dto.PlotMessage;
+import org.btuk.network.lib.utils.ChatUtils;
+import org.btuk.network.lib.utils.Reviewing;
import static net.bteuk.plotsystem.utils.Config.CONFIG;
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewAction.java b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewAction.java
index a12017c..f07e487 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewAction.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewAction.java
@@ -2,8 +2,6 @@
import com.sk89q.worldedit.math.BlockVector2;
import lombok.Getter;
-import net.bteuk.minecraft.gui.Gui;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.ChatAPI;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
@@ -11,12 +9,10 @@
import net.bteuk.network.api.SQLAPI;
import net.bteuk.network.api.entity.Role;
import net.bteuk.network.api.plotsystem.PlotStatus;
+import net.bteuk.network.api.plotsystem.PromotionRoles;
import net.bteuk.network.api.plotsystem.ReviewCategory;
import net.bteuk.network.api.plotsystem.ReviewSelection;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.dto.DiscordDirectMessage;
-import net.bteuk.network.lib.enums.PlotDifficulties;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
@@ -28,6 +24,12 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.minecraft.gui.Gui;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.dto.DiscordDirectMessage;
+import org.btuk.network.lib.enums.PlotDifficulties;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -81,7 +83,7 @@ public ReviewAction(PlotSystem instance, int plotID, User user, NetworkAPI netwo
this.roleAPI = networkAPI.getRoleAPI();
// Get the plot world.
- this.plotWorld = Bukkit.getWorld(plotAPI.getPlotLocation(plotID));
+ this.plotWorld = WorldUtils.getWorld(plotAPI.getPlotLocation(plotID));
// Get the plot owner.
this.plotOwner = plotAPI.getPlotOwner(plotID);
@@ -92,7 +94,7 @@ public ReviewAction(PlotSystem instance, int plotID, User user, NetworkAPI netwo
user.player.getInventory().clear();
// Set up the hotbar for the reviewer.
- hotbarListener = new ReviewHotbar(PlotSystem.getInstance(), user);
+ hotbarListener = new ReviewHotbar(PlotSystem.getInstance(), user, networkAPI.getTimerAPI());
// Create the review book.
reviewBook = new ReviewBook(instance, user.player, hotbarListener, plotAPI);
@@ -106,28 +108,6 @@ public ReviewAction(PlotSystem instance, int plotID, User user, NetworkAPI netwo
}
}
- private static String getNewRole(int difficulty, String role) {
- String newRole = null;
- switch (difficulty) {
- case 1 -> {
- if (role.equals("applicant")) {
- newRole = "apprentice";
- }
- }
- case 2 -> {
- if (role.equals("applicant") || role.equals("apprentice")) {
- newRole = "jrbuilder";
- }
- }
- case 3 -> {
- if (role.equals("applicant") || role.equals("apprentice") || role.equals("jrbuilder")) {
- newRole = "builder";
- }
- }
- }
- return newRole;
- }
-
public abstract Gui getReviewActionGui();
protected abstract void notifyReviewers();
@@ -288,7 +268,7 @@ private boolean canSave(boolean accept) {
protected void completeReview(boolean accept) {
// Get world of plot.
- World world = Bukkit.getWorld(plotAPI.getPlotLocation(plotID));
+ World world = WorldUtils.getWorld(plotAPI.getPlotLocation(plotID));
if (world == null) {
LOGGER.warning("World of the plot is null!");
return;
@@ -363,21 +343,21 @@ private void denyPlot(World plotWorld) {
private void savePlot(World plotWorld) {
// Get the save-world.
- String save_world = PlotSystem.getInstance().getConfig().getString("save_world");
+ String save_world = PlotSystem.getInstance().getConfig().getString("save_world_dimension");
if (save_world == null) {
LOGGER.warning("Save world is not set in config!");
return;
}
- World saveWorld = Bukkit.getWorld(save_world);
+ World saveWorld = WorldUtils.getWorld(save_world);
if (saveWorld == null) {
LOGGER.warning("Save world is null!");
return;
}
// Get the negative coordinate transform.
- int xTransform = -plotAPI.getXTransform(plotWorld.getName());
- int zTransform = -plotAPI.getZTransform(plotWorld.getName());
+ int xTransform = -plotAPI.getXTransform(plotWorld.key().asMinimalString());
+ int zTransform = -plotAPI.getZTransform(plotWorld.key().asMinimalString());
List copyVector;
@@ -408,7 +388,7 @@ private void updateRole() {
LOGGER.info(String.format("Plot owner %s has builder role %s", plotOwner, builderRole));
// Calculate the role the player will be promoted to, if any.
- String newRole = getNewRole(difficulty, builderRole);
+ String newRole = PromotionRoles.getNewRole(difficulty, builderRole);
if (newRole != null) {
Role role = roleAPI.getRoles().stream().filter(r -> r.getId().equals(newRole)).findFirst().orElse(null);
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewActionGui.java b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewActionGui.java
index 800868f..36920c4 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewActionGui.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewActionGui.java
@@ -1,12 +1,12 @@
package net.bteuk.plotsystem.reviewing;
-import net.bteuk.minecraft.gui.Gui;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.utils.Utils;
import net.kyori.adventure.text.Component;
+import org.btuk.minecraft.gui.Gui;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Material;
public abstract class ReviewActionGui extends Gui {
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewBook.java b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewBook.java
index b72bbb5..f8b5038 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewBook.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewBook.java
@@ -4,7 +4,6 @@
import net.bteuk.network.api.plotsystem.ReviewCategory;
import net.bteuk.network.api.plotsystem.ReviewCategoryFeedback;
import net.bteuk.network.api.plotsystem.ReviewSelection;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.kyori.adventure.inventory.Book;
import net.kyori.adventure.text.Component;
@@ -13,6 +12,7 @@
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextDecoration;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewGui.java b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewGui.java
index ab0b0f6..7453c2b 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewGui.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewGui.java
@@ -1,13 +1,13 @@
package net.bteuk.plotsystem.reviewing;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.utils.Utils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Material;
public class ReviewGui extends ReviewActionGui {
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewHotbar.java b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewHotbar.java
index 64d2314..20e6bf7 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/ReviewHotbar.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/ReviewHotbar.java
@@ -1,9 +1,10 @@
package net.bteuk.plotsystem.reviewing;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.api.TimerAPI;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.User;
import net.bteuk.plotsystem.utils.Utils;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
@@ -19,8 +20,8 @@
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.ItemStack;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
import static net.bteuk.plotsystem.PlotSystem.LOGGER;
@@ -35,9 +36,12 @@ public class ReviewHotbar implements Listener {
// Review gui item.
private final ItemStack reviewGui;
- private final List requiredItems = new ArrayList<>();
+ private final Map requiredItems = new HashMap<>();
- public ReviewHotbar(PlotSystem instance, User user) {
+ private final TimerAPI timerApi;
+ private final int timerId;
+
+ public ReviewHotbar(PlotSystem instance, User user, TimerAPI timerApi) {
// Set plotsystem.
this.instance = instance;
@@ -45,6 +49,9 @@ public ReviewHotbar(PlotSystem instance, User user) {
// Set user.
this.user = user;
+ // Set timer api.
+ this.timerApi = timerApi;
+
// Create the review gui item.
reviewGui = Utils.createItem(Material.EMERALD, 1, ChatUtils.title("Review Menu"), ChatUtils.line("Click to open review menu."));
@@ -53,13 +60,19 @@ public ReviewHotbar(PlotSystem instance, User user) {
// Register listeners.
Bukkit.getServer().getPluginManager().registerEvents(this, instance);
+ // Register a timer to check if the required items are still in the inventory.
+ timerId = timerApi.registerTimer(() -> {
+ for (Map.Entry entry : requiredItems.entrySet()) {
+ if (!entry.getValue().equals(user.player.getInventory().getItem(entry.getKey()))) {
+ user.player.getInventory().setItem(entry.getKey(), entry.getValue());
+ }
+ }
+ }, 1000L);
+
}
public void setReviewBookSlot(ItemStack itemStack) {
- if (requiredItems.size() > 1) {
- requiredItems.remove(1);
- }
- requiredItems.add(1, itemStack);
+ requiredItems.put(1, itemStack);
user.player.getInventory().setItem(1, itemStack);
}
@@ -73,6 +86,9 @@ public void unregister() {
PlayerDropItemEvent.getHandlerList().unregister(this);
PlayerSwapHandItemsEvent.getHandlerList().unregister(this);
+ // Unregister timer.
+ timerApi.cancelTimer(timerId);
+
//Send feedback in the console.
LOGGER.info("Reset reviewing hotbar and unregistered listeners");
}
@@ -125,11 +141,11 @@ public void dragItem(InventoryDragEvent e) {
private boolean cancelEvent(HumanEntity humanEntity, ItemStack item) {
// Check if player is the reviewer and the item is one of the required items.
- return item != null && (user.player.equals(humanEntity) && requiredItems.stream().anyMatch(item::equals));
+ return item != null && (user.player.equals(humanEntity) && requiredItems.containsValue(item));
}
private void initReviewItems() {
- requiredItems.add(reviewGui);
+ requiredItems.put(0, reviewGui);
// Set the hotbar items in the player's inventory.
user.player.getInventory().setItem(0, reviewGui);
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/Verification.java b/src/main/java/net/bteuk/plotsystem/reviewing/Verification.java
index d228056..b120708 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/Verification.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/Verification.java
@@ -2,19 +2,19 @@
import lombok.Getter;
import lombok.Setter;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.plotsystem.ReviewCategory;
import net.bteuk.network.api.plotsystem.ReviewCategoryFeedback;
import net.bteuk.network.api.plotsystem.ReviewSelection;
import net.bteuk.network.api.plotsystem.SubmittedStatus;
-import net.bteuk.network.lib.dto.PlotMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.bteuk.plotsystem.utils.User;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.dto.PlotMessage;
+import org.btuk.network.lib.utils.ChatUtils;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/net/bteuk/plotsystem/reviewing/VerificationGui.java b/src/main/java/net/bteuk/plotsystem/reviewing/VerificationGui.java
index cd61ba7..ca57929 100644
--- a/src/main/java/net/bteuk/plotsystem/reviewing/VerificationGui.java
+++ b/src/main/java/net/bteuk/plotsystem/reviewing/VerificationGui.java
@@ -1,13 +1,13 @@
package net.bteuk.plotsystem.reviewing;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.SQLAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.utils.Utils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
+import org.btuk.minecraft.gui.GuiManager;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
diff --git a/src/main/java/net/bteuk/plotsystem/utils/Inactive.java b/src/main/java/net/bteuk/plotsystem/utils/Inactive.java
index d51abf7..9328f20 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/Inactive.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/Inactive.java
@@ -3,14 +3,15 @@
import com.sk89q.worldedit.math.BlockVector2;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.plotsystem.PlotStatus;
-import net.bteuk.network.lib.dto.DirectMessage;
-import net.bteuk.network.lib.dto.DiscordDirectMessage;
-import net.bteuk.network.lib.utils.ChatUtils;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
import net.bteuk.plotsystem.exceptions.RegionNotFoundException;
import net.bteuk.plotsystem.utils.plugins.WorldEditor;
import net.bteuk.plotsystem.utils.plugins.WorldGuardFunctions;
+import org.btuk.network.lib.dto.DirectMessage;
+import org.btuk.network.lib.dto.DiscordDirectMessage;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
@@ -76,14 +77,14 @@ public static void cancelInactivePlots(NetworkAPI networkAPI, PlotHelper plotHel
String location = networkAPI.getPlotAPI().getPlotLocation(plot);
// Get worlds of plot and save location.
- String save_world = config.getString("save_world");
+ String save_world = config.getString("save_world_dimension");
if (save_world == null) {
LOGGER.warning("Save World is not defined in config, plot delete event has therefore failed!");
continue;
}
- World copyWorld = Bukkit.getWorld(save_world);
- World pasteWorld = Bukkit.getWorld(location);
+ World copyWorld = WorldUtils.getWorld(save_world);
+ World pasteWorld = WorldUtils.getWorld(location);
int minusXTransform = -networkAPI.getPlotAPI().getXTransform(location);
int minusZTransform = -networkAPI.getPlotAPI().getZTransform(location);
@@ -162,14 +163,14 @@ public static void closeExpiredZones(NetworkAPI networkAPI) {
String location = networkAPI.getPlotAPI().getZoneLocation(zone);
// Get worlds of plot and save location.
- String save_world = config.getString("save_world");
+ String save_world = config.getString("save_world_dimension");
if (save_world == null) {
LOGGER.warning("Save World is not defined in config, plot delete event has therefore failed!");
continue;
}
- World copyWorld = Bukkit.getWorld(location);
- World pasteWorld = Bukkit.getWorld(save_world);
+ World copyWorld = WorldUtils.getWorld(location);
+ World pasteWorld = WorldUtils.getWorld(save_world);
int minusXTransform = -networkAPI.getPlotAPI().getXTransform(location);
int minusZTransform = -networkAPI.getPlotAPI().getZTransform(location);
diff --git a/src/main/java/net/bteuk/plotsystem/utils/Outlines.java b/src/main/java/net/bteuk/plotsystem/utils/Outlines.java
index e1833af..bc3c1ff 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/Outlines.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/Outlines.java
@@ -16,7 +16,6 @@
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -122,7 +121,7 @@ public void addNearbyOutlines(User user, PlotAPI plotAPI) {
Player player = user.player;
// On single server setup, we do not want to show the WG outlines if not on a plot world.
- if (singleServer && !plotAPI.hasLocation(player.getWorld().getName()))
+ if (singleServer && !plotAPI.hasLocation(player.getWorld().key().asMinimalString()))
return;
// If the player does not have a key, add it.
diff --git a/src/main/java/net/bteuk/plotsystem/utils/PlotHelper.java b/src/main/java/net/bteuk/plotsystem/utils/PlotHelper.java
index 7e9516a..ee0f8ba 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/PlotHelper.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/PlotHelper.java
@@ -6,8 +6,8 @@
import net.bteuk.network.api.plotsystem.ReviewCategory;
import net.bteuk.network.api.plotsystem.ReviewSelection;
import net.bteuk.network.api.plotsystem.SubmittedStatus;
-import net.bteuk.network.lib.enums.PlotDifficulties;
import net.bteuk.plotsystem.PlotSystem;
+import org.btuk.network.lib.enums.PlotDifficulties;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/utils/PlotHologram.java b/src/main/java/net/bteuk/plotsystem/utils/PlotHologram.java
index 07a203f..1ffa70f 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/PlotHologram.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/PlotHologram.java
@@ -7,6 +7,7 @@
import net.bteuk.network.api.entity.NetworkLocation;
import net.bteuk.network.api.plotsystem.PlotStatus;
import net.bteuk.network.api.plotsystem.SubmittedStatus;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -145,7 +146,7 @@ private void createHologram() {
int coordinate = plotAPI.getPlotCoordinate(plot);
if (coordinate != 0) {
NetworkLocation networkLocation = coordinateAPI.getLocation(coordinate);
- location = new Location(Bukkit.getWorld(networkLocation.world()), networkLocation.x(), networkLocation.y(), networkLocation.z(), networkLocation.yaw(), networkLocation.pitch());
+ location = new Location(WorldUtils.getWorld(networkLocation.world()), networkLocation.x(), networkLocation.y(), networkLocation.z(), networkLocation.yaw(), networkLocation.pitch());
}
// Create the holograms; depending on the status, multiple holograms may be necessary for specific players.
diff --git a/src/main/java/net/bteuk/plotsystem/utils/SelectionTool.java b/src/main/java/net/bteuk/plotsystem/utils/SelectionTool.java
index ba0bca0..299714e 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/SelectionTool.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/SelectionTool.java
@@ -2,11 +2,11 @@
import com.sk89q.worldedit.math.BlockVector2;
import net.bteuk.network.api.NetworkAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.plugins.WGCreatePlot;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
diff --git a/src/main/java/net/bteuk/plotsystem/utils/plugins/Multiverse.java b/src/main/java/net/bteuk/plotsystem/utils/plugins/Multiverse.java
index c1723a1..4867bc8 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/plugins/Multiverse.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/plugins/Multiverse.java
@@ -1,7 +1,7 @@
package net.bteuk.plotsystem.utils.plugins;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.exceptions.RegionManagerNotFoundException;
-import org.bukkit.Bukkit;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.GameRule;
@@ -18,7 +18,7 @@
public class Multiverse {
- public static boolean createVoidWorld(String name) {
+ public static boolean createVoidWorld(String worldName, String dimension) {
MultiverseCoreApi core = MultiverseCoreApi.get();
@@ -30,7 +30,7 @@ public static boolean createVoidWorld(String name) {
WorldManager worldManager = core.getWorldManager();
worldManager.createWorld(
- CreateWorldOptions.worldName(name).environment(World.Environment.NORMAL).worldType(WorldType.FLAT).generateStructures(false).generator("VoidGen:{biome" +
+ CreateWorldOptions.worldName(worldName).environment(World.Environment.NORMAL).worldType(WorldType.FLAT).generateStructures(false).generator("VoidGen:{biome" +
":PLAINS}"))
.onSuccess(world -> {
world.setGameMode(GameMode.CREATIVE);
@@ -42,7 +42,7 @@ public static boolean createVoidWorld(String name) {
// Get world from bukkit.
- World world = Bukkit.getWorld(name);
+ World world = WorldUtils.getWorld(dimension);
if (world == null) {
LOGGER.warning("World is null!");
@@ -71,7 +71,7 @@ public static boolean createVoidWorld(String name) {
LOGGER.severe("Failed to set world flags: " + e.getMessage());
}
- LOGGER.info("Created new world with name " + name);
+ LOGGER.info("Created new world with name " + worldName);
return true;
}
diff --git a/src/main/java/net/bteuk/plotsystem/utils/plugins/WGCreatePlot.java b/src/main/java/net/bteuk/plotsystem/utils/plugins/WGCreatePlot.java
index 8e8f46a..a9276ba 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/plugins/WGCreatePlot.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/plugins/WGCreatePlot.java
@@ -10,10 +10,10 @@
import net.bteuk.network.api.CoordinateAPI;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
-import net.bteuk.network.lib.utils.ChatUtils;
import net.bteuk.network.papercore.LocationAdapter;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.bteuk.plotsystem.utils.PlotHologram;
+import org.btuk.network.lib.utils.ChatUtils;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
diff --git a/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldEditor.java b/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldEditor.java
index b35e946..6f9f8b7 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldEditor.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldEditor.java
@@ -137,6 +137,6 @@ public static void deleteEntities(World world) {
entity.remove();
}
});
- PlotSystem.LOGGER.info(String.format("Removed %d entities from world %s", count[0], world.getName()));
+ PlotSystem.LOGGER.info(String.format("Removed %d entities from world %s", count[0], world.key().asMinimalString()));
}
}
\ No newline at end of file
diff --git a/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldGuardFunctions.java b/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldGuardFunctions.java
index 2977b61..28549bd 100644
--- a/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldGuardFunctions.java
+++ b/src/main/java/net/bteuk/plotsystem/utils/plugins/WorldGuardFunctions.java
@@ -44,7 +44,7 @@ private static RegionManager getRegionManager(World world) throws RegionManagerN
RegionManager regionManager = container.get(BukkitAdapter.adapt(world));
if (regionManager == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + world.getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + world.key().asMinimalString() + " is null!");
}
return regionManager;
@@ -76,7 +76,7 @@ public static Location getBeforeLocation(String regionName, World buildWorld, Pl
FileConfiguration config = instance.getConfig();
// Get worlds from config
- String saveWorldName = config.getString("save_world");
+ String saveWorldName = config.getString("save_world_dimension");
if (saveWorldName == null) {
throw new WorldNotFoundException("Save World is not defined in config, plot delete event has therefore failed!");
@@ -94,7 +94,7 @@ public static Location getBeforeLocation(String regionName, World buildWorld, Pl
if (buildRegions == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + buildWorld.getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + buildWorld.key().asMinimalString() + " is null!");
}
@@ -109,8 +109,8 @@ public static Location getBeforeLocation(String regionName, World buildWorld, Pl
BlockVector2 bv = Point.getAveragePoint(region.getPoints());
// To get the actual location we need to take the negative coordinate transform of the plot.
- int xTransform = -plotAPI.getXTransform(buildWorld.getName());
- int zTransform = -plotAPI.getZTransform(buildWorld.getName());
+ int xTransform = -plotAPI.getXTransform(buildWorld.key().asMinimalString());
+ int zTransform = -plotAPI.getZTransform(buildWorld.key().asMinimalString());
BlockVector2 bv2 = BlockVector2.at(bv.x() + xTransform, bv.z() + zTransform);
@@ -129,7 +129,7 @@ public static List getPoints(String regionName, World world) throw
if (buildRegions == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + world.getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + world.key().asMinimalString() + " is null!");
}
@@ -155,7 +155,7 @@ public static boolean inRegion(Block block) throws RegionManagerNotFoundExceptio
if (regions == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + block.getWorld().getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + block.getWorld().key().asMinimalString() + " is null!");
}
@@ -179,7 +179,7 @@ public static boolean addMember(String regionName, String uuid, World world) thr
if (buildRegions == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + world.getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + world.key().asMinimalString() + " is null!");
}
@@ -215,7 +215,7 @@ public static void removeMember(String regionName, String uuid, World world) thr
if (buildRegions == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + world.getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + world.key().asMinimalString() + " is null!");
}
@@ -254,7 +254,7 @@ public static void clearMembers(String regionName, World world) throws RegionNot
if (buildRegions == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + world.getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + world.key().asMinimalString() + " is null!");
}
@@ -288,7 +288,7 @@ public static boolean delete(String regionName, World world) throws RegionManage
if (buildRegions == null) {
- throw new RegionManagerNotFoundException("RegionManager for world " + world.getName() + " is null!");
+ throw new RegionManagerNotFoundException("RegionManager for world " + world.key().asMinimalString() + " is null!");
}
@@ -325,8 +325,8 @@ public static List getPointsTransformedToSaveWorld(String regionNa
List newVector = new ArrayList<>();
// Get the negative coordinate transform.
- int xTransform = -plotAPI.getXTransform(world.getName());
- int zTransform = -plotAPI.getZTransform(world.getName());
+ int xTransform = -plotAPI.getXTransform(world.key().asMinimalString());
+ int zTransform = -plotAPI.getZTransform(world.key().asMinimalString());
// Apply to transform to each coordinate.
vector.forEach(bv -> newVector.add(BlockVector2.at(bv.x() + xTransform, bv.z() + zTransform)));
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 86b546c..ed7788b 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -6,6 +6,7 @@ server_name: plotserver
# Save world name
# This is where all completed plots are stored.
save_world: saveWorld
+save_world_dimension: overworld
# Maximum number of plots a user can have, this includes submitted plots
plot_maximum: 21
diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml
index 0706d5c..ceec8e2 100644
--- a/src/main/resources/paper-plugin.yml
+++ b/src/main/resources/paper-plugin.yml
@@ -1,7 +1,7 @@
name: PlotSystem
version: '${project.version}'
main: net.bteuk.plotsystem.PlotSystem
-api-version: '1.21.4'
+api-version: '26.2'
dependencies:
server:
diff --git a/src/test/java/net/bteuk/plotsystem/reviewing/VerificationTest.java b/src/test/java/net/bteuk/plotsystem/reviewing/VerificationTest.java
index 85ffd36..9833921 100644
--- a/src/test/java/net/bteuk/plotsystem/reviewing/VerificationTest.java
+++ b/src/test/java/net/bteuk/plotsystem/reviewing/VerificationTest.java
@@ -1,15 +1,15 @@
package net.bteuk.plotsystem.reviewing;
-import net.bteuk.minecraft.gui.GuiManager;
import net.bteuk.network.api.NetworkAPI;
import net.bteuk.network.api.PlotAPI;
import net.bteuk.network.api.plotsystem.ReviewCategory;
+import net.bteuk.network.papercore.WorldUtils;
import net.bteuk.plotsystem.PlotSystem;
import net.bteuk.plotsystem.utils.PlotHelper;
import net.bteuk.plotsystem.utils.User;
import net.kyori.adventure.inventory.Book;
import net.kyori.adventure.text.Component;
-import org.bukkit.Bukkit;
+import org.btuk.minecraft.gui.GuiManager;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -94,12 +94,12 @@ public class VerificationTest {
void setUp() throws Exception {
PlotSystem.LOGGER = logger;
try (
- MockedStatic bukkitMockedStatic = mockStatic(Bukkit.class);
+ MockedStatic worldUtilsMockedStatic = mockStatic(WorldUtils.class);
MockedStatic itemStackMockedStatic = mockStatic(ItemStack.class);
MockedStatic bookMockedStatic = mockStatic(Book.class);
) {
- bukkitMockedStatic.when(() -> Bukkit.getWorld(anyString())).thenReturn(world);
+ worldUtilsMockedStatic.when(() -> WorldUtils.getWorld(anyString())).thenReturn(world);
itemStackMockedStatic.when(() -> ItemStack.of(any(), anyInt())).thenReturn(reviewBookItem);
bookMockedStatic.when(() -> Book.book(any(), any(), any(Component.class))).thenReturn(book);
@@ -135,9 +135,9 @@ void setUp() throws Exception {
@Test
void testSaveWithNoChanges() {
try (
- MockedStatic bukkitMockedStatic = mockStatic(Bukkit.class);
+ MockedStatic worldUtilsMockedStatic = mockStatic(WorldUtils.class);
) {
- bukkitMockedStatic.when(() -> Bukkit.getWorld(anyString())).thenReturn(world);
+ worldUtilsMockedStatic.when(() -> WorldUtils.getWorld(anyString())).thenReturn(world);
when(plotAPI.getReviewOutcome(reviewId)).thenReturn(true);