Compare commits

..

35 Commits

Author SHA1 Message Date
Mike Primm bae2a48a83 Handle when Spout explodes during startup 2012-03-28 21:23:36 -05:00
Mike Primm 11b2123f14 Fix lighting problem with custom spout blocks 2012-03-28 21:04:12 -05:00
Mike Primm f93f37deea Handle 1.2.x world height in chunks with Spout plus custom blocks 2012-03-28 11:39:39 -05:00
Mike Primm cf5e2e00e6 Bump to 0.36.1 2012-03-27 23:21:54 -05:00
Mike Primm 121c1050ce Bump to 0.37 2012-03-25 23:21:36 -05:00
Mike Primm 4f6dd1d778 Add chatnotpermitted message 2012-03-25 23:09:39 -05:00
Mike Primm 3ed44ee905 Add dynmap.webchat permission - option to restrict webchat rights 2012-03-25 14:29:49 -05:00
Mike Primm 8f9d2c01c2 Add player permissions check API 2012-03-24 23:29:31 -05:00
Mike Primm faa1948225 Add direct support for PeX, bPerms, PermBukkit 2012-03-23 22:02:13 -05:00
Mike Primm 67e0bd2f2c Merge remote branch 'upstream/master' 2012-03-20 08:02:58 -05:00
Mike Primm 4fc8a53eb0 Add /dynmap webregister permissions and help 2012-03-20 08:02:29 -05:00
Mike Primm 1c1937c80c Add external server login support 2012-03-19 23:02:41 -05:00
Mike Primm f24dfd6c3e First pass login security support (internal server only) 2012-03-18 21:04:46 -05:00
Mike Primm 86b87e78e3 Add misc/swampgrasscolor.png and misc/swampfoliagecolor.png support 2012-03-17 00:34:33 -05:00
Mike Primm 34fe8316c3 Handle custom water color shading (misc/watercolorX.png) 2012-03-16 22:48:33 -05:00
Mike Primm 387844b9dc Bump to 0.36 2012-03-13 11:20:25 -05:00
Mike Primm a493f85bcf Bump to 0.35 (API changes) 2012-03-13 10:55:34 -05:00
Mike Primm 1ab7a8ddbf Handle lighting checks above world top 2012-03-13 01:10:47 -05:00
Mike Primm bdb2620ca9 Fix typo 2012-03-12 18:46:12 -05:00
Mike Primm d8812ce575 Add 'visiblelines' setting for 'chatbox' - control visible space on scrollback 2012-03-12 01:32:58 -05:00
Mike Primm 6c618fa727 More cleanup 2012-03-11 19:56:54 -05:00
Mike Primm a9214502cf More config cleanup 2012-03-11 18:49:58 -05:00
Mike Primm ef0ad40496 Update to 1.2 biome shading model (1.1 maps will be 1.2-style shaded - sorry) 2012-03-11 16:17:32 -05:00
Mike Primm 2628559b55 Retire old beta render options (correct-biome-shading, smooth-biome-shading, waterbiomeshaded, swampshaded, fence-to-block-join) 2012-03-11 16:14:22 -05:00
Mike Primm 11021720c7 Add new commands and security settings for circle markers 2012-03-10 18:14:22 -06:00
Mike Primm de4fdb2b0c Fix handling of normalized world names 2012-03-10 15:07:13 -06:00
Mike Primm ecdb50920e Try fix for getHighestBlockY() not working as advertised 2012-03-09 14:33:51 -06:00
Mike Primm 50f7382b7a Bump to 0.34.1 2012-03-04 23:56:17 -06:00
Mike Primm 56875a05d4 Fix nether render in 1.1 and 1.2 2012-03-04 20:21:01 -06:00
Mike Primm f392eb1344 Drop listeners for disabled triggers (overhead on very big servers) 2012-03-03 23:20:04 -06:00
Mike Primm a41e052f51 Big performance boost - exploit empty section data, max block y in ray trace 2012-03-03 09:33:07 -06:00
Mike Primm 0e97fedd6b Add support for 'blockgrow' trigger (for growing crops) 2012-02-28 23:40:52 -06:00
Mike Primm 9d97f86b7f Add config setting for ComputerCraft rendering 2012-02-28 22:23:58 -06:00
Mike Primm 516125e87b Support world names with '/' characters (substitute internally with '-') 2012-02-27 22:14:48 -06:00
Mike Primm e52234336e Bump to 0.34 2012-02-26 21:11:20 -06:00
17 changed files with 858 additions and 314 deletions
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+22 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.33</version>
<version>0.36.1</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -158,5 +158,26 @@
<version>dev-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<version>1.19.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/PermissionsEx.jar</systemPath>
</dependency>
<dependency>
<groupId>de.bananaco</groupId>
<artifactId>bPermissions</artifactId>
<version>2.9.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/bpermissions.jar</systemPath>
</dependency>
<dependency>
<groupId>com.platymuus.bukkit.permissions</groupId>
<artifactId>PermissionsBukkit</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${project.basedir}/PermissionsBukkit.jar</systemPath>
</dependency>
</dependencies>
</project>
@@ -30,7 +30,7 @@ public class BukkitWorld extends DynmapWorld {
DynmapLocation dloc = new DynmapLocation();
Location sloc = world.getSpawnLocation();
dloc.x = sloc.getBlockX(); dloc.y = sloc.getBlockY();
dloc.z = sloc.getBlockZ(); dloc.world = sloc.getWorld().getName();
dloc.z = sloc.getBlockZ(); dloc.world = normalizeWorldName(sloc.getWorld().getName());
return dloc;
}
/* Get world time */
File diff suppressed because it is too large Load Diff
@@ -1,9 +1,9 @@
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;
@@ -31,12 +31,13 @@ public class NewMapChunkCache implements MapChunkCache {
private static Method gethandle = null;
private static Method removeentities = null;
private static Method getworldhandle = null;
private static Field chunkbiome = null;
private static boolean use_spout = false;
private static boolean use_sections = false;
private World w;
private DynmapWorld dw;
private Object craftworld;
private int nsect;
private List<DynmapChunk> chunks;
private ListIterator<DynmapChunk> iterator;
private int x_min, x_max, z_min, z_max;
@@ -49,7 +50,7 @@ public class NewMapChunkCache implements MapChunkCache {
private boolean do_save = false;
private boolean isempty = true;
private ChunkSnapshot[] snaparray; /* Index = (x-x_min) + ((z-z_min)*x_dim) */
private byte[][] swampcnt;
private byte[][] sameneighborbiomecnt;
private BiomeMap[][] biomemap;
private boolean[][] isSectionNotEmpty; /* Indexed by snapshot index, then by section index */
@@ -113,41 +114,61 @@ public class NewMapChunkCache implements MapChunkCache {
return blkdata;
}
public int getBlockSkyLight() {
return snap.getBlockSkyLight(bx, y, bz);
try {
return snap.getBlockSkyLight(bx, y, bz);
} catch (ArrayIndexOutOfBoundsException aioobx) {
return 15;
}
}
public final int getBlockEmittedLight() {
return snap.getBlockEmittedLight(bx, y, bz);
try {
return snap.getBlockEmittedLight(bx, y, bz);
} catch (ArrayIndexOutOfBoundsException aioobx) {
return 0;
}
}
private void biomePrep() {
if(swampcnt != null)
if(sameneighborbiomecnt != null)
return;
int x_size = x_dim << 4;
int z_size = (z_max - z_min + 1) << 4;
swampcnt = new byte[x_size][];
sameneighborbiomecnt = new byte[x_size][];
biomemap = new BiomeMap[x_size][];
for(int i = 0; i < x_size; i++) {
swampcnt[i] = new byte[z_size];
sameneighborbiomecnt[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);
BiomeMap bm;
if(bb == null)
biomemap[i][j] = BiomeMap.NULL;
bm = 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]++;
}
bm = biome_to_bmap[bb.ordinal()];
biomemap[i][j] = bm;
int cnt = 0;
if(i > 0) {
if(bm == biomemap[i-1][j]) { /* Same as one to left */
cnt++;
sameneighborbiomecnt[i-1][j]++;
}
if((j > 0) && (bm == biomemap[i-1][j-1])) {
cnt++;
sameneighborbiomecnt[i-1][j-1]++;
}
if((j < (z_size-1)) && (bm == biomemap[i-1][j+1])) {
cnt++;
sameneighborbiomecnt[i-1][j+1]++;
}
}
if((j > 0) && (biomemap[i][j] == biomemap[i][j-1])) { /* Same as one to above */
cnt++;
sameneighborbiomecnt[i][j-1]++;
}
sameneighborbiomecnt[i][j] = (byte)cnt;
stepPosition(BlockStep.Z_PLUS);
}
}
@@ -157,54 +178,170 @@ public class NewMapChunkCache implements MapChunkCache {
try {
return biomemap[x - x_base][z - z_base];
} catch (Exception ex) {
exceptions++;
return BiomeMap.NULL;
}
}
public final int countSmoothedSwampBiomes() {
public final int getSmoothGrassColorMultiplier(int[] colormap, int width) {
int mult = 0xFFFFFF;
try {
return swampcnt[x - x_base][z - z_base];
} catch (Exception ex) {
return 0;
int rx = x - x_base;
int rz = z - z_base;
BiomeMap bm = biomemap[rx][rz];
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
mult = bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup(width)]);
}
else {
int raccum = 0;
int gaccum = 0;
int baccum = 0;
for(int xoff = -1; xoff < 2; xoff++) {
for(int zoff = -1; zoff < 2; zoff++) {
bm = biomemap[rx+xoff][rz+zoff];
int rmult = bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup(width)]);
raccum += (rmult >> 16) & 0xFF;
gaccum += (rmult >> 8) & 0xFF;
baccum += rmult & 0xFF;
}
}
mult = ((raccum / 9) << 16) | ((gaccum / 9) << 8) | (baccum / 9);
}
} catch (Exception x) {
exceptions++;
mult = 0xFFFFFF;
}
return mult;
}
public final int getSmoothFoliageColorMultiplier(int[] colormap, int width) {
int mult = 0xFFFFFF;
try {
int rx = x - x_base;
int rz = z - z_base;
BiomeMap bm = biomemap[rx][rz];
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
mult = bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup(width)]);
}
else {
int raccum = 0;
int gaccum = 0;
int baccum = 0;
for(int xoff = -1; xoff < 2; xoff++) {
for(int zoff = -1; zoff < 2; zoff++) {
bm = biomemap[rx+xoff][rz+zoff];
int rmult = bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup(width)]);
raccum += (rmult >> 16) & 0xFF;
gaccum += (rmult >> 8) & 0xFF;
baccum += rmult & 0xFF;
}
}
mult = ((raccum / 9) << 16) | ((gaccum / 9) << 8) | (baccum / 9);
}
} catch (Exception x) {
exceptions++;
mult = 0xFFFFFF;
}
return mult;
}
public final int getSmoothColorMultiplier(int[] colormap, int width, int[] swampmap, int swampwidth) {
int mult = 0xFFFFFF;
try {
int rx = x - x_base;
int rz = z - z_base;
BiomeMap bm = biomemap[rx][rz];
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
if(bm == BiomeMap.SWAMPLAND) {
mult = swampmap[bm.biomeLookup(swampwidth)];
}
else {
mult = colormap[bm.biomeLookup(width)];
}
}
else {
int raccum = 0;
int gaccum = 0;
int baccum = 0;
for(int xoff = -1; xoff < 2; xoff++) {
for(int zoff = -1; zoff < 2; zoff++) {
bm = biomemap[rx+xoff][rz+zoff];
int rmult;
if(bm == BiomeMap.SWAMPLAND) {
rmult = swampmap[bm.biomeLookup(swampwidth)];
}
else {
rmult = colormap[bm.biomeLookup(width)];
}
raccum += (rmult >> 16) & 0xFF;
gaccum += (rmult >> 8) & 0xFF;
baccum += rmult & 0xFF;
}
}
mult = ((raccum / 9) << 16) | ((gaccum / 9) << 8) | (baccum / 9);
}
} catch (Exception x) {
exceptions++;
mult = 0xFFFFFF;
}
return mult;
}
public final int countSmoothedSwampBiomes(int sx, int sz, int scale) {
public final int getSmoothWaterColorMultiplier() {
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);
int rx = x - x_base;
int rz = z - z_base;
BiomeMap bm = biomemap[rx][rz];
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
return bm.getWaterColorMult();
}
else if(sx > scale) {
w = sx - scale;
tot = (w * swampcnt[xx+1][zz]) + ((scale - w) * s0);
int raccum = 0;
int gaccum = 0;
int baccum = 0;
for(int xoff = -1; xoff < 2; xoff++) {
for(int zoff = -1; zoff < 2; zoff++) {
bm = biomemap[rx+xoff][rz+zoff];
int mult = bm.getWaterColorMult();
raccum += (mult >> 16) & 0xFF;
gaccum += (mult >> 8) & 0xFF;
baccum += mult & 0xFF;
}
}
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;
return ((raccum / 9) << 16) | ((gaccum / 9) << 8) | (baccum / 9);
} catch (Exception x) {
exceptions++;
return 0xFFFFFF;
}
}
public final int getSmoothWaterColorMultiplier(int[] colormap, int width) {
int mult = 0xFFFFFF;
try {
int rx = x - x_base;
int rz = z - z_base;
BiomeMap bm = biomemap[rx][rz];
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
mult = colormap[bm.biomeLookup(width)];
}
else {
int raccum = 0;
int gaccum = 0;
int baccum = 0;
for(int xoff = -1; xoff < 2; xoff++) {
for(int zoff = -1; zoff < 2; zoff++) {
bm = biomemap[rx+xoff][rz+zoff];
int rmult = colormap[bm.biomeLookup(width)];
raccum += (rmult >> 16) & 0xFF;
gaccum += (rmult >> 8) & 0xFF;
baccum += rmult & 0xFF;
}
}
mult = ((raccum / 9) << 16) | ((gaccum / 9) << 8) | (baccum / 9);
}
} catch (Exception x) {
exceptions++;
mult = 0xFFFFFF;
}
return mult;
}
public final double getRawBiomeTemperature() {
return snap.getRawBiomeTemperature(bx, bz);
@@ -408,9 +545,6 @@ public class NewMapChunkCache implements MapChunkCache {
public boolean isSectionEmpty(int sy) {
return true;
}
public int getTopNonEmptySection() {
return -1;
}
}
/**
@@ -456,11 +590,22 @@ public class NewMapChunkCache implements MapChunkCache {
private static class SpoutChunkSnapshot implements ChunkSnapshot {
private ChunkSnapshot chunk;
private short[] customids; /* (X << 11) | (Z << 7) | Y */
private short[] customids;
private final int shiftx;
private final int shiftz;
SpoutChunkSnapshot(ChunkSnapshot chunk, short[] customids) {
SpoutChunkSnapshot(ChunkSnapshot chunk, short[] customids, int height) {
this.chunk = chunk;
this.customids = customids.clone();
int sx = 11;
int sz = 7; /* 128 high values */
while(height > 128) {
sx++;
sz++;
height = (height >> 1);
}
shiftx = sx;
shiftz = sz;
}
/* Need these for interface, but not used */
public final int getX() { return chunk.getX(); }
@@ -472,7 +617,7 @@ public class NewMapChunkCache implements MapChunkCache {
public final long getCaptureFullTime() { return chunk.getCaptureFullTime(); }
public final int getBlockTypeId(int x, int y, int z) {
int id = customids[(x << 11) | (z << 7) | y];
int id = customids[(x << shiftx) | (z << shiftz) | y];
if(id != 0) return id;
return chunk.getBlockTypeId(x, y, z);
}
@@ -489,12 +634,7 @@ public class NewMapChunkCache implements MapChunkCache {
return chunk.getHighestBlockYAt(x, z);
}
public boolean isSectionEmpty(int sy) {
//TODO return chunk.isSectionEmpty(sy);
return false;
}
public int getTopNonEmptySection() {
return 0;
//TODO return chunk.getTopNonEmptySection();
return chunk.isSectionEmpty(sy);
}
}
@@ -531,15 +671,13 @@ public class NewMapChunkCache implements MapChunkCache {
} catch (ClassNotFoundException cnfx) {
} catch (NoSuchMethodException nsmx) {
}
/* Get CraftChunkSnapshot.biome field */
/* Check for ChunkSnapshot.isSectionEmpty(int) method */
try {
Class c = Class.forName("org.bukkit.craftbukkit.CraftChunkSnapshot");
chunkbiome = c.getDeclaredField("biome");
chunkbiome.setAccessible(true);
} catch (ClassNotFoundException cnfx) {
} catch (NoSuchFieldException nsmx) {
ChunkSnapshot.class.getDeclaredMethod("isSectionEmpty", new Class[] { int.class });
use_sections = true;
} catch (NoSuchMethodException nsmx) {
}
use_spout = DynmapPlugin.plugin.hasSpout();
init = true;
@@ -548,6 +686,7 @@ public class NewMapChunkCache implements MapChunkCache {
public void setChunks(BukkitWorld dw, List<DynmapChunk> chunks) {
this.dw = dw;
this.w = dw.getWorld();
nsect = dw.worldheight >> 4;
if((getworldhandle != null) && (craftworld == null)) {
try {
craftworld = getworldhandle.invoke(w); /* World.getHandle() */
@@ -588,7 +727,7 @@ public class NewMapChunkCache implements MapChunkCache {
SpoutChunk sc = (SpoutChunk)c;
short[] custids = sc.getCustomBlockIds();
if(custids != null) {
return new SpoutChunkSnapshot(ss, custids);
return new SpoutChunkSnapshot(ss, custids, c.getWorld().getMaxHeight());
}
}
return ss;
@@ -624,7 +763,7 @@ public class NewMapChunkCache implements MapChunkCache {
}
}
/* Check if cached chunk snapshot found */
ChunkSnapshot ss = DynmapPlugin.plugin.sscache.getSnapshot(w.getName(), chunk.x, chunk.z, blockdata, biome, biomeraw, highesty);
ChunkSnapshot ss = DynmapPlugin.plugin.sscache.getSnapshot(dw.getName(), chunk.x, chunk.z, blockdata, biome, biomeraw, highesty);
if(ss != null) {
if(!vis) {
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
@@ -665,7 +804,7 @@ public class NewMapChunkCache implements MapChunkCache {
else
ss = w.getEmptyChunkSnapshot(chunk.x, chunk.z, biome, biomeraw);
if(ss != null) {
DynmapPlugin.plugin.sscache.putSnapshot(w.getName(), chunk.x, chunk.z, ss, blockdata, biome, biomeraw, highesty);
DynmapPlugin.plugin.sscache.putSnapshot(dw.getName(), chunk.x, chunk.z, ss, blockdata, biome, biomeraw, highesty);
}
}
snaparray[(chunk.x-x_min) + (chunk.z - z_min)*x_dim] = ss;
@@ -794,28 +933,27 @@ public class NewMapChunkCache implements MapChunkCache {
return ss.getRawBiomeRainfall(x & 0xF, z & 0xF);
}
private void initSectionData(int idx) {
isSectionNotEmpty[idx] = new boolean[w.getMaxHeight() >> 4];
isSectionNotEmpty[idx] = new boolean[nsect + 1];
int maxy = 0;
if(snaparray[idx] != EMPTY) {
/* Get max height */
for(int i = 0; i < 16; i++) {
for(int j = 0; j < 16; j++) {
maxy = Math.max(maxy, snaparray[idx].getHighestBlockYAt(i, j));
}
if(!use_sections) {
Arrays.fill(isSectionNotEmpty[idx], true);
}
for(int i = 0; i < isSectionNotEmpty[idx].length; i++) {
if((i << 4) < maxy) { /* Below top? */
isSectionNotEmpty[idx][i] = true;
else {
for(int i = 0; i < nsect; i++) {
if(snaparray[idx].isSectionEmpty(i) == false) {
isSectionNotEmpty[idx][i] = true;
}
}
}
}
}
public boolean isEmptySection(int x, int y, int z) {
int idx = ((x>>4) - x_min) + ((z>>4) - z_min) * x_dim;
public boolean isEmptySection(int sx, int sy, int sz) {
int idx = (sx - x_min) + (sz - z_min) * x_dim;
if(isSectionNotEmpty[idx] == null) {
initSectionData(idx);
}
return isSectionNotEmpty[idx][y >> 4];
return !isSectionNotEmpty[idx][sy];
}
/**
@@ -14,6 +14,7 @@ import java.util.List;
import javax.imageio.ImageIO;
import org.bukkit.Material;
import org.dynmap.Log;
import org.getspout.spoutapi.block.design.BlockDesign;
import org.getspout.spoutapi.block.design.GenericBlockDesign;
@@ -73,6 +74,7 @@ public class SpoutPluginBlocks {
for(CustomBlock b : cb) {
BlockDesign bd = b.getBlockDesign();
String blkid = bd.getTexturePlugin() + "." + b.getName();
blkid = blkid.replace(' ', '_');
/* If not GenericCubiodBlockDesign, we don't handle it */
if((bd instanceof GenericCuboidBlockDesign) == false) {
Log.info("Block " + blkid + " not suppored - only cubiod blocks");
@@ -166,7 +168,7 @@ public class SpoutPluginBlocks {
blks.add(b);
sb.append("block:id=" + b.getCustomId() + ",data=*,bottom=" + txtidx[0] + ",west=" +txtidx[1] + ",south=" + txtidx[2] + ",east=" + txtidx[3] + ",north="+txtidx[4]+",top="+txtidx[5]);
if(b.isOpaque() == false)
if(b.getBlockId() == Material.GLASS.getId())
sb.append(",transparency=TRANSPARENT");
sb.append(",txtid=" + txfileid + "\n");
cnt++;
@@ -1,5 +1,10 @@
package org.dynmap.bukkit.permissions;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.dynmap.Log;
@@ -28,4 +33,27 @@ public class BukkitPermissions implements PermissionProvider {
? player.hasPermission(name + "." + permission) || player.hasPermission(name + ".*")
: true;
}
@Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
Player p = Bukkit.getPlayerExact(name);
HashSet<String> hasperms = null;
if (p != null) {
hasperms = new HashSet<String>();
for(String perm : perms) {
if (p.hasPermission(name + "." + perm)) {
hasperms.add(perm);
}
}
}
return hasperms;
}
@Override
public boolean hasOfflinePermission(String player, String perm) {
Player p = Bukkit.getPlayerExact(name);
if (p != null)
return p.hasPermission(name + "." + perm);
else
return false;
}
}
@@ -1,5 +1,9 @@
package org.dynmap.bukkit.permissions;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -13,6 +17,7 @@ public class NijikokunPermissions implements PermissionProvider {
String name;
PermissionHandler permissions;
Plugin plugin;
String defworld;
public static NijikokunPermissions create(Server server, String name) {
Plugin permissionsPlugin = server.getPluginManager().getPlugin("Permissions");
@@ -27,6 +32,7 @@ public class NijikokunPermissions implements PermissionProvider {
public NijikokunPermissions(Plugin permissionsPlugin, String name) {
this.name = name;
plugin = permissionsPlugin;
defworld = Bukkit.getServer().getWorlds().get(0).getName();
}
@Override
@@ -38,4 +44,21 @@ public class NijikokunPermissions implements PermissionProvider {
? permissions.has(player, name + "." + permission) || permissions.has(player, name + ".*")
: true;
}
@Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
HashSet<String> hasperms = new HashSet<String>();
for (String pp : perms) {
if (permissions.has(defworld, player, name + "." + pp)) {
hasperms.add(pp);
}
}
return hasperms;
}
@Override
public boolean hasOfflinePermission(String player, String perm) {
return permissions.has(defworld, player, name + "." + perm);
}
}
@@ -1,6 +1,7 @@
package org.dynmap.bukkit.permissions;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -24,4 +25,12 @@ public class OpPermissions implements PermissionProvider {
: true
: true;
}
@Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
return null;
}
@Override
public boolean hasOfflinePermission(String player, String perm) {
return false;
}
}
@@ -0,0 +1,63 @@
package org.dynmap.bukkit.permissions;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.dynmap.Log;
import ru.tehkode.permissions.PermissionManager;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;
public class PEXPermissions implements PermissionProvider {
String name;
PermissionManager pm;
public static PEXPermissions create(Server server, String name) {
Plugin permissionsPlugin = server.getPluginManager().getPlugin("PermissionsEx");
if (permissionsPlugin == null)
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(PermissionsEx.isAvailable() == false)
return null;
Log.info("Using PermissionsEx " + permissionsPlugin.getDescription().getVersion() + " for access control");
return new PEXPermissions(name);
}
public PEXPermissions(String name) {
this.name = name;
pm = PermissionsEx.getPermissionManager();
}
@Override
public boolean has(CommandSender sender, String permission) {
Player player = sender instanceof Player ? (Player) sender : null;
return (player != null) ? pm.has(player, name + "." + permission) : true;
}
@Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
HashSet<String> hasperms = new HashSet<String>();
PermissionUser pu = pm.getUser(player);
if(pu != null) {
for (String pp : perms) {
if (pu.has(name + "." + pp)) {
hasperms.add(pp);
}
}
}
return hasperms;
}
@Override
public boolean hasOfflinePermission(String player, String perm) {
PermissionUser pu = pm.getUser(player);
if(pu != null) {
return pu.has(name + "." + perm);
}
return false;
}
}
@@ -0,0 +1,65 @@
package org.dynmap.bukkit.permissions;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.dynmap.Log;
import com.nijiko.permissions.PermissionHandler;
import com.platymuus.bukkit.permissions.PermissionsPlugin;
import de.bananaco.bpermissions.api.ApiLayer;
import de.bananaco.bpermissions.api.util.CalculableType;
import de.bananaco.bpermissions.api.util.Permission;
public class PermBukkitPermissions implements PermissionProvider {
String name;
PermissionsPlugin plugin;
public static PermBukkitPermissions create(Server server, String name) {
Plugin permissionsPlugin = server.getPluginManager().getPlugin("PermissionsBukkit");
if (permissionsPlugin == null)
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
Log.info("Using PermissionsBukkit " + permissionsPlugin.getDescription().getVersion() + " for access control");
return new PermBukkitPermissions(permissionsPlugin, name);
}
public PermBukkitPermissions(Plugin permissionsPlugin, String name) {
this.name = name;
plugin = (PermissionsPlugin) permissionsPlugin;
}
@Override
public boolean has(CommandSender sender, String permission) {
Player player = sender instanceof Player ? (Player) sender : null;
return (player != null) ? plugin.getPlayerInfo(player.getName()).getPermissions().containsKey(name + "." + permission) : true;
}
@Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
Map<String, Boolean> prm = plugin.getPlayerInfo(player).getPermissions();
HashSet<String> hasperms = new HashSet<String>();
for (String pp : perms) {
Boolean pb = prm.get(name + "." + pp);
if ((pb != null) && pb.booleanValue()) {
hasperms.add(pp);
}
}
return hasperms;
}
@Override
public boolean hasOfflinePermission(String player, String perm) {
Boolean b = plugin.getPlayerInfo(player).getPermissions().get(name + "." + perm);
if (b != null)
return b;
else
return false;
}
}
@@ -1,7 +1,14 @@
package org.dynmap.bukkit.permissions;
import java.util.Set;
import org.bukkit.command.CommandSender;
public interface PermissionProvider {
boolean has(CommandSender sender, String permission);
Set<String> hasOfflinePermissions(String player, Set<String> perms);
boolean hasOfflinePermission(String player, String perm);
}
@@ -0,0 +1,59 @@
package org.dynmap.bukkit.permissions;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.dynmap.Log;
import ru.tehkode.permissions.bukkit.PermissionsEx;
import de.bananaco.bpermissions.api.ApiLayer;
import de.bananaco.bpermissions.api.util.CalculableType;
import de.bananaco.bpermissions.api.util.Permission;
public class bPermPermissions implements PermissionProvider {
String name;
String defworld;
public static bPermPermissions create(Server server, String name) {
Plugin permissionsPlugin = server.getPluginManager().getPlugin("bPermissions");
if (permissionsPlugin == null)
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
Log.info("Using bPermissions " + permissionsPlugin.getDescription().getVersion() + " for access control");
return new bPermPermissions(name);
}
public bPermPermissions(String name) {
this.name = name;
defworld = Bukkit.getServer().getWorlds().get(0).getName();
}
@Override
public boolean has(CommandSender sender, String permission) {
Player player = sender instanceof Player ? (Player) sender : null;
return (player != null) ? ApiLayer.hasPermission(defworld, CalculableType.USER, player.getName(), name + "." + permission) : true;
}
@Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
HashSet<String> hasperms = new HashSet<String>();
for (String pp : perms) {
if(ApiLayer.hasPermission(defworld, CalculableType.USER, player, name + "." + pp)) {
hasperms.add(pp);
}
}
return hasperms;
}
@Override
public boolean hasOfflinePermission(String player, String perm) {
return ApiLayer.hasPermission(defworld, CalculableType.USER, player, name + "." + perm);
}
}
+22 -17
View File
@@ -28,6 +28,9 @@ components:
require-player-login-ip: false
# (optional) block player login IDs that are banned from chatting
block-banned-player-chat: true
# Require login for web-to-server chat (requires login-enabled: true)
webchat-requires-login: false
# # 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)
@@ -48,6 +51,8 @@ components:
# hideifshadow: 0
# hideifundercover: 0
# hideifsneaking: false
# # Require login for web-to-server chat (requires login-enabled: true)
# webchat-requires-login: false
- class: org.dynmap.SimpleWebChatComponent
allowchat: true
@@ -90,6 +95,8 @@ components:
messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100
# Optiona; set maximum number of lines visible for chatbox
#visiblelines: 10
# Optional: send push button
sendbutton: false
- class: org.dynmap.ClientComponent
@@ -167,17 +174,9 @@ zoomoutperiod: 30
# Tile hashing is used to minimize tile file updates when no changes have occurred - set to false to disable
enabletilehash: true
# Optional - control darkening of biome-shaded colors in swamp biomes (1.9+) - default is true for 1.9+, false for 1.8.x
#swampshaded: false
# Optional - control biome shading of water (1.9+) - default is true for 1.9+, false for 1.8.x
#waterbiomeshaded: false
# Optional - hide ores: render as normal stone (so that they aren't revealed by maps)
#hideores: true
# Optional - control rendering of fences (joining to blocks, as in 1.9+) - default is true for 1.9+, false for 1.8.x
#fence-to-block-join: true
# Optional - enabled BetterGrass style rendering of grass and snow block sides
#better-grass: true
@@ -188,15 +187,10 @@ smooth-lighting: false
# Has no effect on maps with explicit format settings
image-format: png
# 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)
# correct-biome-shading: if true, use fixed color mappings for birch, pine, lily, and proper water shading (same as client); false is pre 0.29
# use-generated-textures: if true, use generated textures (same as client); false is static water/lava textures
# correct-water-lighting: if true, use corrected water lighting (same as client); false is legacy water (darker)
use-generated-textures: true
correct-water-lighting: true
correct-biome-shading: true
# To enable smooth biome shading (as done in MC 1.1.0+), set this to true (this does increase render processing about 10%)
smooth-biome-shading: true
# Control loading of player faces (if set to false, skins are never fetched)
#fetchskins: false
@@ -204,8 +198,8 @@ smooth-biome-shading: true
# Control updating of player faces, once loaded (if faces are being managed by other apps or manually)
#refreshskins: false
# Control behavior for new (1.9+) compass orientation (sunrise moved 90 degrees: east is now what used to be south)
# default is 'pre19' for 1.8 server (existing orientation), 'newrose' for 1.9+ (preserve maps, rotate rose)
# Control behavior for new (1.0+) compass orientation (sunrise moved 90 degrees: east is now what used to be south)
# default is 'newrose' (preserve pre-1.0 maps, rotate rose)
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
compass-mode: newnorth
@@ -230,6 +224,9 @@ compass-mode: newnorth
# Enable Kaevator's Superslopes block rendering support
#superslopes-support: true
# Enabled ComputerCraft block rendering support
#computercraft-support: true
render-triggers:
#- playermove
#- playerjoin
@@ -246,6 +243,7 @@ render-triggers:
- blockfromto
- blockphysics
- structuregrow
- blockgrow
# 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"
@@ -271,6 +269,11 @@ disable-webserver: false
# Enable/disable having the web server allow symbolic links (true=compatible with existing code, false=more secure (default))
allow-symlinks: true
# Enable login support
login-enabled: false
# Require login to access website (requires login-enabled: true)
login-required: false
# Period between tile renders for fullrender, in seconds (non-zero to pace fullrenders, lessen CPU load)
timesliceinterval: 0.0
@@ -334,6 +337,8 @@ persist-ids-by-ip: true
msg:
maptypes: "Map Types"
players: "Players"
chatrequireslogin: "Chat Requires Login"
chatnotallowed: "You are not permitted to send chat messages"
# Set to true to enable verbose startup messages - can help with debugging map configuration problems
# Set to false for a much quieter startup log
+38 -5
View File
@@ -21,15 +21,12 @@ commands:
/<command> radiusrender worldname x z ## mapname - Render at least ## block radius from location x,z on world 'worldname' on map 'mapname'
/<command> updaterender - Render updates starting at your location on all maps.
/<command> updaterender mapname - Render updates starting at your location on give map
/<command> updaterender worldname x z - Render updates starting at location x,z on world 'worldname' for all maps
/<command> updaterender worldname x z mapname - Render updates starting at location x,z on world 'worldname' for given map
/<command> cancelrender - Cancels any active renders on current world
/<command> cancelrender world - Cancels any active renders of world 'world'
/<command> stats - Show render statistics.
/<command> stats world - Show render statistics for maps on world 'world'.
/<command> triggerstats - Show render trigger statistics
/<command> resetstats - Reset render statistics.
/<command> resetstats world - Reset render statistics for maps on world 'world'.
/<command> sendtoweb msg - Send message to web users
/<command> purgequeue - Set tile update queue to empty
/<command> pause - Show render pause state
@@ -38,7 +35,8 @@ commands:
/<command> ips-for-id <playerid> - Show IP addresses that have been used for the given player ID
/<command> add-id-for-ip <playerid> <ipaddress> - Add player ID to given IP address
/<command> del-id-for-ip <playerid> <ipaddress> - Delete player ID from given IP address
/<command> webregister - Start registration process for creating web login account
dmarker:
description: Manipulate map markers
usage: |
@@ -80,6 +78,15 @@ commands:
/<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
/<command> addcircle <label> radius:<rad> - add new circle centered at current location with given radius and label
/<command> addcircle id:<id> <label> radius:<rad> - add new circle centered at current location with given radius and ID
/<command> addcircle <label> radius:<rad> x:<x> y:<y> z:<z> world:<world> - add new circle centered at given coordinates with given radius and label
/<command> deletecircle <label> - delete circle with given label
/<command> deletecircle id:<id> <label> - delete circle with given ID
/<command> listcircles - list details of all circles
/<command> updatecircle <label> <arg>:<value> ... - update attributes of circle with given label
/<command> updatecircle id:<id> <arg>:<value> ... - update attributes of circle with given ID
dmap:
description: List and modify dynmap configuration
usage: |
@@ -114,6 +121,8 @@ permissions:
dynmap.purgequeue: true
dynmap.ids-for-ip: true
dynmap.ips-for-id: true
dynmap.webregister: true
dynmap.webregister.other: true
dynmap.pause: true
dynmap.marker.add: true
dynmap.marker.update: true
@@ -133,6 +142,10 @@ permissions:
dynmap.marker.updatearea: true
dynmap.marker.listareas: true
dynmap.marker.deletearea: true
dynmap.marker.addcircle: true
dynmap.marker.updatecircle: true
dynmap.marker.listcircles: true
dynmap.marker.deletecircle: true
dynmap.dmap.worldlist: true
dynmap.dmap.worldset: true
dynmap.dmap.worldreset: true
@@ -193,6 +206,12 @@ permissions:
dynmap.ips-for-id:
description: Allows /dynmap ips-for-id
default: op
dynmap.webregister:
description: Allows /dynmap webregister
default: true
dynmao,webregister.other:
description: Allows /dynmap webregister userid
default: op
dynmap.marker.add:
description: Allows /dmarker add
default: op
@@ -259,6 +278,18 @@ permissions:
dynmap.marker.deleteline:
description: Allows /dmarker deleteline
default: op
dynmap.marker.addcircle:
description: Allows /dmarker addcircle
default: op
dynmap.marker.updatecircle:
description: Allows /dmarker updatecircle
default: op
dynmap.marker.listcircles:
description: Allows /dmarker listcircles
default: op
dynmap.marker.deletecircle:
description: Allows /dmarker deletecircle
default: op
dynmap.dmap.worldlist:
description: Allows /dmap worldlist
default: op
@@ -286,4 +317,6 @@ permissions:
dynmap.dmap.lightinglist:
description: Allows /dmap lightinglist
default: op
dynmap.webchat:
description: Allows web chat (if login required for webchat)
default: true