From 51fdc80542e060647dfcc929310ecfafc0ddb87c Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Thu, 8 Jul 2021 07:49:39 -0700 Subject: [PATCH] pl3xmap: use lantern icons for region posts --- .../java/us/camin/regions/Pl3xMapRelay.java | 31 +++++++++++++----- src/main/resources/lantern.png | Bin 0 -> 1902 bytes 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/lantern.png diff --git a/src/main/java/us/camin/regions/Pl3xMapRelay.java b/src/main/java/us/camin/regions/Pl3xMapRelay.java index 83ce267..02b67e9 100644 --- a/src/main/java/us/camin/regions/Pl3xMapRelay.java +++ b/src/main/java/us/camin/regions/Pl3xMapRelay.java @@ -33,6 +33,10 @@ import net.pl3x.map.api.marker.Icon; import java.util.ArrayList; import java.util.Collection; import java.util.Optional; +import java.io.File; +import java.awt.image.BufferedImage; +import javax.imageio.ImageIO; +import java.io.IOException; import org.bukkit.World; import org.bukkit.Color; @@ -53,6 +57,20 @@ public class Pl3xMapRelay implements Listener { } if (isEnabled()) { + + File file = new File(m_plugin.getDataFolder(), "lantern.png"); + if (!file.exists()) { + m_plugin.saveResource("lantern.png", false); + } + + Key key = Key.of("lantern"); + try { + BufferedImage image = ImageIO.read(file); + Pl3xMapProvider.get().iconRegistry().register(key, image); + } catch (IOException e) { + //Logger.log().log(Level.WARNING, "Failed to register signs icon", e); + } + for(World world : m_plugin.getServer().getWorlds()) { Optional opt = m_map.getWorldIfEnabled(world); opt.ifPresent((MapWorld mapWorld) -> { @@ -95,28 +113,25 @@ public class Pl3xMapRelay implements Listener { int size = 32; String clickTooltip = "

" + region.name() + "

"; clickTooltip += ""; - marker = Marker.circle(point, size); + Key imageKey = Key.of("lantern"); + Marker marker = Marker.icon(point, imageKey, size); marker.markerOptions(MarkerOptions.builder() .hoverTooltip(region.name()) - .clickTooltip(clickTooltip) - .strokeColor(awtColor) - .strokeOpacity(0.8)); + .clickTooltip(clickTooltip)); markers.add(marker); } diff --git a/src/main/resources/lantern.png b/src/main/resources/lantern.png new file mode 100644 index 0000000000000000000000000000000000000000..56c4a90299893b09e3b32d23bb1cbfeb7b7a6181 GIT binary patch literal 1902 zcmV-!2a))RP)WFU8GbZ8()Nlj2>E@cM*00z=YL_t(o!>yM|j9pg| zhQBl2`{tnsx8o_s>ez9}B%&aP1c`(=AR!>L*dk@cf(<(s3=#r?gaj)VNFXst zAp#^E1QEnIk>kX%9oz8`+ui;8x!-W-bBaZqD1tbC?NHlus_v(%I`!98Y{4FQ=`EzfewZU4~ zI(zD0ek(D}ESC;{{wvD|?>+RBG#x)tWQkQu)1BK!v(+VvV=laX248s=w(Yp*!H1uC zc+c{^ubeym>e`0}`1oU=YwrK(p&y12e&!|IQ{<@)!DFqX(d=N1LnJUlE*`*skl%?Se`+FtJ-GV*M3Pf1T9IZ}_om8Op?1RWT%fdn%+qCF@gK}lU zfo{&C8nL%J$1BqXP83b@qQHx=+ih@neZs!^CiU15Q0RW0p4HeO=&M7*mL{Q5D5J5F z#VobZa}C0^F>ahOXA&NCm(V`qVu-2xA={OwX9AiAsuN@9nxGVtRZw~410?5t0aV=) z9hk>d3Tz!khTYSr6&u67u%beb4_SCRLi2)$B-Ad zDMkVW54Mk9x(De`5o?jlBb?E=dW-{X;W0)d7RYzJIDBA+5q12tA8t-O4_%K@r%4te=-4N39 z#=}&w1%??BglAvi#QsnJxNHatC=TO>j z&e->TItr9VCIulm1<4qfj2H*as%kSsv0j8?X>v@YGos4-TtN85RfSz8*Pyde3 z1El%;LWF67l z1%B>*`NdPOAN}o?*Yd|6|I$I=%fK@}a90)JK(F8qHDGx8GI^1)UT9pmPwM(y92=Ad zt#}LgCGgYZ$Bvx2?f-)Jfb0jJ2EGx5uK1Fu7$Dh*VWFsO18rk8vI2Y?_|5TSM^4WY zdnSMz5E^Iz&v{>dvnUdkXDLOIVT|+6#orQ<9{|JS$Bu+q