mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-01 06:33:38 +01:00
Clean up warnings, extra imports. Fix post_1_8 logic. Color multiplier cache
This commit is contained in:
parent
5e9ba1e6e3
commit
497071aac9
@ -47,7 +47,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
yaml = new Yaml(new SafeConstructor(), new EmptyNullRepresenter(), options);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
public ConfigurationNode(File f) {
|
||||
this.f = f;
|
||||
entries = new HashMap<String, Object>();
|
||||
@ -64,6 +64,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
load(in);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean load(InputStream in) {
|
||||
initparse();
|
||||
|
||||
@ -73,6 +74,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
return (entries != null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean load() {
|
||||
initparse();
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class DynmapCore {
|
||||
Log.verbose = configuration.getBoolean("verbose", true);
|
||||
deftemplatesuffix = configuration.getString("deftemplatesuffix", "");
|
||||
/* Default swamp shading off for 1.8, on after */
|
||||
boolean post_1_8 = mc_ver.contains("1.8.");
|
||||
boolean post_1_8 = !mc_ver.contains("1.8.");
|
||||
swampshading = configuration.getBoolean("swampshaded", post_1_8);
|
||||
/* Default water biome shading off for 1.8, on after */
|
||||
waterbiomeshading = configuration.getBoolean("waterbiomeshaded", post_1_8);
|
||||
@ -458,7 +458,7 @@ public class DynmapCore {
|
||||
}
|
||||
|
||||
public void addServlet(String path, HttpServlet servlet) {
|
||||
ServletHolder holder = new ServletHolder(servlet);
|
||||
new ServletHolder(servlet);
|
||||
router.addServlet(path, servlet);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ public class InternalClientUpdateComponent extends ClientUpdateComponent {
|
||||
});
|
||||
|
||||
if (allowwebchat) {
|
||||
@SuppressWarnings("serial")
|
||||
SendMessageServlet messageHandler = new SendMessageServlet() {{
|
||||
maximumMessageInterval = (int)(webchatInterval * 1000);
|
||||
spamMessage = "\""+spammessage+"\"";
|
||||
|
@ -57,8 +57,8 @@ public abstract class MapTile {
|
||||
String dat = node.getString("data");
|
||||
if((cn == null) || (dat == null)) return null;
|
||||
try {
|
||||
Class cls = Class.forName(cn);
|
||||
Constructor con = cls.getConstructor(DynmapWorld.class, String.class);
|
||||
Class<?> cls = Class.forName(cn);
|
||||
Constructor<?> con = cls.getConstructor(DynmapWorld.class, String.class);
|
||||
return (MapTile)con.newInstance(w, dat);
|
||||
} catch (ClassNotFoundException cnfx) {
|
||||
} catch (NoSuchMethodException nsmx) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.dynmap;
|
||||
|
||||
import org.dynmap.common.DynmapListenerManager;
|
||||
import org.dynmap.common.DynmapListenerManager.EventType;
|
||||
import org.dynmap.common.DynmapListenerManager.WorldEventListener;
|
||||
import org.dynmap.common.DynmapListenerManager.PlayerEventListener;
|
||||
|
@ -146,7 +146,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
break;
|
||||
case WORLD_SPAWN_CHANGE:
|
||||
bep.registerEvent(Type.SPAWN_CHANGE, new WorldListener() {
|
||||
public void onWorldSpawnChange(SpawnChangeEvent evt) {
|
||||
@Override
|
||||
public void onSpawnChange(SpawnChangeEvent evt) {
|
||||
DynmapWorld w = new BukkitWorld(evt.getWorld());
|
||||
core.listenerManager.processWorldEvent(EventType.WORLD_SPAWN_CHANGE, w);
|
||||
}
|
||||
@ -807,7 +808,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
WorldListener worldTrigger = new WorldListener() {
|
||||
@Override
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
if(core.ignore_chunk_loads)
|
||||
if(DynmapCore.ignore_chunk_loads)
|
||||
return;
|
||||
Chunk c = event.getChunk();
|
||||
/* Touch extreme corners */
|
||||
|
@ -126,7 +126,10 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
if(bio == null) {
|
||||
Biome bb = snap.getBiome(bx, bz);
|
||||
if(bb != null)
|
||||
bio = b[off] = biome_to_bmap[bb.ordinal()];
|
||||
bio = biome_to_bmap[bb.ordinal()];
|
||||
else
|
||||
bio = BiomeMap.NULL;
|
||||
b[off] = bio;
|
||||
}
|
||||
return bio;
|
||||
}
|
||||
@ -413,7 +416,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
try {
|
||||
craftworld = getworldhandle.invoke(w); /* World.getHandle() */
|
||||
if(ticklist != null)
|
||||
ourticklist = (TreeSet)ticklist.get(craftworld);
|
||||
ourticklist = (TreeSet<?>)ticklist.get(craftworld);
|
||||
} catch (Exception x) {
|
||||
}
|
||||
}
|
||||
@ -491,7 +494,6 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
snaparray[(chunk.x-x_min) + (chunk.z - z_min)*x_dim] = ss;
|
||||
continue;
|
||||
}
|
||||
long tt0 = 0;
|
||||
chunks_attempted++;
|
||||
boolean wasLoaded = w.isChunkLoaded(chunk.x, chunk.z);
|
||||
boolean didload = w.loadChunk(chunk.x, chunk.z, false);
|
||||
|
@ -23,6 +23,7 @@ public class SnapshotCache {
|
||||
boolean hashighesty;
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CacheHashMap extends LinkedHashMap<String, CacheRec> {
|
||||
private int limit;
|
||||
private IdentityHashMap<WeakReference<ChunkSnapshot>, String> reverselookup;
|
||||
|
@ -2,6 +2,7 @@ package org.dynmap.common;
|
||||
|
||||
/* Generic biome mapping */
|
||||
public enum BiomeMap {
|
||||
NULL,
|
||||
RAINFOREST,
|
||||
SWAMPLAND,
|
||||
SEASONAL_FOREST,
|
||||
|
@ -19,11 +19,9 @@ public enum DynmapChatColor {
|
||||
YELLOW(0xE),
|
||||
WHITE(0xF);
|
||||
|
||||
private final int code;
|
||||
private final String str;
|
||||
|
||||
private DynmapChatColor(final int code) {
|
||||
this.code = code;
|
||||
this.str = String.format("\u00A7%x", code);
|
||||
}
|
||||
@Override
|
||||
|
@ -2,7 +2,6 @@ package org.dynmap.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dynmap.DynmapCore;
|
||||
|
@ -4,7 +4,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.common.DynmapListenerManager.EventType;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,6 @@ import org.dynmap.ColorScheme;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapCore.CompassMode;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.TileHashManager;
|
||||
|
@ -10,7 +10,6 @@ import org.dynmap.Client;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
|
@ -3,7 +3,6 @@ package org.dynmap.hdmap;
|
||||
import java.util.List;
|
||||
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
@ -15,7 +15,6 @@ import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapCore.CompassMode;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
@ -662,8 +661,6 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean logit = false;
|
||||
|
||||
private boolean raytraceSubblock(short[] model, boolean firsttime) {
|
||||
if(firsttime) {
|
||||
mt = t + 0.00000001;
|
||||
|
@ -1301,6 +1301,9 @@ public class TexturePack {
|
||||
|
||||
LoadedImage li = null;
|
||||
int clrmult = -1;
|
||||
/* See if multiplier is cached */
|
||||
int c_mult = ss.getCachedMult(mapiter.getX(), mapiter.getY(), mapiter.getZ());
|
||||
if(c_mult == Integer.MIN_VALUE) {
|
||||
/* Switch based on texture modifier */
|
||||
switch(textop) {
|
||||
case COLORMOD_GRASSTONED:
|
||||
@ -1337,6 +1340,10 @@ public class TexturePack {
|
||||
if(ss.do_swamp_shading && (mapiter.getBiome() == BiomeMap.SWAMPLAND))
|
||||
clrmult = (clrmult & 0xFF000000) | (((clrmult & 0x00FEFEFE) + 0x4E0E4E) / 2);
|
||||
}
|
||||
ss.setCachedMult(mapiter.getX(), mapiter.getY(), mapiter.getZ(), clrmult);
|
||||
}
|
||||
else
|
||||
clrmult = c_mult;
|
||||
if((clrmult != -1) && (clrmult != 0)) {
|
||||
rslt.blendColor(clrmult);
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ public class TexturePackHDShader implements HDShader {
|
||||
boolean do_swamp_shading;
|
||||
boolean do_water_shading;
|
||||
boolean do_better_grass;
|
||||
private boolean has_hit;
|
||||
/* Cached color multiplier */
|
||||
int mult_x, mult_y, mult_z, mult;
|
||||
|
||||
private ShaderState(MapIterator mapiter, HDMap map, MapChunkCache cache) {
|
||||
this.mapiter = mapiter;
|
||||
@ -102,7 +103,7 @@ public class TexturePackHDShader implements HDShader {
|
||||
do_swamp_shading = do_biome_shading && swamp_shaded;
|
||||
do_water_shading = do_biome_shading && waterbiomeshaded;
|
||||
do_better_grass = bettergrass;
|
||||
has_hit = false;
|
||||
mult = Integer.MIN_VALUE;
|
||||
}
|
||||
/**
|
||||
* Get our shader
|
||||
@ -132,7 +133,6 @@ public class TexturePackHDShader implements HDShader {
|
||||
for(int i = 0; i < color.length; i++)
|
||||
color[i].setTransparent();
|
||||
lastblkid = 0;
|
||||
has_hit = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,8 +152,6 @@ public class TexturePackHDShader implements HDShader {
|
||||
scaledtp.readColor(ps, mapiter, c, blocktype, lastblocktype, ShaderState.this);
|
||||
|
||||
if (c.getAlpha() > 0) {
|
||||
has_hit = true;
|
||||
int subalpha = ps.getSubmodelAlpha();
|
||||
/* Scale brightness depending upon face */
|
||||
switch(ps.getLastBlockStep()) {
|
||||
case X_MINUS:
|
||||
@ -225,6 +223,18 @@ public class TexturePackHDShader implements HDShader {
|
||||
*/
|
||||
public void cleanup() {
|
||||
}
|
||||
/*
|
||||
* Get cached multiplier, if available
|
||||
*/
|
||||
public int getCachedMult(int x, int y, int z) {
|
||||
if((x == mult_x) && (y == mult_y) && (z == mult_z))
|
||||
return mult;
|
||||
else
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
public void setCachedMult(int x, int y, int z, int m) {
|
||||
mult_x = x; mult_y = y; mult_z = z; mult = m;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,9 +10,7 @@ import java.util.logging.Logger;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
||||
public class KzedZoomedMapTile extends MapTile {
|
||||
|
@ -4,11 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.markers.AreaMarker;
|
||||
import org.dynmap.markers.MarkerIcon;
|
||||
import org.dynmap.markers.MarkerSet;
|
||||
import org.dynmap.markers.impl.MarkerAPIImpl.MarkerUpdate;
|
||||
|
||||
@ -58,8 +56,6 @@ class AreaMarkerImpl implements AreaMarker {
|
||||
for(int i = 0; i < x.length; i++) {
|
||||
this.corners.add(new Coord(x[i], z[i]));
|
||||
}
|
||||
this.ytop = ytop;
|
||||
this.ybottom = ybottom;
|
||||
this.world = world;
|
||||
this.desc = null;
|
||||
ispersistent = persistent;
|
||||
|
@ -1,14 +1,10 @@
|
||||
package org.dynmap.markers.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.markers.MarkerIcon;
|
||||
|
||||
class MarkerIconImpl implements MarkerIcon {
|
||||
|
@ -15,10 +15,10 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.dynmap.ClientUpdateEvent;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.web.HttpField;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ClientUpdateServlet extends HttpServlet {
|
||||
private DynmapCore plugin;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @author BalusC
|
||||
* @link http://balusc.blogspot.com/2009/02/fileservlet-supporting-resume-and.html
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FileServlet extends HttpServlet {
|
||||
|
||||
// Constants ----------------------------------------------------------------------------------
|
||||
|
@ -5,7 +5,6 @@ import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.json.simple.JSONAware;
|
||||
import org.json.simple.JSONStreamAware;
|
||||
|
||||
public class JSONServlet {
|
||||
|
@ -12,8 +12,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.dynmap.Log;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MainServlet extends HttpServlet {
|
||||
public static class Header {
|
||||
public String name;
|
||||
|
@ -20,6 +20,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SendMessageServlet extends HttpServlet {
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
@ -174,9 +174,9 @@ public class FileLockManager {
|
||||
|
||||
// Find a jpeg writer
|
||||
ImageWriter writer = null;
|
||||
Iterator iter = ImageIO.getImageWritersByFormatName("jpg");
|
||||
Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName("jpg");
|
||||
if (iter.hasNext()) {
|
||||
writer = (ImageWriter)iter.next();
|
||||
writer = iter.next();
|
||||
}
|
||||
if(writer == null) {
|
||||
Log.severe("No JPEG ENCODER - Java VM does not support JPEG encoding");
|
||||
|
@ -3,6 +3,7 @@ package org.dynmap.utils;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LRULinkedHashMap<T, K> extends LinkedHashMap<T, K> {
|
||||
private int limit;
|
||||
public LRULinkedHashMap(int lim) {
|
||||
|
@ -13,7 +13,6 @@ public class BanIPFilter implements Filter {
|
||||
private HashSet<String> banned_ips = new HashSet<String>();
|
||||
private HashSet<String> banned_ips_notified = new HashSet<String>();
|
||||
private long last_loaded = 0;
|
||||
private long lastmod = 0;
|
||||
private static final long BANNED_RELOAD_INTERVAL = 15000; /* Every 15 seconds */
|
||||
|
||||
public BanIPFilter(DynmapCore core) {
|
||||
|
@ -1,11 +1,9 @@
|
||||
package org.dynmap.web;
|
||||
|
||||
import org.dynmap.Log;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -13,7 +11,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class FilterHandler extends AbstractHandler {
|
||||
private Handler handler;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.dynmap.web;
|
||||
|
||||
import org.dynmap.Log;
|
||||
import org.eclipse.jetty.http.PathMap;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
|
Loading…
Reference in New Issue
Block a user