From 2f22560f3d3aef933f9eab4282569882c40705e1 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Mon, 13 Jun 2011 22:05:14 -0500 Subject: [PATCH] Clean up warnings --- src/main/java/org/dynmap/ClientComponent.java | 2 ++ src/main/java/org/dynmap/ConfigurationNode.java | 5 +++++ src/main/java/org/dynmap/Events.java | 3 +++ src/main/java/org/dynmap/JSONUtils.java | 3 +++ .../java/org/dynmap/JsonFileClientUpdateComponent.java | 1 + src/main/java/org/dynmap/MapChunkCache.java | 2 ++ src/main/java/org/dynmap/flat/FlatMap.java | 4 ---- src/main/java/org/dynmap/herochat/HeroChatHandler.java | 4 +++- src/main/java/org/dynmap/kzedmap/KzedMap.java | 1 - src/main/java/org/dynmap/kzedmap/KzedMapTile.java | 2 -- .../java/org/dynmap/kzedmap/KzedZoomedMapTile.java | 1 - .../web/handlers/ClientConfigurationHandler.java | 2 -- .../org/dynmap/web/handlers/ClientUpdateHandler.java | 10 ---------- src/main/java/org/dynmap/web/handlers/FileHandler.java | 1 - 14 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/dynmap/ClientComponent.java b/src/main/java/org/dynmap/ClientComponent.java index 112bf5ea..8d006976 100644 --- a/src/main/java/org/dynmap/ClientComponent.java +++ b/src/main/java/org/dynmap/ClientComponent.java @@ -39,6 +39,7 @@ public class ClientComponent extends Component { return o; } + @SuppressWarnings("unchecked") protected static final JSONArray convertList(List l) { JSONArray o = new JSONArray(); for(Object entry : l) { @@ -47,6 +48,7 @@ public class ClientComponent extends Component { return o; } + @SuppressWarnings("unchecked") protected static final Object convert(Object o) { if (o instanceof Map) { return convertMap((Map)o); diff --git a/src/main/java/org/dynmap/ConfigurationNode.java b/src/main/java/org/dynmap/ConfigurationNode.java index eb50106c..8e4bb87e 100644 --- a/src/main/java/org/dynmap/ConfigurationNode.java +++ b/src/main/java/org/dynmap/ConfigurationNode.java @@ -29,6 +29,7 @@ public class ConfigurationNode implements Map { entries = map; } + @SuppressWarnings("unchecked") public Object getObject(String path) { if (path.isEmpty()) return entries; @@ -60,6 +61,7 @@ public class ConfigurationNode implements Map { return o; } + @SuppressWarnings("unchecked") public T getGeneric(String path, T def) { Object o = getObject(path, def); try { @@ -112,6 +114,7 @@ public class ConfigurationNode implements Map { return o.toString(); } + @SuppressWarnings("unchecked") public List getList(String path) { try { List list = (List)getObject(path, null); @@ -139,6 +142,7 @@ public class ConfigurationNode implements Map { return new ConfigurationNode(v); } + @SuppressWarnings("unchecked") public List getNodes(String path) { List o = getList(path); @@ -165,6 +169,7 @@ public class ConfigurationNode implements Map { extendMap(this, other); } + @SuppressWarnings("unchecked") private final static void extendMap(Map left, Map right) { ConfigurationNode original = new ConfigurationNode(left); for(Map.Entry entry : right.entrySet()) { diff --git a/src/main/java/org/dynmap/Events.java b/src/main/java/org/dynmap/Events.java index 81933180..3804fc56 100644 --- a/src/main/java/org/dynmap/Events.java +++ b/src/main/java/org/dynmap/Events.java @@ -5,6 +5,7 @@ import java.util.Map; public class Events { public Map> events = new HashMap>(); + @SuppressWarnings("unchecked") public void addListener(String eventName, Event.Listener listener) { Event genericEvent = events.get(eventName); Event event = null; @@ -16,6 +17,7 @@ public class Events { event.addListener(listener); } + @SuppressWarnings("unchecked") public void removeListener(String eventName, Event.Listener listener) { Event genericEvent = events.get(eventName); Event event = null; @@ -25,6 +27,7 @@ public class Events { } } + @SuppressWarnings("unchecked") public void trigger(String eventName, T argument) { Event genericEvent = events.get(eventName); if (genericEvent == null) diff --git a/src/main/java/org/dynmap/JSONUtils.java b/src/main/java/org/dynmap/JSONUtils.java index a685b112..333eadb9 100644 --- a/src/main/java/org/dynmap/JSONUtils.java +++ b/src/main/java/org/dynmap/JSONUtils.java @@ -25,6 +25,7 @@ public class JSONUtils { } // Sets a value on the specified path. If JSONObjects inside the path are missing, they'll be created. + @SuppressWarnings("unchecked") public static void s(JSONObject o, String path, Object value) { int index = path.indexOf('/'); if (index == -1) { @@ -45,6 +46,7 @@ public class JSONUtils { } // Adds a value to the list at the specified path. If the list does not exist, it will be created. + @SuppressWarnings("unchecked") public static void a(JSONObject o, String path, Object value) { Object oo = g(o, path); JSONArray array; @@ -58,6 +60,7 @@ public class JSONUtils { } // Simply creates a JSONArray. + @SuppressWarnings("unchecked") public static JSONArray l(Object... items) { JSONArray arr = new JSONArray(); for(Object item : items) { diff --git a/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java b/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java index 57723b26..737db67b 100644 --- a/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java +++ b/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java @@ -102,6 +102,7 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent { } } + @SuppressWarnings("unchecked") protected void writeUpdates() { File outputFile; File outputTempFile; diff --git a/src/main/java/org/dynmap/MapChunkCache.java b/src/main/java/org/dynmap/MapChunkCache.java index fa6b7cf4..e7483a59 100644 --- a/src/main/java/org/dynmap/MapChunkCache.java +++ b/src/main/java/org/dynmap/MapChunkCache.java @@ -165,6 +165,7 @@ public class MapChunkCache { if(!initialized) { try { + @SuppressWarnings("rawtypes") Class c = Class.forName("net.minecraft.server.Chunk"); getchunkdata = c.getDeclaredMethod("a", new Class[] { byte[].class, int.class, int.class, int.class, int.class, int.class, int.class, int.class }); @@ -177,6 +178,7 @@ public class MapChunkCache { } /* Get CraftWorld.popPreservedChunk(x,z) - reduces memory bloat from map traversals (optional) */ try { + @SuppressWarnings("rawtypes") Class c = Class.forName("org.bukkit.craftbukkit.CraftWorld"); poppreservedchunk = c.getDeclaredMethod("popPreservedChunk", new Class[] { int.class, int.class }); } catch (ClassNotFoundException cnfx) { diff --git a/src/main/java/org/dynmap/flat/FlatMap.java b/src/main/java/org/dynmap/flat/FlatMap.java index 1b83b810..afe026e3 100644 --- a/src/main/java/org/dynmap/flat/FlatMap.java +++ b/src/main/java/org/dynmap/flat/FlatMap.java @@ -3,10 +3,6 @@ package org.dynmap.flat; import org.dynmap.DynmapWorld; import static org.dynmap.JSONUtils.a; import static org.dynmap.JSONUtils.s; -import java.awt.image.DataBufferInt; -import java.awt.image.BufferedImage; -import java.awt.image.WritableRaster; -import java.awt.image.ColorModel; import java.io.File; import java.io.IOException; diff --git a/src/main/java/org/dynmap/herochat/HeroChatHandler.java b/src/main/java/org/dynmap/herochat/HeroChatHandler.java index 0b4d593f..c92ffef1 100644 --- a/src/main/java/org/dynmap/herochat/HeroChatHandler.java +++ b/src/main/java/org/dynmap/herochat/HeroChatHandler.java @@ -10,7 +10,6 @@ import org.bukkit.event.Event; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.ServerListener; import org.bukkit.plugin.Plugin; -import java.lang.reflect.Field; import org.dynmap.Client; import org.dynmap.ConfigurationNode; import org.dynmap.DynmapPlugin; @@ -40,6 +39,7 @@ public class HeroChatHandler { /* Reflection-based access wrapper for ChannelChatEvent from HeroChat */ private static class HeroChatChannelChatEvent { + @SuppressWarnings("rawtypes") private static Class channelchatevent; private static Method getsource; private static Method getmessage; @@ -97,6 +97,7 @@ public class HeroChatHandler { /* Reflection-based access wrapper for ChannelEvent from HeroChat */ private static class HeroChatChannelEvent { + @SuppressWarnings("rawtypes") private static Class channelevent; private static Method getchannel; private static Method iscancelled; @@ -148,6 +149,7 @@ public class HeroChatHandler { /* Reflection-based access wrapper for Channel from HeroChat */ private static class HeroChatChannel { + @SuppressWarnings("rawtypes") private static Class channel; private static Method getname; private static Method getnick; diff --git a/src/main/java/org/dynmap/kzedmap/KzedMap.java b/src/main/java/org/dynmap/kzedmap/KzedMap.java index 078694ed..43037570 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedMap.java +++ b/src/main/java/org/dynmap/kzedmap/KzedMap.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.logging.Logger; import org.bukkit.Location; -import org.bukkit.World; import org.dynmap.ConfigurationNode; import org.dynmap.DynmapChunk; import org.dynmap.Log; diff --git a/src/main/java/org/dynmap/kzedmap/KzedMapTile.java b/src/main/java/org/dynmap/kzedmap/KzedMapTile.java index 3d958c35..5df90cdc 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedMapTile.java +++ b/src/main/java/org/dynmap/kzedmap/KzedMapTile.java @@ -2,8 +2,6 @@ package org.dynmap.kzedmap; import org.dynmap.DynmapWorld; import java.io.File; - -import org.bukkit.World; import org.dynmap.MapTile; public class KzedMapTile extends MapTile { diff --git a/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java b/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java index 7516b992..b7fec488 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java +++ b/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java @@ -1,7 +1,6 @@ package org.dynmap.kzedmap; import org.dynmap.DynmapWorld; -import org.bukkit.World; import org.dynmap.MapTile; public class KzedZoomedMapTile extends MapTile { diff --git a/src/main/java/org/dynmap/web/handlers/ClientConfigurationHandler.java b/src/main/java/org/dynmap/web/handlers/ClientConfigurationHandler.java index c65f20f3..9a899f07 100644 --- a/src/main/java/org/dynmap/web/handlers/ClientConfigurationHandler.java +++ b/src/main/java/org/dynmap/web/handlers/ClientConfigurationHandler.java @@ -2,8 +2,6 @@ package org.dynmap.web.handlers; import java.io.BufferedOutputStream; import java.util.Date; -import java.util.Map; - import org.dynmap.DynmapPlugin; import org.dynmap.DynmapWorld; import org.dynmap.Event; diff --git a/src/main/java/org/dynmap/web/handlers/ClientUpdateHandler.java b/src/main/java/org/dynmap/web/handlers/ClientUpdateHandler.java index df2ed713..90b3ed43 100644 --- a/src/main/java/org/dynmap/web/handlers/ClientUpdateHandler.java +++ b/src/main/java/org/dynmap/web/handlers/ClientUpdateHandler.java @@ -5,24 +5,14 @@ import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.util.config.Configuration; -import org.dynmap.Client; import org.dynmap.ClientUpdateEvent; import org.dynmap.DynmapPlugin; import org.dynmap.DynmapWorld; -import org.dynmap.MapManager; -import org.dynmap.PlayerList; import org.dynmap.web.HttpField; import org.dynmap.web.HttpHandler; import org.dynmap.web.HttpRequest; import org.dynmap.web.HttpResponse; import org.dynmap.web.HttpStatus; -import org.dynmap.web.Json; -import org.json.simple.JSONArray; import org.json.simple.JSONObject; import static org.dynmap.JSONUtils.*; diff --git a/src/main/java/org/dynmap/web/handlers/FileHandler.java b/src/main/java/org/dynmap/web/handlers/FileHandler.java index 9ee75128..950b7df9 100644 --- a/src/main/java/org/dynmap/web/handlers/FileHandler.java +++ b/src/main/java/org/dynmap/web/handlers/FileHandler.java @@ -13,7 +13,6 @@ import org.dynmap.web.HttpHandler; import org.dynmap.web.HttpRequest; import org.dynmap.web.HttpResponse; import org.dynmap.web.HttpStatus; -import org.dynmap.utils.FileLockManager; public abstract class FileHandler implements HttpHandler { protected static final Logger log = Logger.getLogger("Minecraft");