Giter Site home page Giter Site logo

minimapgui's Introduction

JitPack Discord

MiniMapGUI

An easy-to-use Spigot library that implements a GUI interface within offhand maps.

Video

YouTube

Maven/Gradle Dependencies

Replace Tag with the latest version. (Latest version is in the Releases tab.)

Gradle

repositories {
  maven { url 'https://jitpack.io' }
}

dependencies {
  implementation 'com.github.byteful:MiniMapGUI:Tag'
}

Maven

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

<dependency>
  <groupId>com.github.byteful</groupId>
  <artifactId>MiniMapGUI</artifactId>
  <version>Tag</version>
</dependency>

Example Usage

public class WarpGUI extends MiniMapGUI {
  private final JavaPlugin plugin;

  public WarpGUI(JavaPlugin plugin, Player player) {
    super(plugin, player);
    this.plugin = plugin;

    wraparoundStages = false;
  }

  @Override
  public void setup() {
    try {
      addStage(
          0,
          SimpleStage.newBuilder()
              .wraparoundOptions(true)
              .addOption(
                  new ImageOption(
                      getPlayer().getWorld(),
                      new URL("someimgurlink.com/image.png"),
                      gui -> {
                        gui.close();
                        gui.getPlayer().teleport(Bukkit.getWorld("world").getSpawnLocation());
                      }))
              .addOption(
                  new ImageOption(
                      getPlayer().getWorld(),
                      new URL("someimgurlink.com/image2.png"),
                      gui -> {
                        gui.close();
                        gui.getPlayer()
                            .teleport(Bukkit.getWorld("world_nether").getSpawnLocation());
                      }))
              .build());
    } catch (MalformedURLException e) {
      e.printStackTrace();
    }
  }

  @Override
  public void onLeftClick(boolean isSneaking, boolean isClickingBlock) {
    if (getCurrentStage() != null) {
      getCurrentStage().nextOption();
      render();
    }
  }

  @Override
  public void onRightClick(boolean isSneaking, boolean isClickingBlock) {
    selectCurrentOption();
  }
}

minimapgui's People

Contributors

byteful avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

minimapgui's Issues

Optimize map rendering and re-use map views.

Map rendering currently is continuously ran. Maybe each MiniMapGUI instance can have its own renderer instead of each option. MapViews are also created and disposed of carelessly. This can clutter up the amount of maps in the server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.