diff --git a/DynmapCore/src/main/java/org/dynmap/DynmapCore.java b/DynmapCore/src/main/java/org/dynmap/DynmapCore.java index a7026aec..f94b36cf 100644 --- a/DynmapCore/src/main/java/org/dynmap/DynmapCore.java +++ b/DynmapCore/src/main/java/org/dynmap/DynmapCore.java @@ -45,7 +45,6 @@ import org.dynmap.debug.Debugger; import org.dynmap.exporter.DynmapExpCommands; import org.dynmap.hdmap.HDBlockModels; import org.dynmap.hdmap.HDBlockStateTextureMap; -import org.dynmap.hdmap.HDMapManager; import org.dynmap.hdmap.TexturePack; import org.dynmap.markers.MarkerAPI; import org.dynmap.markers.impl.MarkerAPIImpl; diff --git a/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java b/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java index 4afe85ac..681c02e0 100644 --- a/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java +++ b/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java @@ -61,11 +61,9 @@ public class PlayerFaces { private class LoadPlayerImages implements Runnable { public final String playername; public final String playerskinurl; - public final UUID playeruuid; public LoadPlayerImages(String playername, String playerskinurl, UUID playeruuid) { this.playername = playername; this.playerskinurl = playerskinurl; - this.playeruuid = playeruuid; } public void run() { boolean has_8x8 = storage.hasPlayerFaceImage(playername, FaceType.FACE_8X8); @@ -199,7 +197,6 @@ public class PlayerFaces { DynmapBufferedImage.freeBufferedImage(face8x8); img.flush(); - /* TODO: signal update for player icon to client */ } } public PlayerFaces(DynmapCore core) { diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java b/DynmapCore/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java index ff159aea..7fff47a8 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java @@ -78,9 +78,6 @@ public class IsoHDPerspective implements HDPerspective { private boolean need_rawbiomedata = false; private static final BlockStep [] semi_steps = { BlockStep.Y_PLUS, BlockStep.X_MINUS, BlockStep.X_PLUS, BlockStep.Z_MINUS, BlockStep.Z_PLUS }; - - private DynmapBlockState full_water = null; - private RenderPatch full_water_patch = null; private class OurPerspectiveState implements HDPerspectiveState { DynmapBlockState blocktype = DynmapBlockState.AIR; diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/FenceWallBlockStateRenderer.java b/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/FenceWallBlockStateRenderer.java index 7d9bd188..565de3be 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/FenceWallBlockStateRenderer.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/FenceWallBlockStateRenderer.java @@ -129,13 +129,6 @@ public class FenceWallBlockStateRenderer extends CustomRenderer { list.clear(); } } - - private static int[][] sides = { - { 1, 0, 0, SIDE_XP }, - { -1, 0, 0, SIDE_XN }, - { 0, 0, 1, SIDE_ZP }, - { 0, 0, -1, SIDE_ZN } - }; @Override public RenderPatch[] getRenderPatchList(MapDataContext ctx) { diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/RedstoneWireStateRenderer.java b/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/RedstoneWireStateRenderer.java index a0090cf5..95f4129c 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/RedstoneWireStateRenderer.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/RedstoneWireStateRenderer.java @@ -1,21 +1,10 @@ package org.dynmap.hdmap.renderer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.Map; - -import org.dynmap.renderer.CustomRenderer; -import org.dynmap.renderer.DynmapBlockState; import org.dynmap.renderer.MapDataContext; import org.dynmap.renderer.RenderPatch; -import org.dynmap.renderer.RenderPatchFactory; -import org.dynmap.renderer.RenderPatchFactory.SideVisible; // v1.13+ redstone wire renderer public class RedstoneWireStateRenderer extends RedstoneWireRenderer { - private static final int x_off[] = { -1, 1, 0, 0 }; - private static final int z_off[] = { 0, 0, -1, 1 }; - @Override public RenderPatch[] getRenderPatchList(MapDataContext ctx) { int idx = ctx.getBlockType().stateIndex; diff --git a/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java b/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java index 56dd8b6c..6af983e8 100644 --- a/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java +++ b/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java @@ -22,7 +22,6 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintWriter; -import java.io.IOException; import java.io.OutputStream; public class MapStorageResourceHandler extends AbstractHandler { diff --git a/DynmapCore/src/main/java/org/dynmap/storage/mariadb/MariaDBMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/mariadb/MariaDBMapStorage.java index 5ee509e6..78618bb4 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/mariadb/MariaDBMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/mariadb/MariaDBMapStorage.java @@ -781,19 +781,22 @@ public class MariaDBMapStorage extends MapStorage { public boolean setMarkerImage(String markerid, BufferOutputStream encImage) { Connection c = null; boolean err = false; + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT IconName FROM " + tableMarkerIcons + " WHERE IconName=?;"); stmt.setString(1, markerid); - ResultSet rs = stmt.executeQuery(); + rs = stmt.executeQuery(); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (encImage == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return false; @@ -812,11 +815,12 @@ public class MariaDBMapStorage extends MapStorage { stmt.setBinaryStream(2, new BufferInputStream(encImage.buf, encImage.len), encImage.len); } stmt.executeUpdate(); - stmt.close(); } catch (SQLException x) { Log.severe("Marker write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err; @@ -851,19 +855,22 @@ public class MariaDBMapStorage extends MapStorage { public boolean setMarkerFile(String world, String content) { Connection c = null; boolean err = false; + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT FileName FROM " + tableMarkerFiles + " WHERE FileName=?;"); stmt.setString(1, world); - ResultSet rs = stmt.executeQuery(); + rs = stmt.executeQuery(); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (content == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return false; @@ -882,11 +889,12 @@ public class MariaDBMapStorage extends MapStorage { stmt.setBytes(2, content.getBytes(UTF8)); } stmt.executeUpdate(); - stmt.close(); } catch (SQLException x) { Log.severe("Marker file write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err; @@ -972,20 +980,23 @@ public class MariaDBMapStorage extends MapStorage { public boolean setStandaloneFile(String fileid, BufferOutputStream content) { Connection c = null; boolean err = false; + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT FileName FROM " + tableStandaloneFiles + " WHERE FileName=? AND ServerID=?;"); stmt.setString(1, fileid); stmt.setLong(2, serverID); - ResultSet rs = stmt.executeQuery(); + rs = stmt.executeQuery(); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (content == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return true; @@ -1007,11 +1018,12 @@ public class MariaDBMapStorage extends MapStorage { stmt.setBinaryStream(3, new BufferInputStream(content.buf, content.len), content.len); } stmt.executeUpdate(); - stmt.close(); } catch (SQLException x) { Log.severe("Standalone file write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err; diff --git a/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java index 77c142d3..12d2b40d 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java @@ -781,19 +781,22 @@ public class MySQLMapStorage extends MapStorage { public boolean setMarkerImage(String markerid, BufferOutputStream encImage) { Connection c = null; boolean err = false; + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT IconName FROM " + tableMarkerIcons + " WHERE IconName=?;"); stmt.setString(1, markerid); - ResultSet rs = stmt.executeQuery(); + rs = stmt.executeQuery(); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (encImage == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return false; @@ -812,11 +815,12 @@ public class MySQLMapStorage extends MapStorage { stmt.setBinaryStream(2, new BufferInputStream(encImage.buf, encImage.len), encImage.len); } stmt.executeUpdate(); - stmt.close(); } catch (SQLException x) { Log.severe("Marker write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err; @@ -851,19 +855,21 @@ public class MySQLMapStorage extends MapStorage { public boolean setMarkerFile(String world, String content) { Connection c = null; boolean err = false; - + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT FileName FROM " + tableMarkerFiles + " WHERE FileName=?;"); stmt.setString(1, world); - ResultSet rs = stmt.executeQuery(); + rs = stmt.executeQuery(); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (content == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return false; @@ -882,11 +888,12 @@ public class MySQLMapStorage extends MapStorage { stmt.setBytes(2, content.getBytes(UTF8)); } stmt.executeUpdate(); - stmt.close(); } catch (SQLException x) { Log.severe("Marker file write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err; @@ -972,20 +979,22 @@ public class MySQLMapStorage extends MapStorage { public boolean setStandaloneFile(String fileid, BufferOutputStream content) { Connection c = null; boolean err = false; - + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT FileName FROM " + tableStandaloneFiles + " WHERE FileName=? AND ServerID=?;"); stmt.setString(1, fileid); stmt.setLong(2, serverID); - ResultSet rs = stmt.executeQuery(); + rs = stmt.executeQuery(); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (content == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return true; @@ -1007,11 +1016,12 @@ public class MySQLMapStorage extends MapStorage { stmt.setBinaryStream(3, new BufferInputStream(content.buf, content.len), content.len); } stmt.executeUpdate(); - stmt.close(); } catch (SQLException x) { Log.severe("Standalone file write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err; diff --git a/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java index 1efbbdad..d05494f4 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java @@ -695,20 +695,21 @@ public class SQLiteMapStorage extends MapStorage { public boolean setMarkerImage(String markerid, BufferOutputStream encImage) { Connection c = null; boolean err = false; - + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT IconName FROM MarkerIcons WHERE IconName=?;"); stmt.setString(1, markerid); - //ResultSet rs = stmt.executeQuery(); - ResultSet rs = doExecuteQuery(stmt); + rs = doExecuteQuery(stmt); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (encImage == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return false; @@ -727,13 +728,15 @@ public class SQLiteMapStorage extends MapStorage { stmt.setString(1, markerid); stmt.setBytes(2, encImage.buf); } - //stmt.executeUpdate(); doExecuteUpdate(stmt); stmt.close(); + stmt = null; } catch (SQLException x) { Log.severe("Marker write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err; @@ -769,26 +772,26 @@ public class SQLiteMapStorage extends MapStorage { public boolean setMarkerFile(String world, String content) { Connection c = null; boolean err = false; - + PreparedStatement stmt = null; + ResultSet rs = null; try { c = getConnection(); boolean exists = false; - PreparedStatement stmt; stmt = c.prepareStatement("SELECT FileName FROM MarkerFiles WHERE FileName=?;"); stmt.setString(1, world); - //ResultSet rs = stmt.executeQuery(); - ResultSet rs = doExecuteQuery(stmt); + rs = doExecuteQuery(stmt); if (rs.next()) { exists = true; } rs.close(); + rs = null; stmt.close(); + stmt = null; if (content == null) { // If delete // If delete, and doesn't exist, quit if (!exists) return false; stmt = c.prepareStatement("DELETE FROM MarkerFiles WHERE FileName=?;"); stmt.setString(1, world); - //stmt.executeUpdate(); doExecuteUpdate(stmt); } else if (exists) { @@ -803,11 +806,12 @@ public class SQLiteMapStorage extends MapStorage { } //stmt.executeUpdate(); doExecuteUpdate(stmt); - stmt.close(); } catch (SQLException x) { Log.severe("Marker file write error - " + x.getMessage()); err = true; } finally { + if (rs != null) { try { rs.close(); } catch (SQLException sx) {} } + if (stmt != null) { try { stmt.close(); } catch (SQLException sx) {} } releaseConnection(c, err); } return !err;