rodepanda / PandaHoloLib

A library to easily create interactive holograms in Spigot.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PandaHoloLib

Latest Build pipeline status

PandaHoloLib is a library which makes it easy to create interactive touchscreen menus for players.

Features

  • Create interactive touch screens for your server.

  • Lots of flexibility, use your own methods for touchscreen interactivity.

  • Built-in support for PlaceHolderAPI and MVdWPlaceholderAPI.

  • Easy to use.

Dependencies

Maven repository

<repositories>
  <repository>
    <id>Rodepanda-repo</id>
    <url>https://nexus.rodepanda.net/repository/maven-public/</url>
  </repository>
</repositories>
<dependencies>
  <dependency>
    <groupId>net.rodepanda</groupId>
    <artifactId>PandaHoloLib</artifactId>
    <version>1.0</version>
  </dependency>
</dependencies>

Getting started

Creating a screen is very easy.

  1. First you create a Page for all your buttons and text.
Page page = new Page();
  1. Next you add a component. In this example we'll put a ButtonComponent in the middle that says "CLICK!" when a player clicks on it.
page.addComponent(new GuiButtonItemComponent(0.5, 0.5, true, "Click me", 0.3, Material.REDSTONE, p -> p.sendMessage("CLICK!") 0, true));
  1. Finally we'll create the actual screen by giving in the player the page the bottomleft corner in vector format, the top right corner in vector format and the update time in ticks.
Screen s = new Screen(player, page, bottomleft, bottomright, 2);
  1. Now the player can finally see his screen. Easy right?

To change the contents of a screen just create a new Page and put it in the new screen.

Holo.getPlayerScreen(p).setSlide(newPage);

You don't need to delete a screen after use, you can just unload it's current slide.

screen.unloadSlide();

Whenever a player logs out the screen will disable itself automatically.

Example code

For a full working example project you can take a look at HoloExample

About

A library to easily create interactive holograms in Spigot.

License:GNU General Public License v3.0


Languages

Language:Java 100.0%