From 9d89e56586f11dc4b2dfc6ec2a44a657da5f44f4 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sat, 5 Feb 2022 15:16:08 -0600 Subject: [PATCH] General warning cleanup in DynmapCore --- .../src/main/java/org/dynmap/Client.java | 2 - .../src/main/java/org/dynmap/ColorScheme.java | 1 - .../src/main/java/org/dynmap/DynmapCore.java | 19 ++++----- .../src/main/java/org/dynmap/PlayerFaces.java | 1 - .../main/java/org/dynmap/common/BiomeMap.java | 1 - .../org/dynmap/common/chunk/GenericChunk.java | 1 - .../common/chunk/GenericMapChunkCache.java | 2 - .../dynmap/common/chunk/GenericNBTList.java | 2 - .../java/org/dynmap/exporter/OBJExport.java | 6 +++ .../org/dynmap/hdmap/ChunkStatusHDShader.java | 30 +++++++------- .../dynmap/hdmap/ChunkVersionHDShader.java | 6 +-- .../dynmap/hdmap/HDBlockStateTextureMap.java | 3 -- .../dynmap/hdmap/LightLevelHDLighting.java | 3 -- .../org/dynmap/hdmap/ShadowHDLighting.java | 1 - .../hdmap/renderer/ChestStateRenderer.java | 7 ---- .../renderer/FenceWallBlockStateRenderer.java | 1 - .../dynmap/markers/impl/AreaMarkerImpl.java | 1 - .../dynmap/markers/impl/CircleMarkerImpl.java | 1 - .../impl/CopyBlockTextureRecordImpl.java | 1 - .../impl/ModModelDefinitionImpl.java | 6 +++ .../modsupport/impl/ModelBlockModelImpl.java | 1 - .../dynmap/servlet/FileResourceHandler.java | 3 -- .../servlet/MapStorageResourceHandler.java | 1 - .../storage/MapStorageTileSearchEndCB.java | 2 - .../postgresql/PostgreSQLMapStorage.java | 1 - .../java/org/dynmap/utils/DataBitsPacked.java | 2 +- .../dynmap/utils/PatchDefinitionFactory.java | 41 +++++++++---------- .../java/org/dynmap/web/HandlerRouter.java | 30 +++++++++----- 28 files changed, 77 insertions(+), 99 deletions(-) diff --git a/DynmapCore/src/main/java/org/dynmap/Client.java b/DynmapCore/src/main/java/org/dynmap/Client.java index 222a7cdc..4a7dd0ed 100644 --- a/DynmapCore/src/main/java/org/dynmap/Client.java +++ b/DynmapCore/src/main/java/org/dynmap/Client.java @@ -4,8 +4,6 @@ import java.io.IOException; import java.io.Writer; import java.util.Random; -import javax.sound.sampled.AudioFormat.Encoding; - import org.json.simple.JSONAware; import org.json.simple.JSONStreamAware; import org.owasp.html.HtmlPolicyBuilder; diff --git a/DynmapCore/src/main/java/org/dynmap/ColorScheme.java b/DynmapCore/src/main/java/org/dynmap/ColorScheme.java index 4c522096..868902f5 100644 --- a/DynmapCore/src/main/java/org/dynmap/ColorScheme.java +++ b/DynmapCore/src/main/java/org/dynmap/ColorScheme.java @@ -105,7 +105,6 @@ public class ColorScheme { continue; } Integer id = null; - Integer dat = null; boolean isbiome = false; boolean istemp = false; boolean israin = false; diff --git a/DynmapCore/src/main/java/org/dynmap/DynmapCore.java b/DynmapCore/src/main/java/org/dynmap/DynmapCore.java index 534cf5c8..16f95a37 100644 --- a/DynmapCore/src/main/java/org/dynmap/DynmapCore.java +++ b/DynmapCore/src/main/java/org/dynmap/DynmapCore.java @@ -75,7 +75,6 @@ import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.session.DefaultSessionIdManager; import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.util.resource.FileResource; import org.eclipse.jetty.util.thread.ExecutorThreadPool; import org.yaml.snakeyaml.Yaml; @@ -913,12 +912,13 @@ public class DynmapCore implements DynmapCommonAPI { return config_hashcode; } - private FileResource createFileResource(String path) { + @SuppressWarnings("deprecation") + private org.eclipse.jetty.util.resource.FileResource createFileResource(String path) { try { File f = new File(path); URI uri = f.toURI(); URL url = uri.toURL(); - return new FileResource(url); + return new org.eclipse.jetty.util.resource.FileResource(url); } catch(Exception e) { Log.info("Could not create file resource"); return null; @@ -1970,11 +1970,11 @@ public class DynmapCore implements DynmapCommonAPI { if(args.length == 2) { // /dynmap radiusrender ** return getWorldSuggestions(args[1]); } if(args.length == 3 && player != null) { // /dynmap radiusrender ** - Scanner sc = new Scanner(args[1]); - - if(sc.hasNextInt(10)) { //Only show map suggestions if a number was entered before - return getMapSuggestions(player.getLocation().world, args[2], false); - } + try (Scanner sc = new Scanner(args[1])) { + if(sc.hasNextInt(10)) { //Only show map suggestions if a number was entered before + return getMapSuggestions(player.getLocation().world, args[2], false); + } + } } else if(args.length == 6) { // /dynmap radiusrender ** return getMapSuggestions(args[1], args[5], false); } @@ -2644,7 +2644,6 @@ public class DynmapCore implements DynmapCommonAPI { int off = 0; int firsthit = -1; boolean done = false; - String orig = msg; while (!done) { int idx = msg.indexOf("${", off); // Look for next ${ if (idx >= 0) { // Hit @@ -2790,7 +2789,7 @@ public class DynmapCore implements DynmapCommonAPI { return platformVersion; } - private static boolean deleteDirectory(File dir) { + public static boolean deleteDirectory(File dir) { File[] files = dir.listFiles(); if (files != null) { for (File f : files) { diff --git a/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java b/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java index 50e99aec..ae552d16 100644 --- a/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java +++ b/DynmapCore/src/main/java/org/dynmap/PlayerFaces.java @@ -174,7 +174,6 @@ public class PlayerFaces { // Copy face and overlay to icon copyLayersToTarget(img, 8*scale, 8*scale, 40*scale, 8*scale, 8*scale, 8*scale, faceOriginal, 0, 8*scale); - int[] faceaccessory = new int[64]; /* 8x8 of face accessory */ /* Get buffered image for face at 8x8 */ DynmapBufferedImage face8x8 = DynmapBufferedImage.allocateBufferedImage(8, 8); Image face8x8_image = faceOriginal.getScaledInstance(8,8,BufferedImage.SCALE_SMOOTH); diff --git a/DynmapCore/src/main/java/org/dynmap/common/BiomeMap.java b/DynmapCore/src/main/java/org/dynmap/common/BiomeMap.java index 85d468a7..7d838ed7 100644 --- a/DynmapCore/src/main/java/org/dynmap/common/BiomeMap.java +++ b/DynmapCore/src/main/java/org/dynmap/common/BiomeMap.java @@ -4,7 +4,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import org.dynmap.Log; import org.dynmap.hdmap.HDBlockModels; /* Generic biome mapping */ diff --git a/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericChunk.java b/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericChunk.java index 1adc1296..95a16745 100644 --- a/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericChunk.java +++ b/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericChunk.java @@ -3,7 +3,6 @@ package org.dynmap.common.chunk; import java.util.Arrays; import org.dynmap.renderer.DynmapBlockState; -import org.dynmap.Log; import org.dynmap.common.BiomeMap; // Generic chunk representation diff --git a/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericMapChunkCache.java b/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericMapChunkCache.java index 2f28405d..90fa625d 100644 --- a/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericMapChunkCache.java +++ b/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericMapChunkCache.java @@ -7,7 +7,6 @@ import java.util.ListIterator; import org.dynmap.DynmapChunk; import org.dynmap.DynmapCore; import org.dynmap.DynmapWorld; -import org.dynmap.Log; import org.dynmap.common.BiomeMap; import org.dynmap.common.chunk.GenericChunkCache.ChunkCacheRec; import org.dynmap.hdmap.HDBlockModels; @@ -24,7 +23,6 @@ import org.dynmap.utils.VisibilityLimit; * Abstract container for handling map cache and map iterator, using DynmapChunks */ public abstract class GenericMapChunkCache extends MapChunkCache { - private static boolean init = false; protected DynmapWorld dw; private int nsect; private int sectoff; // Offset for sake of negative section indexes diff --git a/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericNBTList.java b/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericNBTList.java index 25716aa3..12f97075 100644 --- a/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericNBTList.java +++ b/DynmapCore/src/main/java/org/dynmap/common/chunk/GenericNBTList.java @@ -1,7 +1,5 @@ package org.dynmap.common.chunk; -import java.util.Set; - // Generic interface for accessing an NBT Composite object public interface GenericNBTList { public int size(); diff --git a/DynmapCore/src/main/java/org/dynmap/exporter/OBJExport.java b/DynmapCore/src/main/java/org/dynmap/exporter/OBJExport.java index 7df1fcbd..46afafdc 100644 --- a/DynmapCore/src/main/java/org/dynmap/exporter/OBJExport.java +++ b/DynmapCore/src/main/java/org/dynmap/exporter/OBJExport.java @@ -523,6 +523,12 @@ public class OBJExport { case TOP: f.faceLine = String.format("f %d/%d %d/%d %d/%d %d/%d\n", v[0], uv[0], v[1], uv[1], v[2], uv[2], v[3], uv[3]); break; + case TOPFLIP: + f.faceLine += String.format("f %d/%d %d/%d %d/%d %d/%d\n", v[3], uv[2], v[2], uv[3], v[1], uv[0], v[0], uv[1]); + break; + case TOPFLIPV: + f.faceLine = String.format("f %d/%d %d/%d %d/%d %d/%d\n", v[0], uv[0], v[1], uv[1], v[2], uv[2], v[3], uv[3]); + break; case BOTTOM: f.faceLine = String.format("f %d/%d %d/%d %d/%d %d/%d\n", v[3], uv[3], v[2], uv[2], v[1], uv[1], v[0], uv[0]); break; diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkStatusHDShader.java b/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkStatusHDShader.java index 2bb56307..c23b6348 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkStatusHDShader.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkStatusHDShader.java @@ -33,21 +33,21 @@ public class ChunkStatusHDShader implements HDShader { }; private static HashMap statusmap = new HashMap(); - private static ChunkStatusMap[] statusvals = { - new ChunkStatusMap("empty", 0xFF0000), - new ChunkStatusMap("structure_starts", 0xFF1493), - new ChunkStatusMap("structure_references", 0xFF7F50), - new ChunkStatusMap("biomes", 0xFFA500), - new ChunkStatusMap("noise", 0xFFD700), - new ChunkStatusMap("surface", 0xFFFF00), - new ChunkStatusMap("carvers", 0xFFEFD5), - new ChunkStatusMap("liquid_carvers", 0xF0E68C), - new ChunkStatusMap("features", 0xBDB76B), - new ChunkStatusMap("light", 0xDDA0DD), - new ChunkStatusMap("spawn", 0xFF00FF), - new ChunkStatusMap("heightmaps", 0x9370DB), - new ChunkStatusMap("full", 0x32CD32), - }; + static { + new ChunkStatusMap("empty", 0xFF0000); + new ChunkStatusMap("structure_starts", 0xFF1493); + new ChunkStatusMap("structure_references", 0xFF7F50); + new ChunkStatusMap("biomes", 0xFFA500); + new ChunkStatusMap("noise", 0xFFD700); + new ChunkStatusMap("surface", 0xFFFF00); + new ChunkStatusMap("carvers", 0xFFEFD5); + new ChunkStatusMap("liquid_carvers", 0xF0E68C); + new ChunkStatusMap("features", 0xBDB76B); + new ChunkStatusMap("light", 0xDDA0DD); + new ChunkStatusMap("spawn", 0xFF00FF); + new ChunkStatusMap("heightmaps", 0x9370DB); + new ChunkStatusMap("full", 0x32CD32); + } final static Color unknown_color = new Color(255, 255, 255); diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkVersionHDShader.java b/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkVersionHDShader.java index c6dc6020..df2df800 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkVersionHDShader.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/ChunkVersionHDShader.java @@ -4,8 +4,6 @@ import static org.dynmap.JSONUtils.s; import java.io.IOException; import java.util.ArrayList; -import java.util.HashMap; -import java.util.TreeSet; import org.dynmap.Color; import org.dynmap.ConfigurationNode; @@ -27,11 +25,11 @@ public class ChunkVersionHDShader implements HDShader { private static class DataVersionMap { int dataVersion; - String version; + //String version; Color defcolor; DataVersionMap(int dv, String v, int c) { dataVersion = dv; - version = v; + //version = v; defcolor = new Color((c>>16)&0xFF, (c>>8)&0xFF, c&0xFF); } diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/HDBlockStateTextureMap.java b/DynmapCore/src/main/java/org/dynmap/hdmap/HDBlockStateTextureMap.java index dcf227e0..d58872bc 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/HDBlockStateTextureMap.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/HDBlockStateTextureMap.java @@ -2,12 +2,9 @@ package org.dynmap.hdmap; import java.util.Arrays; import java.util.BitSet; -import java.util.List; import java.util.Map; -import org.dynmap.hdmap.TexturePack; import org.dynmap.Log; -import org.dynmap.hdmap.HDBlockModels; import org.dynmap.hdmap.TexturePack.BlockTransparency; import org.dynmap.hdmap.TexturePack.ColorizingData; import org.dynmap.renderer.CustomColorMultiplier; diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/LightLevelHDLighting.java b/DynmapCore/src/main/java/org/dynmap/hdmap/LightLevelHDLighting.java index 6b22a2bd..876ebb54 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/LightLevelHDLighting.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/LightLevelHDLighting.java @@ -4,10 +4,7 @@ import org.dynmap.Color; import org.dynmap.ConfigurationNode; import org.dynmap.DynmapCore; import org.dynmap.DynmapWorld; -import org.dynmap.Log; -import org.dynmap.MapManager; import org.dynmap.utils.LightLevels; -import org.dynmap.utils.BlockStep; public class LightLevelHDLighting extends DefaultHDLighting { private final Color[] lightlevelcolors = new Color[16]; diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java b/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java index 90df1716..5381e961 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java @@ -4,7 +4,6 @@ import org.dynmap.Color; import org.dynmap.ConfigurationNode; import org.dynmap.DynmapCore; import org.dynmap.DynmapWorld; -import org.dynmap.Log; import org.dynmap.MapManager; import org.dynmap.utils.LightLevels; import org.dynmap.utils.BlockStep; diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/ChestStateRenderer.java b/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/ChestStateRenderer.java index 464e1e7b..2a47e69b 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/ChestStateRenderer.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/ChestStateRenderer.java @@ -1,14 +1,7 @@ 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; /** * Simple renderer for handling single and double chests (1.13+) 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 a22f552e..b5fcc44d 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/FenceWallBlockStateRenderer.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/renderer/FenceWallBlockStateRenderer.java @@ -5,7 +5,6 @@ import java.util.BitSet; import java.util.List; import java.util.Map; -import org.dynmap.Log; import org.dynmap.renderer.CustomRenderer; import org.dynmap.renderer.MapDataContext; import org.dynmap.renderer.RenderPatch; diff --git a/DynmapCore/src/main/java/org/dynmap/markers/impl/AreaMarkerImpl.java b/DynmapCore/src/main/java/org/dynmap/markers/impl/AreaMarkerImpl.java index 53d327d0..5649d2c4 100644 --- a/DynmapCore/src/main/java/org/dynmap/markers/impl/AreaMarkerImpl.java +++ b/DynmapCore/src/main/java/org/dynmap/markers/impl/AreaMarkerImpl.java @@ -9,7 +9,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.dynmap.Client; import org.dynmap.ConfigurationNode; import org.dynmap.DynmapWorld; -import org.dynmap.Log; import org.dynmap.MapManager; import org.dynmap.hdmap.HDPerspective; import org.dynmap.markers.AreaMarker; diff --git a/DynmapCore/src/main/java/org/dynmap/markers/impl/CircleMarkerImpl.java b/DynmapCore/src/main/java/org/dynmap/markers/impl/CircleMarkerImpl.java index afe534a0..1bb92d13 100644 --- a/DynmapCore/src/main/java/org/dynmap/markers/impl/CircleMarkerImpl.java +++ b/DynmapCore/src/main/java/org/dynmap/markers/impl/CircleMarkerImpl.java @@ -11,7 +11,6 @@ import org.dynmap.hdmap.HDPerspective; import org.dynmap.markers.CircleMarker; import org.dynmap.markers.EnterExitMarker; import org.dynmap.markers.MarkerSet; -import org.dynmap.markers.EnterExitMarker.EnterExitText; import org.dynmap.markers.impl.MarkerAPIImpl.MarkerUpdate; import org.dynmap.utils.Vector3D; diff --git a/DynmapCore/src/main/java/org/dynmap/modsupport/impl/CopyBlockTextureRecordImpl.java b/DynmapCore/src/main/java/org/dynmap/modsupport/impl/CopyBlockTextureRecordImpl.java index cdc4aec1..7edddf98 100644 --- a/DynmapCore/src/main/java/org/dynmap/modsupport/impl/CopyBlockTextureRecordImpl.java +++ b/DynmapCore/src/main/java/org/dynmap/modsupport/impl/CopyBlockTextureRecordImpl.java @@ -2,7 +2,6 @@ package org.dynmap.modsupport.impl; import java.util.Arrays; -import org.dynmap.DynmapCore; import org.dynmap.modsupport.CopyBlockTextureRecord; import org.dynmap.modsupport.TransparencyMode; diff --git a/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModModelDefinitionImpl.java b/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModModelDefinitionImpl.java index 264575a9..51ce4f3b 100644 --- a/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModModelDefinitionImpl.java +++ b/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModModelDefinitionImpl.java @@ -287,6 +287,12 @@ public class ModModelDefinitionImpl implements ModModelDefinition { case TOP: line += ",visibility=top"; break; + case TOPFLIP: + line += ",visibility=topflip"; + break; + case TOPFLIPV: + line += ",visibility=topflipv"; + break; case FLIP: line += ",visibility=flip"; break; diff --git a/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModelBlockModelImpl.java b/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModelBlockModelImpl.java index a5da328b..73412e23 100644 --- a/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModelBlockModelImpl.java +++ b/DynmapCore/src/main/java/org/dynmap/modsupport/impl/ModelBlockModelImpl.java @@ -6,7 +6,6 @@ import java.util.HashMap; import org.dynmap.modsupport.BlockSide; import org.dynmap.modsupport.ModelBlockModel; -import org.dynmap.modsupport.ModelBlockModel.SideRotation; public class ModelBlockModelImpl extends BlockModelImpl implements ModelBlockModel { diff --git a/DynmapCore/src/main/java/org/dynmap/servlet/FileResourceHandler.java b/DynmapCore/src/main/java/org/dynmap/servlet/FileResourceHandler.java index 2ee77c52..9d6f6636 100644 --- a/DynmapCore/src/main/java/org/dynmap/servlet/FileResourceHandler.java +++ b/DynmapCore/src/main/java/org/dynmap/servlet/FileResourceHandler.java @@ -9,9 +9,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; - -import java.lang.reflect.Method; import java.lang.reflect.Field; import java.lang.Class; diff --git a/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java b/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java index 824cf1a6..c887515f 100644 --- a/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java +++ b/DynmapCore/src/main/java/org/dynmap/servlet/MapStorageResourceHandler.java @@ -2,7 +2,6 @@ package org.dynmap.servlet; import org.dynmap.DynmapCore; import org.dynmap.DynmapWorld; -import org.dynmap.MapType.ImageEncoding; import org.dynmap.PlayerFaces; import org.dynmap.storage.MapStorage; import org.dynmap.storage.MapStorageTile; diff --git a/DynmapCore/src/main/java/org/dynmap/storage/MapStorageTileSearchEndCB.java b/DynmapCore/src/main/java/org/dynmap/storage/MapStorageTileSearchEndCB.java index 8367a3f6..507c7926 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/MapStorageTileSearchEndCB.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/MapStorageTileSearchEndCB.java @@ -1,7 +1,5 @@ package org.dynmap.storage; -import org.dynmap.MapType.ImageEncoding; - public interface MapStorageTileSearchEndCB { /** * Callback for end of tile enumeration calls diff --git a/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java index 838c635b..a5349055 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java @@ -27,7 +27,6 @@ import org.dynmap.storage.MapStorageBaseTileEnumCB; import org.dynmap.storage.MapStorageTile; import org.dynmap.storage.MapStorageTileEnumCB; import org.dynmap.storage.MapStorageTileSearchEndCB; -import org.dynmap.storage.mysql.MySQLMapStorage.StorageTile; import org.dynmap.utils.BufferInputStream; import org.dynmap.utils.BufferOutputStream; diff --git a/DynmapCore/src/main/java/org/dynmap/utils/DataBitsPacked.java b/DynmapCore/src/main/java/org/dynmap/utils/DataBitsPacked.java index 3f4b62f6..867ec8ea 100644 --- a/DynmapCore/src/main/java/org/dynmap/utils/DataBitsPacked.java +++ b/DynmapCore/src/main/java/org/dynmap/utils/DataBitsPacked.java @@ -6,7 +6,7 @@ public class DataBitsPacked { private final long[] values; private final int bitsperrec; private final long valuemask; - private final int length; + public final int length; public static int calcLongCount(int i, int j) { if (j == 0) { diff --git a/DynmapCore/src/main/java/org/dynmap/utils/PatchDefinitionFactory.java b/DynmapCore/src/main/java/org/dynmap/utils/PatchDefinitionFactory.java index d4f91677..596b6a38 100644 --- a/DynmapCore/src/main/java/org/dynmap/utils/PatchDefinitionFactory.java +++ b/DynmapCore/src/main/java/org/dynmap/utils/PatchDefinitionFactory.java @@ -8,8 +8,6 @@ import org.dynmap.modsupport.BlockSide; import org.dynmap.modsupport.ModelBlockModel; import org.dynmap.renderer.RenderPatch; import org.dynmap.renderer.RenderPatchFactory; -import org.dynmap.renderer.RenderPatchFactory.SideVisible; -import org.dynmap.Log; public class PatchDefinitionFactory implements RenderPatchFactory { private HashMap patches = new HashMap(); @@ -198,24 +196,23 @@ public class PatchDefinitionFactory implements RenderPatchFactory { return TexturePack.getTextureMapLength(id); } - public static void main(String[] args) { - PatchDefinitionFactory fact = new PatchDefinitionFactory(); - PatchDefinition pd; - BlockSide[] faces = { BlockSide.NORTH, BlockSide.EAST, BlockSide.SOUTH, BlockSide.WEST, BlockSide.TOP, BlockSide.BOTTOM }; - // campfire log:box=1/0/0:5/4/16:n/0/0/4/4/8:e/0/0/1/16/5:s/0/0/4/4/8:w/0/16/0/0/4:u90/0/0/0/16/4:d90/0/0/0/16/4 - double[][] uvs = { { 0, 4, 4, 8 }, { 0, 1, 16, 5 }, { 0, 4, 4, 8 }, { 16, 0, 0, 4 }, { 0, 0, 16, 4 }, { 0, 0, 16, 4 } }; - ModelBlockModel.SideRotation[] rots = { ModelBlockModel.SideRotation.DEG0, ModelBlockModel.SideRotation.DEG0, ModelBlockModel.SideRotation.DEG0, - ModelBlockModel.SideRotation.DEG0, ModelBlockModel.SideRotation.DEG90, ModelBlockModel.SideRotation.DEG90 }; - double[] from = { 1, 0, 0 }; - double[] to = { 5, 4, 16 }; - - // Do normal faces, default limits - pd = new PatchDefinition(); - for (int i = 0; i < faces.length; i++) { - pd.updateModelFace(from, to, faces[i], uvs[i], rots[i], 0); - System.out.println("Log " + faces[i] + ": " + pd); - } - +// public static void main(String[] args) { +// PatchDefinition pd; +// BlockSide[] faces = { BlockSide.NORTH, BlockSide.EAST, BlockSide.SOUTH, BlockSide.WEST, BlockSide.TOP, BlockSide.BOTTOM }; +// // campfire log:box=1/0/0:5/4/16:n/0/0/4/4/8:e/0/0/1/16/5:s/0/0/4/4/8:w/0/16/0/0/4:u90/0/0/0/16/4:d90/0/0/0/16/4 +// double[][] uvs = { { 0, 4, 4, 8 }, { 0, 1, 16, 5 }, { 0, 4, 4, 8 }, { 16, 0, 0, 4 }, { 0, 0, 16, 4 }, { 0, 0, 16, 4 } }; +// ModelBlockModel.SideRotation[] rots = { ModelBlockModel.SideRotation.DEG0, ModelBlockModel.SideRotation.DEG0, ModelBlockModel.SideRotation.DEG0, +// ModelBlockModel.SideRotation.DEG0, ModelBlockModel.SideRotation.DEG90, ModelBlockModel.SideRotation.DEG90 }; +// double[] from = { 1, 0, 0 }; +// double[] to = { 5, 4, 16 }; +// +// // Do normal faces, default limits +// pd = new PatchDefinition(); +// for (int i = 0; i < faces.length; i++) { +// pd.updateModelFace(from, to, faces[i], uvs[i], rots[i], 0); +// System.out.println("Log " + faces[i] + ": " + pd); +// } +// // // Do normal faces, default limits // pd = new PatchDefinition(); // for (BlockSide face : faces) { @@ -234,6 +231,6 @@ public class PatchDefinitionFactory implements RenderPatchFactory { // pd.updateModelFace(from, toquarter, face, new double[] { 4, 4, 12, 12 }, 0); // System.out.println("Full cube, middle half of texture " + face + ": " + pd); // } - - } +// +// } } diff --git a/DynmapCore/src/main/java/org/dynmap/web/HandlerRouter.java b/DynmapCore/src/main/java/org/dynmap/web/HandlerRouter.java index 21a8e4fa..bdcabccf 100644 --- a/DynmapCore/src/main/java/org/dynmap/web/HandlerRouter.java +++ b/DynmapCore/src/main/java/org/dynmap/web/HandlerRouter.java @@ -11,18 +11,27 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +@SuppressWarnings("deprecation") public class HandlerRouter extends AbstractHandler { - PathMap pathMap = new PathMap(); + PathMap pathMap = new PathMap(); + + private static class HandlerOrServlet { + Servlet servlet; + Handler handler; + HandlerOrServlet(Servlet s) { servlet = s; handler = null; } + HandlerOrServlet(Handler h) { servlet = null; handler = h; } + }; + public HandlerRouter() { } public void addHandler(String path, Handler handler) { - pathMap.put(path, handler); + pathMap.put(path, new HandlerOrServlet(handler)); } public void addServlet(String path, Servlet servlet) { - pathMap.put(path, servlet); + pathMap.put(path, new HandlerOrServlet(servlet)); } public void clear() { @@ -32,7 +41,7 @@ public class HandlerRouter extends AbstractHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String pathInfo = request.getPathInfo(); - PathMap.MappedEntry e = pathMap.getMatch(pathInfo); + PathMap.MappedEntry e = pathMap.getMatch(pathInfo); String mappedPath = e.getMapped(); String childPathInfo = pathInfo; @@ -45,13 +54,12 @@ public class HandlerRouter extends AbstractHandler { org.eclipse.jetty.server.Request r = (org.eclipse.jetty.server.Request)request; r.setPathInfo(childPathInfo); - Object o = e.getValue(); - if (o instanceof Handler) { - Handler h = (Handler)o; - h.handle(target, baseRequest, request, response); - } else if (o instanceof Servlet) { - Servlet s = (Servlet)o; - s.service(request, response); + HandlerOrServlet o = e.getValue(); + if (o.handler != null) { + o.handler.handle(target, baseRequest, request, response); + } + else if (o.servlet != null) { + o.servlet.service(request, response); } r.setPathInfo(pathInfo);