final ftw!
This commit is contained in:
parent
bf60f6702d
commit
6e8670c64c
@ -54,7 +54,7 @@ public class GateMarkerUtil
|
|||||||
this.gateIcon = this.markerAPI.getMarkerIcon(markerIconID);
|
this.gateIcon = this.markerAPI.getMarkerIcon(markerIconID);
|
||||||
|
|
||||||
if (this.gateIcon == null) {
|
if (this.gateIcon == null) {
|
||||||
InputStream inputStream = this.getClass().getResourceAsStream("/gate.png");
|
final InputStream inputStream = this.getClass().getResourceAsStream("/gate.png");
|
||||||
|
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
Logger.log(Level.SEVERE, "Cannot load gate icon (missing resource)");
|
Logger.log(Level.SEVERE, "Cannot load gate icon (missing resource)");
|
||||||
@ -81,7 +81,7 @@ public class GateMarkerUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected String getGateHTMLDescription(Gate gate)
|
protected String getGateHTMLDescription(final Gate gate)
|
||||||
{
|
{
|
||||||
final String gateId = "<div class=\"infowindow\"><h2>";
|
final String gateId = "<div class=\"infowindow\"><h2>";
|
||||||
final String open = "</h2><p>This gate is <span style=\"font-weight:bold;\">";
|
final String open = "</h2><p>This gate is <span style=\"font-weight:bold;\">";
|
||||||
@ -121,23 +121,23 @@ public class GateMarkerUtil
|
|||||||
return infoString;
|
return infoString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMarker(Gate gate)
|
public void addMarker(final Gate gate)
|
||||||
{
|
{
|
||||||
if (gate.getLocation() == null) {
|
if (gate.getLocation() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String id = gate.getId();
|
final String id = gate.getId();
|
||||||
String label = gate.getId();
|
final String label = gate.getId();
|
||||||
Location l = gate.getLocation();
|
final Location l = gate.getLocation();
|
||||||
MarkerIcon icon = this.gateIcon;
|
final MarkerIcon icon = this.gateIcon;
|
||||||
|
|
||||||
final Marker marker = this.markerSet.createMarker(id, label, false, l.getWorld().getName(), l.getX(), l.getY(), l.getZ(), icon, false);
|
final Marker marker = this.markerSet.createMarker(id, label, false, l.getWorld().getName(), l.getX(), l.getY(), l.getZ(), icon, false);
|
||||||
marker.setDescription(this.getGateHTMLDescription(gate));
|
marker.setDescription(this.getGateHTMLDescription(gate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateMarker(Gate gate, String oldID)
|
public void updateMarker(final Gate gate, final String oldID)
|
||||||
{
|
{
|
||||||
Marker m = this.markerSet.findMarker(gate.getId());
|
Marker m = this.markerSet.findMarker(gate.getId());
|
||||||
|
|
||||||
@ -153,16 +153,16 @@ public class GateMarkerUtil
|
|||||||
this.removeMarker(gate);
|
this.removeMarker(gate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Location l = gate.getLocation();
|
final Location l = gate.getLocation();
|
||||||
m.setLocation(l.getWorld().getName(), l.getX(), l.getY(), l.getZ());
|
m.setLocation(l.getWorld().getName(), l.getX(), l.getY(), l.getZ());
|
||||||
m.setDescription(this.getGateHTMLDescription(gate));
|
m.setDescription(this.getGateHTMLDescription(gate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void removeMarker(Gate gate)
|
public void removeMarker(final Gate gate)
|
||||||
{
|
{
|
||||||
Marker m = this.markerSet.findMarker(gate.getId());
|
final Marker m = this.markerSet.findMarker(gate.getId());
|
||||||
m.deleteMarker();
|
m.deleteMarker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,13 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class Logger
|
public class Logger
|
||||||
{
|
{
|
||||||
public static void log(String msg)
|
public static void log(final String msg)
|
||||||
{
|
{
|
||||||
log(Level.INFO, msg);
|
log(Level.INFO, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void log(Level level, String msg)
|
public static void log(final Level level, final String msg)
|
||||||
{
|
{
|
||||||
java.util.logging.Logger.getLogger("Minecraft").log(level, "["+Plugin.getPlugin().getDescription().getFullName()+"] "+msg);
|
java.util.logging.Logger.getLogger("Minecraft").log(level, "["+Plugin.getPlugin().getDescription().getFullName()+"] "+msg);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ public class Plugin extends JavaPlugin implements GateChangeListener
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void gateChangedHandler(Gate gate, Map<String, Object> stringObjectMap)
|
public void gateChangedHandler(final Gate gate, final Map<String, Object> stringObjectMap)
|
||||||
{
|
{
|
||||||
String oldID = (String)stringObjectMap.get(GateChangeListener.changedID);
|
String oldID = (String)stringObjectMap.get(GateChangeListener.changedID);
|
||||||
this.markerUtil.updateMarker(gate, oldID);
|
this.markerUtil.updateMarker(gate, oldID);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user