Skip to content

SlaxNetwork/mc-chestui-plus

 
 

Repository files navigation

ChestUI+

ChestUI+ is a fork and slight recode of mc-chestui, originally developed by, hazae41.

The primary aim of this project was to add additional features to the original project and redo a few elements to better suite my own personal needs from the project.

Changes From Original

GUI

Changes within the GUI are as following

  • GUIs now support Dispenser/Hopper types.
  • Shift clicking items from the players inventory into the GUI is now toggleable.
  • You can now use the fillBorder method to outline your GUI with whatever item you desire, especially useful for repetitive placeholder items.

Item

  • Toggleable item glow.
  • Modifiable skull owners.

Other

  • Switched from using Strings to using Kyori TextComponents for all text.

Thanks for checking out this project! And for further examples of what you can do you can checkout the original page for mc-chestui.

Examples

GUI Creation

fun mainGUI(): GUI {
  return gui(
    plugin = this,
    title = Component.text("Example GUI", NamedTextColor.GOLD),
    type = GUIType.CHEST,
      rows = 1
  ) {
    slot(0, 0) {
      item = item(Material.STONE) {
      	name = Component.text("Cool stone!")
      }
    }
  }
}

Hoppers & Dispensers Are Supported

fun hopperGUI(): GUI { 
  return gui(
    plugin = this,
    title = Component.text("Hopper GUI", NamedTextColor.GOLD),
    type = GUIType.HOPPER
  ) {
    slot(0, 0) {
      item = item(Material.CAKE) {
        name = Component.text("Cooler Cake")
      }
    }
  }
}
fun dispenserGUI(): GUI {
  return gui(
    plugin = this,
    title = Component.text("Dispenser GUI", NamedTextColor.GOLD),
    type = GUIType.DISPENSER
  ) {
    slot(0, 0) {
        item = item(Material.CAKE) {
            name = Component.text("Dispensed Cake")
        }
    }
  }
}

You don't need to specify the rows with these types since their rows will stay static.

Skull Support

fun headGUI(): GUI {
  return gui(
    plugin = this,
    title = Component.text("Head GUI", NamedTextColor.GOLD),
    type = GUIType.DiSPENSER
  ) {
    // Middle of the dispenser.
    slot(1, 1) {
      item = item(Material.PLAYER_HEAD) {
        name = Component.text("Your head!", NamedTextColor.RED)
        skullOwner = player
      }
    }
  }
}

We use a Player or OfflinePlayer object to assign the skull owner, this also supports Player Profiles for skulls.

Glowing Items Support

fun glowingHeadGUI(): GUI {
  return gui(
    plugin = this,
    title = Component.text("Glowing Head GUI", NamedTextColor.GOLD),
    type = GUIType.DISPENSER
  ) {
    slot(1, 1) {
      item = item(Material.PLAYER_HEAD) {
        name = Component.text("Your glowing head!", NamedTextColor.GOLD)
        skulOwner = player
        glowing = true
      }
    }
  }
}

You can make items glow in a GUI, it automatically hides the enchantments of the item if you do this as well.

Fill The Border Of Your GUI

fun filledBorderGUI(): GUI {
    return gui(
      plugin = this,
      title = Component.text("Chest GUI", NamedTextColor.GOLD),
      type = GUIType.CHEST,
      rows = 3
    ) {
      fillBorder {
        item = item(Material.GRAY_STAINED_GLASS_PANE) {
          name = Component.text("")
        }
      }
    }
}

This'll automatically outline your GUI with whatever item you put as input.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Kotlin 100.0%