tyl5336

make me something where all ui for java is the same for bedrock

Kodari AI
KodariApr 3 at 3:46 am 11,442 (v2)

I’ll create a cross-platform GUI system that automatically shows chest GUIs to Java players and Floodgate forms to Bedrock players using the same code.

CrossPlatformGUI
A unified GUI framework for Bukkit plugins that provides identical user interfaces for both Java and Bedrock Edition players. Automatically detects player platform and renders chest inventories for Java Edition or Floodgate forms for Bedrock Edition using a single API. Includes button-based system, automatic platform detection, and example implementations for shops, menus, and confirmations.

Created a cross-platform GUI system that automatically detects if players are on Java or Bedrock Edition and renders the appropriate interface. Java players see chest inventories, Bedrock players see Floodgate forms - all using the exact same code.

Key Features:

  • Single API for both platforms - write GUI once, works everywhere

  • Automatic Bedrock detection via Floodgate

  • Button-based system with icons, names, lore, and click handlers

  • Three example GUIs: Shop, Confirmation, and Settings

  • Command system to test all GUIs: /cpgui [shop|confirm|settings]

How it works:

  1. Extend UnifiedGUI and override populate() to add buttons

  2. Use GUIButton to define icon, text, lore, and click action

  3. Call plugin.getGuiManager().openGUI(player, gui)

  4. System detects platform and renders accordingly

Java players get interactive chest menus, Bedrock players get native forms with identical functionality.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
13 695
src/main/java/com/crossplatform/gui/CrossPlatformGUI.java
package com.crossplatform.gui;

import com.crossplatform.gui.command.GUICommand;
import com.crossplatform.gui.manager.UnifiedGUIManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CrossPlatformGUI extends JavaPlugin {
    
    private UnifiedGUIManager guiManager;
    private boolean floodgateEnabled;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.floodgateEnabled = Bukkit.getPluginManager().getPlugin("floodgate") != null;
        
        if (floodgateEnabled) {
            getLogger().info("Floodgate detected! Bedrock form support enabled.");
        } else {
            getLogger().warning("Floodgate not found. Bedrock players will see chest GUIs.");
        }
        
        this.guiManager = new UnifiedGUIManager(this);
        
        getCommand("cpgui").setExecutor(new GUICommand(this));
        
        getLogger().info("CrossPlatformGUI enabled successfully!");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("CrossPlatformGUI disabled.");
    }
}