From 724c3ff426dabdb7631de4807a2c4fec0bdca535 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 26 Jan 2014 14:00:17 +0100 Subject: [PATCH] Fix loading of existing gate icon. --- src/de/craftinc/gates/dynmap/Plugin.java | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/de/craftinc/gates/dynmap/Plugin.java b/src/de/craftinc/gates/dynmap/Plugin.java index 5f68d9d..869a04a 100644 --- a/src/de/craftinc/gates/dynmap/Plugin.java +++ b/src/de/craftinc/gates/dynmap/Plugin.java @@ -93,17 +93,21 @@ public class Plugin extends JavaPlugin private void loadIcons() { - InputStream inputStream = this.getClass().getResourceAsStream("/gate.png"); - - if (inputStream == null) { - log(Level.SEVERE, "Cannot load gate icon (missing resource)"); - return; - } - - this.gateIcon = this.markerAPI.createMarkerIcon(markerIconID, markerIconLabel, inputStream); + this.gateIcon = this.markerAPI.getMarkerIcon(markerSetID); if (this.gateIcon == null) { - log(Level.SEVERE, "Cannot load gate icon"); + InputStream inputStream = this.getClass().getResourceAsStream("/gate.png"); + + if (inputStream == null) { + log(Level.SEVERE, "Cannot load gate icon (missing resource)"); + return; + } + + this.gateIcon = this.markerAPI.createMarkerIcon(markerIconID, markerIconLabel, inputStream); + + if (this.gateIcon == null) { + log(Level.SEVERE, "Cannot load gate icon"); + } } } @@ -124,6 +128,11 @@ public class Plugin extends JavaPlugin List allGates = this.gatesPlugin.getGatesManager().allGates(); for (Gate g : allGates) { + + if (g.getLocation() == null) { + continue; + } + String id = g.getId(); String label = g.getId(); boolean markup = false;