son1k4438

can you unzip it and read the sourcecode?

Kodari AI
KodariSep 8 at 7:28 pm 1

There’s no ZIP archive in the project directory. The available files are:

  • README.md

  • build.gradle.kts

  • settings.gradle.kts

If you upload or place the ZIP in the project directory, I can extract it and inspect the source code.

son1k4438

the plugin fails to use api to disband players island can you implement it some other way to work?

Kodari AI
KodariSep 8 at 7:31 pm 1
  1. Add compatibility for SuperiorSkyblock2’s actual disbandIsland() API method.

  2. Add a reflective static SuperiorSkyblockAPI.deleteIsland(island) fallback.

  3. Keep the configured command fallback for server builds where neither API path is available.

son1k4438

would it work now?

Kodari AI
KodariSep 8 at 7:35 pm 1
  1. Verify the current reset path against the SuperiorSkyblock2 API.

  2. Add the documented Island.disbandIsland() call and SuperiorSkyblockAPI.deleteIsland(Island) fallback.

Yes—the reset logic now tries the documented SuperiorSkyblock2 API method:

  1. Gets the player’s island.

  2. Calls island.disbandIsland().

  3. Falls back to SuperiorSkyblockAPI.deleteIsland(island).

  4. Uses the configured disband command only if both API methods are unavailable.

It should work if:

  • SuperiorSkyblock2 is installed and enabled.

  • The player is the island owner.

  • reset.island: true.

  • integration.superior-skyblock.use-api-reset: true.

One separate point: automatic new-island creation still depends on commands.create-new-island. Since that list is currently empty, the old island should be disbanded, but a replacement island will not be created unless you configure the appropriate command.

son1k4438

Rebirth transaction ead9d041-b028-4e99-9004-85b149db287f failed for _SON1K_: Index 0 out of bounds for length 0

Kodari AI
KodariSep 8 at 7:37 pm 1
  1. The error is coming from the SuperiorSkyblock reset invocation, likely inside disbandIsland().

  2. I’ll try the documented SuperiorSkyblockAPI.deleteIsland(island) path first, then use disbandIsland() only as a fallback, while preserving command fallback.

The Index 0 out of bounds for length 0 error is likely thrown internally by SuperiorSkyblock2 while executing disbandIsland().

I changed the reset order:

  1. Try the documented SuperiorSkyblockAPI.deleteIsland(island) API first.

  2. Fall back to island.disbandIsland().

  3. Try the other compatible island methods.

  4. Use configured commands if all API methods fail.

  5. Log the underlying root exception instead of only the reflection wrapper.

This should avoid the failing disbandIsland() path in builds where deleteIsland() works. If both API calls trigger the same error, configure a working command under:

YAML
commands:
  disband-island:
    - "[player] island disband"

Use the exact disband command provided by your SuperiorSkyblock2 installation.

son1k4438

compile?

Kodari AI
KodariSep 8 at 7:38 pm 1

I can’t run the compiler in this environment because Gradle/JDK tools aren’t available here. Run this in the project directory:

Shell
./gradlew build

On Windows:

Shell
gradlew.bat build

The generated plugin JAR should be under:

Plain Text
build/libs/

The previous patch was applied, but it has not been locally compile-verified.

son1k4438

ok so it tries to disband island even the message popups but the island is still there players can tp back to it also at time of rebirth it's supposd to also wipe other player data including this reset: island: true inventory: true armor: true offhand: true ender-chest: true experience: true potion-effects: true economy-balance: false playerpoints: false

Kodari AI
KodariSep 8 at 8:16 pm 3
  1. Fix island removal so the reset cannot report success while the island remains usable.

  2. Ensure all configured player-data resets run for every rebirth, with correct ordering and failure handling.

  3. Verify the transaction flow and configuration before patching.

The current code has two confirmed issues: island deletion is treated as successful immediately after invoking a method, and economy-balance/playerpoints are never executed even when enabled. I’m patching both, plus making the inventory sub-flags independent.

The direct API currently returns success without proving deletion, and the configured reset flags for economy/points are not wired at all. I’ll make island deletion verify the player’s island is gone, try both public delete routes plus disband, and fail instead of issuing rewards if it remains.

Implemented the reset fixes:

  • Island deletion is no longer considered successful just because the API method was invoked.

  • The plugin now re-checks SuperiorSkyblock2 and fails the rebirth if the island still exists.

  • Both deleteIsland(...) and disbandIsland() are verified.

  • Command fallback is also verified instead of blindly returning success.

  • Inventory clearing now respects the individual inventory, armor, and offhand settings.

  • reset.economy-balance: true now resets the Vault economy balance.

  • reset.playerpoints: true now resets PlayerPoints before the rebirth reward is granted.

  • If Vault or PlayerPoints reset fails, no reward is issued and the transaction is marked failed.

Your current config has these two disabled:

YAML
economy-balance: false
playerpoints: false

Enable them if desired:

YAML
reset:
  economy-balance: true
  playerpoints: true

The island issue will now fail safely rather than displaying a successful rebirth while leaving the island available.

son1k4438

read entire config for any possible bugs i need this to be production ready

Kodari AI
KodariSep 8 at 8:31 pm 6
  1. Audit the complete configuration against the implementation, including defaults, edge cases, integrations, and transaction safety.

  2. Report only confirmed production blockers with exact file/method references.

  3. Patch the confirmed issues after the audit.

The audit found several real blockers, and the first patch exposed two missing pieces that must be completed before this is production-safe: API-based replacement-island creation and rollback of cleared player data when a later step fails. I’m completing those now, then I’ll correct reward/milestone ordering and the shipped OneBlock configuration.

I audited the full config.yml against the implementation and patched the confirmed issues:

  • confirmation-required: false now executes immediately.

  • Reward provider/mode are validated instead of silently ignored.

  • Milestone bonuses are included within maximum-points.

  • New-island creation now uses the SuperiorSkyblock2 API, with command fallback.

  • New-island creation is verified before continuing.

  • after-reset runs after island creation.

  • Configured reset commands now fail the transaction when Bukkit reports failure.

  • Player inventory, armor, offhand, ender chest, XP, effects, economy, and PlayerPoints are snapshotted and restored when a later reset step fails.

  • PlayerPoints balances can be restored through look()/set().

  • Economy balances can be restored through Vault.

  • Island creation is only required when island reset and automatic creation are both enabled.

  • Default SuperiorSkyblock creation settings were added:

    YAML
    new-island-schematic: "default"
    new-island-biome: "PLAINS"
    new-island-name: "%player% Island"
    

Two production requirements remain configuration/server-specific:

  1. Configure the actual OneBlock final-phase placeholder. The shipped config intentionally leaves this blank:

    YAML
    final-phase: ""
    fallback-final-phase: -1
    

    With require-final-oneblock-phase: true, rebirths will safely be rejected until you configure the correct placeholder exposed by your OneBlock plugin.

  2. Test the exact SuperiorSkyblock2 build on staging. Island deletion and creation are called reflectively because the project does not compile directly against SuperiorSkyblock2. Confirm:

    Plain Text
    /papi parse me <final-phase-placeholder>
    

    and test one complete rebirth before production use.

There is still no true rollback possible for an island already deleted by SuperiorSkyblock2 if a later external command or API operation fails. The plugin now fails safely before issuing rewards and restores player data where possible, but island deletion itself cannot be atomically undone.

son1k4438

it says no new working island api or command found?

Kodari AI
KodariSep 8 at 10:30 pm 2

The failure is in the API detection path: it only recognizes one reflective shape and never checks SuperiorSkyblock2’s grid-manager creation route. I’m replacing that with a shared signature matcher, adding the documented grid fallback, and validating the actual Biome parameter.

Fixed the “No working new-island API or command is configured” detection.

Changes:

  • The plugin now checks SuperiorSkyblock2’s documented SuperiorSkyblockAPI.createIsland(...) method.

  • It also checks the documented SuperiorSkyblockAPI.getGrid().createIsland(...) fallback.

  • API detection now uses the actual player’s SuperiorSkyblock wrapper.

  • Island creation uses the configured schematic, biome, and island name.

  • The eligibility check and creation logic now use the same API signature detection.

The existing configuration can remain:

YAML
settings:
  automatically-create-new-island: true

integration:
  superior-skyblock:
    new-island-schematic: "default"
    new-island-biome: "PLAINS"
    new-island-name: "%player% Island"

If your SuperiorSkyblock2 build does not expose either API route, configure the exact server command instead:

YAML
commands:
  create-new-island:
    - "[player] island create"

This patch has been applied, but it still needs to be compiled and tested against your exact SuperiorSkyblock2 version.

son1k4438

also optimize the plugin for a large scale playerbase

Kodari AI
KodariSep 8 at 10:35 pm 3
  1. Audit the rebirth transaction path for main-thread blocking, repeated API lookups, unbounded work, and unsafe shared state.

  2. Patch the highest-impact scalability issues without changing the configured rebirth behavior.

  3. Keep external plugin calls on the required server thread and preserve failure-safe transaction handling.

The main confirmed scale bottleneck is synchronous full-file persistence: each rebirth currently rewrites the entire player and transaction file several times on the server thread. I’m changing storage to an in-memory update plus a single debounced writer, adding a bounded shutdown flush, and caching the leaderboard/rank sort so PlaceholderAPI requests do not sort every stored player repeatedly.

The persistence patch is in place. I’m tightening two correctness/performance details before stopping: new players must invalidate the cached leaderboard, and the repeated reflective lookups for PlayerPoints, Vault, PlaceholderAPI, and combat checks should be resolved once instead of on every rebirth or placeholder request.One compatibility issue surfaced in the reflection cache: requiring every optional PlayerPoints method during startup would make the required reward method fail on builds that lack only reset/set helpers. I’m making those methods individually optional so the normal reward path stays compatible while configured reset/rollback features still fail safely when unavailable.Optimized the plugin for a large playerbase:

  • Removed synchronous full-file writes from every storage update.

  • Added a single debounced background storage writer.

  • Added bounded shutdown flushing to prevent data loss.

  • Cached leaderboard sorting instead of sorting all players for every /rebirth top or placeholder rank request.

  • New player records now invalidate leaderboard data correctly.

  • Cached PlayerPoints reflection methods.

  • Cached Vault economy methods and provider lookup.

  • Cached PlaceholderAPI reflection methods for OneBlock and combat checks.

  • Kept Bukkit, SuperiorSkyblock, Vault, PlayerPoints, and PlaceholderAPI operations on the main thread for safety.

This reduces the largest current performance bottleneck: multiple complete disk rewrites during each rebirth. The plugin still needs to be compiled and tested on a staging server with your exact SuperiorSkyblock2, PlayerPoints, Vault, and OneBlock versions.

son1k4438

also apply security updates for any possible exploits bugs anything at all

Kodari AI
KodariSep 8 at 10:46 pm 6
  1. Audit all transaction, command, placeholder, reflection, persistence, and integration paths for exploitable behavior.

  2. Patch only confirmed security/correctness issues, prioritizing duplication, unauthorized access, data loss, and denial-of-service risks.

  3. Re-check configuration and build metadata for unsafe defaults or exposed secrets.

Confirmed security issues include inventory-cursor bypass, crash-window reward duplication, restart re-entry after an interrupted reward, mixed-config transactions during reload, storage snapshot races, and permanently cached integration failures. I’m patching those fail-closed paths now; island deletion remains non-atomic because SuperiorSkyblock2 exposes external destructive operations without rollback.

The first security patch exposed two required consistency changes before it is complete: the new durable transaction states and storage APIs must be added, and the pre-island transaction marker must be flushed before any destructive integration call. I’m applying those compile-critical pieces and making restart recovery block unresolved players instead of reopening them.

The durable transaction guard is now in place. One additional confirmed data-loss path remains: enabling reset.playerpoints can proceed even when the installed PlayerPoints API lacks the reset/lookup/restore methods, because the current hook silently returns 0 or false. I’m making that configuration fail closed before any island deletion.Two more confirmed data-loss paths remain: a failed island-verification call is treated as “created” during replacement, and merely listing a create command lets the plugin delete the old island without proving the fallback can work. I’m changing both to fail closed, and removing generic destructive reflection names (delete/removeIsland).

The remaining patch is a concrete verification bug: API island creation still calls the removal verifier, which returns true on verification failure and can falsely accept an unverified replacement. I’m correcting that call and then checking for stale enum/switch references and unsafe transaction states.

The audit found one remaining concrete rollback gap in the player snapshot: the inventory cursor was cleared but never captured/restored, so a failed transaction could permanently lose the cursor item. I’m closing that gap; the destructive island operation itself still cannot be made atomic without a real SuperiorSkyblock2 rollback API.Two additional availability issues are confirmed: completed/failed transaction records were never pruned, allowing long-term storage growth, and island creation eligibility accepted an API signature even when the configured biome was invalid, allowing deletion before guaranteed replacement. I’m adding bounded terminal-history retention and validating the selected biome before reset.One production correctness/security issue remains in the command guard: configured [player] integration commands are executed while the player is marked as processing, so PlayerCommandPreprocessEvent cancels the plugin’s own command and can leave a reset half-complete. I’m allowing only the plugin’s synchronous internal command invocation while continuing to block all player-issued commands.

Applied security hardening to the plugin:

  • Added durable transaction checkpoints before island deletion and before issuing PlayerPoints rewards.

  • Prevented rebirths for players with unresolved or interrupted transactions.

  • Added REWARD_PENDING and REWARD_UNCERTAIN transaction states.

  • Prevented duplicate rewards after crashes or ambiguous PlayerPoints results.

  • Failed closed when PlayerPoints reset/restore APIs are unavailable.

  • Blocked inventory-cursor item loss during resets and rollback.

  • Prevented external player commands from bypassing the reset lock.

  • Protected internal configured [player] commands from being cancelled by the reset lock.

  • Blocked configuration reloads while a rebirth is active.

  • Fixed cached integration failures for PlayerPoints, Vault, and PlaceholderAPI.

  • Fixed replacement-island verification to fail when SuperiorSkyblock cannot verify creation.

  • Validated the configured island biome before destructive island reset.

  • Removed generic reflective destructive methods such as delete and removeIsland; only disbandIsland and disband remain.

  • Added 30-day cleanup for completed/failed transaction records.

  • Disabled unverified new-island command fallback by default:

YAML
integration:
  superior-skyblock:
    allow-unverified-create-command: false

This is intentionally fail-safe. If no verified SuperiorSkyblock creation API exists, rebirths will be rejected rather than deleting the player’s island without guaranteeing a replacement.

One limitation remains: island deletion and replacement cannot be truly atomic unless SuperiorSkyblock2 provides a rollback/transaction API. The plugin now refuses uncertain replacement paths by default, but the exact SuperiorSkyblock2 version still needs staging validation.

I could not compile the project in this environment because the JDK/Gradle tools are unavailable. Run:

Shell
./gradlew build

before deploying.

son1k4438

the plugin works great but i want a gui as a front page for like when player types /rebirth it shows him what rebirth it and the procedure of how it works

Kodari AI
KodariOct 10 at 5:06 pm 1
  • Make bare /rebirth open an explainer menu showing the player’s current/next rebirth and reward.

  • Include configured requirements and reset effects, plus a Continue button that opens the existing confirmation flow.

  • Keep /rebirth info, rewards, leaderboard, and command-confirmation behavior unchanged.

Bare /rebirth now opens a guide menu showing the player’s current and next rebirth, a reward preview, configured requirements, and what the reset affects. Continue leads into the existing confirmation flow; /rebirth info, /rebirth top, and other subcommands are unchanged.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle.kts
README.md
settings.gradle.kts
Code
11 1,753
src/main/java/fun/voidland/voidrebirth/VoidRebirthPlugin.java
package fun.voidland.voidrebirth;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Sound;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

public final class VoidRebirthPlugin extends JavaPlugin implements Listener, CommandExecutor, TabCompleter {
    public static final String GUIDE_GUI_TITLE = "§0Rebirth Guide";
    public static final String GUI_TITLE = "§0Confirm Your Rebirth";

    private final Set<UUID> processing = ConcurrentHashMap.newKeySet();
    private final Set<UUID> internalCommandPlayers = ConcurrentHashMap.newKeySet();
    private final Map<UUID, Long> confirmations = new ConcurrentHashMap<>();
    private final Set<UUID> clickedOnce = ConcurrentHashMap.newKeySet();

    private RebirthStorage storage;
    private PlayerPointsHook playerPoints;
    private EconomyHook economy;
    private SuperiorSkyblockHook superiorSkyblock;
    private OneBlockProgressHook oneBlock;
    private CombatHook combat;
    private VoidRebirthExpansion expansion;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        this.storage = new RebirthStorage(getDataFolder().toPath(), getLogger());
        this.storage.load();
        this.storage.failOpenTransactionsAfterRestart();

        this.playerPoints = new PlayerPointsHook(this);
        this.economy = new EconomyHook(this);
        this.superiorSkyblock = new SuperiorSkyblockHook(this);
        this.oneBlock = new OneBlockProgressHook(this);
        this.combat = new CombatHook(this);

        PluginCommand rebirth = getCommand("rebirth");
        PluginCommand admin = getCommand("rebirthadmin");
        if (rebirth != null) { rebirth.setExecutor(this); rebirth.setTabCompleter(this); }
        if (admin != null) { admin.setExecutor(this); admin.setTabCompleter(this); }
        Bukkit.getPluginManager().registerEvents(this, this);

        Plugin papi = Bukkit.getPluginManager().getPlugin("PlaceholderAPI");
        if (papi != null && papi.isEnabled()) {
            try {
                this.expansion = new VoidRebirthExpansion(this);
                this.expansion.register();
                getLogger().info("Registered PlaceholderAPI expansion: voidrebirth");
            } catch (Throwable ex) {
                getLogger().warning("Could not register PlaceholderAPI expansion: " + ex.getMessage());
            }
        }

        getLogger().info("VoidRebirth enabled. SuperiorSkyblock2=" + superiorSkyblock.isAvailable()
                + ", PlayerPoints=" + playerPoints.isAvailable() + ", PlaceholderAPI=" + oneBlock.isPlaceholderApiAvailable());
    }

    @Override
    public void onDisable() {
        if (expansion != null) {
            try { expansion.unregister(); } catch (Throwable ignored) { }
        }
        storage.save();
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("rebirth")) return handleRebirth(sender, args);
        if (command.getName().equalsIgnoreCase("rebirthadmin")) return handleAdmin(sender, args);
        return false;
    }

    private boolean handleRebirth(CommandSender sender, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage(color("&cOnly players can use /rebirth."));
            return true;
        }
        if (!player.hasPermission("voidrebirth.use")) {
            player.sendMessage(color("&cYou do not have permission to use rebirths."));
            return true;
        }
        String sub = args.length == 0 ? "open" : args[0].toLowerCase(Locale.ROOT);
        switch (sub) {
            case "open" -> openRebirthGuide(player);
            case "info" -> showInfo(player);
            case "top" -> showTop(player);
            case "rewards" -> showRewards(player);
            case "confirm" -> confirmByCommand(player);
            case "cancel" -> cancel(player);
            default -> sendUsage(player);
        }
        return true;
    }

    private boolean handleAdmin(CommandSender sender, String[] args) {
        if (!sender.hasPermission("voidrebirth.admin")) {
            sender.sendMessage(color("&cYou do not have permission."));
            return true;
        }
        if (args.length == 0) {
            sendAdminUsage(sender);
            return true;
        }
        String sub = args[0].toLowerCase(Locale.ROOT);
        if (sub.equals("reload")) {
            if (!sender.hasPermission("voidrebirth.admin.reload")) return deny(sender);
            if (!processing.isEmpty()) {
                sender.sendMessage(color("&cCannot reload while a rebirth is being processed."));
                return true;
            }
            reloadConfig();
            sender.sendMessage(color("&aVoidRebirth configuration reloaded."));
            return true;
        }
        if (sub.equals("recover")) {
            if (!sender.hasPermission("voidrebirth.admin.modify")) return deny(sender);
            sender.sendMessage(color("&eFailed or interrupted transactions:"));
            List<RebirthTransaction> txs = storage.getNonCompletedTransactions();
            if (txs.isEmpty()) sender.sendMessage(color("&7None."));
            txs.forEach(tx -> sender.sendMessage(color("&7- &f" + tx.id() + " &7player=&f" + tx.playerUuid()
                    + " &7status=&e" + tx.status() + " &7reward=&e" + tx.reward())));
            return true;
        }
        if (args.length < 2) {
            sendAdminUsage(sender);
            return true;
        }
        OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]);
        UUID uuid = target.getUniqueId();
        switch (sub) {
            case "set", "add", "remove" -> {
                if (!sender.hasPermission("voidrebirth.admin.modify")) return deny(sender);
                if (args.length < 3) {
                    sender.sendMessage(color("&cUsage: /rebirthadmin " + sub + " <player> <amount>"));
                    return true;
                }
                Integer amount = parseNonNegativeInt(args[2]);
                if (amount == null) {
                    sender.sendMessage(color("&cAmount must be a non-negative whole number."));
                    return true;
                }
                PlayerRecord record = storage.get(uuid);
                int value = switch (sub) {
                    case "set" -> amount;
                    case "add" -> safeAdd(record.rebirths(), amount);
                    default -> Math.max(0, record.rebirths() - amount);
                };
                storage.put(record.withRebirths(value));