An easy-to-use Spigot library that implements a GUI interface within offhand maps.
Replace Tag
with the latest version. (Latest version is in the Releases
tab.)
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.byteful:MiniMapGUI:Tag'
}
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.byteful</groupId>
<artifactId>MiniMapGUI</artifactId>
<version>Tag</version>
</dependency>
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();
}
}