Compare commits

..

19 Commits

Author SHA1 Message Date
Mike Primm 96673f0fb3 More protection against exceptions for blocks at top of world 2012-05-23 08:13:47 -05:00
Mike Primm fc451fd002 Prevent traps by stupid mods that think BlockBreak events are good to send without blocks.... 2012-05-22 23:53:29 -05:00
Mike Primm 2f1b1789fd Bump to 0.40 2012-05-20 18:45:40 -05:00
Mike Primm 01b054e972 Make logo component position settable, allow more than one instance 2012-05-19 22:12:01 -05:00
Mike Primm 5d35205cae Handle chunk cache loading in platform module 2012-05-19 15:50:20 -05:00
Mike Primm 58c7d6378c Add IC2 Compact Solars support setting 2012-05-11 22:35:07 -05:00
Mike Primm d95213e7dd Fix hideifundercover on The End 2012-05-09 00:29:04 -05:00
Mike Primm 4f5063155e Add forestry-support flag to configuration.txt 2012-05-08 22:40:08 -05:00
Mike Primm 2d4e233005 Bump to 0.39 2012-05-06 17:25:48 -05:00
Mike Primm afc0d9bd6b Bump to 0.38 2012-04-22 18:10:39 -05:00
Mike Primm 267b423ff1 Update POM to use Bukkit 1.2.5-R1.0 2012-04-17 21:57:59 -05:00
Mike Primm d523ce8a41 Add 'protected-player-info' option - require login + privilege to see players other than self 2012-04-16 22:54:31 -05:00
Mike Primm ee7e6eedc8 Disable blockphysics and blockfromto by default - fires too much in recent CB versions, and just not needed 99% of the time 2012-04-13 23:20:36 -05:00
Mike Primm 4d6d156e9c Declare world permission nodes 2012-04-11 01:19:12 -05:00
Mike Primm 177310a949 Add lctrees-support setting (enable LC Trees++ support) 2012-04-09 18:05:07 -05:00
Mike Primm 0707953718 Fix handling of unknown biomes (For Trees++) 2012-04-09 18:03:32 -05:00
Mike Primm 8546b2205e Bump to 0.37 2012-04-04 01:04:26 -05:00
Mike Primm d154f23bab Add 'chatlengthlimit' setting - control max chat message length 2012-04-03 23:23:29 -05:00
Mike Primm 0b38a4cec8 Bump to 0.36.3 2012-04-03 13:36:44 -05:00
10 changed files with 165 additions and 27 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.36.2</version>
<version>0.40</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -133,7 +133,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>[1.1-R5-SNAPSHOT,1.7)</version>
<version>[1.2.5-R1.0,1.7)</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
@@ -6,6 +6,8 @@ import java.util.List;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWorld;
@@ -13,16 +15,21 @@ import org.dynmap.utils.MapChunkCache;
public class BukkitWorld extends DynmapWorld {
private World world;
private Permission perm;
private World.Environment env;
private boolean skylight;
public BukkitWorld(World w) {
super(w.getName(), w.getMaxHeight(), w.getSeaLevel());
world = w;
env = world.getEnvironment();
skylight = (env == World.Environment.NORMAL);
perm = new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
}
/* Test if world is nether */
@Override
public boolean isNether() {
return world.getEnvironment() == World.Environment.NETHER;
return env == World.Environment.NETHER;
}
/* Get world spawn location */
@Override
@@ -66,7 +73,7 @@ public class BukkitWorld extends DynmapWorld {
/* Test if sky light level is requestable */
@Override
public boolean canGetSkyLightLevel() {
return true;
return skylight;
}
/* Return sky light level */
@Override
@@ -78,7 +85,7 @@ public class BukkitWorld extends DynmapWorld {
*/
@Override
public String getEnvironment() {
return world.getEnvironment().name().toLowerCase();
return env.name().toLowerCase();
}
/**
* Get map chunk cache for world
@@ -57,6 +57,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.dynmap.DynmapAPI;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapCore;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWebChatEvent;
@@ -77,6 +78,7 @@ import org.dynmap.common.DynmapPlayer;
import org.dynmap.common.DynmapServerInterface;
import org.dynmap.common.DynmapListenerManager.EventType;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.utils.MapChunkCache;
import org.getspout.spoutapi.plugin.SpoutPlugin;
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
@@ -108,6 +110,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
* Server access abstraction class
*/
public class BukkitServer implements DynmapServerInterface {
/* Chunk load handling */
private Object loadlock = new Object();
private int chunks_in_cur_tick = 0;
private long cur_tick;
@Override
public void scheduleServerTask(Runnable run, long delay) {
getServer().getScheduler().scheduleSyncDelayedTask(DynmapPlugin.this, run, delay);
@@ -209,7 +216,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent evt) {
if(evt.isCancelled()) return;
Block b = evt.getBlock();
if(b == null) return; /* Work around for stupid mods.... */
Location l = b.getLocation();
core.listenerManager.processBlockEvent(EventType.BLOCK_BREAK, b.getType().getId(),
BukkitWorld.normalizeWorldName(l.getWorld().getName()), l.getBlockX(), l.getBlockY(), l.getBlockZ());
@@ -221,6 +230,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onSignChange(SignChangeEvent evt) {
if(evt.isCancelled()) return;
Block b = evt.getBlock();
Location l = b.getLocation();
String[] lines = evt.getLines(); /* Note: changes to this change event - intentional */
@@ -302,6 +312,70 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
return false;
return permissions.hasOfflinePermission(player, perm);
}
/**
* Render processor helper - used by code running on render threads to request chunk snapshot cache from server/sync thread
*/
@Override
public MapChunkCache createMapChunkCache(DynmapWorld w, List<DynmapChunk> chunks,
boolean blockdata, boolean highesty, boolean biome, boolean rawbiome) {
MapChunkCache c = w.getChunkCache(chunks);
if(w.visibility_limits != null) {
for(MapChunkCache.VisibilityLimit limit: w.visibility_limits) {
c.setVisibleRange(limit);
}
c.setHiddenFillStyle(w.hiddenchunkstyle);
c.setAutoGenerateVisbileRanges(w.do_autogenerate);
}
if(w.hidden_limits != null) {
for(MapChunkCache.VisibilityLimit limit: w.hidden_limits) {
c.setHiddenRange(limit);
}
c.setHiddenFillStyle(w.hiddenchunkstyle);
}
if(c.setChunkDataTypes(blockdata, biome, highesty, rawbiome) == false) {
Log.severe("CraftBukkit build does not support biome APIs");
}
if(chunks.size() == 0) { /* No chunks to get? */
c.loadChunks(0);
return c;
}
final MapChunkCache cc = c;
while(!cc.isDoneLoading()) {
synchronized(loadlock) {
long now = System.currentTimeMillis();
if(cur_tick != (now/50)) { /* New tick? */
chunks_in_cur_tick = mapManager.getMaxChunkLoadsPerTick();
cur_tick = now/50;
}
}
Future<Boolean> f = core.getServer().callSyncMethod(new Callable<Boolean>() {
public Boolean call() throws Exception {
boolean exhausted;
synchronized(loadlock) {
if(chunks_in_cur_tick > 0)
chunks_in_cur_tick -= cc.loadChunks(chunks_in_cur_tick);
exhausted = (chunks_in_cur_tick == 0);
}
return exhausted;
}
});
Boolean delay;
try {
delay = f.get();
} catch (Exception ix) {
Log.severe(ix);
return null;
}
if((delay != null) && delay.booleanValue()) {
try { Thread.sleep(25); } catch (InterruptedException ix) {}
}
}
return c;
}
}
/**
* Player access abstraction class
@@ -771,7 +845,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockBreak(BlockBreakEvent event) {
if(event.isCancelled())
return;
Location loc = event.getBlock().getLocation();
Block b = event.getBlock();
if(b == null) return; /* Stupid mod workaround */
Location loc = b.getLocation();
String wn = BukkitWorld.normalizeWorldName(loc.getWorld().getName());
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockbreak");
@@ -825,6 +901,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
return;
Block b = event.getBlock();
Material m = b.getType();
if(m == null) return;
switch(m) {
case STATIONARY_WATER:
case WATER:
@@ -832,7 +909,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
case LAVA:
case GRAVEL:
case SAND:
checkBlock(event.getBlock(), "blockphysics");
checkBlock(b, "blockphysics");
break;
}
}
@@ -847,12 +924,14 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockFromTo(BlockFromToEvent event) {
if(event.isCancelled())
return;
Material m = event.getBlock().getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE))
checkBlock(event.getBlock(), "blockfromto");
m = event.getToBlock().getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE))
checkBlock(event.getToBlock(), "blockfromto");
Block b = event.getBlock();
Material m = b.getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE) && (m != null))
checkBlock(b, "blockfromto");
b = event.getToBlock();
m = b.getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE) && (m != null))
checkBlock(b, "blockfromto");
}
};
pm.registerEvents(fromtolistener, this);
@@ -101,16 +101,21 @@ public class NewMapChunkCache implements MapChunkCache {
exceptions++;
}
laststep = BlockStep.Y_MINUS;
typeid = blkdata = -1;
if((y >= 0) && (y < worldheight))
typeid = blkdata = -1;
else
typeid = blkdata = 0;
}
public final int getBlockTypeID() {
if(typeid < 0)
if(typeid < 0) {
typeid = snap.getBlockTypeId(bx, y, bz);
}
return typeid;
}
public final int getBlockData() {
if(blkdata < 0)
if(blkdata < 0) {
blkdata = snap.getBlockData(bx, y, bz);
}
return blkdata;
}
public int getBlockSkyLight() {
@@ -353,6 +358,8 @@ public class NewMapChunkCache implements MapChunkCache {
* Step current position in given direction
*/
public final void stepPosition(BlockStep step) {
typeid = -1;
blkdata = -1;
switch(step.ordinal()) {
case 0:
x++;
@@ -372,6 +379,9 @@ public class NewMapChunkCache implements MapChunkCache {
break;
case 1:
y++;
if(y >= worldheight) {
typeid = blkdata = 0;
}
break;
case 2:
z++;
@@ -407,6 +417,9 @@ public class NewMapChunkCache implements MapChunkCache {
break;
case 4:
y--;
if(y < 0) {
typeid = blkdata = 0;
}
break;
case 5:
z--;
@@ -426,8 +439,6 @@ public class NewMapChunkCache implements MapChunkCache {
break;
}
laststep = step;
typeid = -1;
blkdata = -1;
}
/**
* Unstep current position to previous position
@@ -449,8 +460,12 @@ public class NewMapChunkCache implements MapChunkCache {
else
laststep = BlockStep.Y_MINUS;
this.y = y;
typeid = -1;
blkdata = -1;
if((y < 0) || (y >= worldheight)) {
typeid = blkdata = 0;
}
else {
typeid = blkdata = -1;
}
}
public final int getX() {
return x;
@@ -493,9 +508,12 @@ public class NewMapChunkCache implements MapChunkCache {
}
@Override
public final boolean isEmptySection() {
if(isSectionNotEmpty[chunkindex] == null)
try {
return !isSectionNotEmpty[chunkindex][y >> 4];
} catch (Exception x) {
initSectionData(chunkindex);
return !isSectionNotEmpty[chunkindex][y >> 4];
return !isSectionNotEmpty[chunkindex][y >> 4];
}
}
}
@@ -1060,6 +1078,9 @@ public class NewMapChunkCache implements MapChunkCache {
Biome[] b = Biome.values();
BiomeMap[] bm = BiomeMap.values();
biome_to_bmap = new BiomeMap[b.length];
for(int i = 0; i < b.length; i++) {
biome_to_bmap[i] = BiomeMap.NULL;
}
for(int i = 0; i < b.length; i++) {
String bs = b[i].toString();
for(int j = 0; j < bm.length; j++) {
@@ -25,6 +25,9 @@ public class NijikokunPermissions implements PermissionProvider {
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
Log.info("Using Permissions " + permissionsPlugin.getDescription().getVersion() + " for access control");
return new NijikokunPermissions(permissionsPlugin, name);
}
@@ -22,6 +22,8 @@ public class PEXPermissions implements PermissionProvider {
if (permissionsPlugin == null)
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
if(PermissionsEx.isAvailable() == false)
return null;
Log.info("Using PermissionsEx " + permissionsPlugin.getDescription().getVersion() + " for access control");
@@ -28,6 +28,9 @@ public class PermBukkitPermissions extends BukkitPermissions {
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
Log.info("Using PermissionsBukkit " + permissionsPlugin.getDescription().getVersion() + " for access control");
Log.info("Web interface permissions only available for online users");
return new PermBukkitPermissions(permissionsPlugin, name, pd);
@@ -28,6 +28,9 @@ public class bPermPermissions extends BukkitPermissions {
if (permissionsPlugin == null)
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
Log.info("Using bPermissions " + permissionsPlugin.getDescription().getVersion() + " for access control");
return new bPermPermissions(name, pd);
}
+20 -4
View File
@@ -32,12 +32,16 @@ components:
webchat-requires-login: false
# If set to true, users must have dynmap.webchat permission in order to chat
webchat-permissions: false
# Limit length of single chat messages
chatlengthlimit: 256
# # Optional - make players hidden when they are inside/underground/in shadows (#=light level: 0=full shadow,15=sky)
# hideifshadow: 4
# # Optional - make player hidden when they are under cover (#=sky light level,0=underground,15=open to sky)
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
# hideifsneaking: false
hideifsneaking: false
# If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
protected-player-info: false
#- class: org.dynmap.JsonFileClientUpdateComponent
# writeinterval: 1
# sendhealth: true
@@ -56,6 +60,8 @@ components:
# webchat-requires-login: false
# # If set to true, users must have dynmap.webchat permission in order to chat
# webchat-permissions: false
# # Limit length of single chat messages
# chatlengthlimit: 256
- class: org.dynmap.SimpleWebChatComponent
allowchat: true
@@ -133,11 +139,14 @@ components:
hidey: false
show-mcr: false
# Note: more than one logo component can be defined
#- class: org.dynmap.ClientComponent
# type: logo
# text: "Dynmap"
# #logourl: "images/block_surface.png"
# linkurl: "http://forums.bukkit.org/threads/dynmap.489/"
# # Valid positions: top-left, top-right, bottom-left, bottom-right
# position: bottom-right
#- class: org.dynmap.ClientComponent
# type: inactive
@@ -206,11 +215,12 @@ correct-water-lighting: true
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
compass-mode: newnorth
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters)
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters, Compact Solars)
#ic2-support: true
#ic2-advancesmachines-support: true
#ic2-chargingbench-support: true
#ic2-powerconverters-support: true
#ic2-compactsolars-support: true
# Enable BuildCraft block rendering support
#buildcraft-support: true
@@ -230,6 +240,12 @@ compass-mode: newnorth
# Enabled ComputerCraft block rendering support
#computercraft-support: true
# Enabled LC Trees++ block rendering support
#lctrees-support: true
# Enable Forestry block rending support
#forestry-support: true
render-triggers:
#- playermove
#- playerjoin
@@ -243,8 +259,8 @@ render-triggers:
- blockspread
- pistonmoved
- explosion
- blockfromto
- blockphysics
#- blockfromto
#- blockphysics
- structuregrow
- blockgrow
+4
View File
@@ -155,6 +155,7 @@ permissions:
dynmap.dmap.perspectivelist: true
dynmap.dmap.shaderlist: true
dynmap.dmap.lightinglist: true
dynmap.playermarkers.seeall: true
dynmap.render:
description: Allows /dynmap render command
default: true
@@ -320,3 +321,6 @@ permissions:
dynmap.webchat:
description: Allows web chat (if login required for webchat)
default: true
dynmap.playermarkers.seeall:
description: Allow all players to be seen by user on web UI
default: op