_e3rq

i want a plugin that activate sift portale with all the things in it

Kodari AI
KodariOct 1 at 5:36 pm 1
PortalSiftActivator
Activates sift portals with full functionality. When a player interacts with a designated portal block, the plugin triggers the sift portal activation sequence, enabling all associated portal mechanics including teleportation, particle effects, sound effects, and cooldown management. The plugin automatically detects portal configurations, validates activation requirements, and manages portal state persistence. Features include configurable activation cooldowns, permission-based access control, visual feedback through particles and sounds, and comprehensive portal state tracking. The system supports multiple portal types and integrates seamlessly with existing world structures, ensuring portals activate reliably and consistently across all server instances.

What do you mean by “sift portale”—a rift portal that teleports players, a Nether/End portal, or something else? And what should “all the things in it” include—for example, mobs, items, and passengers traveling through too?

_e3rq

the new diamension sift

Kodari AI
KodariOct 1 at 5:39 pm 1

Created SiftPortal. It creates or loads a separate world named Sift; this is a normal Bukkit world, not a custom-generated dimension.

  • /sift — travel between Sift and your return location.

  • /sift portal — build a portal; walk through it to travel.

  • Portal cooldown, particles, sound, and return-world name are configurable in config.yml.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 333
src/main/java/com/kodari/siftportal/SiftPortalPlugin.java
package com.kodari.siftportal;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import org.bukkit.Axis;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Orientable;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public final class SiftPortalPlugin extends JavaPlugin implements Listener, CommandExecutor {
    private final Set<String> portalBlocks = new HashSet<>();
    private final Map<UUID, LocationRecord> returnLocations = new HashMap<>();
    private final Map<UUID, Long> cooldowns = new HashMap<>();
    private World siftWorld;
    private Material frameMaterial;
    private Material portalMaterial;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        frameMaterial = materialFromConfig("portal.frame-material", "OBSIDIAN");
        portalMaterial = materialFromConfig("portal.portal-material", "NETHER_PORTAL");
        if (frameMaterial == null || portalMaterial == null) {
            getLogger().severe("Configured portal materials are unavailable; disabling SiftPortal.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        for (String portal : getConfig().getStringList("portals")) {
            if (isValidPortalKey(portal)) {
                portalBlocks.add(portal);
            }
        }

        if (!ensureSiftWorld()) {
            getLogger().severe("Could not load or create the Sift world; disabling SiftPortal.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getServer().getPluginManager().registerEvents(this, this);
        if (getCommand("sift") != null) {
            getCommand("sift").setExecutor(this);
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length > 0 && args[0].equalsIgnoreCase("portal")) {
            if (!(sender instanceof Player player)) {
                sender.sendMessage(color("&cOnly players can create a portal."));
                return true;
            }
            if (!player.hasPermission("siftportal.portal")) {
                player.sendMessage(color("&cYou don't have permission to create a Sift portal."));
                return true;
            }
            createPortal(player);
            return true;
        }

        if (args.length > 0 && args[0].equalsIgnoreCase("create")) {
            if (!sender.hasPermission("siftportal.portal")) {
                sender.sendMessage(color("&cYou don't have permission to create the Sift dimension."));
                return true;
            }
            sender.sendMessage(ensureSiftWorld()
                    ? color("&aThe Sift dimension is ready.")
                    : color("&cThe Sift dimension could not be loaded."));
            return true;
        }

        if (!(sender instanceof Player player)) {
            sender.sendMessage(color("&cOnly players can travel to the Sift dimension."));
            return true;
        }
        if (!player.hasPermission("siftportal.use")) {
            player.sendMessage(color("&cYou don't have permission to use Sift portals."));
            return true;
        }
        travel(player);
        return true;
    }

    @EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {
        if (event.getTo() == null || sameBlock(event.getFrom(), event.getTo())) {
            return;
        }

        Player player = event.getPlayer();
        String portalKey = key(event.getTo().getBlock());
        if (!portalBlocks.contains(portalKey)) {
            return;
        }

        if (event.getTo().getBlock().getType() != portalMaterial) {
            portalBlocks.remove(portalKey);
            savePortalBlocks();
            return;
        }

        long now = System.currentTimeMillis();
        if (cooldowns.getOrDefault(player.getUniqueId(), 0L) > now) {
            return;
        }
        if (player.hasPermission("siftportal.use")) {
            travel(player);
        }
    }

    private void travel(Player player) {
        if (!ensureSiftWorld()) {
            player.sendMessage(color("&cThe Sift dimension is unavailable."));
            return;
        }

        boolean leavingSift = player.getWorld().getUID().equals(siftWorld.getUID());
        org.bukkit.Location destination;
        if (leavingSift) {
            LocationRecord returnLocation = returnLocations.remove(player.getUniqueId());
            destination = returnLocation == null ? returnWorldSpawn() : returnLocation.toLocation();
            if (destination == null) {
                player.sendMessage(color("&cThe return world is unavailable."));
                return;
            }
        } else {
            returnLocations.put(player.getUniqueId(), LocationRecord.from(player.getLocation()));
            destination = safeSpawn(siftWorld);
        }

        int cooldownSeconds = Math.max(0, getConfig().getInt("portal.cooldown-seconds", 3));
        if (!player.teleport(destination)) {
            return;
        }
        cooldowns.put(player.getUniqueId(), System.currentTimeMillis() + cooldownSeconds * 1000L);
        playEffects(player, destination);
        player.sendMessage(leavingSift
                ? color("&aYou returned from the Sift dimension.")
                : color("&aYou entered the Sift dimension."));
    }

    private void createPortal(Player player) {
        boolean spansX = player.getFacing() == BlockFace.NORTH || player.getFacing() == BlockFace.SOUTH;
        int centerX = player.getLocation().getBlockX();
        int baseY = player.getLocation().getBlockY();
        int centerZ = player.getLocation().getBlockZ();
        Axis portalAxis = spansX ? Axis.X : Axis.Z;

        for (int width = -1; width <= 2; width++) {
            for (int height = 0; height <= 4; height++) {
                int x = centerX + (spansX ? width : 0);
                int y = baseY + height;
                int z = centerZ + (spansX ? 0 : width);
                Block block = player.getWorld().getBlockAt(x, y, z);
                boolean frame = width == -1 || width == 2 || height == 0 || height == 4;
                if (frame) {
                    block.setType(frameMaterial, false);
                } else {
                    block.setType(portalMaterial, false);
                    BlockData data = block.getBlockData();
                    if (data instanceof Orientable orientable) {
                        orientable.setAxis(portalAxis);
                        block.setBlockData(orientable, false);
                    }
                    portalBlocks.add(key(block));
                }
            }
        }

        savePortalBlocks();
        player.sendMessage(color("&aSift portal created. Walk through it to travel."));
    }

    private boolean ensureSiftWorld() {
        if (siftWorld != null) {
            return true;