Merge branch 'v3.0' into v3.0

This commit is contained in:
mikeprimm 2019-12-14 22:09:42 -06:00 committed by GitHub
commit 69e42c83db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 154 additions and 176 deletions

View File

@ -289,7 +289,7 @@ public class MariaDBMapStorage extends MapStorage {
connectionString = "jdbc:mariadb://" + hostname + ":" + port + "/" + database + "?allowReconnect=true"; connectionString = "jdbc:mariadb://" + hostname + ":" + port + "/" + database + "?allowReconnect=true";
Log.info("Opening MariaDB database " + hostname + ":" + port + "/" + database + " as map store"); Log.info("Opening MariaDB database " + hostname + ":" + port + "/" + database + " as map store");
try { try {
Class.forName("com.mariadb.jdbc.Driver"); Class.forName("org.mariadb.jdbc.Driver");
// Initialize/update tables, if needed // Initialize/update tables, if needed
if(!initializeTables()) { if(!initializeTables()) {
return false; return false;

View File

@ -375,6 +375,7 @@ DynMap.prototype = {
componentstoload--; componentstoload--;
if (componentstoload == 0) { if (componentstoload == 0) {
// Actually start updating once all components are loaded. // Actually start updating once all components are loaded.
me.update();
setTimeout(function() { me.update(); }, me.options.updaterate); setTimeout(function() { me.update(); }, me.options.updaterate);
} }
}); });

View File

@ -13,13 +13,13 @@ allprojects {
maven { url "http://repo.mikeprimm.com" } maven { url "http://repo.mikeprimm.com" }
maven { url "http://repo.maven.apache.org/maven2" } maven { url "http://repo.maven.apache.org/maven2" }
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } 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' apply plugin: 'java'
group = 'us.dynmap' group = 'us.dynmap'
version = '3.0-beta-6' version = '3.0-beta-7'
} }

View File

@ -86,7 +86,7 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
@Override @Override
public Object[] getBiomeBaseList() { public Object[] getBiomeBaseList() {
if (biomelist == null) { if (biomelist == null) {
biomelist = new BiomeBase[1024]; biomelist = new Object[1024];
for (int i = 0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
biomelist[i] = IRegistry.BIOME.fromId(i); biomelist[i] = IRegistry.BIOME.fromId(i);
} }
@ -168,21 +168,9 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
*/ */
@Override @Override
public int getBiomeBaseWaterMult(Object bb) { public int getBiomeBaseWaterMult(Object bb) {
return ((BiomeBase)bb).o(); return ((BiomeBase)bb).p();
} }
/** 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 @Override
public Polygon getWorldBorder(World world) { public Polygon getWorldBorder(World world) {
Polygon p = null; Polygon p = null;

View File

@ -86,7 +86,7 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
@Override @Override
public Object[] getBiomeBaseList() { public Object[] getBiomeBaseList() {
if (biomelist == null) { if (biomelist == null) {
biomelist = new BiomeBase[1024]; biomelist = new Object[1024];
for (int i = 0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
biomelist[i] = IRegistry.BIOME.fromId(i); biomelist[i] = IRegistry.BIOME.fromId(i);
} }
@ -168,7 +168,7 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
*/ */
@Override @Override
public int getBiomeBaseWaterMult(Object bb) { public int getBiomeBaseWaterMult(Object bb) {
return ((BiomeBase)bb).o(); return ((BiomeBase)bb).p();
} }
/** Get temperature from biomebase */ /** Get temperature from biomebase */

View File

@ -1,6 +1,8 @@
package org.dynmap.bukkit.helper.v115; package org.dynmap.bukkit.helper.v115;
import org.bukkit.Bukkit;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.libs.jline.internal.Log;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import java.io.IOException; import java.io.IOException;
@ -18,13 +20,10 @@ import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.utils.DynIntHashMap; import org.dynmap.utils.DynIntHashMap;
import org.dynmap.utils.VisibilityLimit; import org.dynmap.utils.VisibilityLimit;
import net.minecraft.server.v1_15_R1.BiomeBase;
import net.minecraft.server.v1_15_R1.BiomeStorage;
import net.minecraft.server.v1_15_R1.Chunk; import net.minecraft.server.v1_15_R1.Chunk;
import net.minecraft.server.v1_15_R1.ChunkCoordIntPair; import net.minecraft.server.v1_15_R1.ChunkCoordIntPair;
import net.minecraft.server.v1_15_R1.ChunkRegionLoader; import net.minecraft.server.v1_15_R1.ChunkRegionLoader;
import net.minecraft.server.v1_15_R1.DataBits; import net.minecraft.server.v1_15_R1.DataBits;
import net.minecraft.server.v1_15_R1.IRegistry;
import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagList; import net.minecraft.server.v1_15_R1.NBTTagList;
@ -43,13 +42,14 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
private final int x, z; private final int x, z;
private final Section[] section; private final Section[] section;
private final int[] hmap; // Height map private final int[] hmap; // Height map
private final BiomeStorage biomestorage; private final int[] biome;
private final BiomeBase[] biomebase; private final Object[] biomebase;
private final long captureFulltime; private final long captureFulltime;
private final int sectionCnt; private final int sectionCnt;
private final long inhabitedTicks; private final long inhabitedTicks;
private static final int BLOCKS_PER_SECTION = 16 * 16 * 16; 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[] emptyData = new byte[BLOCKS_PER_SECTION / 2];
private static final byte[] fullData = new byte[BLOCKS_PER_SECTION / 2]; private static final byte[] fullData = new byte[BLOCKS_PER_SECTION / 2];
@ -121,8 +121,8 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
this.x = x; this.x = x;
this.z = z; this.z = z;
this.captureFulltime = captime; this.captureFulltime = captime;
this.biomebase = new BiomeBase[BiomeStorage.a]; this.biome = new int[COLUMNS_PER_CHUNK];
this.biomestorage = new BiomeStorage(this.biomebase); this.biomebase = new Object[COLUMNS_PER_CHUNK];
this.sectionCnt = worldheight / 16; this.sectionCnt = worldheight / 16;
/* Allocate arrays indexed by section */ /* Allocate arrays indexed by section */
this.section = new Section[this.sectionCnt]; this.section = new Section[this.sectionCnt];
@ -138,10 +138,9 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
this.inhabitedTicks = inhabitedTime; this.inhabitedTicks = inhabitedTime;
} }
public NBTSnapshot(World w, NBTTagCompound nbt, int worldheight) { public NBTSnapshot(NBTTagCompound nbt, int worldheight) {
this.x = nbt.getInt("xPos"); this.x = nbt.getInt("xPos");
this.z = nbt.getInt("zPos"); this.z = nbt.getInt("zPos");
ChunkCoordIntPair cc = new ChunkCoordIntPair(this.x, this.z);
this.captureFulltime = 0; this.captureFulltime = 0;
this.hmap = nbt.getIntArray("HeightMap"); this.hmap = nbt.getIntArray("HeightMap");
this.sectionCnt = worldheight / 16; this.sectionCnt = worldheight / 16;
@ -218,32 +217,20 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
} }
} }
/* Get biome data */ /* Get biome data */
BiomeStorage biomestorage = null; this.biome = new int[COLUMNS_PER_CHUNK];
this.biomebase = new BiomeBase[BiomeStorage.a]; this.biomebase = new Object[COLUMNS_PER_CHUNK];
BiomeBase[] bbl = (BiomeBase[])BukkitVersionHelper.helper.getBiomeBaseList(); Object[] bbl = BukkitVersionHelper.helper.getBiomeBaseList();
if (nbt.hasKey("Biomes")) { if (nbt.hasKey("Biomes")) {
int[] bb = nbt.getIntArray("Biomes"); int[] bb = nbt.getIntArray("Biomes");
if (bb != null && bb.length <= 256) { if (bb != null) {
for (int i = 0; i < bb.length; i++) { for (int i = 0; i < bb.length; i++) {
int bv = bb[i]; int bv = bb[i];
if (bv < 0) bv = 0; if (bv < 0) bv = 0;
this.biome[i] = bv;
this.biomebase[i] = bbl[bv]; this.biomebase[i] = bbl[bv];
} }
} }
else if (bb != null && bb.length > 256) { }
biomestorage = new BiomeStorage(cc, ((CraftWorld)w).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager(), bb);
for(int iz = 0; iz < 16; iz++) {
for(int ix = 0; ix < 16; ix++) {
this.biomebase[iz << 4 | ix] = biomestorage.getBiome(ix >> 2, 0, iz >> 2);
}
}
}
}
if(biomestorage == null) {
biomestorage = new BiomeStorage(cc, ((CraftWorld)w).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager());
}
this.biomestorage = biomestorage;
} }
public int getX() public int getX()
@ -292,9 +279,7 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
@Override @Override
public Biome getBiome(int x, int z) { public Biome getBiome(int x, int z) {
BiomeBase bb = this.biomestorage.getBiome(x, 64, z); return AbstractMapChunkCache.getBiomeByID(biome[z << 4 | x]);
int biomeId = IRegistry.BIOME.a(bb);
return AbstractMapChunkCache.getBiomeByID(biomeId);
} }
@Override @Override
@ -424,7 +409,7 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
did_load = true; did_load = true;
} }
if (nbt != null) { if (nbt != null) {
NBTSnapshot nss = new NBTSnapshot(w, nbt, w.getMaxHeight()); NBTSnapshot nss = new NBTSnapshot(nbt, w.getMaxHeight());
ss = nss; ss = nss;
inhabited_ticks = nss.getInhabitedTicks(); inhabited_ticks = nss.getInhabitedTicks();
if(!vis) { if(!vis) {

View File

@ -140,7 +140,7 @@ components:
messagettl: 5 messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages # Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100 #scrollback: 100
# Optiona; set maximum number of lines visible for chatbox # Optional: set maximum number of lines visible for chatbox
#visiblelines: 10 #visiblelines: 10
# Optional: send push button # Optional: send push button
sendbutton: false sendbutton: false

View File

@ -140,7 +140,7 @@ components:
messagettl: 5 messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages # Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100 #scrollback: 100
# Optiona; set maximum number of lines visible for chatbox # Optional: set maximum number of lines visible for chatbox
#visiblelines: 10 #visiblelines: 10
# Optional: send push button # Optional: send push button
sendbutton: false sendbutton: false

View File

@ -140,7 +140,7 @@ components:
messagettl: 5 messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages # Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100 #scrollback: 100
# Optiona; set maximum number of lines visible for chatbox # Optional: set maximum number of lines visible for chatbox
#visiblelines: 10 #visiblelines: 10
# Optional: send push button # Optional: send push button
sendbutton: false sendbutton: false

View File

@ -140,7 +140,7 @@ components:
messagettl: 5 messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages # Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100 #scrollback: 100
# Optiona; set maximum number of lines visible for chatbox # Optional: set maximum number of lines visible for chatbox
#visiblelines: 10 #visiblelines: 10
# Optional: send push button # Optional: send push button
sendbutton: false sendbutton: false

View File

@ -140,7 +140,7 @@ components:
messagettl: 5 messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages # Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100 #scrollback: 100
# Optiona; set maximum number of lines visible for chatbox # Optional: set maximum number of lines visible for chatbox
#visiblelines: 10 #visiblelines: 10
# Optional: send push button # Optional: send push button
sendbutton: false sendbutton: false

View File

@ -140,7 +140,7 @@ components:
messagettl: 5 messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages # Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100 #scrollback: 100
# Optiona; set maximum number of lines visible for chatbox # Optional: set maximum number of lines visible for chatbox
#visiblelines: 10 #visiblelines: 10
# Optional: send push button # Optional: send push button
sendbutton: false sendbutton: false

View File

@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true

View File

@ -4,14 +4,14 @@ description = 'dynmap'
dependencies { dependencies {
compile group: 'org.bukkit', name: 'bukkit', version:'1.7.10-R0.1-SNAPSHOT' compile group: 'org.bukkit', name: 'bukkit', version:'1.7.10-R0.1-SNAPSHOT'
compile 'com.nijikokun.bukkit:Permissions:3.1.6' 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(":dynmap-api")
compile project(path: ":DynmapCore", configuration: "shadow") compile project(path: ":DynmapCore", configuration: "shadow")
compile group: 'ru.tehkode', name: 'PermissionsEx', version:'1.19.1' compile group: 'ru.tehkode', name: 'PermissionsEx', version:'1.19.1'
compile group: 'de.bananaco', name: 'bPermissions', version:'2.9.1' compile group: 'de.bananaco', name: 'bPermissions', version:'2.9.1'
compile group: 'com.platymuus.bukkit.permissions', name: 'PermissionsBukkit', version:'1.6' compile group: 'com.platymuus.bukkit.permissions', name: 'PermissionsBukkit', version:'1.6'
compile group: 'org.anjocaido', name: 'EssentialsGroupManager', version:'2.10.1' 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.googlecode.json-simple', name: 'json-simple', version:'1.1.1'
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.2' compile group: 'com.google.code.gson', name: 'gson', version:'2.8.2'
compile project(':bukkit-helper') compile project(':bukkit-helper')

View File

@ -16,7 +16,7 @@ import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import org.bstats.Metrics; import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Chunk; import org.bukkit.Chunk;
@ -1194,7 +1194,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
onblockfromto = core.isTrigger("blockfromto"); onblockfromto = core.isTrigger("blockfromto");
onblockphysics = core.isTrigger("blockphysics"); onblockphysics = core.isTrigger("blockphysics");
onpiston = core.isTrigger("pistonmoved"); onpiston = core.isTrigger("pistonmoved");
onblockfade = core.isTrigger("blockfaded");
onblockredstone = core.isTrigger("blockredstone"); onblockredstone = core.isTrigger("blockredstone");
if(onplace) { if(onplace) {
@ -1585,35 +1584,31 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private void initMetrics() { private void initMetrics() {
metrics = new Metrics(this); metrics = new Metrics(this);
metrics.addCustomChart(new Metrics.MultiLineChart("features_used") { metrics.addCustomChart(new Metrics.MultiLineChart("features_used", () -> {
@Override Map<String, Integer> hashMap = new HashMap<>();
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) { hashMap.put("internal_web_server", core.configuration.getBoolean("disable-webserver", false) ? 0 : 1);
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("login_security", core.configuration.getBoolean("login-enabled", false) ? 1 : 0); hashMap.put("player_info_protected", core.player_info_protected ? 1 : 0);
hashMap.put("player_info_protected", core.player_info_protected ? 1 : 0); for (String mod : modsused)
for (String mod : modsused) hashMap.put(mod + "_blocks", 1);
hashMap.put(mod + "_blocks", 1); return hashMap;
return hashMap; }));
}
});
metrics.addCustomChart(new Metrics.MultiLineChart("map_data") { metrics.addCustomChart(new Metrics.MultiLineChart("map_data", () -> {
@Override Map<String, Integer> hashMap = new HashMap<>();
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) { hashMap.put("worlds", core.mapManager != null ? core.mapManager.getWorlds().size() : 0);
hashMap.put("worlds", core.mapManager != null ? core.mapManager.getWorlds().size() : 0); int maps = 0, hdmaps = 0;
int maps = 0, hdmaps = 0; if (core.mapManager != null)
if (core.mapManager != null) for (DynmapWorld w : core.mapManager.getWorlds()) {
for (DynmapWorld w : core.mapManager.getWorlds()) { for (MapType mt : w.maps)
for (MapType mt : w.maps) if (mt instanceof HDMap)
if (mt instanceof HDMap) ++hdmaps;
++hdmaps; maps += w.maps.size();
maps += w.maps.size(); }
} hashMap.put("maps", maps);
hashMap.put("maps", maps); hashMap.put("hd_maps", hdmaps);
hashMap.put("hd_maps", hdmaps); return hashMap;
return hashMap; }));
}
});
} }
@Override @Override
public void processSignChange(int blkid, String world, int x, int y, int z, public void processSignChange(int blkid, String world, int x, int y, int z,

View File

@ -1,65 +1,65 @@
package org.dynmap.bukkit; package org.dynmap.bukkit;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.dynmap.Log; import org.dynmap.Log;
import org.dynmap.bukkit.helper.BukkitVersionHelper; import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.BukkitVersionHelperCB; import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone; import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone;
import org.dynmap.bukkit.helper.v113.BukkitVersionHelperSpigot113; import org.dynmap.bukkit.helper.v113.BukkitVersionHelperSpigot113;
import org.dynmap.bukkit.helper.v113_1.BukkitVersionHelperSpigot113_1; import org.dynmap.bukkit.helper.v113_1.BukkitVersionHelperSpigot113_1;
import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2; import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2;
import org.dynmap.bukkit.helper.v114.BukkitVersionHelperSpigot114; import org.dynmap.bukkit.helper.v114.BukkitVersionHelperSpigot114;
import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1; import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1;
import org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115; import org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115;
public class Helper { public class Helper {
public static final BukkitVersionHelper getHelper() { public static final BukkitVersionHelper getHelper() {
if (BukkitVersionHelper.helper == null) { if (BukkitVersionHelper.helper == null) {
String v = Bukkit.getServer().getVersion(); String v = Bukkit.getServer().getVersion();
Log.info("version=" + v); Log.info("version=" + v);
if (v.contains("MCPC")) { if (v.contains("MCPC")) {
Log.severe("*********************************************************************************"); Log.severe("*********************************************************************************");
Log.severe("* MCPC-Plus is no longer supported via the Bukkit version of Dynmap. *"); 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("* Install the appropriate Forge version of Dynmap. *");
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *"); Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
Log.severe("*********************************************************************************"); Log.severe("*********************************************************************************");
} }
else if(v.contains("BukkitForge")) { else if(v.contains("BukkitForge")) {
Log.severe("*********************************************************************************"); Log.severe("*********************************************************************************");
Log.severe("* BukkitForge is not supported via the Bukkit version of Dynmap. *"); Log.severe("* BukkitForge is not supported via the Bukkit version of Dynmap. *");
Log.severe("* Install the appropriate Forge 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("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
Log.severe("*********************************************************************************"); Log.severe("*********************************************************************************");
} }
else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) { else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
Log.info("Loading Glowstone support"); Log.info("Loading Glowstone support");
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone(); BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
} }
else if (v.contains("(MC: 1.15)")) { else if (v.contains("(MC: 1.15)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115(); BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115();
} }
else if (v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") || 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)")) { v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1(); BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
} }
else if (v.contains("(MC: 1.14)")) { else if (v.contains("(MC: 1.14)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114(); BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114();
} }
else if (v.contains("(MC: 1.13.2)")) { else if (v.contains("(MC: 1.13.2)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2(); BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
} }
else if (v.contains("(MC: 1.13.1)")) { else if (v.contains("(MC: 1.13.1)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_1(); BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_1();
} }
else if (v.contains("(MC: 1.13)")) { else if (v.contains("(MC: 1.13)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113(); BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113();
} }
else { else {
BukkitVersionHelper.helper = new BukkitVersionHelperCB(); BukkitVersionHelper.helper = new BukkitVersionHelperCB();
} }
} }
return BukkitVersionHelper.helper; return BukkitVersionHelper.helper;
} }
} }

View File

@ -6,9 +6,12 @@ import java.util.UUID;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import me.lucko.luckperms.api.LuckPermsApi; import net.luckperms.api.LuckPerms;
import me.lucko.luckperms.api.User; import net.luckperms.api.model.user.User;
import me.lucko.luckperms.api.caching.PermissionData; 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.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -18,19 +21,19 @@ import org.dynmap.Log;
public class LuckPermsPermissions implements PermissionProvider { public class LuckPermsPermissions implements PermissionProvider {
String name; String name;
LuckPermsApi luckPerms; LuckPerms luckPerms;
public static LuckPermsPermissions create(Server server, String name) { public static LuckPermsPermissions create(Server server, String name) {
if (!server.getPluginManager().isPluginEnabled("LuckPerms")) if (!server.getPluginManager().isPluginEnabled("LuckPerms"))
return null; return null;
LuckPermsApi luckPerms = server.getServicesManager().load(LuckPermsApi.class); LuckPerms luckPerms = server.getServicesManager().load(LuckPerms.class);
if (luckPerms == null) if (luckPerms == null)
return 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); return new LuckPermsPermissions(name, luckPerms);
} }
public LuckPermsPermissions(String name, LuckPermsApi luckPerms) { public LuckPermsPermissions(String name, LuckPerms luckPerms) {
this.name = name; this.name = name;
this.luckPerms = luckPerms; this.luckPerms = luckPerms;
} }
@ -43,10 +46,10 @@ public class LuckPermsPermissions implements PermissionProvider {
@Override @Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) { public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
Set<String> result = new HashSet<>(); Set<String> result = new HashSet<>();
PermissionData user = getUser(player); CachedPermissionData user = getUser(player);
if (user != null) { if (user != null) {
for (String p : perms) { for (String p : perms) {
if (user.getPermissionValue(name + "." + p).asBoolean()) if (user.checkPermission(name + "." + p).asBoolean())
result.add(p); result.add(p);
} }
} }
@ -55,34 +58,39 @@ public class LuckPermsPermissions implements PermissionProvider {
@Override @Override
public boolean hasOfflinePermission(String player, String perm) { public boolean hasOfflinePermission(String player, String perm) {
PermissionData user = getUser(player); CachedPermissionData user = getUser(player);
if (user == null) if (user == null)
return false; 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); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(username);
UUID uuid; UUID uuid;
if (offlinePlayer != null && offlinePlayer.getUniqueId() != null) if (offlinePlayer != null && offlinePlayer.getUniqueId() != null)
uuid = offlinePlayer.getUniqueId(); uuid = offlinePlayer.getUniqueId();
else else
uuid = joinFuture(luckPerms.getStorage().getUUID(username)); uuid = joinFuture(luckPerms.getUserManager().lookupUniqueId(username));
if (uuid == null) if (uuid == null)
return null; return null;
User user = luckPerms.getUser(uuid); User user = luckPerms.getUserManager().getUser(uuid);
if (user == null) { if (user == null) {
joinFuture(luckPerms.getStorage().loadUser(uuid)); joinFuture(luckPerms.getUserManager().loadUser(uuid));
user = luckPerms.getUser(uuid); user = luckPerms.getUserManager().getUser(uuid);
} }
if (user == null) if (user == null)
return 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) { private static <T> T joinFuture(Future<T> future) {
@ -92,4 +100,4 @@ public class LuckPermsPermissions implements PermissionProvider {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
} }

View File

@ -141,7 +141,7 @@ components:
messagettl: 5 messagettl: 5
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages # Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
#scrollback: 100 #scrollback: 100
# Optiona; set maximum number of lines visible for chatbox # Optional: set maximum number of lines visible for chatbox
#visiblelines: 10 #visiblelines: 10
# Optional: send push button # Optional: send push button
sendbutton: false sendbutton: false

View File

@ -3,7 +3,7 @@ main: org.dynmap.bukkit.DynmapPlugin
version: "${version}-${buildnumber}" version: "${version}-${buildnumber}"
authors: [mikeprimm] authors: [mikeprimm]
website: "https://forums.dynmap.us" website: "https://forums.dynmap.us"
softdepend: [ Permissions, PermissionEx, bPermissions, PermissionsBukkit, GroupManager, LuckPerm ] softdepend: [ Permissions, PermissionEx, bPermissions, PermissionsBukkit, GroupManager, LuckPerms ]
commands: commands:
dynmap: dynmap:
description: Controls Dynmap. description: Controls Dynmap.