Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
77f41e2
move world generation to SkeletonWorldGenerator and copy skeleton dat…
Cinnazeyy Jul 14, 2025
9263206
generate skeleton on startup if not exists.
Cinnazeyy Jul 14, 2025
573884f
save skeleton to generate level.dat and remove uid.dat for multiverse…
Cinnazeyy Jul 14, 2025
d0b8173
fix async issues and cleanup generation related classes
Cinnazeyy Jul 20, 2025
16f0b39
add util methods for passing up exceptions in bukkit scheduler
Cinnazeyy Aug 3, 2025
779b31a
- pass schematic bytes into generateOutlines method of PlotGenerators
Cinnazeyy Aug 7, 2025
337a972
Merge branch 'update/1.21-data-abstraction' into update/world-generat…
Cinnazeyy Aug 7, 2025
fb9fd47
feat(gen): ✨ update emptychunkgenerator and provide it outside of plugin
Zoriot Aug 25, 2025
a4af0e0
Merge remote-tracking branch 'origin/update/world-generation-rework' …
Cinnazeyy Sep 17, 2025
198e014
Implement plot abandon functionality in the PlotHandler and rework Pl…
Cinnazeyy Nov 1, 2025
a87a7e3
move world generation to SkeletonWorldGenerator and copy skeleton dat…
Cinnazeyy Jul 14, 2025
73e9def
generate skeleton on startup if not exists.
Cinnazeyy Jul 14, 2025
0783dc6
save skeleton to generate level.dat and remove uid.dat for multiverse…
Cinnazeyy Jul 14, 2025
6571670
fix async issues and cleanup generation related classes
Cinnazeyy Jul 20, 2025
030be1f
add util methods for passing up exceptions in bukkit scheduler
Cinnazeyy Aug 3, 2025
fc403d6
- pass schematic bytes into generateOutlines method of PlotGenerators
Cinnazeyy Aug 7, 2025
35931a8
feat(gen): ✨ update emptychunkgenerator and provide it outside of plugin
Zoriot Aug 25, 2025
91e97ad
Implement plot abandon functionality in the PlotHandler and rework Pl…
Cinnazeyy Nov 1, 2025
73db572
fix incorrectly rebased imports
Cinnazeyy Nov 1, 2025
54a8333
Merge remote-tracking branch 'origin/update/world-generation-rework' …
Cinnazeyy Nov 1, 2025
a53c9f7
Implement TutorialPlotLoader.java.
Cinnazeyy Nov 25, 2025
17a8376
remove unused imports
Cinnazeyy Nov 25, 2025
3ca8cb7
add nbt dependency to gradle for parity with maven
Dec 2, 2025
e669434
Merge remote-tracking branch 'origin/update/world-generation-rework' …
Dec 2, 2025
aa53fa3
Merge branch 'update/1.21-data-abstraction' into update/world-generat…
Dec 2, 2025
4a9a6ce
fix merging issues
Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies {
implementation(libs.com.alpsbte.alpslib.alpslib.utils)
implementation(libs.org.mariadb.jdbc.mariadb.java.client)
implementation(libs.com.zaxxer.hikaricp)
implementation(libs.com.github.querz.nbt)
compileOnly(libs.io.papermc.paper.paper.api)
implementation(platform(libs.com.intellectualsites.bom.bom.newest))
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Core")
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ io-papermc-paper-paper-api = "1.21.8-R0.1-SNAPSHOT"
li-cinnazeyy-langlibs-api = "1.5.1"
org-mariadb-jdbc-mariadb-java-client = "2.7.4"
com-intellectualsites-bom-bom-newest = "1.55" # Ref: https://github.com/IntellectualSites/bom
com-github-querz-nbt-newest = "6.1"

[libraries]
com-alpsbte-alpslib-alpslib-hologram = { module = "com.alpsbte.alpslib:alpslib-hologram", version.ref = "com-alpsbte-alpslib-alpslib-hologram" }
Expand All @@ -27,6 +28,7 @@ com-alpsbte-canvas = { module = "com.alpsbte:canvas", version.ref = "com-alpsbte
com-arcaniax-headdatabase-api = { module = "com.arcaniax:HeadDatabase-API", version.ref = "com-arcaniax-headdatabase-api" }
com-github-decentsoftware-eu-decentholograms = { module = "com.github.decentsoftware-eu:decentholograms", version.ref = "com-github-decentsoftware-eu-decentholograms" }
com-github-fierioziy-particlenativeapi-particlenativeapi-plugin = { module = "com.github.fierioziy.particlenativeapi:ParticleNativeAPI-plugin", version.ref = "com-github-fierioziy-particlenativeapi-particlenativeapi-plugin" }
com-github-querz-nbt = { module = "com.github.Querz:NBT", version.ref = "com-github-querz-nbt-newest" }
multiverse-core = { module = "org.mvplugins.multiverse.core:multiverse-core", version.ref = "multiverse-core" }
com-sk89q-worldguard-worldguard-bukkit = { module = "com.sk89q.worldguard:worldguard-bukkit", version.ref = "com-sk89q-worldguard-worldguard-bukkit" }
com-zaxxer-hikaricp = { module = "com.zaxxer:HikariCP", version.ref = "com-zaxxer-hikaricp" }
Expand All @@ -35,4 +37,4 @@ de-oliver-fancynpcs = { module = "de.oliver:FancyNpcs", version.ref = "de-oliver
io-papermc-paper-paper-api = { module = "io.papermc.paper:paper-api", version.ref = "io-papermc-paper-paper-api" }
li-cinnazeyy-langlibs-api = { module = "li.cinnazeyy:LangLibs-API", version.ref = "li-cinnazeyy-langlibs-api" }
org-mariadb-jdbc-mariadb-java-client = { module = "org.mariadb.jdbc:mariadb-java-client", version.ref = "org-mariadb-jdbc-mariadb-java-client" }
com-intellectualsites-bom-bom-newest = { module = "com.intellectualsites.bom:bom-newest", version.ref = "com-intellectualsites-bom-bom-newest" }
com-intellectualsites-bom-bom-newest = { module = "com.intellectualsites.bom:bom-newest", version.ref = "com-intellectualsites-bom-bom-newest" }
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@
<version>2.17.0</version> <!-- Provided by Minecraft (libraries folder) -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Querz</groupId>
<artifactId>NBT</artifactId>
<version>6.1</version>
</dependency>
</dependencies>
<!-- Fast Async World Edit -->
<dependencyManagement>
Expand Down
19 changes: 18 additions & 1 deletion src/main/java/com/alpsbte/plotsystem/PlotSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.alpsbte.plotsystem.core.holograms.HologramRegister;
import com.alpsbte.plotsystem.core.system.Builder;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.core.system.plot.generator.world.SkeletonWorldGenerator;
import com.alpsbte.plotsystem.core.system.plot.utils.PlotUtils;
import com.alpsbte.plotsystem.core.system.tutorial.AbstractTutorial;
import com.alpsbte.plotsystem.core.system.tutorial.BeginnerTutorial;
Expand All @@ -28,6 +30,7 @@
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.java.JavaPlugin;
import org.ipvp.canvas.MenuFunctionListener;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -117,16 +120,25 @@ public void onEnable() {

DecentHologramDisplay.registerPlugin(this);
HologramRegister.init();
PlotUtils.checkPlotsForLastActivity();
Utils.ChatUtils.checkForChatInputExpiry();
PlotUtils.Effects.startTimer();

// Start task that checks for and abandons inactive plots every hour
Bukkit.getScheduler().runTaskTimerAsynchronously(PlotSystem.getPlugin(), PlotHandler::abandonInactivePlots, 0L, 20 * 60 * 60L);

// Register tutorials
if (getConfig().getBoolean(ConfigPaths.TUTORIAL_ENABLE)) {
AbstractTutorial.registerTutorials(Collections.singletonList(BeginnerTutorial.class));
Bukkit.getScheduler().runTaskTimerAsynchronously(FancyNpcsPlugin.get().getPlugin(), new TutorialNPCTurnTracker(), 0, 1L);
}

// Generate Skeleton World
if (Bukkit.getWorld("Skeleton") == null) {
getComponentLogger().info("No skeleton world found!");
getComponentLogger().info("Generating skeleton world...");
new SkeletonWorldGenerator();
}

pluginEnabled = true;
getComponentLogger().info(text("Enabled Plot-System plugin.", DARK_GREEN));
getComponentLogger().info(text("------------------------------------------------------", GOLD));
Expand Down Expand Up @@ -196,4 +208,9 @@ public void initDatabase() throws IOException, SQLException, ClassNotFoundExcept
s.execute(initScript);
}
}

@Override
public ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, String id) {
return new SkeletonWorldGenerator.EmptyChunkGenerator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.alpsbte.plotsystem.commands.BaseCommand;
import com.alpsbte.plotsystem.core.database.DataProvider;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.core.system.plot.utils.PlotUtils;
import com.alpsbte.plotsystem.utils.Utils;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -38,10 +39,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N

sender.sendMessage(Utils.ChatUtils.getInfoFormat("Deleting plot..."));
Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> {
if (PlotUtils.Actions.deletePlot(plot)) {
sender.sendMessage(Utils.ChatUtils.getInfoFormat("Successfully deleted plot with the ID §6#" + plotID + "§a!"));
if (getPlayer(sender) != null) getPlayer(sender).playSound(getPlayer(sender).getLocation(), Utils.SoundUtils.DONE_SOUND, 1f, 1f);
} else sender.sendMessage(Utils.ChatUtils.getAlertFormat("An unexpected error has occurred!"));
if (!PlotHandler.deletePlot(plot)) {
sender.sendMessage(Utils.ChatUtils.getAlertFormat("An unexpected error has occurred!"));
return;
}
sender.sendMessage(Utils.ChatUtils.getInfoFormat("Successfully deleted plot with the ID §6#" + plotID + "§a!"));
if (getPlayer(sender) != null) getPlayer(sender).playSound(getPlayer(sender).getLocation(), Utils.SoundUtils.DONE_SOUND, 1f, 1f);
});
});
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.alpsbte.plotsystem.core.system.Builder;
import com.alpsbte.plotsystem.core.system.plot.AbstractPlot;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.core.system.plot.utils.PlotUtils;
import com.alpsbte.plotsystem.utils.Utils;
import com.alpsbte.plotsystem.utils.enums.Status;
Expand Down Expand Up @@ -67,10 +68,9 @@ public void onCommand(CommandSender sender, String[] args) {
}

Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> {
if (PlotUtils.Actions.abandonPlot(plot)) {
sender.sendMessage(Utils.ChatUtils.getInfoFormat(langUtil.get(sender, LangPaths.Message.Info.ABANDONED_PLOT, plot.getId() + "")));
player.playSound(player.getLocation(), Utils.SoundUtils.ABANDON_PLOT_SOUND, 1, 1);
}
if (!PlotHandler.abandonPlot(plot)) return;
sender.sendMessage(Utils.ChatUtils.getInfoFormat(langUtil.get(sender, LangPaths.Message.Info.ABANDONED_PLOT, plot.getId() + "")));
player.playSound(player.getLocation(), Utils.SoundUtils.ABANDON_PLOT_SOUND, 1, 1);
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.alpsbte.plotsystem.core.system.Builder;
import com.alpsbte.plotsystem.core.system.plot.AbstractPlot;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.core.system.plot.utils.PlotUtils;
import com.alpsbte.plotsystem.utils.Utils;
import com.alpsbte.plotsystem.utils.enums.Status;
Expand Down Expand Up @@ -75,7 +76,7 @@ public void onCommand(CommandSender sender, String[] args) {

Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> {

PlotUtils.Actions.submitPlot(plot);
PlotHandler.submitPlot(plot);
if (plotMembers.isEmpty()) {
// Plot was made alone
langUtil.broadcast(LangPaths.Message.Info.FINISHED_PLOT, String.valueOf(plot.getId()), plot.getPlotOwner().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.alpsbte.plotsystem.core.system.Builder;
import com.alpsbte.plotsystem.core.system.plot.AbstractPlot;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.generator.DefaultPlotGenerator;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.utils.Utils;
import com.alpsbte.plotsystem.utils.enums.Status;
import com.alpsbte.plotsystem.utils.io.LangPaths;
Expand Down Expand Up @@ -63,7 +63,7 @@ public void onCommand(CommandSender sender, String[] args) {
return;
}

Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> new DefaultPlotGenerator(plot, builder));
PlotHandler.assignAndGeneratePlot(builder, plot);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.alpsbte.plotsystem.core.system.Builder;
import com.alpsbte.plotsystem.core.system.plot.AbstractPlot;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.core.system.plot.utils.PlotUtils;
import com.alpsbte.plotsystem.utils.Utils;
import com.alpsbte.plotsystem.utils.enums.Status;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void onCommand(CommandSender sender, String[] args) {
}

Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> {
PlotUtils.Actions.undoSubmit(plot);
PlotHandler.undoSubmit(plot);

sender.sendMessage(Utils.ChatUtils.getInfoFormat(langUtil.get(sender, LangPaths.Message.Info.UNDID_SUBMISSION, plot.getId() + "")));
player.playSound(player.getLocation(), Utils.SoundUtils.FINISH_PLOT_SOUND, 1, 1);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/alpsbte/plotsystem/core/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.alpsbte.plotsystem.core.system.Builder;
import com.alpsbte.plotsystem.core.system.CityProject;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.core.system.plot.TutorialPlot;
import com.alpsbte.plotsystem.core.system.plot.generator.DefaultPlotGenerator;
import com.alpsbte.plotsystem.core.system.plot.utils.PlotUtils;
import com.alpsbte.plotsystem.core.system.plot.world.PlotWorld;
import com.alpsbte.plotsystem.core.system.review.ReviewNotification;
Expand Down Expand Up @@ -123,7 +123,7 @@ public void onPlayerInteractAtEntity(@NotNull PlayerInteractAtEntityEvent event)
public void onPlayerQuitEvent(@NotNull PlayerQuitEvent event) {
final World w = event.getPlayer().getWorld();

DefaultPlotGenerator.playerPlotGenerationHistory.remove(event.getPlayer().getUniqueId());
PlotHandler.removePlayerFromGenerationHistory(event.getPlayer().getUniqueId());
ChatInput.awaitChatInput.remove(event.getPlayer().getUniqueId());
PlotUtils.Cache.clearCache(event.getPlayer().getUniqueId());

Expand Down Expand Up @@ -170,7 +170,7 @@ public void onInventoryClickEvent(@NotNull InventoryClickEvent event) {
}

@EventHandler
public void onlPlayerItemDropEvent(@NotNull PlayerDropItemEvent event) {
public void onPlayerItemDropEvent(@NotNull PlayerDropItemEvent event) {
if (event.getItemDrop().getItemStack().equals(CompanionMenu.getMenuItem(event.getPlayer())) ||
event.getItemDrop().getItemStack().equals(ReviewMenu.getMenuItem(event.getPlayer()))) {
event.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
import com.alpsbte.plotsystem.core.system.CityProject;
import com.alpsbte.plotsystem.core.system.Country;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.generator.DefaultPlotGenerator;
import com.alpsbte.plotsystem.core.system.plot.PlotHandler;
import com.alpsbte.plotsystem.utils.Utils;
import com.alpsbte.plotsystem.utils.enums.PlotDifficulty;
import com.alpsbte.plotsystem.utils.enums.Status;
import com.alpsbte.plotsystem.utils.io.ConfigPaths;
import com.alpsbte.plotsystem.utils.io.LangPaths;
import com.alpsbte.plotsystem.utils.io.LangUtil;
import com.alpsbte.plotsystem.utils.items.MenuItems;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.ipvp.canvas.mask.BinaryMask;
import org.ipvp.canvas.mask.Mask;
Expand All @@ -24,6 +27,7 @@

import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

public class CityProjectMenu extends AbstractPaginatedMenu {
Expand Down Expand Up @@ -96,6 +100,28 @@ protected void setItemClickEventsAsync() {
CompanionMenu.clickEventTutorialItem(getMenu());
}

public void handleCityProjectClick(Player player, CityProject city) {
Builder builder = Builder.byUUID(player.getUniqueId());

PlotDifficulty plotDifficultyForCity;
try {
plotDifficultyForCity = selectedPlotDifficulty != null ? selectedPlotDifficulty : Plot.getPlotDifficultyForBuilder(city, builder).get();
} catch (ExecutionException | InterruptedException ex) {
sqlError(player, ex);
return;
}

List<Plot> unclaimedPlots = DataProvider.PLOT.getPlots(city, plotDifficultyForCity, Status.unclaimed);
if (unclaimedPlots.isEmpty()) {
player.sendMessage(Utils.ChatUtils.getAlertFormat(LangUtil.getInstance().get(player, LangPaths.Message.Error.NO_PLOTS_LEFT)));
Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> player.playSound(player.getLocation(), Utils.SoundUtils.ERROR_SOUND, 1, 1));
return;
}

Plot plot = unclaimedPlots.get(Utils.getRandom().nextInt(unclaimedPlots.size()));
PlotHandler.assignAndGeneratePlot(builder, plot);
}

public static boolean generateRandomPlot(Player player, @NotNull List<CityProject> items, PlotDifficulty selectedPlotDifficulty) {
PlotDifficulty difficulty = selectedPlotDifficulty;
if (items.isEmpty()) {
Expand All @@ -108,14 +134,13 @@ public static boolean generateRandomPlot(Player player, @NotNull List<CityProjec
try {
if (difficulty == null) difficulty = Plot.getPlotDifficultyForBuilder(randomCity, Builder.byUUID(player.getUniqueId())).get();
if (difficulty == null) difficulty = PlotDifficulty.EASY;

player.closeInventory();
new DefaultPlotGenerator(randomCity, difficulty, builder);
} catch (InterruptedException | ExecutionException e) {
sqlError(player, e);
return false;
}
player.playSound(player, Utils.SoundUtils.DONE_SOUND, 1, 1);
player.closeInventory();
boolean successful = PlotHandler.assignAndGenerateRandomPlot(builder, randomCity, difficulty);
if (successful) player.playSound(player, Utils.SoundUtils.DONE_SOUND, 1, 1);
return true;
}

Expand Down Expand Up @@ -175,29 +200,9 @@ protected void setPaginatedItemClickEventsAsync(@NotNull List<?> source) {
clickPlayer.playSound(clickPlayer.getLocation(), Utils.SoundUtils.ERROR_SOUND, 1, 1);
return;
}

clickPlayer.closeInventory();
Builder builder = Builder.byUUID(clickPlayer.getUniqueId());

try {
PlotDifficulty plotDifficultyForCity = selectedPlotDifficulty != null ? selectedPlotDifficulty : Plot.getPlotDifficultyForBuilder(city, builder).get();
List<Plot> unclaimedPlots = DataProvider.PLOT.getPlots(city, plotDifficultyForCity, Status.unclaimed);
if (unclaimedPlots.isEmpty()) {
clickPlayer.sendMessage(Utils.ChatUtils.getAlertFormat(LangUtil.getInstance().get(clickPlayer, LangPaths.Message.Error.NO_PLOTS_LEFT)));
clickPlayer.playSound(clickPlayer.getLocation(), Utils.SoundUtils.ERROR_SOUND, 1, 1);
return;
}

if (selectedPlotDifficulty != null && PlotSystem.getPlugin().getConfig().getBoolean(ConfigPaths.ENABLE_SCORE_REQUIREMENT) && !DataProvider.DIFFICULTY.builderMeetsRequirements(builder, selectedPlotDifficulty)) {
clickPlayer.sendMessage(Utils.ChatUtils.getAlertFormat(LangUtil.getInstance().get(clickPlayer, LangPaths.Message.Error.PLAYER_NEEDS_HIGHER_SCORE)));
clickPlayer.playSound(clickPlayer.getLocation(), Utils.SoundUtils.ERROR_SOUND, 1, 1);
return;
}

new DefaultPlotGenerator(city, plotDifficultyForCity, builder);
} catch (ExecutionException | InterruptedException ex) {
sqlError(clickPlayer, ex);
}

CompletableFuture.runAsync(() -> handleCityProjectClick(clickPlayer, city));
});
slot++;
}
Expand Down
Loading