ceccye

ceccye

Update this plugin to target Paper 26.2 (api-version: '26.2'), make sure vanilla Note Blocks keep working normally, and compile the .jar file.

Kodari AI
KodariFri at 1:45 pm 3
  • Update the plugin’s Paper API version.

  • Preserve vanilla Note Blocks; the existing source has no Note Block handler to change.

  • Check whether the project can produce a jar.

  • Set api-version to 26.2. No Note Block handler was found, so vanilla Note Blocks remain untouched.

  • The jar could not be compiled here. The project references missing classes, including SiftListener and SonorousManager; those must be restored before compilation can succeed.

Kodari can make mistakes. Review important code before using.
Files
resource-pack
src
compile.bat
compile.sh
README.md
Code
18 1,194
src/main/java/in/sift/plugin/TheSiftPlugin.java
package in.sift.plugin;

import in.sift.plugin.command.SiftCommand;
import in.sift.plugin.entity.SiftMobSpawner;
import in.sift.plugin.item.ItemFactory;
import in.sift.plugin.listener.SiftListener;
import in.sift.plugin.portal.PortalManager;
import in.sift.plugin.rift.RiftManager;
import in.sift.plugin.sonorous.SonorousManager;
import in.sift.plugin.world.IchorManager;
import in.sift.plugin.world.SiftWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class TheSiftPlugin extends JavaPlugin {
    private ItemFactory itemFactory;
    private SiftWorldManager worldManager;
    private PortalManager portalManager;
    private RiftManager riftManager;
    private IchorManager ichorManager;
    private SonorousManager sonorousManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        itemFactory = new ItemFactory(this);
        worldManager = new SiftWorldManager(this);
        portalManager = new PortalManager(this);
        riftManager = new RiftManager(this);
        ichorManager = new IchorManager(this);
        sonorousManager = new SonorousManager(this);
        if (getConfig().getBoolean("sift.enabled", true) && getConfig().getBoolean("sift.generate-on-start", true)) {
            worldManager.loadOrCreate();
        }
        portalManager.load();
        riftManager.load();
        ichorManager.load();
        sonorousManager.load();
        itemFactory.registerRecipes();
        Bukkit.getPluginManager().registerEvents(new SiftListener(this), this);
        SiftCommand command = new SiftCommand(this);
        getCommand("sift").setExecutor(command);
        getCommand("sift").setTabCompleter(command);
        if (getConfig().getBoolean("spawning.enabled", true)) new SiftMobSpawner(this).start();
        ichorManager.start();
        Bukkit.getPluginManager().registerEvents(new org.bukkit.event.Listener() {
            @org.bukkit.event.EventHandler
            public void onJoin(org.bukkit.event.player.PlayerJoinEvent event) {
                sendResourcePack(event.getPlayer());
            }
        }, this);
        getLogger().info("TheSift enabled. Paper worlds are separate worlds, not custom dimension types.");
    }

    @Override
    public void onDisable() {
        if (portalManager != null) portalManager.save();
        if (riftManager != null) riftManager.save();
        if (ichorManager != null) ichorManager.save();
        if (sonorousManager != null) sonorousManager.save();
    }

    public NamespacedKey key(String value) { return new NamespacedKey(this, value); }
    public ItemFactory items() { return itemFactory; }
    public SiftWorldManager worlds() { return worldManager; }
    public PortalManager portals() { return portalManager; }
    public RiftManager rifts() { return riftManager; }
    public IchorManager ichor() { return ichorManager; }
    public SonorousManager sonorous() { return sonorousManager; }

    public boolean isSiftWorld(World world) {
        return world != null && world.getName().equalsIgnoreCase(getConfig().getString("sift.world-name", "TheSift"));
    }

    private void sendResourcePack(Player player) {
        if (!getConfig().getBoolean("resource-pack.enabled", false)) return;
        String url = getConfig().getString("resource-pack.url", "");
        if (url == null || url.isBlank()) {
            getLogger().warning("Resource pack is enabled but resource-pack.url is empty.");
            return;
        }
        try {
            player.setResourcePack(url);
        } catch (RuntimeException exception) {
            getLogger().warning("Could not send resource pack to " + player.getName() + ": " + exception.getMessage());
        }
    }
}