This API helps developer with displaying images on maps.
Find a file
2024-11-07 19:30:20 +01:00
.idea Legacy NMS to 1.21.2/3 2024-11-07 19:30:20 +01:00
API Fixed v1.20(.1), small startup print improvements 2023-07-05 11:33:48 +02:00
Dist Added 1.20.5 support in NMS branch 2024-04-29 16:43:23 +02:00
NMS-v1_12_R1 Added javadoc 2023-07-04 17:47:30 +02:00
NMS-v1_13_R2 Added javadoc 2023-07-04 17:47:30 +02:00
NMS-v1_14_R1 Added javadoc 2023-07-04 17:47:30 +02:00
NMS-v1_15_R1 Added javadoc 2023-07-04 17:47:30 +02:00
NMS-v1_16_R3 Added javadoc 2023-07-04 17:47:30 +02:00
NMS-v1_17_R1 Added javadoc 2023-07-04 17:47:30 +02:00
NMS-v1_18_R2 Added javadoc 2023-07-04 17:47:30 +02:00
NMS-v1_19_R3 Fixed build issue 2023-07-05 19:29:23 +02:00
NMS-v1_20_R2 Bumped legacy NMS branch to 1.20.2 2023-09-22 14:35:41 +02:00
NMS-v1_20_R3 LEGACY: Added v1_20_R3 2023-12-22 20:38:54 +01:00
NMS-v1_20_R4 Legacy NMS to 1.21.2/3 2024-11-07 19:30:20 +01:00
NMS-v1_21_R1 Re-update based on missing commit 2024-06-30 20:33:07 +02:00
NMS-v1_21_R2 Legacy NMS to 1.21.2/3 2024-11-07 19:30:20 +01:00
.gitignore Fixed deploy again (revision problem) 2023-07-05 12:04:21 +02:00
jitpack.yml Added jitpack.yml, because Jitpack picks up wrong version 2022-07-29 15:52:13 +02:00
LICENSE Changed to GNU GPLv3 license 2022-08-19 13:38:45 +02:00
pom.xml Legacy NMS to 1.21.2/3 2024-11-07 19:30:20 +01:00
README.md Bumped README version 2023-07-05 11:54:49 +02:00

MapReflectionAPI

This plugin helps developer with viewing images on maps. It supports Spigot 1.12 - 1.19.

Usage:

First, include the API using Maven:

<repository>
  <id>sbdevelopment-repo-releases</id>
  <name>SBDevelopment Repository</name>
  <url>https://repo.sbdevelopment.tech/releases</url>
</repository>

<dependency>
  <groupId>tech.sbdevelopment</groupId>
  <artifactId>MapReflectionAPI-API</artifactId>
  <version>1.5</version>
  <scope>provided</scope>
</dependency>

Then, use our API. Below is an example.

//--- Wrap image ---
MapWrapper wrapper = MapReflectionAPI.getMapManager().wrapImage(ImageIO.read(new File("image.png")));
MapController controller = wrapper.getController();

final Player p = Bukkit.getPlayer("SBDeveloper");

//--- Add viewer ---
try {
   controller.addViewer(p);
} catch (MapLimitExceededException e) {
   e.printStackTrace();
   return;
}
controller.sendContent(p);

//--- Show in frame ---
ItemFrame frame = ...; //This is your ItemFrame.
controller.showInFrame(p, frame, true);

//--- Or show in hand ---
controller.showInHand(p, true);

It's also possible to split one image onto multiple itemframes. For example using the following code.

BufferedImage leftTopFrame = ...;
BufferedImage leftBottomFrame = ...;
BufferedImage rightTopFrame = ...;
BufferedImage rightBottomFrame = ...;
BufferedImage[][] images = {
    {leftBottomFrame, leftTopFrame},
    {rightBottomFrame, rightTopFrame}
};

//--- Wrap image ---
MultiMapWrapper wrapper = MapReflectionAPI.getMapManager().wrapMultiImage(images);
MultiMapController controller = wrapper.getController();

final Player p = Bukkit.getPlayer("SBDeveloper");

//--- Add viewer ---
try {
   controller.addViewer(p);
} catch (MapLimitExceededException e) {
   e.printStackTrace();
   return;
}
controller.sendContent(p);

//--- Show in frames ---
//These are your itemframes
ItemFrame leftTopFrame = ...;
ItemFrame leftBottomFrame = ...;
ItemFrame rightTopFrame = ...;
ItemFrame rightBottomFrame = ...;
ItemFrame[][] frames = {
    {leftBottomFrame, leftTopFrame},
    {rightBottomFrame, rightTopFrame}
};
controller.showInFrames(p, frames, true);

More information can be found on the JavaDoc.

Credits:

This is a fork of MapManager. It updates the API to 1.19 and uses other dependencies.

This plugin includes classes from BKCommonLib. Please checkout the README in that package for more information.