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
69e42c83db
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
@ -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-6'
|
||||
version = '3.0-beta-7'
|
||||
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
|
||||
@Override
|
||||
public Object[] getBiomeBaseList() {
|
||||
if (biomelist == null) {
|
||||
biomelist = new BiomeBase[1024];
|
||||
biomelist = new Object[1024];
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
biomelist[i] = IRegistry.BIOME.fromId(i);
|
||||
}
|
||||
@ -168,21 +168,9 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
public Polygon getWorldBorder(World world) {
|
||||
Polygon p = null;
|
||||
|
@ -86,7 +86,7 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
|
||||
@Override
|
||||
public Object[] getBiomeBaseList() {
|
||||
if (biomelist == null) {
|
||||
biomelist = new BiomeBase[1024];
|
||||
biomelist = new Object[1024];
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
biomelist[i] = IRegistry.BIOME.fromId(i);
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
|
||||
*/
|
||||
@Override
|
||||
public int getBiomeBaseWaterMult(Object bb) {
|
||||
return ((BiomeBase)bb).o();
|
||||
return ((BiomeBase)bb).p();
|
||||
}
|
||||
|
||||
/** Get temperature from biomebase */
|
||||
|
@ -1,6 +1,8 @@
|
||||
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;
|
||||
@ -18,13 +20,10 @@ import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.utils.DynIntHashMap;
|
||||
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.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_15_R1.ChunkRegionLoader;
|
||||
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.NBTTagList;
|
||||
|
||||
@ -43,13 +42,14 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||
private final int x, z;
|
||||
private final Section[] section;
|
||||
private final int[] hmap; // Height map
|
||||
private final BiomeStorage biomestorage;
|
||||
private final BiomeBase[] biomebase;
|
||||
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];
|
||||
|
||||
@ -121,8 +121,8 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.captureFulltime = captime;
|
||||
this.biomebase = new BiomeBase[BiomeStorage.a];
|
||||
this.biomestorage = new BiomeStorage(this.biomebase);
|
||||
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];
|
||||
@ -138,10 +138,9 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||
this.inhabitedTicks = inhabitedTime;
|
||||
}
|
||||
|
||||
public NBTSnapshot(World w, NBTTagCompound nbt, int worldheight) {
|
||||
public NBTSnapshot(NBTTagCompound nbt, int worldheight) {
|
||||
this.x = nbt.getInt("xPos");
|
||||
this.z = nbt.getInt("zPos");
|
||||
ChunkCoordIntPair cc = new ChunkCoordIntPair(this.x, this.z);
|
||||
this.z = nbt.getInt("zPos");
|
||||
this.captureFulltime = 0;
|
||||
this.hmap = nbt.getIntArray("HeightMap");
|
||||
this.sectionCnt = worldheight / 16;
|
||||
@ -218,32 +217,20 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||
}
|
||||
}
|
||||
/* Get biome data */
|
||||
BiomeStorage biomestorage = null;
|
||||
this.biomebase = new BiomeBase[BiomeStorage.a];
|
||||
BiomeBase[] bbl = (BiomeBase[])BukkitVersionHelper.helper.getBiomeBaseList();
|
||||
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 && bb.length <= 256) {
|
||||
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];
|
||||
}
|
||||
}
|
||||
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()
|
||||
@ -292,9 +279,7 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int x, int z) {
|
||||
BiomeBase bb = this.biomestorage.getBiome(x, 64, z);
|
||||
int biomeId = IRegistry.BIOME.a(bb);
|
||||
return AbstractMapChunkCache.getBiomeByID(biomeId);
|
||||
return AbstractMapChunkCache.getBiomeByID(biome[z << 4 | x]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -424,7 +409,7 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||
did_load = true;
|
||||
}
|
||||
if (nbt != null) {
|
||||
NBTSnapshot nss = new NBTSnapshot(w, nbt, w.getMaxHeight());
|
||||
NBTSnapshot nss = new NBTSnapshot(nbt, w.getMaxHeight());
|
||||
ss = nss;
|
||||
inhabited_ticks = nss.getInhabitedTicks();
|
||||
if(!vis) {
|
||||
|
@ -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,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,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,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,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,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
|
||||
|
@ -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')
|
||||
|
@ -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;
|
||||
@ -1194,7 +1194,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) {
|
||||
@ -1585,35 +1584,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,65 +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;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
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