errorlegend_
📎 1 file 3,884 chars
📄
pasted-code-1777040569138.txt
txt 145 lines
▶
package me.chaos.lobby;

import org.bukkit.*;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.player.*;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.geysermc.floodgate.api.FloodgateApi;

public class AncientLobby extends JavaPlugin implements Listener {

    private Location lobby;

    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
        getLogger().info("AncientLobby Bedrock Ready!");
    }

    // 🌐 Bedrock detection
    public boolean isBedrock(Player p) {
        return FloodgateApi.getInstance().isFloodgatePlayer(p.getUniqueId());
    }

    // 🏠 Join system
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();

        if (lobby != null) {
            p.teleport(lobby);
        }

        setupPlayer(p);
    }

    public void setupPlayer(Player p) {
        p.getInventory().clear();

        ItemStack menu = new ItemStack(Material.COMPASS);
        ItemMeta meta = menu.getItemMeta();
        meta.setDisplayName("§aServer Menu");
        menu.setItemMeta(meta);

        p.getInventory().setItem(4, menu);

        p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0));

        p.sendMessage("§aWelcome to Ancient Lobby!");

        if (isBedrock(p)) {
            p.sendMessage("§eBedrock player detected!");
        }
    }

    // 🚫 Disable damage
    @EventHandler
    public void onDamage(EntityDamageEvent e) {
        if (e.getEntity() instanceof Player) {
            e.setCancelled(true);
        }
    }

    // 🍗 Disable hunger
    @EventHandler
    public void onFood(FoodLevelChangeEvent e) {
        e.setCancelled(true);
    }

    // 🧭 Open INVENTORY GUI
    @EventHandler
    public void onInteract(PlayerInteractEvent e) {
        if (e.getItem() == null) return;

        if (e.getItem().getType() == Material.COMPASS) {
            openMenu(e.getPlayer());
        }
    }

    // 🎮 Simple INVENTORY GUI (Bedrock SAFE)
    public void openMenu(Player p) {
        Inventory inv = Bukkit.createInventory(null, 9, "Server Menu");

        ItemStack smp = new ItemStack(Material.DIAMOND_SWORD);
        ItemMeta smpMeta = smp.getItemMeta();
        smpMeta.setDisplayName("§aJoin SMP");
        smp.setItemMeta(smpMeta);

        inv.setItem(4, smp);

        p.openInventory(inv);
    }

    // 🖱️ INVENTORY GUI click
    @EventHandler
    public void onClick(InventoryClickEvent e) {
        if (e.getView().getTitle().equals("Server Menu")) {
            e.setCancelled(true);

            Player p = (Player) e.getWhoClicked();

            if (e.getCurrentItem() == null) return;

            if (e.getCurrentItem().getType() == Material.DIAMOND_SWORD) {
                p.sendMessage("§aConnecting to SMP...");
                // Add server connect later (Bungee/Velocity)
            }
        }
    }

    // 🕳️ Void protection
    @EventHandler
    public void onMove(PlayerMoveEvent e) {
        if (e.getPlayer().getLocation().getY() < 0 && lobby != null) {
            e.getPlayer().teleport(lobby);
        }
    }

    // ⚙️ Commands
    @Override
    public boolean onCommand(CommandSender s, Command cmd, String label, String[] args) {
        if (!(s instanceof Player)) return true;

        Player p = (Player) s;

        if (cmd.getName().equalsIgnoreCase("setlobby")) {
            lobby = p.getLocation();
            p.sendMessage("§aLobby set!");
        }

        if (cmd.getName().equalsIgnoreCase("lobby")) {
            if (lobby != null) {
                p.teleport(lobby);
            }
        }

        return true;
    }
}
Kodari AI
KodariApr 24 at 2:24 pm 8,428 (v2)

I’ll create a comprehensive lobby plugin with proper structure, GUI system, and Bedrock support.

AncientLobby
A comprehensive lobby plugin with Bedrock player support via Floodgate. Features include spawn protection, server selector menu, void teleportation, lobby location management, and automatic player setup with speed effect. Provides a safe lobby environment with customizable server selector GUI and cross-version compatibility.

Project created! I’ve transformed your lobby plugin into a well-structured system with:

  • GUI Framework: Proper inventory system with button handlers (no title checking)

  • XSeries Integration: Cross-version material/potion compatibility

  • Config System: Persistent lobby location and customizable messages

  • Separated Listeners: PlayerSetup and Protection in dedicated classes

  • Command Structure: Separate command executors for /setlobby and /lobby

  • Floodgate Support: Bedrock player detection maintained

The plugin now saves lobby location to config, uses a robust GUI system, and follows proper architectural patterns.

errorlegend_

Make a folder that contains the things like config and more

Kodari AI
KodariApr 24 at 2:27 pm 7,917 (v2)

I’ll create a dedicated config package to centralize configuration management.

Created a config package with three dedicated classes: ConfigManager centralizes all configuration access, MessagesConfig handles message retrieval with colorization, and LobbyManager manages lobby location persistence. All classes now use plugin.cfg() for clean, organized config access.

errorlegend_

Compile it?

Kodari AI
KodariApr 24 at 2:28 pm 6,873 (v2)

[Generation stopped]

errorlegend_

Where is the build i cnt see the build

Kodari AI
KodariApr 24 at 2:31 pm 1,488 (v2)

I can only create and modify files - I cannot execute build commands. You need to compile the project yourself:

To build the plugin:

Shell
./gradlew build

or on Windows:

Shell
gradlew.bat build

The compiled JAR will appear in:

Plain Text
build/libs/AncientLobby-1.0.jar

If you’re getting compilation errors when you run the build command, paste them here and I’ll fix the code.

errorlegend_

./gradlew build

Kodari AI
KodariApr 24 at 2:33 pm 1,631 (v2)

I need to see the actual build output to fix any compilation errors. Please paste the full error message you’re getting from ./gradlew build here.

If the build is hanging or you don’t see any output, try:

Shell
./gradlew build --stacktrace

or

Shell
./gradlew clean build

Share the complete error output and I’ll fix the issues immediately.

errorlegend_

Can u make it like to set lobby for different worlds

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
18 728
src/main/java/me/chaos/lobby/AncientLobby.java
package me.chaos.lobby;

import me.chaos.lobby.commands.LobbyCommand;
import me.chaos.lobby.commands.SetLobbyCommand;
import me.chaos.lobby.config.ConfigManager;
import me.chaos.lobby.inventory.gui.GUIListener;
import me.chaos.lobby.inventory.gui.GUIManager;
import me.chaos.lobby.listeners.ProtectionListener;
import me.chaos.lobby.listeners.PlayerSetupListener;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.geysermc.floodgate.api.FloodgateApi;

public class AncientLobby extends JavaPlugin {

    private ConfigManager configManager;
    private GUIManager guiManager;

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.guiManager = new GUIManager();
        
        configManager.load();
        
        registerListeners();
        registerCommands();
        
        getLogger().info("AncientLobby enabled with Bedrock support!");
    }

    @Override
    public void onDisable() {
        configManager.save();
    }

    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new PlayerSetupListener(this), this);
        Bukkit.getPluginManager().registerEvents(new ProtectionListener(this), this);
    }

    private void registerCommands() {
        getCommand("setlobby").setExecutor(new SetLobbyCommand(this));
        getCommand("lobby").setExecutor(new LobbyCommand(this));
    }

    public boolean isBedrock(java.util.UUID uuid) {
        return FloodgateApi.getInstance().isFloodgatePlayer(uuid);
    }

    public ConfigManager cfg() {
        return configManager;
    }

    public GUIManager getGUIManager() {
        return guiManager;
    }
}