mirror of
https://github.com/encounter/dynmap.git
synced 2026-03-30 11:08:39 -07:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fdc14b413d | |||
| e6d509c3e6 | |||
| b10ec3a331 | |||
| 9f8617d81d | |||
| 265e037b74 | |||
| f50e73180c | |||
| aad4b64603 | |||
| aeeb09f600 |
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.dynmap</groupId>
|
||||
<artifactId>dynmap</artifactId>
|
||||
<version>0.70.2</version>
|
||||
<version>0.80</version>
|
||||
<name>dynmap</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -68,6 +69,7 @@ import org.dynmap.DynmapWebChatEvent;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.PlayerList;
|
||||
import org.dynmap.bukkit.permissions.BukkitPermissions;
|
||||
import org.dynmap.bukkit.permissions.NijikokunPermissions;
|
||||
@@ -81,6 +83,7 @@ import org.dynmap.common.DynmapCommandSender;
|
||||
import org.dynmap.common.DynmapPlayer;
|
||||
import org.dynmap.common.DynmapServerInterface;
|
||||
import org.dynmap.common.DynmapListenerManager.EventType;
|
||||
import org.dynmap.hdmap.HDMap;
|
||||
import org.dynmap.markers.MarkerAPI;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
||||
@@ -95,6 +98,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public static DynmapPlugin plugin;
|
||||
public SpoutPluginBlocks spb;
|
||||
public PluginManager pm;
|
||||
private Metrics metrics;
|
||||
|
||||
private class BukkitEnableCoreCallback extends DynmapCore.EnableCoreCallbacks {
|
||||
@Override
|
||||
@@ -631,11 +635,18 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
/* Register our update trigger events */
|
||||
registerEvents();
|
||||
|
||||
/* Submit metrics to mcstats.org */
|
||||
initMetrics();
|
||||
|
||||
Log.info("Enabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (metrics != null) {
|
||||
metrics = null;
|
||||
}
|
||||
|
||||
/* Disable core */
|
||||
core.disableCore();
|
||||
|
||||
@@ -1280,4 +1291,86 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public boolean testIfPlayerInfoProtected() {
|
||||
return core.testIfPlayerInfoProtected();
|
||||
}
|
||||
|
||||
private void initMetrics() {
|
||||
try {
|
||||
metrics = new Metrics(this);
|
||||
|
||||
Metrics.Graph features = metrics.createGraph("Features Used");
|
||||
|
||||
features.addPlotter(new Metrics.Plotter("Internal Web Server") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
if (!core.configuration.getBoolean("disable-webserver", false))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
features.addPlotter(new Metrics.Plotter("Spout") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
if(plugin.has_spout)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
features.addPlotter(new Metrics.Plotter("Login Security") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
if(core.configuration.getBoolean("login-enabled", false))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
features.addPlotter(new Metrics.Plotter("Player Info Protected") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
if(core.player_info_protected)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
Metrics.Graph maps = metrics.createGraph("Map Data");
|
||||
maps.addPlotter(new Metrics.Plotter("Worlds") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
if(core.mapManager != null)
|
||||
return core.mapManager.getWorlds().size();
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
maps.addPlotter(new Metrics.Plotter("Maps") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
int cnt = 0;
|
||||
if(core.mapManager != null) {
|
||||
for(DynmapWorld w :core.mapManager.getWorlds()) {
|
||||
cnt += w.maps.size();
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
});
|
||||
maps.addPlotter(new Metrics.Plotter("HD Maps") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
int cnt = 0;
|
||||
if(core.mapManager != null) {
|
||||
for(DynmapWorld w :core.mapManager.getWorlds()) {
|
||||
for(MapType mt : w.maps) {
|
||||
if(mt instanceof HDMap) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
});
|
||||
metrics.start();
|
||||
} catch (IOException e) {
|
||||
// Failed to submit the stats :-(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,15 @@
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import net.minecraft.server.ChunkProviderServer;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.block.Biome;
|
||||
@@ -28,6 +33,8 @@ import org.getspout.spoutapi.block.SpoutChunk;
|
||||
public class NewMapChunkCache implements MapChunkCache {
|
||||
private static boolean init = false;
|
||||
private static boolean use_spout = false;
|
||||
private static Field unloadqueue = null;
|
||||
private static Method queuecontainskey = null;
|
||||
|
||||
private World w;
|
||||
private DynmapWorld dw;
|
||||
@@ -659,6 +666,21 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
if(!init) {
|
||||
use_spout = DynmapPlugin.plugin.hasSpout();
|
||||
|
||||
try {
|
||||
unloadqueue = ChunkProviderServer.class.getField("unloadQueue");
|
||||
Class cls = unloadqueue.getType();
|
||||
String nm = cls.getName();
|
||||
if (nm.equals("org.bukkit.craftbukkit.util.LongHashset")) {
|
||||
queuecontainskey = unloadqueue.getType().getMethod("containsKey", new Class[] { int.class, int.class });
|
||||
}
|
||||
else {
|
||||
unloadqueue = null;
|
||||
}
|
||||
} catch (NoSuchFieldException nsfx) {
|
||||
unloadqueue = null;
|
||||
} catch (NoSuchMethodException nsmx) {
|
||||
unloadqueue = null;
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
}
|
||||
@@ -709,7 +731,14 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
public int loadChunks(int max_to_load) {
|
||||
long t0 = System.nanoTime();
|
||||
CraftWorld cw = (CraftWorld)w;
|
||||
LongHashset unloadqueue = cw.getHandle().chunkProviderServer.unloadQueue;
|
||||
Object queue = null;
|
||||
try {
|
||||
if (unloadqueue != null) {
|
||||
queue = unloadqueue.get(cw.getHandle().chunkProviderServer);
|
||||
}
|
||||
} catch (IllegalArgumentException iax) {
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
int cnt = 0;
|
||||
if(iterator == null)
|
||||
iterator = chunks.listIterator();
|
||||
@@ -754,7 +783,15 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
chunks_attempted++;
|
||||
boolean wasLoaded = w.isChunkLoaded(chunk.x, chunk.z);
|
||||
boolean didload = false;
|
||||
boolean isunloadpending = unloadqueue.containsKey(chunk.x, chunk.z);
|
||||
boolean isunloadpending = false;
|
||||
if (queue != null) {
|
||||
try {
|
||||
isunloadpending = (Boolean)queuecontainskey.invoke(queue, chunk.x, chunk.z);
|
||||
} catch (IllegalAccessException iax) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
}
|
||||
if (isunloadpending) { /* Workaround: can't be pending if not loaded */
|
||||
wasLoaded = true;
|
||||
}
|
||||
|
||||
@@ -248,6 +248,12 @@ compass-mode: newnorth
|
||||
#tubecraft-support: true
|
||||
# Enable Ender Storage block rendering support
|
||||
#enderstorage-support: true
|
||||
# Enable ExtraBiomesXL block rendering support
|
||||
#extrabiomesxl-support: true
|
||||
# Enable ExtraBiomesXL Bunyan block rendering support
|
||||
#extrabiomesxl-bunyan-support: true
|
||||
# Equivalent Exchange 2 block rendering support
|
||||
#ee2-support: true
|
||||
|
||||
render-triggers:
|
||||
#- playermove
|
||||
|
||||
Reference in New Issue
Block a user