mirror of
https://github.com/encounter/dynmap.git
synced 2026-03-30 11:08:39 -07:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f1782fd9f4 | |||
| f0907ce954 | |||
| 7ce55a3fd3 | |||
| d0e477b3e7 | |||
| 0053d89d2b | |||
| 1ef9bdd861 | |||
| 9be7c4d7ef | |||
| c7b709fd75 | |||
| 57a69bf9ad | |||
| ddf3b71592 |
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.dynmap</groupId>
|
||||
<artifactId>dynmap</artifactId>
|
||||
<version>0.31</version>
|
||||
<version>0.32</version>
|
||||
<name>dynmap</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -1,449 +0,0 @@
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.CustomEventListener;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkPopulateEvent;
|
||||
import org.bukkit.event.world.SpawnChangeEvent;
|
||||
import org.bukkit.event.world.WorldListener;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.dynmap.Log;
|
||||
|
||||
public class BukkitEventProcessor {
|
||||
private Plugin plugin;
|
||||
private PluginManager pm;
|
||||
|
||||
private HashMap<Event.Type, List<Listener>> event_handlers = new HashMap<Event.Type, List<Listener>>();
|
||||
|
||||
public BukkitEventProcessor(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pm = plugin.getServer().getPluginManager();
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
/* Clean up all registered handlers */
|
||||
for(Event.Type t : event_handlers.keySet()) {
|
||||
List<Listener> ll = event_handlers.get(t);
|
||||
ll.clear(); /* Empty list - we use presence of list to remember that we've registered with Bukkit */
|
||||
}
|
||||
if(plugin.getServer().getVersion().contains("(MC: 1.0") == false) {
|
||||
event_handlers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private BlockListener ourBlockEventHandler = new BlockListener() {
|
||||
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockPlace(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockBreak(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onLeavesDecay(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockBurn(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockForm(BlockFormEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockForm(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockFade(BlockFadeEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockFade(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockSpread(BlockSpreadEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockSpread(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockFromTo(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockPhysics(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockPistonRetract(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onBlockPistonExtend(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((BlockListener)l).onSignChange(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
private PlayerListener ourPlayerEventHandler = new PlayerListener() {
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((PlayerListener)l).onPlayerJoin(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((PlayerListener)l).onPlayerLogin(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((PlayerListener)l).onPlayerMove(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((PlayerListener)l).onPlayerQuit(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((PlayerListener)l).onPlayerBedLeave(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((PlayerListener)l).onPlayerChat(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private WorldListener ourWorldEventHandler = new WorldListener() {
|
||||
@Override
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((WorldListener)l).onWorldLoad(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onWorldUnload(WorldUnloadEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((WorldListener)l).onWorldUnload(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((WorldListener)l).onChunkLoad(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onChunkPopulate(ChunkPopulateEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((WorldListener)l).onChunkPopulate(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSpawnChange(SpawnChangeEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((WorldListener)l).onSpawnChange(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private CustomEventListener ourCustomEventHandler = new CustomEventListener() {
|
||||
@Override
|
||||
public void onCustomEvent(Event event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((CustomEventListener)l).onCustomEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private EntityListener ourEntityEventHandler = new EntityListener() {
|
||||
@Override
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((EntityListener)l).onEntityExplode(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private ServerListener ourServerEventHandler = new ServerListener() {
|
||||
@Override
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((ServerListener)l).onPluginEnable(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((ServerListener)l).onPluginDisable(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Register event listener - this will be cleaned up properly on a /dynmap reload, unlike
|
||||
* registering with Bukkit directly
|
||||
*/
|
||||
public void registerEvent(Event.Type type, Listener listener) {
|
||||
List<Listener> ll = event_handlers.get(type);
|
||||
if(ll == null) {
|
||||
switch(type) { /* See if it is a type we're brokering */
|
||||
case PLAYER_LOGIN:
|
||||
case PLAYER_CHAT:
|
||||
case PLAYER_JOIN:
|
||||
case PLAYER_QUIT:
|
||||
case PLAYER_MOVE:
|
||||
case PLAYER_BED_LEAVE:
|
||||
pm.registerEvent(type, ourPlayerEventHandler, Event.Priority.Monitor, plugin);
|
||||
break;
|
||||
case BLOCK_PLACE:
|
||||
case BLOCK_BREAK:
|
||||
case LEAVES_DECAY:
|
||||
case BLOCK_BURN:
|
||||
case BLOCK_FORM:
|
||||
case BLOCK_FADE:
|
||||
case BLOCK_SPREAD:
|
||||
case BLOCK_FROMTO:
|
||||
case BLOCK_PHYSICS:
|
||||
case BLOCK_PISTON_EXTEND:
|
||||
case BLOCK_PISTON_RETRACT:
|
||||
pm.registerEvent(type, ourBlockEventHandler, Event.Priority.Monitor, plugin);
|
||||
break;
|
||||
case SIGN_CHANGE:
|
||||
pm.registerEvent(type, ourBlockEventHandler, Event.Priority.Low, plugin);
|
||||
break;
|
||||
case WORLD_LOAD:
|
||||
case WORLD_UNLOAD:
|
||||
case CHUNK_LOAD:
|
||||
case CHUNK_POPULATED:
|
||||
case SPAWN_CHANGE:
|
||||
pm.registerEvent(type, ourWorldEventHandler, Event.Priority.Monitor, plugin);
|
||||
break;
|
||||
case CUSTOM_EVENT:
|
||||
pm.registerEvent(type, ourCustomEventHandler, Event.Priority.Monitor, plugin);
|
||||
break;
|
||||
case ENTITY_EXPLODE:
|
||||
pm.registerEvent(type, ourEntityEventHandler, Event.Priority.Monitor, plugin);
|
||||
break;
|
||||
case PLUGIN_ENABLE:
|
||||
case PLUGIN_DISABLE:
|
||||
pm.registerEvent(type, ourServerEventHandler, Event.Priority.Monitor, plugin);
|
||||
break;
|
||||
default:
|
||||
Log.severe("registerEvent() in DynmapPlugin does not handle " + type);
|
||||
return;
|
||||
}
|
||||
ll = new ArrayList<Listener>();
|
||||
event_handlers.put(type, ll); /* Add list for this event */
|
||||
}
|
||||
ll.add(listener);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -58,6 +58,8 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
private boolean isempty = true;
|
||||
private ChunkSnapshot[] snaparray; /* Index = (x-x_min) + ((z-z_min)*x_dim) */
|
||||
private TreeSet<?> ourticklist;
|
||||
private byte[][] swampcnt;
|
||||
private BiomeMap[][] biomemap;
|
||||
|
||||
private int chunks_read; /* Number of chunks actually loaded */
|
||||
private int chunks_attempted; /* Number of chunks attempted to load */
|
||||
@@ -79,12 +81,15 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
private BlockStep laststep;
|
||||
private int typeid = -1;
|
||||
private int blkdata = -1;
|
||||
private int lastbiome_x = Integer.MIN_VALUE, lastbiome_z = Integer.MIN_VALUE;
|
||||
private BiomeMap lastbiome;
|
||||
private int lastcountswamp_x = Integer.MIN_VALUE, lastcountswamp_z = Integer.MIN_VALUE, lastcountswamp;
|
||||
private final int worldheight;
|
||||
private final int x_base;
|
||||
private final int z_base;
|
||||
|
||||
OurMapIterator(int x0, int y0, int z0) {
|
||||
x_base = x_min << 4;
|
||||
z_base = z_min << 4;
|
||||
if(biome)
|
||||
biomePrep();
|
||||
initialize(x0, y0, z0);
|
||||
worldheight = w.getMaxHeight();
|
||||
}
|
||||
@@ -121,53 +126,92 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
public final int getBlockEmittedLight() {
|
||||
return snap.getBlockEmittedLight(bx, y, bz);
|
||||
}
|
||||
public final BiomeMap getBiome() {
|
||||
if((x == lastbiome_x) && (z == lastbiome_z)) {
|
||||
return lastbiome;
|
||||
private void biomePrep() {
|
||||
int x_size = x_dim << 4;
|
||||
int z_size = (z_max - z_min + 1) << 4;
|
||||
swampcnt = new byte[x_size][];
|
||||
biomemap = new BiomeMap[x_size][];
|
||||
for(int i = 0; i < x_size; i++) {
|
||||
swampcnt[i] = new byte[z_size];
|
||||
biomemap[i] = new BiomeMap[z_size];
|
||||
}
|
||||
for(int i = 0; i < x_size; i++) {
|
||||
initialize(i + x_base, 64, z_base);
|
||||
for(int j = 0; j < z_size; j++) {
|
||||
Biome bb = snap.getBiome(bx, bz);
|
||||
if(bb == null)
|
||||
biomemap[i][j] = BiomeMap.NULL;
|
||||
else
|
||||
biomemap[i][j] = biome_to_bmap[bb.ordinal()];
|
||||
if(biomemap[i][j] == BiomeMap.SWAMPLAND) {
|
||||
for(int ii = i-1; ii < i+2; ii++) {
|
||||
for(int jj = j-1; jj < j+2; jj++) {
|
||||
if(ii < 0) continue;
|
||||
if(jj < 0) continue;
|
||||
if(ii >= x_size) continue;
|
||||
if(jj >= z_size) continue;
|
||||
swampcnt[ii][jj]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
stepPosition(BlockStep.Z_PLUS);
|
||||
}
|
||||
}
|
||||
BiomeMap bio;
|
||||
Biome bb = snap.getBiome(bx, bz);
|
||||
if(bb != null)
|
||||
bio = biome_to_bmap[bb.ordinal()];
|
||||
else
|
||||
bio = BiomeMap.NULL;
|
||||
lastbiome_x = x;
|
||||
lastbiome_z = z;
|
||||
lastbiome = bio;
|
||||
return bio;
|
||||
}
|
||||
|
||||
public final BiomeMap getBiome() {
|
||||
try {
|
||||
return biomemap[x - x_base][z - z_base];
|
||||
} catch (Exception ex) {
|
||||
return BiomeMap.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
public final int countSmoothedSwampBiomes() {
|
||||
if((lastcountswamp_x == x) && (lastcountswamp_z == z))
|
||||
return lastcountswamp;
|
||||
int cnt = 0;
|
||||
BlockStep s_bak = laststep;
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.X_MINUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.Z_MINUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.X_PLUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.X_PLUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.Z_PLUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.Z_PLUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.X_MINUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.X_MINUS);
|
||||
if(getBiome() == BiomeMap.SWAMPLAND) cnt++;
|
||||
stepPosition(BlockStep.X_PLUS);
|
||||
stepPosition(BlockStep.Z_MINUS);
|
||||
laststep = s_bak;
|
||||
|
||||
lastcountswamp_x = x;
|
||||
lastcountswamp_z = z;
|
||||
lastcountswamp = cnt;
|
||||
|
||||
return cnt;
|
||||
try {
|
||||
return swampcnt[x - x_base][z - z_base];
|
||||
} catch (Exception ex) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public final int countSmoothedSwampBiomes(int sx, int sz, int scale) {
|
||||
try {
|
||||
int xx = x - x_base;
|
||||
int zz = z - z_base;
|
||||
sx <<= 1;
|
||||
sz <<= 1;
|
||||
int s0 = swampcnt[xx][zz];
|
||||
int w;
|
||||
int tot;
|
||||
if(sx < scale) {
|
||||
w = scale - sx;
|
||||
tot = (w * swampcnt[xx-1][zz]) + ((scale - w) * s0);
|
||||
}
|
||||
else if(sx > scale) {
|
||||
w = sx - scale;
|
||||
tot = (w * swampcnt[xx+1][zz]) + ((scale - w) * s0);
|
||||
}
|
||||
else {
|
||||
tot = scale * s0;
|
||||
}
|
||||
if(sz < scale) {
|
||||
w = scale - sz;
|
||||
tot += (w * swampcnt[xx][zz-1]) + ((scale - w) * s0);
|
||||
}
|
||||
else if(sz > scale) {
|
||||
w = sz - scale;
|
||||
tot += (w * swampcnt[xx][zz+1]) + ((scale - w) * s0);
|
||||
}
|
||||
else {
|
||||
tot += scale * s0;
|
||||
}
|
||||
return tot;
|
||||
} catch (Exception ex) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public final double getRawBiomeTemperature() {
|
||||
return snap.getRawBiomeTemperature(bx, bz);
|
||||
}
|
||||
@@ -312,6 +356,10 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
public int getWorldHeight() {
|
||||
return worldheight;
|
||||
}
|
||||
@Override
|
||||
public long getBlockKey() {
|
||||
return (((chunkindex * worldheight) + y) << 8) | (bx << 4) | bz;
|
||||
}
|
||||
}
|
||||
|
||||
private class OurEndMapIterator extends OurMapIterator {
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.event.CustomEventListener;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -28,8 +30,8 @@ public class HeroChatHandler {
|
||||
private DynmapCore core;
|
||||
private HeroChatChannel hcwebinputchan;
|
||||
|
||||
private class OurPluginListener extends ServerListener {
|
||||
@Override
|
||||
private class OurPluginListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
Plugin plugin = event.getPlugin();
|
||||
String name = plugin.getDescription().getName();
|
||||
@@ -209,7 +211,7 @@ public class HeroChatHandler {
|
||||
/**
|
||||
* Handle custom events
|
||||
*/
|
||||
@Override
|
||||
@EventHandler
|
||||
public void onCustomEvent(Event event) {
|
||||
if (HeroChatChannelEvent.isInstance(event)) {
|
||||
HeroChatChannelEvent ce = new HeroChatChannelEvent(event);
|
||||
@@ -261,7 +263,7 @@ public class HeroChatHandler {
|
||||
}
|
||||
else {
|
||||
/* Set up to hear when HeroChat is enabled */
|
||||
DynmapPlugin.plugin.bep.registerEvent(Event.Type.PLUGIN_ENABLE, new OurPluginListener());
|
||||
DynmapPlugin.plugin.pm.registerEvents(new OurPluginListener(), DynmapPlugin.plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +281,8 @@ public class HeroChatHandler {
|
||||
return;
|
||||
}
|
||||
/* Register event handler */
|
||||
DynmapPlugin.plugin.bep.registerEvent(Event.Type.CUSTOM_EVENT, new OurEventListener());
|
||||
DynmapPlugin.plugin.pm.registerEvent(Event.Type.CUSTOM_EVENT, new OurEventListener(), Event.Priority.Monitor, DynmapPlugin.plugin);
|
||||
|
||||
Log.verboseinfo("HeroChat integration active");
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -71,12 +71,13 @@ components:
|
||||
showspawn: true
|
||||
spawnicon: world
|
||||
spawnlabel: "Spawn"
|
||||
# (optional) layer for showing offline player's positions
|
||||
# (optional) layer for showing offline player's positions (for 'maxofflinetime' minutes after logoff)
|
||||
showofflineplayers: false
|
||||
offlinelabel: "Offline"
|
||||
offlineicon: offlineuser
|
||||
offlinehidebydefault: true
|
||||
offlineminzoom: 0
|
||||
maxofflinetime: 30
|
||||
# (optional) layer for showing player's spawn beds
|
||||
showspawnbeds: false
|
||||
spawnbedlabel: "Spawn Beds"
|
||||
@@ -186,6 +187,9 @@ enabletilehash: true
|
||||
# Optional - enabled BetterGrass style rendering of grass and snow block sides
|
||||
#better-grass: true
|
||||
|
||||
# Optional - enable smooth lighting by default on all maps supporting it (can be set per map as lighting option)
|
||||
smooth-lighting: false
|
||||
|
||||
# Pre 0.29 render options - set all three to false if you want same results as 0.28 (i.e. you have existing maps and don't want to render)
|
||||
# use-generated-textures: if true, use generated textures (same as client); false is static, pre 0.29 textures
|
||||
# correct-water-lighting: if true, use corrected water lighting (same as client); false is legacy, pre 0.29 water (darker)
|
||||
@@ -243,6 +247,7 @@ render-triggers:
|
||||
- explosion
|
||||
- blockfromto
|
||||
- blockphysics
|
||||
- structuregrow
|
||||
|
||||
# Title for the web page - if not specified, defaults to the server's name (unless it is the default of 'Unknown Server')
|
||||
#webpage-title: "My Awesome Server Map"
|
||||
|
||||
@@ -64,7 +64,7 @@ commands:
|
||||
/<command> deleteicon id:<id> - remove icon
|
||||
/<command> deleteicon <label> - remove icon
|
||||
/<command> addcorner - add corner to corner list using current location
|
||||
/<command> addcorner <x> <z> <world> - add corner with given x and z coordinate on given world to corner list
|
||||
/<command> addcorner <x> <y> <z> <world> - add corner with given x, y and z coordinate on given world to corner list
|
||||
/<command> clearcorners - clear corner list
|
||||
/<command> addarea <label> - add new area with given label using corner list
|
||||
/<command> addarea id:<id> <label> - add new area with given ID using corner list
|
||||
@@ -73,6 +73,13 @@ commands:
|
||||
/<command> listareas - list details of all areas
|
||||
/<command> updatearea <label> <arg>:<value> ... - update attributes of area with given label
|
||||
/<command> updatearea id:<id> <arg>:<value> ... - update attributes of area with given ID
|
||||
/<command> addline <label> - add new poly-line with given label using corner list
|
||||
/<command> addline id:<id> <label> - add new poly-line with given ID using corner list
|
||||
/<command> deleteline <label> - delete poly-line with given label
|
||||
/<command> deleteline id:<id> <label> - delete poly-line with given ID
|
||||
/<command> listlines - list details of all poly-lines
|
||||
/<command> updateline <label> <arg>:<value> ... - update attributes of poly-line with given label
|
||||
/<command> updateline id:<id> <arg>:<value> ... - update attributes of poly-line with given ID
|
||||
dmap:
|
||||
description: List and modify dynmap configuration
|
||||
usage: |
|
||||
@@ -240,6 +247,18 @@ permissions:
|
||||
dynmap.marker.deletearea:
|
||||
description: Allows /dmarker deletearea
|
||||
default: op
|
||||
dynmap.marker.addline:
|
||||
description: Allows /dmarker addline
|
||||
default: op
|
||||
dynmap.marker.updateline:
|
||||
description: Allows /dmarker updateline
|
||||
default: op
|
||||
dynmap.marker.listlines:
|
||||
description: Allows /dmarker listlines
|
||||
default: op
|
||||
dynmap.marker.deleteline:
|
||||
description: Allows /dmarker deleteline
|
||||
default: op
|
||||
dynmap.dmap.worldlist:
|
||||
description: Allows /dmap worldlist
|
||||
default: op
|
||||
|
||||
Reference in New Issue
Block a user