mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Merge branch 'v3.0' into v3.0
This commit is contained in:
commit
bf404ee626
@ -57,6 +57,7 @@ import org.dynmap.storage.filetree.FileTreeMapStorage;
|
||||
import org.dynmap.storage.mysql.MySQLMapStorage;
|
||||
import org.dynmap.storage.mariadb.MariaDBMapStorage;
|
||||
import org.dynmap.storage.sqllte.SQLiteMapStorage;
|
||||
import org.dynmap.storage.postgresql.PostgreSQLMapStorage;
|
||||
import org.dynmap.utils.BlockStep;
|
||||
import org.dynmap.utils.ImageIOManager;
|
||||
import org.dynmap.web.BanIPFilter;
|
||||
@ -388,6 +389,9 @@ public class DynmapCore implements DynmapCommonAPI {
|
||||
else if (storetype.equals("mariadb")) {
|
||||
defaultStorage = new MariaDBMapStorage();
|
||||
}
|
||||
else if (storetype.equals("postgres") || storetype.equals("postgresql")) {
|
||||
defaultStorage = new PostgreSQLMapStorage();
|
||||
}
|
||||
else {
|
||||
Log.severe("Invalid storage type for map data: " + storetype);
|
||||
return false;
|
||||
|
@ -11,6 +11,7 @@ import org.dynmap.utils.DynmapBufferedImage;
|
||||
import org.dynmap.utils.ImageIOManager;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -96,6 +97,13 @@ public class PlayerFaces {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void copyLayersToTarget(BufferedImage srcimg, int layer1x, int layer1y, int layer2x, int layer2y, int w, int h, BufferedImage dest, int destoff, int destscansize)
|
||||
{
|
||||
int[] tmp = new int[w*h];
|
||||
copyLayersToTarget(srcimg,layer1x,layer1y,layer2x,layer2y,w,h,tmp,0,w);
|
||||
dest.setRGB(0,0,w,h,tmp,destoff,destscansize);
|
||||
}
|
||||
|
||||
private class LoadPlayerImages implements Runnable {
|
||||
public final String playername;
|
||||
@ -145,14 +153,24 @@ public class PlayerFaces {
|
||||
img.flush();
|
||||
return;
|
||||
}
|
||||
else if(img.getHeight() == 32) {
|
||||
else if( (img.getWidth() / img.getHeight()) == 2 ) { /* Is single layer skin? */
|
||||
is_64x32_skin = true;
|
||||
}
|
||||
|
||||
/* Get buffered image for face at original size */
|
||||
int scale = img.getWidth()/8 /8;
|
||||
BufferedImage faceOriginal = new BufferedImage(8*scale, 8*scale, BufferedImage.TYPE_INT_ARGB);
|
||||
// Copy face and overlay to icon
|
||||
copyLayersToTarget(img, 8*scale, 8*scale, 40*scale, 8*scale, 8*scale, 8*scale, faceOriginal, 0, 8*scale);
|
||||
|
||||
int[] faceaccessory = new int[64]; /* 8x8 of face accessory */
|
||||
/* Get buffered image for face at 8x8 */
|
||||
DynmapBufferedImage face8x8 = DynmapBufferedImage.allocateBufferedImage(8, 8);
|
||||
// Copy face and overlay to icon
|
||||
copyLayersToTarget(img, 8, 8, 40, 8, 8, 8, face8x8.argb_buf, 0, 8);
|
||||
Image face8x8_image = faceOriginal.getScaledInstance(8,8,BufferedImage.SCALE_SMOOTH);
|
||||
BufferedImage face8x8_buff = new BufferedImage(8, 8, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
face8x8_buff.getGraphics().drawImage(face8x8_image,0,0,null);
|
||||
face8x8_buff.getRGB(0,0,8,8,face8x8.argb_buf,0,8);
|
||||
/* Write 8x8 file */
|
||||
if(refreshskins || (!has_8x8)) {
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(face8x8.buf_img, ImageFormat.FORMAT_PNG);
|
||||
@ -164,36 +182,60 @@ public class PlayerFaces {
|
||||
if(refreshskins || (!has_16x16)) {
|
||||
/* Make 16x16 version */
|
||||
DynmapBufferedImage face16x16 = DynmapBufferedImage.allocateBufferedImage(16, 16);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
for(int j = 0; j < 16; j++) {
|
||||
face16x16.argb_buf[i*16+j] = face8x8.argb_buf[(i/2)*8 + (j/2)];
|
||||
}
|
||||
}
|
||||
Image face16x16_image = faceOriginal.getScaledInstance(16,16,BufferedImage.SCALE_SMOOTH);
|
||||
BufferedImage face16x16_buff = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
face16x16_buff.getGraphics().drawImage(face16x16_image,0,0,null);
|
||||
face16x16_buff.getRGB(0,0,16,16,face16x16.argb_buf,0,16);
|
||||
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(face16x16.buf_img, ImageFormat.FORMAT_PNG);
|
||||
if (bos != null) {
|
||||
storage.setPlayerFaceImage(playername, FaceType.FACE_16X16, bos);
|
||||
}
|
||||
DynmapBufferedImage.freeBufferedImage(face16x16);
|
||||
face16x16_buff.flush();
|
||||
}
|
||||
|
||||
/* Write 32x32 file */
|
||||
if(refreshskins || (!has_32x32)) {
|
||||
/* Make 32x32 version */
|
||||
DynmapBufferedImage face32x32 = DynmapBufferedImage.allocateBufferedImage(32, 32);
|
||||
for(int i = 0; i < 32; i++) {
|
||||
for(int j = 0; j < 32; j++) {
|
||||
face32x32.argb_buf[i*32+j] = face8x8.argb_buf[(i/4)*8 + (j/4)];
|
||||
}
|
||||
}
|
||||
Image face32x32_image = faceOriginal.getScaledInstance(32,32,BufferedImage.SCALE_SMOOTH);
|
||||
BufferedImage face32x32_buff = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
face32x32_buff.getGraphics().drawImage(face32x32_image,0,0,null);
|
||||
face32x32_buff.getRGB(0,0,32,32,face32x32.argb_buf,0,32);
|
||||
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(face32x32.buf_img, ImageFormat.FORMAT_PNG);
|
||||
if (bos != null) {
|
||||
storage.setPlayerFaceImage(playername, FaceType.FACE_32X32, bos);
|
||||
}
|
||||
DynmapBufferedImage.freeBufferedImage(face32x32);
|
||||
face32x32_buff.flush();
|
||||
}
|
||||
|
||||
/* Write body file */
|
||||
if(refreshskins || (!has_body)) {
|
||||
|
||||
Image skin_image = null;
|
||||
BufferedImage skin_buff = null;
|
||||
|
||||
if (is_64x32_skin){
|
||||
|
||||
skin_image = img.getScaledInstance(64,32,BufferedImage.SCALE_SMOOTH);
|
||||
skin_buff = new BufferedImage(64, 32, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
skin_buff.getGraphics().drawImage(skin_image,0,0,null);
|
||||
|
||||
} else {
|
||||
|
||||
skin_image = img.getScaledInstance(64,64,BufferedImage.SCALE_SMOOTH);
|
||||
skin_buff = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
skin_buff.getGraphics().drawImage(skin_image,0,0,null);
|
||||
|
||||
}
|
||||
|
||||
/* Make 32x32 version */
|
||||
DynmapBufferedImage body32x32 = DynmapBufferedImage.allocateBufferedImage(32, 32);
|
||||
/* Copy face at 12,0 to 20,8 (already handled accessory) */
|
||||
@ -203,34 +245,38 @@ public class PlayerFaces {
|
||||
}
|
||||
}
|
||||
/* Copy body at 20,20 and chest at 20,36 to 8,12 */
|
||||
copyLayersToTarget(img, 20, 20, 20, 36, 8, 12, body32x32.argb_buf, 8*32+12, 32);
|
||||
copyLayersToTarget(skin_buff, 20, 20, 20, 36, 8, 12, body32x32.argb_buf, 8*32+12, 32);
|
||||
/* Copy right leg at 4,20 and 4,36 to 20,12 */
|
||||
copyLayersToTarget(img, 4, 20, 4, 36, 4, 12, body32x32.argb_buf, 20*32+12, 32);
|
||||
copyLayersToTarget(skin_buff, 4, 20, 4, 36, 4, 12, body32x32.argb_buf, 20*32+12, 32);
|
||||
/* Copy left leg at 4,20 if old format or 20,52 and 4,53 to 20,16 */
|
||||
if(is_64x32_skin) {
|
||||
img.getRGB(4, 20, 4, 12, body32x32.argb_buf, 20*32+16, 32);
|
||||
skin_buff.getRGB(4, 20, 4, 12, body32x32.argb_buf, 20*32+16, 32);
|
||||
}
|
||||
else {
|
||||
copyLayersToTarget(img, 20, 52, 4, 52, 4, 12, body32x32.argb_buf, 20 * 32 + 16, 32);
|
||||
copyLayersToTarget(skin_buff, 20, 52, 4, 52, 4, 12, body32x32.argb_buf, 20 * 32 + 16, 32);
|
||||
}
|
||||
/* Copy right arm at 44,20 and 44,36 to 8,8 */
|
||||
copyLayersToTarget(img, 44, 20, 44, 36, 4, 12, body32x32.argb_buf, 8*32+8, 32);
|
||||
copyLayersToTarget(skin_buff, 44, 20, 44, 36, 4, 12, body32x32.argb_buf, 8*32+8, 32);
|
||||
/* Copy left arm at 44,20 if old format or 36,52 and 52,52 to 8,20 */
|
||||
if(is_64x32_skin) {
|
||||
img.getRGB(44, 20, 4, 12, body32x32.argb_buf, 8*32+20, 32);
|
||||
skin_buff.getRGB(44, 20, 4, 12, body32x32.argb_buf, 8*32+20, 32);
|
||||
}
|
||||
else {
|
||||
copyLayersToTarget(img, 36, 52, 52, 52, 4, 12, body32x32.argb_buf, 8 * 32 + 20, 32);
|
||||
copyLayersToTarget(skin_buff, 36, 52, 52, 52, 4, 12, body32x32.argb_buf, 8 * 32 + 20, 32);
|
||||
}
|
||||
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(body32x32.buf_img, ImageFormat.FORMAT_PNG);
|
||||
if (bos != null) {
|
||||
storage.setPlayerFaceImage(playername, FaceType.BODY_32X32, bos);
|
||||
}
|
||||
|
||||
DynmapBufferedImage.freeBufferedImage(body32x32);
|
||||
skin_buff.flush();
|
||||
}
|
||||
|
||||
DynmapBufferedImage.freeBufferedImage(face8x8);
|
||||
face8x8_buff.flush();
|
||||
faceOriginal.flush();
|
||||
img.flush();
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,6 @@ public abstract class DynmapServerInterface {
|
||||
* @return block ID, or -1 if chunk at given coordinate isn't loaded
|
||||
*/
|
||||
public abstract int getBlockIDAt(String wname, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Checks if a sign is at a given coordinate in a given world (if chunk is loaded)
|
||||
* @param wname - world name
|
||||
@ -188,7 +187,6 @@ public abstract class DynmapServerInterface {
|
||||
* @return 1 if a sign is at the location, 0 if it's not, -1 if the chunk isn't loaded
|
||||
*/
|
||||
public abstract int isSignAt(String wname, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Get current TPS for server (20.0 is nominal)
|
||||
* @return ticks per second
|
||||
|
@ -343,8 +343,8 @@ public class CTMTexturePack {
|
||||
bs = DynmapBlockState.getBaseStateByName(token);
|
||||
addbase = true;
|
||||
}
|
||||
if (bs.isAir()) {
|
||||
Log.info("Unknown block ID in CTM: " + token);
|
||||
if (bs == DynmapBlockState.AIR) {
|
||||
Log.info("Unknown block ID in CTM: " + token);
|
||||
}
|
||||
else if (addbase) {
|
||||
addBaseBlockStateToIDSet(list, bs);
|
||||
@ -486,7 +486,7 @@ public class CTMTexturePack {
|
||||
this.matchTiles = null;
|
||||
}
|
||||
else {
|
||||
String[] tok = tokenize(v, " ");
|
||||
String[] tok = tokenize(v.toLowerCase(), " ");
|
||||
for (int i = 0; i < tok.length; i++) {
|
||||
String t = tok[i];
|
||||
if (t.endsWith(".png")) { /* Strip off PNG */
|
||||
@ -505,7 +505,7 @@ public class CTMTexturePack {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
v = v.trim();
|
||||
v = v.trim().toLowerCase();
|
||||
if (v.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class HDBlockStateTextureMap {
|
||||
if ((this.blockset != null) && (this.blockset.equals("core") == false)) {
|
||||
HDBlockModels.resetIfNotBlockSet(bs, this.blockset);
|
||||
}
|
||||
copyToStateIndex(bs, this);
|
||||
copyToStateIndex(bs, this, null);
|
||||
}
|
||||
}
|
||||
else { // Else, loop over all state IDs for given block
|
||||
@ -110,7 +110,7 @@ public class HDBlockStateTextureMap {
|
||||
if ((this.blockset != null) && (this.blockset.equals("core") == false)) {
|
||||
HDBlockModels.resetIfNotBlockSet(bs, this.blockset);
|
||||
}
|
||||
copyToStateIndex(bs, this);
|
||||
copyToStateIndex(bs, this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -144,9 +144,11 @@ public class HDBlockStateTextureMap {
|
||||
return m;
|
||||
}
|
||||
// Copy given block state to given state index
|
||||
public static void copyToStateIndex(DynmapBlockState blk, HDBlockStateTextureMap map) {
|
||||
public static void copyToStateIndex(DynmapBlockState blk, HDBlockStateTextureMap map, TexturePack.BlockTransparency trans) {
|
||||
resize(blk.globalStateIndex);
|
||||
TexturePack.BlockTransparency trans = map.trans;
|
||||
if (trans == null) {
|
||||
trans = map.trans;
|
||||
}
|
||||
// Force waterloogged blocks to use SEMITRANSPARENT (same as water)
|
||||
if ((trans == TexturePack.BlockTransparency.TRANSPARENT) && blk.isWaterlogged()) {
|
||||
trans = TexturePack.BlockTransparency.SEMITRANSPARENT;
|
||||
|
@ -2222,13 +2222,13 @@ public class TexturePack {
|
||||
if (stateids == null) {
|
||||
for (int sid = 0; sid < dblk.getStateCount(); sid++) {
|
||||
DynmapBlockState dblk2 = dblk.getState(sid);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map, trans);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int stateid = stateids.nextSetBit(0); stateid >= 0; stateid = stateids.nextSetBit(stateid+1)) {
|
||||
DynmapBlockState dblk2 = dblk.getState(stateid);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map, trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,223 @@
|
||||
package org.dynmap.hdmap.renderer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dynmap.renderer.CustomRenderer;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.renderer.MapDataContext;
|
||||
import org.dynmap.renderer.RenderPatch;
|
||||
import org.dynmap.renderer.RenderPatchFactory;
|
||||
|
||||
public class CopyStairBlockRenderer extends CustomRenderer {
|
||||
private static final int TEXTURE_X_PLUS = 0;
|
||||
private static final int TEXTURE_Y_PLUS = 1;
|
||||
private static final int TEXTURE_Z_PLUS = 2;
|
||||
private static final int TEXTURE_X_MINUS = 3;
|
||||
private static final int TEXTURE_Y_MINUS = 4;
|
||||
private static final int TEXTURE_Z_MINUS = 5;
|
||||
|
||||
private static BitSet stair_ids = new BitSet();
|
||||
|
||||
// Array of meshes for normal steps - index = (data value & 7)
|
||||
private RenderPatch[][] stepmeshes = new RenderPatch[8][];
|
||||
// Array of meshes for 3/4 steps - index = (data value & 7), with extra one clockwise from normal step
|
||||
private RenderPatch[][] step_3_4_meshes = new RenderPatch[8][];
|
||||
// Array of meshes for 1/4 steps - index = (data value & 7), with clockwise quarter clopped from normal step
|
||||
private RenderPatch[][] step_1_4_meshes = new RenderPatch[8][];
|
||||
|
||||
private void setID(String bname) {
|
||||
DynmapBlockState bbs = DynmapBlockState.getBaseStateByName(bname);
|
||||
if (bbs.isNotAir()) {
|
||||
for (int i = 0; i < bbs.getStateCount(); i++) {
|
||||
stair_ids.set(bbs.getState(i).globalStateIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean initializeRenderer(RenderPatchFactory rpf, String blkname, BitSet blockdatamask, Map<String,String> custparm) {
|
||||
if(!super.initializeRenderer(rpf, blkname, blockdatamask, custparm))
|
||||
return false;
|
||||
setID(blkname); /* Mark block as a stair */
|
||||
/* Build step meshes */
|
||||
for(int i = 0; i < 8; i++) {
|
||||
stepmeshes[i] = buildStepMeshes(rpf, i);
|
||||
step_1_4_meshes[i] = buildCornerStepMeshes(rpf, i);
|
||||
step_3_4_meshes[i] = buildIntCornerStepMeshes(rpf, i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumTextureCount() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTileEntityFieldsNeeded() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final int[] patchlist = { TEXTURE_Y_PLUS, TEXTURE_Y_MINUS, TEXTURE_Z_PLUS, TEXTURE_Z_MINUS, TEXTURE_X_PLUS, TEXTURE_X_MINUS };
|
||||
|
||||
private void addBox(RenderPatchFactory rpf, List<RenderPatch> list, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) {
|
||||
addBox(rpf, list, xmin, xmax, ymin, ymax, zmin, zmax, patchlist);
|
||||
}
|
||||
|
||||
private RenderPatch[] buildStepMeshes(RenderPatchFactory rpf, int dat) {
|
||||
ArrayList<RenderPatch> list = new ArrayList<RenderPatch>();
|
||||
/* If inverted, add half top */
|
||||
if((dat & 0x4) != 0) {
|
||||
addBox(rpf, list, 0, 1, 0.5, 1, 0, 1);
|
||||
}
|
||||
else { // Else, add half bottom
|
||||
addBox(rpf, list, 0, 1, 0.0, 0.5, 0, 1);
|
||||
}
|
||||
switch(dat & 0x3) {
|
||||
case 0:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 1);
|
||||
break;
|
||||
case 1:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 1);
|
||||
break;
|
||||
case 2:
|
||||
addBox(rpf, list, 0, 1, 0, 1, 0.5, 1);
|
||||
break;
|
||||
case 3:
|
||||
addBox(rpf, list, 0, 1, 0, 1, 0, 0.5);
|
||||
break;
|
||||
}
|
||||
return list.toArray(new RenderPatch[list.size()]);
|
||||
}
|
||||
|
||||
private RenderPatch[] buildCornerStepMeshes(RenderPatchFactory rpf, int dat) {
|
||||
ArrayList<RenderPatch> list = new ArrayList<RenderPatch>();
|
||||
/* If inverted, add half top */
|
||||
if((dat & 0x4) != 0) {
|
||||
addBox(rpf, list, 0, 1, 0.5, 1, 0, 1);
|
||||
}
|
||||
else { // Else, add half bottom
|
||||
addBox(rpf, list, 0, 1, 0.0, 0.5, 0, 1);
|
||||
}
|
||||
switch(dat & 0x3) {
|
||||
case 0:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 1:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 2:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0.5, 1);
|
||||
break;
|
||||
case 3:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0.5, 1);
|
||||
break;
|
||||
}
|
||||
return list.toArray(new RenderPatch[list.size()]);
|
||||
}
|
||||
|
||||
private RenderPatch[] buildIntCornerStepMeshes(RenderPatchFactory rpf, int dat) {
|
||||
ArrayList<RenderPatch> list = new ArrayList<RenderPatch>();
|
||||
/* If inverted, add half top */
|
||||
if((dat & 0x4) != 0) {
|
||||
addBox(rpf, list, 0, 1, 0.5, 1, 0, 1);
|
||||
}
|
||||
else { // Else, add half bottom
|
||||
addBox(rpf, list, 0, 1, 0.0, 0.5, 0, 1);
|
||||
}
|
||||
switch(dat & 0x3) {
|
||||
case 0:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 1:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0.5, 1);
|
||||
break;
|
||||
case 2:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 3:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0.5, 1);
|
||||
break;
|
||||
}
|
||||
return list.toArray(new RenderPatch[list.size()]);
|
||||
}
|
||||
|
||||
// Steps
|
||||
// 0 = up to east
|
||||
// 1 = up to west
|
||||
// 2 = up to south
|
||||
// 3 = up to north
|
||||
// Corners
|
||||
// 0 = NE
|
||||
// 1 = NW
|
||||
// 2 = SW
|
||||
// 3 = SE
|
||||
// Interior Corners
|
||||
// 0 = open to SW
|
||||
// 1 = open to NW
|
||||
// 2 = open to SE
|
||||
// 3 = open to NE
|
||||
private static final int off_x[] = { 1, -1, 0, 0, 1, -1, 0, 0 };
|
||||
private static final int off_z[] = { 0, 0, 1, -1, 0, 0, 1, -1 };
|
||||
private static final int match1[] = { 2, 3, 0, 1, 6, 7, 4, 5 };
|
||||
private static final int corner1[] = { 3, 1, 3, 1, 7, 5, 7, 5 };
|
||||
private static final int icorner1[] = { 1, 2, 1, 2, 5, 6, 5, 6 };
|
||||
private static final int match2[] = { 3, 2, 1, 0, 7, 6, 5, 4 };
|
||||
private static final int corner2[] = { 0, 2, 2, 0, 4, 6, 6, 4 };
|
||||
private static final int icorner2[] = { 0, 3, 3, 0, 4, 7, 7, 4 };
|
||||
|
||||
@Override
|
||||
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
|
||||
return getBaseRenderPatchList(ctx);
|
||||
}
|
||||
|
||||
private RenderPatch[] getBaseRenderPatchList(MapDataContext ctx) {
|
||||
int data = ctx.getBlockType().stateIndex & 0x07; /* Get block data */
|
||||
/* Check block behind stair */
|
||||
DynmapBlockState corner = ctx.getBlockTypeAt(off_x[data], 0, off_z[data]);
|
||||
if (stair_ids.get(corner.globalStateIndex)) { /* If it is a stair */
|
||||
int cornerdat = corner.stateIndex & 0x07;
|
||||
if(cornerdat == match1[data]) { /* If right orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_1_4_meshes[corner1[data]];
|
||||
}
|
||||
}
|
||||
else if(cornerdat == match2[data]) { /* If other orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_1_4_meshes[corner2[data]];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Check block in front of stair */
|
||||
corner = ctx.getBlockTypeAt(-off_x[data], 0, -off_z[data]);
|
||||
if(stair_ids.get(corner.globalStateIndex)) { /* If it is a stair */
|
||||
int cornerdat = corner.stateIndex & 0x07;
|
||||
if(cornerdat == match1[data]) { /* If right orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_3_4_meshes[icorner1[data]];
|
||||
}
|
||||
}
|
||||
else if(cornerdat == match2[data]) { /* If other orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_3_4_meshes[icorner2[data]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stepmeshes[data];
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ public class MarkerSignManager {
|
||||
private static MarkerSignManager mgr = null;
|
||||
private static DynmapCore plugin = null;
|
||||
private static String defSignSet = null;
|
||||
|
||||
|
||||
private static class SignRec {
|
||||
String wname;
|
||||
int x, y, z;
|
||||
@ -30,10 +30,12 @@ public class MarkerSignManager {
|
||||
@Override
|
||||
public void signChangeEvent(int blkid, String wname, int x, int y, int z, String[] lines, DynmapPlayer p) {
|
||||
if(mgr == null)
|
||||
return;
|
||||
return;
|
||||
|
||||
if(!lines[0].equalsIgnoreCase("[dynmap]")) { /* If not dynmap sign, quit */
|
||||
return;
|
||||
}
|
||||
|
||||
/* If allowed to do marker signs */
|
||||
if((p == null) || ((plugin != null) && (plugin.checkPlayerPermission(p, "marker.sign")))) {
|
||||
String id = getSignMarkerID(wname, x, y, z); /* Get marker ID */
|
||||
@ -146,10 +148,9 @@ public class MarkerSignManager {
|
||||
}
|
||||
else {
|
||||
if(plugin.getServer().isSignAt(r.wname, r.x, r.y, r.z) == 0) {
|
||||
System.out.println("Removing from cache sign " + r.m.getLabel());
|
||||
r.m.deleteMarker();
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getServer().scheduleServerTask(sl, 60*20);
|
||||
|
@ -15,7 +15,7 @@ public class StairBlockModelImpl extends BlockModelImpl implements StairBlockMod
|
||||
public String getLine() {
|
||||
String ids = this.getIDsAndMeta();
|
||||
if (ids == null) return null;
|
||||
return String.format("customblock:%s,class=org.dynmap.hdmap.renderer.StairBlockRenderer", ids);
|
||||
return String.format("customblock:%s,class=org.dynmap.hdmap.renderer.CopyStairBlockRenderer", ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ public class MariaDBMapStorage extends MapStorage {
|
||||
connectionString = "jdbc:mariadb://" + hostname + ":" + port + "/" + database + "?allowReconnect=true";
|
||||
Log.info("Opening MariaDB database " + hostname + ":" + port + "/" + database + " as map store");
|
||||
try {
|
||||
Class.forName("com.mariadb.jdbc.Driver");
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
// Initialize/update tables, if needed
|
||||
if(!initializeTables()) {
|
||||
return false;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -375,6 +375,7 @@ DynMap.prototype = {
|
||||
componentstoload--;
|
||||
if (componentstoload == 0) {
|
||||
// Actually start updating once all components are loaded.
|
||||
me.update();
|
||||
setTimeout(function() { me.update(); }, me.options.updaterate);
|
||||
}
|
||||
});
|
||||
|
@ -180,6 +180,15 @@ public class DynmapBlockState {
|
||||
DynmapBlockState blk = blocksByName.get(name);
|
||||
if ((blk == null) && (name.indexOf(':') == -1)) {
|
||||
blk = blocksByName.get("minecraft:" + name);
|
||||
if (blk == null) { // If still null, see if legacy ID number
|
||||
try {
|
||||
int v = Integer.parseInt(name);
|
||||
if (v >= 0) {
|
||||
blk = blocksByLegacyID.get(v);
|
||||
}
|
||||
} catch (NumberFormatException nfx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return (blk != null) ? blk : AIR;
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ allprojects {
|
||||
maven { url "http://repo.mikeprimm.com" }
|
||||
maven { url "http://repo.maven.apache.org/maven2" }
|
||||
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
|
||||
maven { url "http://repo.bstats.org/content/repositories/releases/" }
|
||||
maven { url "https://repo.codemc.org/repository/maven-public/" }
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
group = 'us.dynmap'
|
||||
version = '3.0-beta-5'
|
||||
version = '3.0-beta-7'
|
||||
|
||||
}
|
||||
|
||||
|
1
bukkit-helper-114-1/bin/.gitignore
vendored
1
bukkit-helper-114-1/bin/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/main/
|
1
bukkit-helper-114/bin/.gitignore
vendored
1
bukkit-helper-114/bin/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/main/
|
1
bukkit-helper-115/.gitignore
vendored
Normal file
1
bukkit-helper-115/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build/
|
10
bukkit-helper-115/build.gradle
Normal file
10
bukkit-helper-115/build.gradle
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
description = 'bukkit-helper-1.15'
|
||||
|
||||
dependencies {
|
||||
compile project(':bukkit-helper')
|
||||
compile project(':dynmap-api')
|
||||
compile project(path: ':DynmapCore', configuration: 'shadow')
|
||||
compile group: 'org.bukkit', name: 'bukkit', version:'1.15-R0.1-SNAPSHOT'
|
||||
compile group: 'org.bukkit', name: 'craftbukkit', version:'1.15-R0.1-SNAPSHOT'
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package org.dynmap.bukkit.helper.v114_1;
|
||||
package org.dynmap.bukkit.helper.v115;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@ -14,23 +14,23 @@ import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
|
||||
import org.dynmap.bukkit.helper.BukkitWorld;
|
||||
import org.dynmap.bukkit.helper.v114_1.MapChunkCache114_1;
|
||||
import org.dynmap.bukkit.helper.v115.MapChunkCache115;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.Polygon;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.BiomeBase;
|
||||
import net.minecraft.server.v1_14_R1.Block;
|
||||
import net.minecraft.server.v1_14_R1.BlockFluids;
|
||||
import net.minecraft.server.v1_14_R1.BlockLogAbstract;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.IRegistry;
|
||||
import net.minecraft.server.v1_14_R1.Material;
|
||||
import net.minecraft.server.v1_15_R1.BiomeBase;
|
||||
import net.minecraft.server.v1_15_R1.Block;
|
||||
import net.minecraft.server.v1_15_R1.BlockFluids;
|
||||
import net.minecraft.server.v1_15_R1.BlockLogAbstract;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.IRegistry;
|
||||
import net.minecraft.server.v1_15_R1.Material;
|
||||
|
||||
/**
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot114_1 extends BukkitVersionHelperCB {
|
||||
public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
|
||||
|
||||
/** CraftChunkSnapshot */
|
||||
protected Class<?> datapalettearray;
|
||||
@ -46,7 +46,7 @@ public class BukkitVersionHelperSpigot114_1 extends BukkitVersionHelperCB {
|
||||
return false;
|
||||
}
|
||||
|
||||
public BukkitVersionHelperSpigot114_1() {
|
||||
public BukkitVersionHelperSpigot115() {
|
||||
datapalettearray = getNMSClass("[Lnet.minecraft.server.DataPaletteBlock;");
|
||||
blockid_field = getPrivateField(craftchunksnapshot, new String[] { "blockids" }, datapalettearray);
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class BukkitVersionHelperSpigot114_1 extends BukkitVersionHelperCB {
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
if ((!bd.p().isEmpty()) && ((bd.getBlock() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||
if ((!bd.getFluid().isEmpty()) && ((bd.getBlock() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||
bs.setWaterlogged();
|
||||
}
|
||||
if (mat == Material.AIR) {
|
||||
@ -158,7 +158,7 @@ public class BukkitVersionHelperSpigot114_1 extends BukkitVersionHelperCB {
|
||||
*/
|
||||
@Override
|
||||
public MapChunkCache getChunkCache(BukkitWorld dw, List<DynmapChunk> chunks) {
|
||||
MapChunkCache114_1 c = new MapChunkCache114_1();
|
||||
MapChunkCache115 c = new MapChunkCache115();
|
||||
c.setChunks(dw, chunks);
|
||||
return c;
|
||||
}
|
||||
@ -168,9 +168,21 @@ public class BukkitVersionHelperSpigot114_1 extends BukkitVersionHelperCB {
|
||||
*/
|
||||
@Override
|
||||
public int getBiomeBaseWaterMult(Object bb) {
|
||||
return ((BiomeBase)bb).n();
|
||||
return ((BiomeBase)bb).o();
|
||||
}
|
||||
|
||||
/** Get temperature from biomebase */
|
||||
@Override
|
||||
public float getBiomeBaseTemperature(Object bb) {
|
||||
return ((BiomeBase)bb).getTemperature();
|
||||
}
|
||||
|
||||
/** Get humidity from biomebase */
|
||||
@Override
|
||||
public float getBiomeBaseHumidity(Object bb) {
|
||||
return ((BiomeBase)bb).getHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Polygon getWorldBorder(World world) {
|
||||
Polygon p = null;
|
@ -0,0 +1,458 @@
|
||||
package org.dynmap.bukkit.helper.v115;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.craftbukkit.libs.jline.internal.Log;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.bukkit.helper.AbstractMapChunkCache;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||
import org.dynmap.bukkit.helper.SnapshotCache;
|
||||
import org.dynmap.bukkit.helper.SnapshotCache.SnapshotRec;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.utils.DynIntHashMap;
|
||||
import org.dynmap.utils.VisibilityLimit;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.Chunk;
|
||||
import net.minecraft.server.v1_15_R1.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_15_R1.ChunkRegionLoader;
|
||||
import net.minecraft.server.v1_15_R1.DataBits;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagList;
|
||||
|
||||
/**
|
||||
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
|
||||
*/
|
||||
public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||
|
||||
public static class NBTSnapshot implements Snapshot {
|
||||
private static interface Section {
|
||||
public DynmapBlockState getBlockType(int x, int y, int z);
|
||||
public int getBlockSkyLight(int x, int y, int z);
|
||||
public int getBlockEmittedLight(int x, int y, int z);
|
||||
public boolean isEmpty();
|
||||
}
|
||||
private final int x, z;
|
||||
private final Section[] section;
|
||||
private final int[] hmap; // Height map
|
||||
private final int[] biome;
|
||||
private final Object[] biomebase;
|
||||
private final long captureFulltime;
|
||||
private final int sectionCnt;
|
||||
private final long inhabitedTicks;
|
||||
|
||||
private static final int BLOCKS_PER_SECTION = 16 * 16 * 16;
|
||||
private static final int COLUMNS_PER_CHUNK = 16 * 16 * 4;
|
||||
private static final byte[] emptyData = new byte[BLOCKS_PER_SECTION / 2];
|
||||
private static final byte[] fullData = new byte[BLOCKS_PER_SECTION / 2];
|
||||
|
||||
static
|
||||
{
|
||||
Arrays.fill(fullData, (byte)0xFF);
|
||||
}
|
||||
|
||||
private static class EmptySection implements Section {
|
||||
@Override
|
||||
public DynmapBlockState getBlockType(int x, int y, int z) {
|
||||
return DynmapBlockState.AIR;
|
||||
}
|
||||
@Override
|
||||
public int getBlockSkyLight(int x, int y, int z) {
|
||||
return 15;
|
||||
}
|
||||
@Override
|
||||
public int getBlockEmittedLight(int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static final EmptySection empty_section = new EmptySection();
|
||||
|
||||
private static class StdSection implements Section {
|
||||
DynmapBlockState[] states;
|
||||
byte[] skylight;
|
||||
byte[] emitlight;
|
||||
|
||||
public StdSection() {
|
||||
states = new DynmapBlockState[BLOCKS_PER_SECTION];
|
||||
Arrays.fill(states, DynmapBlockState.AIR);
|
||||
skylight = emptyData;
|
||||
emitlight = emptyData;
|
||||
}
|
||||
@Override
|
||||
public DynmapBlockState getBlockType(int x, int y, int z) {
|
||||
return states[((y & 0xF) << 8) | (z << 4) | x];
|
||||
}
|
||||
@Override
|
||||
public int getBlockSkyLight(int x, int y, int z) {
|
||||
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
|
||||
return (skylight[off] >> (4 * (x & 1))) & 0xF;
|
||||
}
|
||||
@Override
|
||||
public int getBlockEmittedLight(int x, int y, int z)
|
||||
{
|
||||
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
|
||||
return (emitlight[off] >> (4 * (x & 1))) & 0xF;
|
||||
}
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Construct empty chunk snapshot
|
||||
*
|
||||
* @param x
|
||||
* @param z
|
||||
*/
|
||||
public NBTSnapshot(int worldheight, int x, int z, long captime, long inhabitedTime)
|
||||
{
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.captureFulltime = captime;
|
||||
this.biome = new int[COLUMNS_PER_CHUNK];
|
||||
this.biomebase = new Object[COLUMNS_PER_CHUNK];
|
||||
this.sectionCnt = worldheight / 16;
|
||||
/* Allocate arrays indexed by section */
|
||||
this.section = new Section[this.sectionCnt];
|
||||
|
||||
/* Fill with empty data */
|
||||
for (int i = 0; i < this.sectionCnt; i++) {
|
||||
this.section[i] = empty_section;
|
||||
}
|
||||
|
||||
/* Create empty height map */
|
||||
this.hmap = new int[16 * 16];
|
||||
|
||||
this.inhabitedTicks = inhabitedTime;
|
||||
}
|
||||
|
||||
public NBTSnapshot(NBTTagCompound nbt, int worldheight) {
|
||||
this.x = nbt.getInt("xPos");
|
||||
this.z = nbt.getInt("zPos");
|
||||
this.captureFulltime = 0;
|
||||
this.hmap = nbt.getIntArray("HeightMap");
|
||||
this.sectionCnt = worldheight / 16;
|
||||
if (nbt.hasKey("InhabitedTime")) {
|
||||
this.inhabitedTicks = nbt.getLong("InhabitedTime");
|
||||
}
|
||||
else {
|
||||
this.inhabitedTicks = 0;
|
||||
}
|
||||
/* Allocate arrays indexed by section */
|
||||
this.section = new Section[this.sectionCnt];
|
||||
/* Fill with empty data */
|
||||
for (int i = 0; i < this.sectionCnt; i++) {
|
||||
this.section[i] = empty_section;
|
||||
}
|
||||
/* Get sections */
|
||||
NBTTagList sect = nbt.getList("Sections", 10);
|
||||
for (int i = 0; i < sect.size(); i++) {
|
||||
NBTTagCompound sec = sect.getCompound(i);
|
||||
int secnum = sec.getByte("Y");
|
||||
if (secnum >= this.sectionCnt) {
|
||||
//Log.info("Section " + (int) secnum + " above world height " + worldheight);
|
||||
continue;
|
||||
}
|
||||
if (secnum < 0)
|
||||
continue;
|
||||
//System.out.println("section(" + secnum + ")=" + sec.asString());
|
||||
// Create normal section to initialize
|
||||
StdSection cursect = new StdSection();
|
||||
this.section[secnum] = cursect;
|
||||
DynmapBlockState[] states = cursect.states;
|
||||
DynmapBlockState[] palette = null;
|
||||
// If we've got palette and block states list, process non-empty section
|
||||
if (sec.hasKeyOfType("Palette", 9) && sec.hasKeyOfType("BlockStates", 12)) {
|
||||
NBTTagList plist = sec.getList("Palette", 10);
|
||||
long[] statelist = sec.getLongArray("BlockStates");
|
||||
palette = new DynmapBlockState[plist.size()];
|
||||
for (int pi = 0; pi < plist.size(); pi++) {
|
||||
NBTTagCompound tc = plist.getCompound(pi);
|
||||
String pname = tc.getString("Name");
|
||||
if (tc.hasKey("Properties")) {
|
||||
StringBuilder statestr = new StringBuilder();
|
||||
NBTTagCompound prop = tc.getCompound("Properties");
|
||||
for (String pid : prop.getKeys()) {
|
||||
if (statestr.length() > 0) statestr.append(',');
|
||||
statestr.append(pid).append('=').append(prop.get(pid).asString());
|
||||
}
|
||||
palette[pi] = DynmapBlockState.getStateByNameAndState(pname, statestr.toString());
|
||||
}
|
||||
if (palette[pi] == null) {
|
||||
palette[pi] = DynmapBlockState.getBaseStateByName(pname);
|
||||
}
|
||||
if (palette[pi] == null) {
|
||||
palette[pi] = DynmapBlockState.AIR;
|
||||
}
|
||||
}
|
||||
int bitsperblock = (statelist.length * 64) / 4096;
|
||||
DataBits db = new DataBits(bitsperblock, 4096, statelist);
|
||||
if (bitsperblock > 8) { // Not palette
|
||||
for (int j = 0; j < 4096; j++) {
|
||||
states[j] = DynmapBlockState.getStateByGlobalIndex(db.a(j));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int j = 0; j < 4096; j++) {
|
||||
int v = db.a(j);
|
||||
states[j] = (v < palette.length) ? palette[v] : DynmapBlockState.AIR;
|
||||
}
|
||||
}
|
||||
}
|
||||
cursect.emitlight = sec.getByteArray("BlockLight");
|
||||
if (sec.hasKey("SkyLight")) {
|
||||
cursect.skylight = sec.getByteArray("SkyLight");
|
||||
}
|
||||
}
|
||||
/* Get biome data */
|
||||
this.biome = new int[COLUMNS_PER_CHUNK];
|
||||
this.biomebase = new Object[COLUMNS_PER_CHUNK];
|
||||
Object[] bbl = BukkitVersionHelper.helper.getBiomeBaseList();
|
||||
if (nbt.hasKey("Biomes")) {
|
||||
int[] bb = nbt.getIntArray("Biomes");
|
||||
if (bb != null) {
|
||||
for (int i = 0; i < bb.length; i++) {
|
||||
int bv = bb[i];
|
||||
if (bv < 0) bv = 0;
|
||||
this.biome[i] = bv;
|
||||
this.biomebase[i] = bbl[bv];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getZ()
|
||||
{
|
||||
return z;
|
||||
}
|
||||
|
||||
public DynmapBlockState getBlockType(int x, int y, int z)
|
||||
{
|
||||
return section[y >> 4].getBlockType(x, y, z);
|
||||
}
|
||||
|
||||
public int getBlockSkyLight(int x, int y, int z)
|
||||
{
|
||||
return section[y >> 4].getBlockSkyLight(x, y, z);
|
||||
}
|
||||
|
||||
public int getBlockEmittedLight(int x, int y, int z)
|
||||
{
|
||||
return section[y >> 4].getBlockEmittedLight(x, y, z);
|
||||
}
|
||||
|
||||
public int getHighestBlockYAt(int x, int z)
|
||||
{
|
||||
return hmap[z << 4 | x];
|
||||
}
|
||||
|
||||
public final long getCaptureFullTime()
|
||||
{
|
||||
return captureFulltime;
|
||||
}
|
||||
|
||||
public boolean isSectionEmpty(int sy)
|
||||
{
|
||||
return section[sy].isEmpty();
|
||||
}
|
||||
|
||||
public long getInhabitedTicks() {
|
||||
return inhabitedTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int x, int z) {
|
||||
return AbstractMapChunkCache.getBiomeByID(biome[z << 4 | x]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getBiomeBaseFromSnapshot() {
|
||||
return this.biomebase;
|
||||
}
|
||||
}
|
||||
|
||||
private NBTTagCompound fetchLoadedChunkNBT(World w, int x, int z) {
|
||||
CraftWorld cw = (CraftWorld) w;
|
||||
NBTTagCompound nbt = null;
|
||||
if (cw.isChunkLoaded(x, z)) {
|
||||
Chunk c = cw.getHandle().getChunkAt(x, z);
|
||||
if ((c != null) && c.loaded) {
|
||||
nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
|
||||
}
|
||||
}
|
||||
if (nbt != null) {
|
||||
nbt = nbt.getCompound("Level");
|
||||
if (nbt != null) {
|
||||
String stat = nbt.getString("Status");
|
||||
if ((stat == null) || (stat.equals("full") == false)) {
|
||||
nbt = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
private NBTTagCompound loadChunkNBT(World w, int x, int z) {
|
||||
CraftWorld cw = (CraftWorld) w;
|
||||
NBTTagCompound nbt = null;
|
||||
ChunkCoordIntPair cc = new ChunkCoordIntPair(x, z);
|
||||
try {
|
||||
nbt = cw.getHandle().getChunkProvider().playerChunkMap.read(cc);
|
||||
} catch (IOException iox) {
|
||||
}
|
||||
if (nbt != null) {
|
||||
nbt = nbt.getCompound("Level");
|
||||
if (nbt != null) {
|
||||
String stat = nbt.getString("Status");
|
||||
if ((stat == null) || (stat.equals("full") == false)) {
|
||||
nbt = null;
|
||||
if ((stat == null) || stat.equals("") && DynmapCore.migrateChunks()) {
|
||||
Chunk c = cw.getHandle().getChunkAt(x, z);
|
||||
if (c != null) {
|
||||
nbt = fetchLoadedChunkNBT(w, x, z);
|
||||
cw.getHandle().unloadChunk(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Snapshot wrapChunkSnapshot(ChunkSnapshot css) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
// Load chunk snapshots
|
||||
@Override
|
||||
public int loadChunks(int max_to_load) {
|
||||
if(dw.isLoaded() == false)
|
||||
return 0;
|
||||
int cnt = 0;
|
||||
if(iterator == null)
|
||||
iterator = chunks.listIterator();
|
||||
|
||||
DynmapCore.setIgnoreChunkLoads(true);
|
||||
// Load the required chunks.
|
||||
while((cnt < max_to_load) && iterator.hasNext()) {
|
||||
long startTime = System.nanoTime();
|
||||
DynmapChunk chunk = iterator.next();
|
||||
boolean vis = true;
|
||||
if(visible_limits != null) {
|
||||
vis = false;
|
||||
for(VisibilityLimit limit : visible_limits) {
|
||||
if (limit.doIntersectChunk(chunk.x, chunk.z)) {
|
||||
vis = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(vis && (hidden_limits != null)) {
|
||||
for(VisibilityLimit limit : hidden_limits) {
|
||||
if (limit.doIntersectChunk(chunk.x, chunk.z)) {
|
||||
vis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Check if cached chunk snapshot found */
|
||||
Snapshot ss = null;
|
||||
long inhabited_ticks = 0;
|
||||
DynIntHashMap tileData = null;
|
||||
int idx = (chunk.x-x_min) + (chunk.z - z_min)*x_dim;
|
||||
SnapshotRec ssr = SnapshotCache.sscache.getSnapshot(dw.getName(), chunk.x, chunk.z, blockdata, biome, biomeraw, highesty);
|
||||
if(ssr != null) {
|
||||
inhabited_ticks = ssr.inhabitedTicks;
|
||||
if(!vis) {
|
||||
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
|
||||
ss = STONE;
|
||||
else if(hidestyle == HiddenChunkStyle.FILL_OCEAN)
|
||||
ss = OCEAN;
|
||||
else
|
||||
ss = EMPTY;
|
||||
}
|
||||
else {
|
||||
ss = ssr.ss;
|
||||
}
|
||||
snaparray[idx] = ss;
|
||||
snaptile[idx] = ssr.tileData;
|
||||
inhabitedTicks[idx] = inhabited_ticks;
|
||||
|
||||
endChunkLoad(startTime, ChunkStats.CACHED_SNAPSHOT_HIT);
|
||||
continue;
|
||||
}
|
||||
// Fetch NTB for chunk if loaded
|
||||
NBTTagCompound nbt = fetchLoadedChunkNBT(w, chunk.x, chunk.z);
|
||||
boolean did_load = false;
|
||||
if (nbt == null) {
|
||||
// Load NTB for chunk, if it exists
|
||||
nbt = loadChunkNBT(w, chunk.x, chunk.z);
|
||||
did_load = true;
|
||||
}
|
||||
if (nbt != null) {
|
||||
NBTSnapshot nss = new NBTSnapshot(nbt, w.getMaxHeight());
|
||||
ss = nss;
|
||||
inhabited_ticks = nss.getInhabitedTicks();
|
||||
if(!vis) {
|
||||
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
|
||||
ss = STONE;
|
||||
else if(hidestyle == HiddenChunkStyle.FILL_OCEAN)
|
||||
ss = OCEAN;
|
||||
else
|
||||
ss = EMPTY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ss = EMPTY;
|
||||
}
|
||||
ssr = new SnapshotRec();
|
||||
ssr.ss = ss;
|
||||
ssr.inhabitedTicks = inhabited_ticks;
|
||||
ssr.tileData = tileData;
|
||||
SnapshotCache.sscache.putSnapshot(dw.getName(), chunk.x, chunk.z, ssr, blockdata, biome, biomeraw, highesty);
|
||||
snaparray[idx] = ss;
|
||||
snaptile[idx] = ssr.tileData;
|
||||
inhabitedTicks[idx] = inhabited_ticks;
|
||||
if (nbt == null)
|
||||
endChunkLoad(startTime, ChunkStats.UNGENERATED_CHUNKS);
|
||||
else if (did_load)
|
||||
endChunkLoad(startTime, ChunkStats.UNLOADED_CHUNKS);
|
||||
else
|
||||
endChunkLoad(startTime, ChunkStats.LOADED_CHUNKS);
|
||||
cnt++;
|
||||
}
|
||||
DynmapCore.setIgnoreChunkLoads(false);
|
||||
|
||||
if(iterator.hasNext() == false) { /* If we're done */
|
||||
isempty = true;
|
||||
/* Fill missing chunks with empty dummy chunk */
|
||||
for(int i = 0; i < snaparray.length; i++) {
|
||||
if(snaparray[i] == null)
|
||||
snaparray[i] = EMPTY;
|
||||
else if(snaparray[i] != EMPTY)
|
||||
isempty = false;
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
}
|
@ -47,6 +47,8 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
||||
private Method cw_gethandle;
|
||||
|
||||
/** BiomeBase related helpers */
|
||||
protected Class<?> biomestorage;
|
||||
protected Field biomestoragebase;
|
||||
protected Class<?> biomebase;
|
||||
protected Class<?> biomebasearray;
|
||||
protected Field biomebaselist;
|
||||
@ -131,7 +133,12 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
||||
/* CraftChunkSnapshot */
|
||||
craftchunksnapshot = getOBCClass("org.bukkit.craftbukkit.CraftChunkSnapshot");
|
||||
biomebasearray = getNMSClass("[Lnet.minecraft.server.BiomeBase;");
|
||||
ccss_biome = getPrivateField(craftchunksnapshot, new String[] { "biome" }, biomebasearray);
|
||||
ccss_biome = getPrivateFieldNoFail(craftchunksnapshot, new String[] { "biome" }, biomebasearray);
|
||||
if(ccss_biome == null) {
|
||||
biomestorage = getNMSClass("net.minecraft.server.BiomeStorage");
|
||||
biomestoragebase = getPrivateField(biomestorage, new String[] { "f" }, biomebasearray);
|
||||
ccss_biome = getPrivateField(craftchunksnapshot, new String[] { "biome" }, biomestorage);
|
||||
}
|
||||
/* CraftChunk */
|
||||
craftchunk = getOBCClass("org.bukkit.craftbukkit.CraftChunk");
|
||||
cc_gethandle = getMethod(craftchunk, new String[] { "getHandle" }, new Class[0]);
|
||||
@ -321,7 +328,11 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
||||
* Get list of defined biomebase objects
|
||||
*/
|
||||
public Object[] getBiomeBaseList() {
|
||||
return (Object[]) getFieldValue(biomebase, biomebaselist, new Object[0]);
|
||||
Object baselist = getFieldValue(biomebase, biomebaselist, new Object[0]);
|
||||
if(biomestoragebase != null)
|
||||
baselist = getFieldValue(baselist, biomestoragebase, new Object[0]);
|
||||
|
||||
return (Object[])baselist;
|
||||
}
|
||||
/** Get temperature from biomebase */
|
||||
public float getBiomeBaseTemperature(Object bb) {
|
||||
|
@ -145,6 +145,9 @@ public class DynmapPlugin
|
||||
private boolean isMCPC = false;
|
||||
private boolean useSaveFolder = true;
|
||||
private Field displayName = null; // MCPC+ display name
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
@ -512,6 +515,20 @@ public class DynmapPlugin
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
int blkid = plugin.getServer().getBlockIDAt(r.wname, r.x, r.y, r.z);
|
||||
|
||||
if (blkid == -1)
|
||||
return -1;
|
||||
|
||||
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
|
@ -140,7 +140,7 @@ 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
|
||||
# Optional: set maximum number of lines visible for chatbox
|
||||
#visiblelines: 10
|
||||
# Optional: send push button
|
||||
sendbutton: false
|
||||
|
@ -520,6 +520,20 @@ public class DynmapPlugin
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
int blkid = plugin.getServer().getBlockIDAt(r.wname, r.x, r.y, r.z);
|
||||
|
||||
if (blkid == -1)
|
||||
return -1;
|
||||
|
||||
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
|
@ -140,7 +140,7 @@ 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
|
||||
# Optional: set maximum number of lines visible for chatbox
|
||||
#visiblelines: 10
|
||||
# Optional: send push button
|
||||
sendbutton: false
|
||||
|
@ -145,6 +145,9 @@ public class DynmapPlugin
|
||||
private boolean isMCPC = false;
|
||||
private boolean useSaveFolder = true;
|
||||
private Field displayName = null; // MCPC+ display name
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
@ -525,6 +528,20 @@ public class DynmapPlugin
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
int blkid = plugin.getServer().getBlockIDAt(r.wname, r.x, r.y, r.z);
|
||||
|
||||
if (blkid == -1)
|
||||
return -1;
|
||||
|
||||
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
|
@ -140,7 +140,7 @@ 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
|
||||
# Optional: set maximum number of lines visible for chatbox
|
||||
#visiblelines: 10
|
||||
# Optional: send push button
|
||||
sendbutton: false
|
||||
|
@ -18,7 +18,7 @@ apply plugin: 'eclipse'
|
||||
dependencies {
|
||||
compile project(":DynmapCore")
|
||||
compile project(":DynmapCoreAPI")
|
||||
minecraft 'net.minecraftforge:forge:1.13.2-25.0.191'
|
||||
minecraft 'net.minecraftforge:forge:1.13.2-25.0.219'
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
@ -33,7 +33,7 @@ repositories {
|
||||
}
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'snapshot', version: '20190415-1.13.2'
|
||||
mappings channel: 'snapshot', version: '20190215-1.13.1'
|
||||
runs {
|
||||
server {
|
||||
workingDirectory project.file('run').canonicalPath
|
||||
|
@ -156,6 +156,9 @@ public class DynmapPlugin
|
||||
private boolean isMCPC = false;
|
||||
private boolean useSaveFolder = true;
|
||||
private Field displayName = null; // MCPC+ display name
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
@ -516,6 +519,11 @@ public class DynmapPlugin
|
||||
public int getBlockIDAt(String wname, int x, int y, int z) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
|
@ -140,7 +140,7 @@ 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
|
||||
# Optional: set maximum number of lines visible for chatbox
|
||||
#visiblelines: 10
|
||||
# Optional: send push button
|
||||
sendbutton: false
|
||||
|
@ -140,6 +140,9 @@ public class DynmapPlugin
|
||||
private boolean isMCPC = false;
|
||||
private boolean useSaveFolder = true;
|
||||
private Field displayName = null; // MCPC+ display name
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
@ -496,6 +499,20 @@ public class DynmapPlugin
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
int blkid = plugin.getServer().getBlockIDAt(r.wname, r.x, r.y, r.z);
|
||||
|
||||
if (blkid == -1)
|
||||
return -1;
|
||||
|
||||
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
|
@ -140,7 +140,7 @@ 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
|
||||
# Optional: set maximum number of lines visible for chatbox
|
||||
#visiblelines: 10
|
||||
# Optional: send push button
|
||||
sendbutton: false
|
||||
|
@ -138,6 +138,9 @@ public class DynmapPlugin
|
||||
private boolean isMCPC = false;
|
||||
private boolean useSaveFolder = true;
|
||||
private Field displayName = null; // MCPC+ display name
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
@ -499,6 +502,20 @@ public class DynmapPlugin
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
int blkid = plugin.getServer().getBlockIDAt(r.wname, r.x, r.y, r.z);
|
||||
|
||||
if (blkid == -1)
|
||||
return -1;
|
||||
|
||||
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
|
@ -140,7 +140,7 @@ 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
|
||||
# Optional: set maximum number of lines visible for chatbox
|
||||
#visiblelines: 10
|
||||
# Optional: send push button
|
||||
sendbutton: false
|
||||
|
@ -1 +1,2 @@
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
org.gradle.parallel=true
|
||||
|
@ -5,6 +5,7 @@ include ':bukkit-helper-113-1'
|
||||
include ':bukkit-helper-113-2'
|
||||
include ':bukkit-helper-114'
|
||||
include ':bukkit-helper-114-1'
|
||||
include ':bukkit-helper-115'
|
||||
include ':bukkit-helper'
|
||||
include ':dynmap-api'
|
||||
include ':DynmapCore'
|
||||
@ -22,6 +23,7 @@ project(':bukkit-helper-113-1').projectDir = "$rootDir/bukkit-helper-113-1" as F
|
||||
project(':bukkit-helper-113-2').projectDir = "$rootDir/bukkit-helper-113-2" as File
|
||||
project(':bukkit-helper-114').projectDir = "$rootDir/bukkit-helper-114" as File
|
||||
project(':bukkit-helper-114-1').projectDir = "$rootDir/bukkit-helper-114-1" as File
|
||||
project(':bukkit-helper-115').projectDir = "$rootDir/bukkit-helper-115" as File
|
||||
project(':bukkit-helper').projectDir = "$rootDir/bukkit-helper" as File
|
||||
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
||||
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
||||
|
@ -4,14 +4,14 @@ description = 'dynmap'
|
||||
dependencies {
|
||||
compile group: 'org.bukkit', name: 'bukkit', version:'1.7.10-R0.1-SNAPSHOT'
|
||||
compile 'com.nijikokun.bukkit:Permissions:3.1.6'
|
||||
compile 'me.lucko.luckperms:luckperms-api:4.3'
|
||||
compile 'net.luckperms:api:5.0'
|
||||
compile project(":dynmap-api")
|
||||
compile project(path: ":DynmapCore", configuration: "shadow")
|
||||
compile group: 'ru.tehkode', name: 'PermissionsEx', version:'1.19.1'
|
||||
compile group: 'de.bananaco', name: 'bPermissions', version:'2.9.1'
|
||||
compile group: 'com.platymuus.bukkit.permissions', name: 'PermissionsBukkit', version:'1.6'
|
||||
compile group: 'org.anjocaido', name: 'EssentialsGroupManager', version:'2.10.1'
|
||||
compile group: 'org.bstats', name: 'bstats-bukkit', version:'1.1'
|
||||
compile group: 'org.bstats', name: 'bstats-bukkit', version:'1.5'
|
||||
compile group: 'com.googlecode.json-simple', name: 'json-simple', version:'1.1.1'
|
||||
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.2'
|
||||
compile project(':bukkit-helper')
|
||||
@ -30,6 +30,9 @@ dependencies {
|
||||
implementation(project(':bukkit-helper-114-1')) {
|
||||
transitive = false
|
||||
}
|
||||
implementation(project(':bukkit-helper-115')) {
|
||||
transitive = false
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
@ -59,6 +62,7 @@ shadowJar {
|
||||
include(dependency(':bukkit-helper-113-2'))
|
||||
include(dependency(':bukkit-helper-114'))
|
||||
include(dependency(':bukkit-helper-114-1'))
|
||||
include(dependency(':bukkit-helper-115'))
|
||||
}
|
||||
relocate('org.bstats', 'org.dynmap.bstats')
|
||||
destinationDir = file '../target'
|
||||
|
@ -16,7 +16,7 @@ import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.bstats.Metrics;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
@ -213,6 +213,22 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
World w = getServer().getWorld(wname);
|
||||
if((w != null) && w.isChunkLoaded(x >> 4, z >> 4)) {
|
||||
Block b = w.getBlockAt(x, y, z);
|
||||
BlockState s = b.getState();
|
||||
|
||||
if (s instanceof Sign) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isSignAt(String wname, int x, int y, int z) {
|
||||
@ -1211,7 +1227,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
onblockfromto = core.isTrigger("blockfromto");
|
||||
onblockphysics = core.isTrigger("blockphysics");
|
||||
onpiston = core.isTrigger("pistonmoved");
|
||||
onblockfade = core.isTrigger("blockfaded");
|
||||
onblockredstone = core.isTrigger("blockredstone");
|
||||
|
||||
if(onplace) {
|
||||
@ -1602,35 +1617,31 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
private void initMetrics() {
|
||||
metrics = new Metrics(this);
|
||||
|
||||
metrics.addCustomChart(new Metrics.MultiLineChart("features_used") {
|
||||
@Override
|
||||
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) {
|
||||
hashMap.put("internal_web_server", core.configuration.getBoolean("disable-webserver", false) ? 0 : 1);
|
||||
hashMap.put("login_security", core.configuration.getBoolean("login-enabled", false) ? 1 : 0);
|
||||
hashMap.put("player_info_protected", core.player_info_protected ? 1 : 0);
|
||||
for (String mod : modsused)
|
||||
hashMap.put(mod + "_blocks", 1);
|
||||
return hashMap;
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new Metrics.MultiLineChart("features_used", () -> {
|
||||
Map<String, Integer> hashMap = new HashMap<>();
|
||||
hashMap.put("internal_web_server", core.configuration.getBoolean("disable-webserver", false) ? 0 : 1);
|
||||
hashMap.put("login_security", core.configuration.getBoolean("login-enabled", false) ? 1 : 0);
|
||||
hashMap.put("player_info_protected", core.player_info_protected ? 1 : 0);
|
||||
for (String mod : modsused)
|
||||
hashMap.put(mod + "_blocks", 1);
|
||||
return hashMap;
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new Metrics.MultiLineChart("map_data") {
|
||||
@Override
|
||||
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) {
|
||||
hashMap.put("worlds", core.mapManager != null ? core.mapManager.getWorlds().size() : 0);
|
||||
int maps = 0, hdmaps = 0;
|
||||
if (core.mapManager != null)
|
||||
for (DynmapWorld w : core.mapManager.getWorlds()) {
|
||||
for (MapType mt : w.maps)
|
||||
if (mt instanceof HDMap)
|
||||
++hdmaps;
|
||||
maps += w.maps.size();
|
||||
}
|
||||
hashMap.put("maps", maps);
|
||||
hashMap.put("hd_maps", hdmaps);
|
||||
return hashMap;
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new Metrics.MultiLineChart("map_data", () -> {
|
||||
Map<String, Integer> hashMap = new HashMap<>();
|
||||
hashMap.put("worlds", core.mapManager != null ? core.mapManager.getWorlds().size() : 0);
|
||||
int maps = 0, hdmaps = 0;
|
||||
if (core.mapManager != null)
|
||||
for (DynmapWorld w : core.mapManager.getWorlds()) {
|
||||
for (MapType mt : w.maps)
|
||||
if (mt instanceof HDMap)
|
||||
++hdmaps;
|
||||
maps += w.maps.size();
|
||||
}
|
||||
hashMap.put("maps", maps);
|
||||
hashMap.put("hd_maps", hdmaps);
|
||||
return hashMap;
|
||||
}));
|
||||
}
|
||||
@Override
|
||||
public void processSignChange(int blkid, String world, int x, int y, int z,
|
||||
|
@ -1,61 +1,65 @@
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone;
|
||||
import org.dynmap.bukkit.helper.v113.BukkitVersionHelperSpigot113;
|
||||
import org.dynmap.bukkit.helper.v113_1.BukkitVersionHelperSpigot113_1;
|
||||
import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2;
|
||||
import org.dynmap.bukkit.helper.v114.BukkitVersionHelperSpigot114;
|
||||
import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1;
|
||||
|
||||
public class Helper {
|
||||
|
||||
public static final BukkitVersionHelper getHelper() {
|
||||
if (BukkitVersionHelper.helper == null) {
|
||||
String v = Bukkit.getServer().getVersion();
|
||||
Log.info("version=" + v);
|
||||
if (v.contains("MCPC")) {
|
||||
Log.severe("*********************************************************************************");
|
||||
Log.severe("* MCPC-Plus is no longer supported via the Bukkit version of Dynmap. *");
|
||||
Log.severe("* Install the appropriate Forge version of Dynmap. *");
|
||||
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
|
||||
Log.severe("*********************************************************************************");
|
||||
}
|
||||
else if(v.contains("BukkitForge")) {
|
||||
Log.severe("*********************************************************************************");
|
||||
Log.severe("* BukkitForge is not supported via the Bukkit version of Dynmap. *");
|
||||
Log.severe("* Install the appropriate Forge version of Dynmap. *");
|
||||
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
|
||||
Log.severe("*********************************************************************************");
|
||||
}
|
||||
else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
|
||||
Log.info("Loading Glowstone support");
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
||||
}
|
||||
else if (v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
|
||||
v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
|
||||
}
|
||||
else if (v.contains("(MC: 1.14)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114();
|
||||
}
|
||||
else if (v.contains("(MC: 1.13.2)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
|
||||
}
|
||||
else if (v.contains("(MC: 1.13.1)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_1();
|
||||
}
|
||||
else if (v.contains("(MC: 1.13)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113();
|
||||
}
|
||||
else {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperCB();
|
||||
}
|
||||
}
|
||||
return BukkitVersionHelper.helper;
|
||||
}
|
||||
|
||||
}
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone;
|
||||
import org.dynmap.bukkit.helper.v113.BukkitVersionHelperSpigot113;
|
||||
import org.dynmap.bukkit.helper.v113_1.BukkitVersionHelperSpigot113_1;
|
||||
import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2;
|
||||
import org.dynmap.bukkit.helper.v114.BukkitVersionHelperSpigot114;
|
||||
import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1;
|
||||
import org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115;
|
||||
|
||||
public class Helper {
|
||||
|
||||
public static final BukkitVersionHelper getHelper() {
|
||||
if (BukkitVersionHelper.helper == null) {
|
||||
String v = Bukkit.getServer().getVersion();
|
||||
Log.info("version=" + v);
|
||||
if (v.contains("MCPC")) {
|
||||
Log.severe("*********************************************************************************");
|
||||
Log.severe("* MCPC-Plus is no longer supported via the Bukkit version of Dynmap. *");
|
||||
Log.severe("* Install the appropriate Forge version of Dynmap. *");
|
||||
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
|
||||
Log.severe("*********************************************************************************");
|
||||
}
|
||||
else if(v.contains("BukkitForge")) {
|
||||
Log.severe("*********************************************************************************");
|
||||
Log.severe("* BukkitForge is not supported via the Bukkit version of Dynmap. *");
|
||||
Log.severe("* Install the appropriate Forge version of Dynmap. *");
|
||||
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
|
||||
Log.severe("*********************************************************************************");
|
||||
}
|
||||
else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
|
||||
Log.info("Loading Glowstone support");
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
||||
}
|
||||
else if (v.contains("(MC: 1.15)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115();
|
||||
}
|
||||
else if (v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
|
||||
v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
|
||||
}
|
||||
else if (v.contains("(MC: 1.14)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114();
|
||||
}
|
||||
else if (v.contains("(MC: 1.13.2)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
|
||||
}
|
||||
else if (v.contains("(MC: 1.13.1)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_1();
|
||||
}
|
||||
else if (v.contains("(MC: 1.13)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113();
|
||||
}
|
||||
else {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperCB();
|
||||
}
|
||||
}
|
||||
return BukkitVersionHelper.helper;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,9 +6,12 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.caching.PermissionData;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.model.user.UserManager;
|
||||
import net.luckperms.api.cacheddata.CachedPermissionData;
|
||||
import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -18,19 +21,19 @@ import org.dynmap.Log;
|
||||
|
||||
public class LuckPermsPermissions implements PermissionProvider {
|
||||
String name;
|
||||
LuckPermsApi luckPerms;
|
||||
LuckPerms luckPerms;
|
||||
|
||||
public static LuckPermsPermissions create(Server server, String name) {
|
||||
if (!server.getPluginManager().isPluginEnabled("LuckPerms"))
|
||||
return null;
|
||||
LuckPermsApi luckPerms = server.getServicesManager().load(LuckPermsApi.class);
|
||||
LuckPerms luckPerms = server.getServicesManager().load(LuckPerms.class);
|
||||
if (luckPerms == null)
|
||||
return null;
|
||||
Log.info("Using LuckPerms " + luckPerms.getPlatformInfo().getVersion() + " for access control");
|
||||
Log.info("Using LuckPerms " + luckPerms.getPluginMetadata().getVersion() + " for access control");
|
||||
return new LuckPermsPermissions(name, luckPerms);
|
||||
}
|
||||
|
||||
public LuckPermsPermissions(String name, LuckPermsApi luckPerms) {
|
||||
public LuckPermsPermissions(String name, LuckPerms luckPerms) {
|
||||
this.name = name;
|
||||
this.luckPerms = luckPerms;
|
||||
}
|
||||
@ -43,10 +46,10 @@ public class LuckPermsPermissions implements PermissionProvider {
|
||||
@Override
|
||||
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
|
||||
Set<String> result = new HashSet<>();
|
||||
PermissionData user = getUser(player);
|
||||
CachedPermissionData user = getUser(player);
|
||||
if (user != null) {
|
||||
for (String p : perms) {
|
||||
if (user.getPermissionValue(name + "." + p).asBoolean())
|
||||
if (user.checkPermission(name + "." + p).asBoolean())
|
||||
result.add(p);
|
||||
}
|
||||
}
|
||||
@ -55,34 +58,39 @@ public class LuckPermsPermissions implements PermissionProvider {
|
||||
|
||||
@Override
|
||||
public boolean hasOfflinePermission(String player, String perm) {
|
||||
PermissionData user = getUser(player);
|
||||
CachedPermissionData user = getUser(player);
|
||||
if (user == null)
|
||||
return false;
|
||||
return user.getPermissionValue(name + "." + perm).asBoolean();
|
||||
return user.checkPermission(name + "." + perm).asBoolean();
|
||||
}
|
||||
|
||||
private PermissionData getUser(String username) {
|
||||
private CachedPermissionData getUser(String username) {
|
||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(username);
|
||||
UUID uuid;
|
||||
|
||||
if (offlinePlayer != null && offlinePlayer.getUniqueId() != null)
|
||||
uuid = offlinePlayer.getUniqueId();
|
||||
else
|
||||
uuid = joinFuture(luckPerms.getStorage().getUUID(username));
|
||||
uuid = joinFuture(luckPerms.getUserManager().lookupUniqueId(username));
|
||||
|
||||
if (uuid == null)
|
||||
return null;
|
||||
|
||||
User user = luckPerms.getUser(uuid);
|
||||
User user = luckPerms.getUserManager().getUser(uuid);
|
||||
if (user == null) {
|
||||
joinFuture(luckPerms.getStorage().loadUser(uuid));
|
||||
user = luckPerms.getUser(uuid);
|
||||
joinFuture(luckPerms.getUserManager().loadUser(uuid));
|
||||
user = luckPerms.getUserManager().getUser(uuid);
|
||||
}
|
||||
|
||||
if (user == null)
|
||||
return null;
|
||||
|
||||
return user.getCachedData().getPermissionData(luckPerms.getContextManager().getStaticContexts());
|
||||
CachedDataManager data = user.getCachedData();
|
||||
return luckPerms
|
||||
.getContextManager()
|
||||
.getQueryOptions(user)
|
||||
.map(queryOptions -> data.getPermissionData(queryOptions))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
private static <T> T joinFuture(Future<T> future) {
|
||||
@ -92,4 +100,4 @@ public class LuckPermsPermissions implements PermissionProvider {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ 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
|
||||
# Optional: set maximum number of lines visible for chatbox
|
||||
#visiblelines: 10
|
||||
# Optional: send push button
|
||||
sendbutton: false
|
||||
|
@ -3,7 +3,7 @@ main: org.dynmap.bukkit.DynmapPlugin
|
||||
version: "${version}-${buildnumber}"
|
||||
authors: [mikeprimm]
|
||||
website: "https://forums.dynmap.us"
|
||||
softdepend: [ Permissions, PermissionEx, bPermissions, PermissionsBukkit, GroupManager, LuckPerm ]
|
||||
softdepend: [ Permissions, PermissionEx, bPermissions, PermissionsBukkit, GroupManager, LuckPerms ]
|
||||
commands:
|
||||
dynmap:
|
||||
description: Controls Dynmap.
|
||||
|
Loading…
Reference in New Issue
Block a user