├── README ├── src └── main │ ├── resources │ ├── plugin.yml │ └── config.yml │ ├── assembly │ └── package.xml │ └── java │ └── org │ └── dynmap │ └── essentialsx │ └── DynmapEssentialsXPlugin.java ├── .gitignore ├── pom.xml └── dependency-reduced-pom.xml /README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: Dynmap-EssentialsX 2 | main: org.dynmap.essentialsx.DynmapEssentialsXPlugin 3 | version: "${project.version}" 4 | author: mikeprimm 5 | depend: [ dynmap, Essentials ] 6 | api-version: 1.13 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse stuff 2 | /.classpath 3 | /.project 4 | /.settings 5 | 6 | # netbeans 7 | /nbproject 8 | 9 | # we use maven! 10 | /build.xml 11 | 12 | # maven 13 | /target 14 | 15 | # vim 16 | .*.sw[a-p] 17 | 18 | # various other potential build files 19 | /build 20 | /bin 21 | /dist 22 | /manifest.mf 23 | 24 | # Mac filesystem dust 25 | /.DS_Store -------------------------------------------------------------------------------- /src/main/assembly/package.xml: -------------------------------------------------------------------------------- 1 | 2 | bin 3 | false 4 | 5 | zip 6 | 7 | 8 | 9 | 10 | 11 | ${project.build.directory}/${artifactId}-${version}.jar 12 | / 13 | Dynmap-Essentials.jar 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | # Dynmap-Essentials configuration 2 | # 3 | update: 4 | # Seconds between position updates 5 | period: 300.0 6 | # Seconds between player visibility checks 7 | player-period: 5.0 8 | 9 | layer: 10 | homes: 11 | enable: true 12 | name: "Homes" 13 | # Make home layer hidden by default 14 | hidebydefault: false 15 | # ordering priority in layer menu (low goes before high - default is 0) 16 | layerprio: 20 17 | # (optional) set minimum zoom level when mob icons should be visible (0=default, any zoom) 18 | minzoom: 0 19 | # Default icon for home markers 20 | deficon: house 21 | # Label format - substitute %name% for player's name 22 | labelfmt: "%player%'s %name% (home)" 23 | # (optional) List of visible homes (by user ID) - if non-empty, only these will be shown. 24 | # For homes other that the default for a user, the ID is ':' 25 | # To show all homes on a given world, include "world:" in the string list 26 | visiblemarkers: [] 27 | # (optional) List of hidden homes (by user ID) 28 | # For homes other that the default for a user, the ID is ':' 29 | # To hide all homes on a given world, include "world:" in the string list 30 | hiddenmarkers: [] 31 | # (optional) If set to true, only show homes of online players 32 | online-only: false 33 | warps: 34 | enable: true 35 | name: "Warps" 36 | # Make warp layer hidden by default 37 | hidebydefault: false 38 | # ordering priority in layer menu (low goes before high - default is 0) 39 | layerprio: 21 40 | # (optional) set minimum zoom level when mob icons should be visible (0=default, any zoom) 41 | minzoom: 0 42 | # Default icon for warp markers 43 | deficon: portal 44 | # Label format - substitute %name% for warp's name 45 | labelfmt: "[%name%]" 46 | # (optional) List of visible warps (by warp ID) - if non-empty, only these will be shown. 47 | # To show all warps on a given world, include "world:" in the string list 48 | visiblemarkers: [] 49 | # (optional) List of hidden warps (by warp ID) 50 | # To hide all warps on a given world, include "world:" in the string list 51 | hiddenmarkers: [] 52 | 53 | # Hide player on dynmap when hidden by Essentials 54 | hide-when-hidden: true 55 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | us.dynmap 4 | Dynmap-EssentialsX 5 | 1.1-SNAPSHOT 6 | 7 | 8 | 9 | src/main/resources 10 | true 11 | 12 | *.yml 13 | *.txt 14 | 15 | 16 | 17 | src/main/resources 18 | false 19 | 20 | *.yml 21 | *.txt 22 | 23 | 24 | 25 | 26 | 27 | org.apache.maven.plugins 28 | maven-compiler-plugin 29 | 2.0.2 30 | 31 | 1.8 32 | 1.8 33 | 34 | 35 | 36 | org.apache.maven.plugins 37 | maven-shade-plugin 38 | 3.2.1 39 | 40 | 41 | 42 | org.bstats 43 | org.dynmap.essentials.bstats 44 | 45 | 46 | 47 | 48 | 49 | package 50 | 51 | shade 52 | 53 | 54 | true 55 | 56 | 57 | org.bstats:bstats-bukkit 58 | 59 | ** 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | spigot-repo 72 | https://hub.spigotmc.org/nexus/content/repositories/snapshots/ 73 | 74 | 75 | 76 | 77 | dynmap-repo 78 | https://repo.mikeprimm.com/ 79 | 80 | 81 | 82 | 83 | essentials 84 | https://repo.essentialsx.net/releases/ 85 | 86 | 87 | 88 | 89 | 90 | us.dynmap 91 | dynmap-api 92 | 3.3 93 | provided 94 | 95 | 96 | net.essentialsx 97 | EssentialsX 98 | 2.19.2 99 | provided 100 | 101 | 102 | org.bstats 103 | bstats-bukkit 104 | 2.2.1 105 | compile 106 | 107 | 108 | 109 | UTF-8 110 | 111 | 112 | -------------------------------------------------------------------------------- /dependency-reduced-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | us.dynmap 5 | Dynmap-EssentialsX 6 | 1.0-SNAPSHOT 7 | 8 | 9 | 10 | true 11 | src/main/resources 12 | 13 | *.yml 14 | *.txt 15 | 16 | 17 | 18 | src/main/resources 19 | 20 | *.yml 21 | *.txt 22 | 23 | 24 | 25 | 26 | 27 | maven-compiler-plugin 28 | 2.0.2 29 | 30 | 1.8 31 | 1.8 32 | 33 | 34 | 35 | maven-shade-plugin 36 | 3.2.1 37 | 38 | 39 | package 40 | 41 | shade 42 | 43 | 44 | true 45 | 46 | 47 | org.bstats:bstats-bukkit 48 | 49 | ** 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.bstats 60 | org.dynmap.essentials.bstats 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | spigot-repo 70 | https://hub.spigotmc.org/nexus/content/repositories/snapshots/ 71 | 72 | 73 | 74 | 75 | dynmap-repo 76 | https://repo.mikeprimm.com/ 77 | 78 | 79 | 80 | 81 | essentials 82 | https://repo.essentialsx.net/releases/ 83 | 84 | 85 | 86 | 87 | us.dynmap 88 | dynmap-api 89 | 3.3-SNAPSHOT 90 | provided 91 | 92 | 93 | bukkit 94 | org.bukkit 95 | 96 | 97 | DynmapCoreAPI 98 | us.dynmap 99 | 100 | 101 | 102 | 103 | net.essentialsx 104 | EssentialsX 105 | 2.19.2 106 | provided 107 | 108 | 109 | paperlib 110 | io.papermc 111 | 112 | 113 | BaseProviders 114 | net.essentialsx 115 | 116 | 117 | PaperProvider 118 | net.essentialsx 119 | 120 | 121 | NMSReflectionProvider 122 | net.essentialsx 123 | 124 | 125 | 1_8Provider 126 | net.essentialsx 127 | 128 | 129 | 1_12Provider 130 | net.essentialsx 131 | 132 | 133 | spigot-api 134 | org.spigotmc 135 | 136 | 137 | configurate-yaml 138 | org.spongepowered 139 | 140 | 141 | checker-qual 142 | org.checkerframework 143 | 144 | 145 | 146 | 147 | 148 | UTF-8 149 | 150 | 151 | -------------------------------------------------------------------------------- /src/main/java/org/dynmap/essentialsx/DynmapEssentialsXPlugin.java: -------------------------------------------------------------------------------- 1 | package org.dynmap.essentialsx; 2 | 3 | import java.io.IOException; 4 | import java.util.Collection; 5 | import java.util.HashMap; 6 | import java.util.HashSet; 7 | import java.util.List; 8 | import java.util.Map; 9 | import java.util.Set; 10 | import java.util.UUID; 11 | import java.util.logging.Level; 12 | import java.util.logging.Logger; 13 | 14 | import org.bstats.bukkit.Metrics; 15 | import org.bukkit.Location; 16 | import org.bukkit.Server; 17 | import org.bukkit.configuration.file.FileConfiguration; 18 | import org.bukkit.entity.Player; 19 | import org.bukkit.event.EventHandler; 20 | import org.bukkit.event.EventPriority; 21 | import org.bukkit.event.Listener; 22 | import org.bukkit.event.player.PlayerJoinEvent; 23 | import org.bukkit.event.player.PlayerQuitEvent; 24 | import org.bukkit.event.server.PluginEnableEvent; 25 | import org.bukkit.plugin.java.JavaPlugin; 26 | import org.bukkit.plugin.Plugin; 27 | import org.bukkit.plugin.PluginManager; 28 | import org.dynmap.DynmapAPI; 29 | import org.dynmap.DynmapWebChatEvent; 30 | import org.dynmap.markers.MarkerAPI; 31 | import org.dynmap.markers.MarkerIcon; 32 | import org.dynmap.markers.MarkerSet; 33 | import org.dynmap.markers.Marker; 34 | 35 | import com.earth2me.essentials.Essentials; 36 | import com.earth2me.essentials.User; 37 | import com.earth2me.essentials.UserMap; 38 | import com.earth2me.essentials.Warps; 39 | 40 | public class DynmapEssentialsXPlugin extends JavaPlugin { 41 | private static Logger log; 42 | 43 | Plugin dynmap; 44 | DynmapAPI api; 45 | MarkerAPI markerapi; 46 | Essentials essentials; 47 | Warps warps; 48 | UserMap users; 49 | boolean reload = false; 50 | private boolean essentials_uses_uuids = false; 51 | 52 | FileConfiguration cfg; 53 | 54 | @Override 55 | public void onLoad() { 56 | log = this.getLogger(); 57 | } 58 | 59 | private abstract class Layer { 60 | MarkerSet set; 61 | MarkerIcon deficon; 62 | String labelfmt; 63 | Set visible; 64 | Set hidden; 65 | Map markers = new HashMap(); 66 | 67 | public Layer(String id, FileConfiguration cfg, String deflabel, String deficon, String deflabelfmt) { 68 | set = markerapi.getMarkerSet("essentials." + id); 69 | if (set == null) 70 | set = markerapi.createMarkerSet("essentials." + id, cfg.getString("layer." + id + ".name", deflabel), 71 | null, false); 72 | else 73 | set.setMarkerSetLabel(cfg.getString("layer." + id + ".name", deflabel)); 74 | if (set == null) { 75 | severe("Error creating " + deflabel + " marker set"); 76 | return; 77 | } 78 | set.setLayerPriority(cfg.getInt("layer." + id + ".layerprio", 10)); 79 | set.setHideByDefault(cfg.getBoolean("layer." + id + ".hidebydefault", false)); 80 | int minzoom = cfg.getInt("layer." + id + ".minzoom", 0); 81 | if (minzoom > 0) /* Don't call if non-default - lets us work with pre-0.28 dynmap */ 82 | set.setMinZoom(minzoom); 83 | String icon = cfg.getString("layer." + id + ".deficon", deficon); 84 | this.deficon = markerapi.getMarkerIcon(icon); 85 | if (this.deficon == null) { 86 | info("Unable to load default icon '" + icon + "' - using default '" + deficon + "'"); 87 | this.deficon = markerapi.getMarkerIcon(deficon); 88 | } 89 | labelfmt = cfg.getString("layer." + id + ".labelfmt", deflabelfmt); 90 | List lst = cfg.getStringList("layer." + id + ".visiblemarkers"); 91 | if (lst != null) 92 | visible = new HashSet(lst); 93 | lst = cfg.getStringList("layer." + id + ".hiddenmarkers"); 94 | if (lst != null) 95 | hidden = new HashSet(lst); 96 | } 97 | 98 | void cleanup() { 99 | if (set != null) { 100 | set.deleteMarkerSet(); 101 | set = null; 102 | } 103 | markers.clear(); 104 | } 105 | 106 | boolean isVisible(String id, String wname) { 107 | if ((visible != null) && (visible.isEmpty() == false)) { 108 | if ((visible.contains(id) == false) && (visible.contains("world:" + wname) == false)) 109 | return false; 110 | } 111 | if ((hidden != null) && (hidden.isEmpty() == false)) { 112 | if (hidden.contains(id) || hidden.contains("world:" + wname)) 113 | return false; 114 | } 115 | return true; 116 | } 117 | 118 | void updateMarkerSet() { 119 | Map newmap = new HashMap(); /* Build new map */ 120 | 121 | Map marks = getMarkers(); 122 | for (String name : marks.keySet()) { 123 | Location loc = marks.get(name); 124 | 125 | String wname = loc.getWorld().getName(); 126 | /* Skip if not visible */ 127 | if (isVisible(name, wname) == false) 128 | continue; 129 | /* Get location */ 130 | String id = wname + "/" + name; 131 | 132 | /* Separate player name and home/warp name */ 133 | int separation = name.indexOf(":"); 134 | String playername = separation < 0 ? "" : name.substring(0, separation); 135 | String pointname = separation < 0 ? name : name.substring(separation + 1); 136 | 137 | String label = labelfmt.replace("%player%", playername).replace("%name%", pointname); 138 | 139 | /* See if we already have marker */ 140 | Marker m = markers.remove(id); 141 | if (m == null) { /* Not found? Need new one */ 142 | m = set.createMarker(id, label, wname, loc.getX(), loc.getY(), loc.getZ(), deficon, false); 143 | } else { /* Else, update position if needed */ 144 | m.setLocation(wname, loc.getX(), loc.getY(), loc.getZ()); 145 | m.setLabel(label); 146 | m.setMarkerIcon(deficon); 147 | } 148 | newmap.put(id, m); /* Add to new map */ 149 | } 150 | /* Now, review old map - anything left is gone */ 151 | for (Marker oldm : markers.values()) { 152 | oldm.deleteMarker(); 153 | } 154 | /* And replace with new map */ 155 | markers.clear(); 156 | markers = newmap; 157 | } 158 | 159 | /* Get current markers, by ID with location */ 160 | public abstract Map getMarkers(); 161 | } 162 | 163 | private class WarpsLayer extends Layer { 164 | 165 | public WarpsLayer(FileConfiguration cfg, String fmt) { 166 | super("warps", cfg, "Warps", "portal", fmt); 167 | } 168 | 169 | /* Get current markers, by ID with location */ 170 | public Map getMarkers() { 171 | HashMap map = new HashMap(); 172 | if (warps != null) { 173 | Collection wn = warps.getList(); 174 | for (String n : wn) { 175 | Location loc; 176 | try { 177 | loc = warps.getWarp(n); 178 | if (loc != null) { 179 | map.put(n, loc); 180 | } 181 | } catch (Exception x) { 182 | } 183 | } 184 | } 185 | return map; 186 | } 187 | } 188 | 189 | private class OurPlayerListener implements Listener, Runnable { 190 | @EventHandler(priority = EventPriority.MONITOR) 191 | public void onPlayerJoin(PlayerJoinEvent event) { 192 | getServer().getScheduler().scheduleSyncDelayedTask(DynmapEssentialsXPlugin.this, this, 10); 193 | } 194 | 195 | @EventHandler(priority = EventPriority.MONITOR) 196 | public void onPlayerQuit(PlayerQuitEvent event) { 197 | getServer().getScheduler().scheduleSyncDelayedTask(DynmapEssentialsXPlugin.this, this, 10); 198 | } 199 | 200 | public void run() { 201 | if ((!stop) && (users != null)) { 202 | homelayer.updateMarkerSet(); 203 | } 204 | } 205 | } 206 | 207 | private class HomesLayer extends Layer { 208 | boolean online_only; 209 | 210 | public HomesLayer(FileConfiguration cfg, String fmt) { 211 | super("homes", cfg, "Homes", "house", fmt); 212 | online_only = cfg.getBoolean("layer.homes.online-only", false); 213 | if (online_only) { 214 | OurPlayerListener lsnr = new OurPlayerListener(); 215 | 216 | getServer().getPluginManager().registerEvents(lsnr, DynmapEssentialsXPlugin.this); 217 | } 218 | } 219 | 220 | private User getByUUID(Server srv, UUID uid) { 221 | /* If online only, and not online, skip */ 222 | if (online_only && (srv.getPlayer(uid) == null)) 223 | return null; 224 | return users.getUser((UUID) uid); 225 | } 226 | 227 | private User getByName(Server srv, String uid) { 228 | /* If online only, and not online, skip */ 229 | if (online_only && (srv.getPlayer(uid) == null)) 230 | return null; 231 | return users.getUser(uid); 232 | } 233 | 234 | private Set getAllUIDs(Server srv) { 235 | if (online_only) { 236 | Collection p = srv.getOnlinePlayers(); 237 | if (essentials_uses_uuids) { 238 | Set rslt = new HashSet(); 239 | for (Player pp : p) { 240 | rslt.add(pp.getUniqueId()); 241 | } 242 | return rslt; 243 | } else { 244 | Set rslt = new HashSet(); 245 | for (Player pp : p) { 246 | rslt.add(pp.getName()); 247 | } 248 | return rslt; 249 | } 250 | } else { 251 | return users.getAllUniqueUsers(); 252 | } 253 | } 254 | 255 | /* Get current markers, by ID with location */ 256 | public Map getMarkers() { 257 | HashMap map = new HashMap(); 258 | if (users != null) { 259 | Set uids = users.getAllUniqueUsers(); 260 | Server srv = getServer(); 261 | 262 | for (Object uid : uids) { 263 | User u; 264 | if (uid instanceof UUID) { 265 | essentials_uses_uuids = true; 266 | u = getByUUID(srv, (UUID) uid); 267 | } else { 268 | essentials_uses_uuids = false; 269 | u = getByName(srv, (String) uid); 270 | } 271 | if (u == null) 272 | continue; 273 | List homes = u.getHomes(); 274 | if (homes == null) 275 | continue; 276 | for (String home : homes) { 277 | try { 278 | Location loc = u.getHome(home); 279 | if (loc != null) { 280 | map.put(u.getName() + ":" + home, loc); 281 | } 282 | } catch (Exception x) { 283 | } 284 | } 285 | } 286 | } 287 | return map; 288 | } 289 | } 290 | 291 | /* Homes layer settings */ 292 | private Layer homelayer; 293 | 294 | /* Warps layer settings */ 295 | private Layer warplayer; 296 | 297 | long updperiod; 298 | long playerupdperiod; 299 | boolean stop; 300 | 301 | public static void info(String msg) { 302 | log.log(Level.INFO, msg); 303 | } 304 | 305 | public static void severe(String msg) { 306 | log.log(Level.SEVERE, msg); 307 | } 308 | 309 | private class MarkerUpdate implements Runnable { 310 | public void run() { 311 | if (!stop) 312 | updateMarkers(); 313 | } 314 | } 315 | 316 | private class PlayerUpdate implements Runnable { 317 | public void run() { 318 | if (!stop) { 319 | updatePlayers(); 320 | getServer().getScheduler().scheduleSyncDelayedTask(DynmapEssentialsXPlugin.this, this, playerupdperiod); 321 | } 322 | } 323 | } 324 | 325 | /* Update mob population and position */ 326 | private void updateMarkers() { 327 | if (users != null) { 328 | homelayer.updateMarkerSet(); 329 | } 330 | if (warps != null) { 331 | warplayer.updateMarkerSet(); 332 | } 333 | getServer().getScheduler().scheduleSyncDelayedTask(this, new MarkerUpdate(), updperiod); 334 | } 335 | 336 | private Set hiddenasserts = new HashSet(); 337 | 338 | private void updatePlayers() { 339 | if (users != null) { 340 | List vanished = essentials.getVanishedPlayers(); 341 | HashSet newasserts = new HashSet(); 342 | for (String van : vanished) { 343 | if (hiddenasserts.contains(van) == false) { 344 | api.assertPlayerInvisibility(van, true, "Dynmap-Essentials"); 345 | } 346 | newasserts.add(van); 347 | hiddenasserts.remove(van); /* Remove from previous */ 348 | } 349 | for (String id : hiddenasserts) { /* What is no longer asserted? */ 350 | api.assertPlayerInvisibility(id, false, "Dynmap-Essentials"); 351 | } 352 | hiddenasserts = newasserts; 353 | } 354 | } 355 | 356 | private class OurServerListener implements Listener { 357 | @EventHandler 358 | public void onPluginEnable(PluginEnableEvent event) { 359 | Plugin p = event.getPlugin(); 360 | String name = p.getDescription().getName(); 361 | if (name.equals("dynmap") || name.equals("Essentials")) { 362 | if (dynmap.isEnabled() && essentials.isEnabled()) 363 | activate(); 364 | } 365 | } 366 | 367 | @EventHandler(priority = EventPriority.MONITOR) 368 | public void onPlayerJoin(PlayerJoinEvent event) { 369 | if (playerupdperiod > 0) 370 | updatePlayers(); 371 | } 372 | 373 | @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) 374 | public void onDynmapWebChat(DynmapWebChatEvent evt) { 375 | String name = evt.getName(); // Get player name 376 | if ((users != null) && (name != null)) { 377 | User u = users.getUser(name); 378 | if ((u != null) && (u.isMuted() || u.getBase().isBanned())) { 379 | evt.setCancelled(true); 380 | } 381 | } 382 | } 383 | } 384 | 385 | private Metrics metrics; 386 | 387 | public void onEnable() { 388 | info("initializing"); 389 | PluginManager pm = getServer().getPluginManager(); 390 | /* Get dynmap */ 391 | dynmap = pm.getPlugin("dynmap"); 392 | if (dynmap == null) { 393 | severe("Cannot find dynmap!"); 394 | return; 395 | } 396 | api = (DynmapAPI) dynmap; /* Get API */ 397 | /* Get Essentials */ 398 | Plugin p = pm.getPlugin("Essentials"); 399 | if (p == null) { 400 | severe("Cannot find Essentials!"); 401 | return; 402 | } 403 | essentials = (Essentials) p; 404 | 405 | getServer().getPluginManager().registerEvents(new OurServerListener(), this); 406 | 407 | /* If both enabled, activate */ 408 | if (dynmap.isEnabled() && essentials.isEnabled()) 409 | activate(); 410 | 411 | metrics = new Metrics(this, 14164); 412 | } 413 | 414 | private void activate() { 415 | /* Now, get markers API */ 416 | markerapi = api.getMarkerAPI(); 417 | if (markerapi == null) { 418 | severe("Error loading Dynmap marker API!"); 419 | return; 420 | } 421 | /* Now, get essentials Warp API */ 422 | warps = essentials.getWarps(); 423 | /* Get essentials user data API */ 424 | users = essentials.getUserMap(); 425 | 426 | /* If not found, signal disabled */ 427 | if (warps == null) 428 | info("Essentials Warps not found - support disabled"); 429 | /* If not found, signal disabled */ 430 | if (users == null) 431 | info("Essentials Homes not found - support disabled"); 432 | 433 | /* Load configuration */ 434 | if (reload) { 435 | reloadConfig(); 436 | if (homelayer != null) { 437 | if (homelayer.set != null) { 438 | homelayer.set.deleteMarkerSet(); 439 | homelayer.set = null; 440 | } 441 | homelayer = null; 442 | } 443 | if (warplayer != null) { 444 | if (warplayer.set != null) { 445 | warplayer.set.deleteMarkerSet(); 446 | warplayer.set = null; 447 | } 448 | warplayer = null; 449 | } 450 | } else { 451 | reload = true; 452 | } 453 | FileConfiguration cfg = getConfig(); 454 | cfg.options().copyDefaults(true); /* Load defaults, if needed */ 455 | this.saveConfig(); /* Save updates, if needed */ 456 | 457 | /* Check which is enabled */ 458 | if (cfg.getBoolean("layer.homes.enable", true) == false) 459 | users = null; 460 | if (cfg.getBoolean("layer.warps.enable", true) == false) 461 | warps = null; 462 | 463 | /* Now, add marker set for homes */ 464 | if (users != null) 465 | homelayer = new HomesLayer(cfg, "%player%'s %name% (home)"); 466 | /* Now, add marker set for warps */ 467 | if (warps != null) 468 | warplayer = new WarpsLayer(cfg, "[%name%]"); 469 | 470 | /* Set up update job - based on period */ 471 | double per = cfg.getDouble("update.period", 5.0); 472 | if (per < 2.0) 473 | per = 2.0; 474 | updperiod = (long) (per * 20.0); 475 | stop = false; 476 | getServer().getScheduler().scheduleSyncDelayedTask(this, new MarkerUpdate(), 5 * 20); 477 | 478 | /* If hide when hidden */ 479 | if (cfg.getBoolean("hide-when-hidden", true)) { 480 | /* Set up player update job - based on period */ 481 | per = cfg.getDouble("update.player-period", 5.0); 482 | if (per < 2.0) 483 | per = 2.0; 484 | playerupdperiod = (long) (per * 20.0); 485 | getServer().getScheduler().scheduleSyncDelayedTask(this, new PlayerUpdate(), 5 * 20); 486 | } else { 487 | playerupdperiod = 0; 488 | } 489 | 490 | info("version " + this.getDescription().getVersion() + " is activated"); 491 | } 492 | 493 | public void onDisable() { 494 | if (homelayer != null) { 495 | homelayer.cleanup(); 496 | homelayer = null; 497 | } 498 | if (warplayer != null) { 499 | warplayer.cleanup(); 500 | warplayer = null; 501 | } 502 | stop = true; 503 | } 504 | 505 | } 506 | --------------------------------------------------------------------------------