Amartya
📎 1 file 6,566 chars
📄
pasted-code-1794552412781.txt
txt 300 lines
▶
# ADVANCED GUI CUSTOMIZATION SYSTEM (VERY IMPORTANT)

The entire DAVILxRTP interface must be fully configurable through `config.yml`.

I want complete control over the GUI without modifying Java source code or recompiling the plugin.

Every GUI element must have its own configuration section.

## 1. GUI Header Customization

Allow configuration of:

- GUI title.
- Title text.
- Title color.
- Title formatting.
- Subtitle.
- Subtitle color.
- Warning icon.
- Warning icon material.
- Warning tooltip.
- Header visibility.

Example:

```yaml
gui:
  header:
    enabled: true
    title: "&6RTP &8· &fRandom Teleport"
    subtitle: "&7Choose your destination"
    warning:
      enabled: true
      material: "YELLOW_STAINED_GLASS"
      tooltip: "&eRTP Information"
```

## 2. Information Section Customization

Every information line must be independently configurable.

Allow changing:
- Text.
- Text color.
- Icon.
- Icon material.
- Highlighted words.
- Visibility.
- Display order.

Example:

```yaml
  information:
    enabled: true

    line-1:
      enabled: true
      icon: "PAPER"
      text: "&7A &6random &asafe &7spot in any world"

    line-2:
      enabled: true
      icon: "TARGET"
      text: "&e200-5,000 &7blocks"

    line-3:
      enabled: true
      icon: "GLOWSTONE_DUST"
      text: "&aReady"
```

## 3. World Button Customization

Every world button must have completely independent settings.

Allow administrators to change:

- Button name.
- Button display text.
- Button text color.
- Button icon/material.
- Button tooltip.
- Button visibility.
- Button enabled/disabled status.
- Button position/order.
- Button sound.
- Button action.
- Permission requirement.
- Unavailable-world message.

Example:

```yaml
  buttons:

    overworld:
      enabled: true
      material: "GRASS_BLOCK"
      name: "&aOverworld"
      tooltip: "&7Teleport to a random Overworld location"
      sound: "UI_BUTTON_CLICK"
      order: 1

    nether:
      enabled: true
      material: "NETHERRACK"
      name: "&cNether"
      tooltip: "&7Teleport to a random Nether location"
      sound: "UI_BUTTON_CLICK"
      order: 2

    end:
      enabled: true
      material: "END_STONE"
      name: "&eEnd"
      tooltip: "&7Teleport to a random End location"
      sound: "UI_BUTTON_CLICK"
      order: 3

    previous:
      enabled: true
      material: "AMETHYST_BLOCK"
      name: "&bPrevious Spot"
      tooltip: "&7Return to your previous RTP location"
      sound: "UI_BUTTON_CLICK"
      order: 4
```

IMPORTANT:

The administrator must be able to replace these icons with ANY valid Minecraft item or block material supported by the target Minecraft version.

For example:

- GRASS_BLOCK
- DIAMOND_BLOCK
- EMERALD_BLOCK
- NETHERITE_BLOCK
- END_STONE
- AMETHYST_BLOCK
- DIAMOND
- EMERALD
- COMPASS
- ENDER_PEARL
- GOLD_INGOT
- REDSTONE
- BARRIER

Do not hardcode the icons inside Java classes.

Load all icons dynamically from configuration.

If an invalid material is provided, display a warning in the console and use a configurable fallback material.

## 4. Close Button Customization

Allow complete customization of the Close button.

```yaml
  close-button:
    enabled: true
    material: "BARRIER"
    name: "&cClose"
    tooltip: "&7Close the RTP menu"
    sound: "UI_BUTTON_CLICK"
```

## 5. GUI Layout Customization

Allow administrators to customize:

- Main menu layout.
- Button order.
- Button width.
- Button spacing.
- Information section spacing.
- Header spacing.
- Close button placement.
- Overall menu width.
- Overall menu alignment.
- GUI scaling behaviour where supported.

The menu must remain properly centered on different screen resolutions.

IMPORTANT: Only expose layout settings that the selected Minecraft API actually supports. Never implement fake configuration options that do nothing.

## 6. Colors and Formatting

Support Minecraft color formatting.

Allow administrators to customize:

- Header colors.
- Subtitle colors.
- Information text colors.
- Button text colors.
- Warning text colors.
- Close button colors.
- Disabled button colors.
- Highlighted words.
- Formatting such as bold and italic.

Support modern RGB/HEX formatting wherever the chosen API supports it.

## 7. GUI Sounds

Allow configuration of:

- Menu opening sound.
- Menu closing sound.
- Button click sound.
- Teleport starting sound.
- Teleport success sound.
- Teleport failure sound.
- Countdown sounds.

Each sound must have an independent enable/disable option and configurable volume and pitch.

## 8. Button Actions

Every button must have configurable behaviour.

Allow:
- Enable/disable individual buttons.
- Change button order.
- Set permission requirements.
- Set world requirements.
- Configure unavailable messages.
- Configure cooldown messages.
- Configure button click actions.

Do not allow configuration to execute arbitrary console commands or unsafe actions.

## 9. Live Configuration Reload

Implement:

`/rtp reload`

When executed:

- Reload the complete configuration.
- Update GUI titles.
- Update button names.
- Update icons.
- Update colors.
- Update information text.
- Update sounds.
- Update button order.
- Update layout settings.
- Apply all supported GUI changes immediately to newly opened interfaces.

Do not require a server restart for ordinary configuration changes.

## 10. Configuration Validation

Implement proper validation.

If an administrator enters:
- An invalid material.
- An invalid color.
- An invalid sound.
- An incorrect value.
- An unsupported layout property.

The plugin must:
1. Detect the invalid setting.
2. Display a clear console warning.
3. Use a safe default value.
4. Continue working without crashing.

## 11. Developer Requirements

Do not hardcode GUI appearance inside Java source files.

Use a centralized GUI configuration manager.

Separate:
- GUI configuration.
- Button configuration.
- Material loading.
- Color formatting.
- Sound configuration.
- Layout configuration.
- GUI interaction handling.

Every configurable option must actually work.

Do not add configuration entries that are ignored by the plugin.

IMPORTANT API LIMITATION:

Paper's native Dialog API may not expose every visual property, including arbitrary pixel positioning, background colors, button dimensions, or item icons.

Investigate the actual Paper 1.21.11 API.

If a requested property is unsupported, clearly document that limitation instead of pretending the setting works.

Never require a Fabric mod, client-side mod, or resource pack to provide these customization features.
Kodari AI
KodariNov 13 at 6:56 am 2
DavilxRtpGui
A fully configurable random teleport GUI plugin for Paper 1.21.11. Provides a centralized GUI configuration manager loading all interface elements from config.yml including header, subtitle, warning icon, information lines, world buttons, close button, sounds, and layout. Supports dynamic material loading with fallback validation, MiniMessage color formatting, per-button permissions and actions, live /rtp reload without restart, and comprehensive configuration validation with console warnings. Implements the inventory GUI framework with lazy initialization and centralized event handling for clickable world selection, previous spot return, and close functionality.
  • Build DAVILxRTP as a Java Paper plugin with /rtp and /rtp reload.

  • Use a slot-based inventory menu so configured item icons and button positions work; document native Dialog API limits.

  • Centralize config parsing, validation, colors, materials, sounds, and safe teleport handling.

Created DAVILxRTP with /rtp and /rtp reload, a configurable inventory menu, safe random teleportation with countdown and cooldown, and validation for configured materials, sounds, and layout.

The menu uses inventory slots because Paper’s native Dialog API does not support arbitrary pixel positioning, backgrounds, or icons on action buttons. The supported layout controls and that limitation are documented in README.md.

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code