mirror of
https://github.com/encounter/dynmap.git
synced 2026-03-30 11:08:39 -07:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d4aaa1d1fd | |||
| fe83a7d1cc | |||
| d4e24e9d26 | |||
| 734937884a | |||
| 3efe3c3d3d | |||
| 46ab344197 | |||
| 9270ce853d | |||
| 04a2019e9d | |||
| 8daf95891d | |||
| 5396d0b823 | |||
| a2ab8c4f2f | |||
| e7efbe193a | |||
| 99ea38d02a | |||
| 7c6e660cf0 | |||
| bcd0acec33 | |||
| 7e07bff71f | |||
| 2d95548d25 | |||
| 3ac67ce2c5 | |||
| 0d25fd2edc | |||
| bee16ef331 | |||
| bf16d18371 | |||
| e57634ebb3 | |||
| 55a5aacfce | |||
| e6fe29f0c5 | |||
| 34712e27f0 | |||
| 6a5eebcc00 | |||
| c8b1f71949 | |||
| dc11ef3507 |
@@ -41,31 +41,6 @@
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<phase>package</phase>
|
||||
<goals><goal>unpack</goal></goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.dynmap</groupId>
|
||||
<artifactId>DynmapCore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>bin</classifier>
|
||||
<type>zip</type>
|
||||
<outputDirectory>${project.build.directory}/core</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -88,29 +63,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/package.xml</descriptor>
|
||||
</descriptors>
|
||||
<!-- Hack for bug in maven-assembly: http://jira.codehaus.org/browse/MASSEMBLY-449 -->
|
||||
<archiverConfig>
|
||||
<fileMode>420</fileMode> <!-- 420(dec) = 644(oct) -->
|
||||
<directoryMode>493</directoryMode> <!-- 493(dec) = 755(oct) -->
|
||||
<defaultDirectoryMode>493</defaultDirectoryMode>
|
||||
</archiverConfig>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
@@ -178,6 +130,11 @@
|
||||
<artifactId>PermissionsBukkit</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.anjocaido</groupId>
|
||||
<artifactId>EssentialsGroupManager</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<version>1.4</version>
|
||||
<version>1.7</version>
|
||||
</project>
|
||||
|
||||
@@ -22,8 +22,18 @@ public abstract class BukkitVersionHelper {
|
||||
public static final BukkitVersionHelper getHelper() {
|
||||
if(helper == null) {
|
||||
if(Bukkit.getServer().getVersion().contains("MCPC")) {
|
||||
Log.info("Loader version helper for MCPC");
|
||||
helper = new BukkitVersionHelperMCPC();
|
||||
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(Bukkit.getServer().getVersion().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 {
|
||||
helper = new BukkitVersionHelperCB();
|
||||
@@ -102,4 +112,20 @@ public abstract class BukkitVersionHelper {
|
||||
* Get field value from NBT compound
|
||||
*/
|
||||
public abstract Object getFieldValue(Object nbt, String field);
|
||||
/**
|
||||
* Unload chunk no save needed
|
||||
*/
|
||||
public abstract void unloadChunkNoSave(World w, Chunk c, int cx, int cz);
|
||||
/**
|
||||
* Get block short name list
|
||||
*/
|
||||
public abstract String[] getBlockShortNames();
|
||||
/**
|
||||
* Get biome name list
|
||||
*/
|
||||
public abstract String[] getBiomeNames();
|
||||
/**
|
||||
* Get block material index list
|
||||
*/
|
||||
public abstract int[] getBlockMaterialMap();
|
||||
}
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.common.BiomeMap;
|
||||
|
||||
/**
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
||||
|
||||
private Class<?> nmsblock;
|
||||
private Class<?> nmsblockarray;
|
||||
private Class<?> nmsmaterial;
|
||||
private Field blockbyid;
|
||||
private Field blockname;
|
||||
private Field material;
|
||||
|
||||
BukkitVersionHelperCB() {
|
||||
}
|
||||
@Override
|
||||
@@ -34,6 +39,14 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
||||
}
|
||||
@Override
|
||||
protected void loadNMS() {
|
||||
// Get block fields
|
||||
nmsblock = getNMSClass("net.minecraft.server.Block");
|
||||
nmsblockarray = getNMSClass("[Lnet.minecraft.server.Block;");
|
||||
nmsmaterial = getNMSClass("net.minecraft.server.Material");
|
||||
blockbyid = getField(nmsblock, new String[] { "byId" }, nmsblockarray);
|
||||
blockname = getPrivateField(nmsblock, new String[] { "name" }, String.class);
|
||||
material = getField(nmsblock, new String[] { "material" }, nmsmaterial);
|
||||
|
||||
/* Set up biomebase fields */
|
||||
biomebase = getNMSClass("net.minecraft.server.BiomeBase");
|
||||
biomebasearray = getNMSClass("[Lnet.minecraft.server.BiomeBase;");
|
||||
@@ -46,6 +59,16 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
||||
nmsworld = getNMSClass("net.minecraft.server.WorldServer");
|
||||
chunkprovserver = getNMSClass("net.minecraft.server.ChunkProviderServer");
|
||||
nmsw_chunkproviderserver = getField(nmsworld, new String[] { "chunkProviderServer" }, chunkprovserver);
|
||||
|
||||
longhashset = getOBCClassNoFail("org.bukkit.craftbukkit.util.LongHashSet");
|
||||
if(longhashset != null) {
|
||||
lhs_containskey = getMethod(longhashset, new String[] { "contains" }, new Class[] { int.class, int.class });
|
||||
}
|
||||
else {
|
||||
longhashset = getOBCClass("org.bukkit.craftbukkit.util.LongHashset");
|
||||
lhs_containskey = getMethod(longhashset, new String[] { "containsKey" }, new Class[] { int.class, int.class });
|
||||
}
|
||||
|
||||
cps_unloadqueue = getFieldNoFail(chunkprovserver, new String[] { "unloadQueue" }, longhashset);
|
||||
if(cps_unloadqueue == null) {
|
||||
Log.info("Unload queue not found - default to unload all chunks");
|
||||
@@ -83,4 +106,75 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
||||
nmst_y = getField(nms_tileentity, new String[] { "y" }, int.class);
|
||||
nmst_z = getField(nms_tileentity, new String[] { "z" }, int.class);
|
||||
}
|
||||
@Override
|
||||
public void unloadChunkNoSave(World w, Chunk c, int cx, int cz) {
|
||||
this.removeEntitiesFromChunk(c);
|
||||
w.unloadChunk(cx, cz, false, false);
|
||||
}
|
||||
/**
|
||||
* Get block short name list
|
||||
*/
|
||||
@Override
|
||||
public String[] getBlockShortNames() {
|
||||
try {
|
||||
Object[] byid = (Object[])blockbyid.get(nmsblock);
|
||||
String[] names = new String[byid.length];
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (byid[i] != null) {
|
||||
names[i] = (String)blockname.get(byid[i]);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
/**
|
||||
* Get biome name list
|
||||
*/
|
||||
@Override
|
||||
public String[] getBiomeNames() {
|
||||
String[] names;
|
||||
/* Find array of biomes in biomebase */
|
||||
Object[] biomelist = getBiomeBaseList();
|
||||
names = new String[biomelist.length];
|
||||
/* Loop through list, starting afer well known biomes */
|
||||
for(int i = 0; i < biomelist.length; i++) {
|
||||
Object bb = biomelist[i];
|
||||
if(bb != null) {
|
||||
names[i] = getBiomeBaseIDString(bb);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
/**
|
||||
* Get block material index list
|
||||
*/
|
||||
public int[] getBlockMaterialMap() {
|
||||
try {
|
||||
Object[] byid = (Object[])blockbyid.get(nmsblock);
|
||||
int[] map = new int[byid.length];
|
||||
ArrayList<Object> mats = new ArrayList<Object>();
|
||||
for (int i = 0; i < map.length; i++) {
|
||||
if (byid[i] != null) {
|
||||
Object mat = (Object)material.get(byid[i]);
|
||||
if (mat != null) {
|
||||
map[i] = mats.indexOf(mat);
|
||||
if (map[i] < 0) {
|
||||
map[i] = mats.size();
|
||||
mats.add(mat);
|
||||
}
|
||||
}
|
||||
else {
|
||||
map[i] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
return new int[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,14 +92,6 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
||||
/* Craftworld fields */
|
||||
craftworld = getOBCClass("org.bukkit.craftbukkit.CraftWorld");
|
||||
cw_gethandle = getMethod(craftworld, new String[] { "getHandle" }, new Class[0]);
|
||||
longhashset = getOBCClassNoFail("org.bukkit.craftbukkit.util.LongHashSet");
|
||||
if(longhashset != null) {
|
||||
lhs_containskey = getMethod(longhashset, new String[] { "contains" }, new Class[] { int.class, int.class });
|
||||
}
|
||||
else {
|
||||
longhashset = getOBCClass("org.bukkit.craftbukkit.util.LongHashset");
|
||||
lhs_containskey = getMethod(longhashset, new String[] { "containsKey" }, new Class[] { int.class, int.class });
|
||||
}
|
||||
/* CraftChunkSnapshot */
|
||||
craftchunksnapshot = getOBCClass("org.bukkit.craftbukkit.CraftChunkSnapshot");
|
||||
ccss_biome = getPrivateField(craftchunksnapshot, new String[] { "biome" }, biomebasearray);
|
||||
@@ -182,7 +174,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
||||
/**
|
||||
* Get private field
|
||||
*/
|
||||
private Field getPrivateField(Class<?> cls, String[] ids, Class<?> type) {
|
||||
protected Field getPrivateField(Class<?> cls, String[] ids, Class<?> type) {
|
||||
if((cls == null) || (type == null)) return null;
|
||||
for(String id : ids) {
|
||||
try {
|
||||
@@ -198,7 +190,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
||||
failed = true;
|
||||
return null;
|
||||
}
|
||||
private Object getFieldValue(Object obj, Field field, Object def) {
|
||||
protected Object getFieldValue(Object obj, Field field, Object def) {
|
||||
if((obj != null) && (field != null)) {
|
||||
try {
|
||||
return field.get(obj);
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Log;
|
||||
|
||||
/**
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperMCPC extends BukkitVersionHelperGeneric {
|
||||
BukkitVersionHelperMCPC() {
|
||||
}
|
||||
@Override
|
||||
protected String getNMSPackage() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void loadNMS() {
|
||||
/* biomebase */
|
||||
biomebase = getNMSClass("yy");
|
||||
biomebasearray = getNMSClass("[Lyy;");
|
||||
/* world */
|
||||
nmsworld = getNMSClass("in");
|
||||
/* chunk */
|
||||
chunkprovserver = getNMSClass("im");
|
||||
nmschunk = getNMSClass("zz");
|
||||
/* nbt */
|
||||
nbttagcompound = getNMSClass("bq");
|
||||
nbttagbyte = getNMSClass("bp");
|
||||
nbttagshort = getNMSClass("cb");
|
||||
nbttagint = getNMSClass("bx");
|
||||
nbttaglong = getNMSClass("bz");
|
||||
nbttagfloat = getNMSClass("bv");
|
||||
nbttagdouble = getNMSClass("bt");
|
||||
nbttagbytearray = getNMSClass("bo");
|
||||
nbttagstring = getNMSClass("cc");
|
||||
nbttagintarray = getNMSClass("bw");
|
||||
/* tileentity */
|
||||
nms_tileentity = getNMSClass("any");
|
||||
|
||||
/** Set up NMS fields **/
|
||||
/* biomebase */
|
||||
biomebaselist = getField(biomebase, new String[] { "a" }, biomebasearray);
|
||||
biomebasetemp = getField(biomebase, new String[] { "F" }, float.class);
|
||||
biomebasehumi = getField(biomebase, new String[] { "G" }, float.class);
|
||||
biomebaseidstring = getField(biomebase, new String[] { "y" }, String.class);
|
||||
biomebaseid = getField(biomebase, new String[] { "N" }, int.class);
|
||||
/* chunk */
|
||||
nmsw_chunkproviderserver = getField(nmsworld, new String[] { "b" }, chunkprovserver);
|
||||
cps_unloadqueue = getFieldNoFail(chunkprovserver, new String[] { "b" }, longhashset);
|
||||
if(cps_unloadqueue == null) {
|
||||
Log.info("Unload queue not found - default to unload all chunks");
|
||||
}
|
||||
nmsc_removeentities = getMethod(nmschunk, new String[] { "d" }, new Class[0]);
|
||||
nmsc_tileentities = getField(nmschunk, new String[] { "i" }, Map.class);
|
||||
/* nbt */
|
||||
compound_get = getMethod(nbttagcompound, new String[] { "a" }, new Class[] { String.class });
|
||||
nbttagbyte_val = getField(nbttagbyte, new String[] { "a" }, byte.class);
|
||||
nbttagshort_val = getField(nbttagshort, new String[] { "a" }, short.class);
|
||||
nbttagint_val = getField(nbttagint, new String[] { "a" }, int.class);
|
||||
nbttaglong_val = getField(nbttaglong, new String[] { "a" }, long.class);
|
||||
nbttagfloat_val = getField(nbttagfloat, new String[] { "a" }, float.class);
|
||||
nbttagdouble_val = getField(nbttagdouble, new String[] { "a" }, double.class);
|
||||
nbttagbytearray_val = getField(nbttagbytearray, new String[] { "a" }, byte[].class);
|
||||
nbttagstring_val = getField(nbttagstring, new String[] { "a" }, String.class);
|
||||
nbttagintarray_val = getField(nbttagintarray, new String[] { "a" }, int[].class);
|
||||
/* tileentity */
|
||||
nmst_readnbt = getMethod(nms_tileentity, new String[] { "b" }, new Class[] { nbttagcompound });
|
||||
nmst_x = getField(nms_tileentity, new String[] { "l" }, int.class);
|
||||
nmst_y = getField(nms_tileentity, new String[] { "m" }, int.class);
|
||||
nmst_z = getField(nms_tileentity, new String[] { "n" }, int.class);
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.dynmap.DynmapAPI;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCommonAPIListener;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapWebChatEvent;
|
||||
@@ -81,6 +82,7 @@ import org.dynmap.bukkit.permissions.NijikokunPermissions;
|
||||
import org.dynmap.bukkit.permissions.OpPermissions;
|
||||
import org.dynmap.bukkit.permissions.PEXPermissions;
|
||||
import org.dynmap.bukkit.permissions.PermBukkitPermissions;
|
||||
import org.dynmap.bukkit.permissions.GroupManagerPermissions;
|
||||
import org.dynmap.bukkit.permissions.PermissionProvider;
|
||||
import org.dynmap.bukkit.permissions.bPermPermissions;
|
||||
import org.dynmap.common.BiomeMap;
|
||||
@@ -91,6 +93,7 @@ import org.dynmap.common.DynmapListenerManager.EventType;
|
||||
import org.dynmap.hdmap.HDMap;
|
||||
import org.dynmap.markers.MarkerAPI;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.VisibilityLimit;
|
||||
|
||||
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
private DynmapCore core;
|
||||
@@ -112,7 +115,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
private World last_world;
|
||||
private BukkitWorld last_bworld;
|
||||
|
||||
private BukkitVersionHelper helper = BukkitVersionHelper.getHelper();
|
||||
private BukkitVersionHelper helper;
|
||||
|
||||
private final BukkitWorld getWorldByName(String name) {
|
||||
if((last_world != null) && (last_world.getName().equals(name))) {
|
||||
@@ -240,7 +243,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
}
|
||||
@Override
|
||||
public <T> Future<T> callSyncMethod(Callable<T> task) {
|
||||
return getServer().getScheduler().callSyncMethod(DynmapPlugin.this, task);
|
||||
if(DynmapPlugin.this.isEnabled())
|
||||
return getServer().getScheduler().callSyncMethod(DynmapPlugin.this, task);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String getServerName() {
|
||||
@@ -428,14 +434,13 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
return null;
|
||||
}
|
||||
if(w.visibility_limits != null) {
|
||||
for(MapChunkCache.VisibilityLimit limit: w.visibility_limits) {
|
||||
for(VisibilityLimit limit: w.visibility_limits) {
|
||||
c.setVisibleRange(limit);
|
||||
}
|
||||
c.setHiddenFillStyle(w.hiddenchunkstyle);
|
||||
c.setAutoGenerateVisbileRanges(w.do_autogenerate);
|
||||
}
|
||||
if(w.hidden_limits != null) {
|
||||
for(MapChunkCache.VisibilityLimit limit: w.hidden_limits) {
|
||||
for(VisibilityLimit limit: w.hidden_limits) {
|
||||
c.setHiddenRange(limit);
|
||||
}
|
||||
c.setHiddenFillStyle(w.hiddenchunkstyle);
|
||||
@@ -471,6 +476,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
return exhausted;
|
||||
}
|
||||
});
|
||||
if (f == null) {
|
||||
return null;
|
||||
}
|
||||
Boolean delay;
|
||||
try {
|
||||
delay = f.get();
|
||||
@@ -685,9 +693,19 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
pm = this.getServer().getPluginManager();
|
||||
public void onLoad() {
|
||||
Log.setLogger(this.getLogger(), "");
|
||||
|
||||
helper = BukkitVersionHelper.getHelper();
|
||||
pm = this.getServer().getPluginManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (helper == null) {
|
||||
Log.info("Dynmap is disabled (unsupported platform)");
|
||||
return;
|
||||
}
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
version = pdfFile.getVersion();
|
||||
|
||||
@@ -707,6 +725,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
permissions = PEXPermissions.create(getServer(), "dynmap");
|
||||
if (permissions == null)
|
||||
permissions = bPermPermissions.create(getServer(), "dynmap", perdefs);
|
||||
if (permissions == null)
|
||||
permissions = GroupManagerPermissions.create(getServer(), "dynmap");
|
||||
if (permissions == null)
|
||||
permissions = PermBukkitPermissions.create(getServer(), "dynmap", perdefs);
|
||||
if (permissions == null)
|
||||
@@ -734,10 +754,14 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
if(core == null)
|
||||
core = new DynmapCore();
|
||||
/* Inject dependencies */
|
||||
core.setPluginJarFile(this.getFile());
|
||||
core.setPluginVersion(version, "CraftBukkit");
|
||||
core.setMinecraftVersion(mcver);
|
||||
core.setDataFolder(dataDirectory);
|
||||
core.setServer(new BukkitServer());
|
||||
core.setBlockNames(helper.getBlockShortNames());
|
||||
core.setBlockMaterialMap(helper.getBlockMaterialMap());
|
||||
core.setBiomeNames(helper.getBiomeNames());
|
||||
|
||||
/* Load configuration */
|
||||
if(!core.initConfiguration(enabCoreCB)) {
|
||||
@@ -792,19 +816,24 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
BukkitWorld w = getWorld(world);
|
||||
if(core.processWorldLoad(w)) /* Have core process load first - fire event listeners if good load after */
|
||||
core.listenerManager.processWorldEvent(EventType.WORLD_LOAD, w);
|
||||
}
|
||||
|
||||
}
|
||||
/* Register our update trigger events */
|
||||
registerEvents();
|
||||
|
||||
/* Submit metrics to mcstats.org */
|
||||
initMetrics();
|
||||
|
||||
/* Core is ready - notify API availability */
|
||||
DynmapCommonAPIListener.apiInitialized(this);
|
||||
|
||||
Log.info("Enabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
/* Core is being disabled - notify API disable */
|
||||
DynmapCommonAPIListener.apiTerminated();
|
||||
|
||||
if (metrics != null) {
|
||||
metrics = null;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -115,7 +115,12 @@ public class SpoutPluginBlocks {
|
||||
/* Loop through blocks - try to freshen files, if needed */
|
||||
for(CustomBlock b : cb) {
|
||||
BlockDesign bd = b.getBlockDesign();
|
||||
String blkid = bd.getTexturePlugin() + "." + fixIDString(b.getName());
|
||||
if(bd == null) continue;
|
||||
String txtplug = bd.getTexturePlugin();
|
||||
if(txtplug == null) continue;
|
||||
String blkname = b.getName();
|
||||
if(blkname == null) continue;
|
||||
String blkid = txtplug + "." + fixIDString(blkname);
|
||||
/* If not GenericCubiodBlockDesign, we don't handle it */
|
||||
if((bd instanceof GenericCuboidBlockDesign) == false) {
|
||||
Log.info("Block " + blkid + " not suppored - only cubiod blocks");
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.dynmap.bukkit.permissions;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.dynmap.Log;
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
|
||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||
|
||||
public class GroupManagerPermissions implements PermissionProvider {
|
||||
String name;
|
||||
GroupManager gm;
|
||||
WorldsHolder wh;
|
||||
|
||||
public static GroupManagerPermissions create(Server server, String name) {
|
||||
Plugin permissionsPlugin = server.getPluginManager().getPlugin("GroupManager");
|
||||
if (permissionsPlugin == null)
|
||||
return null;
|
||||
server.getPluginManager().enablePlugin(permissionsPlugin);
|
||||
if(permissionsPlugin.isEnabled() == false)
|
||||
return null;
|
||||
Log.info("Using GroupManager " + permissionsPlugin.getDescription().getVersion() + " for access control");
|
||||
return new GroupManagerPermissions(name, permissionsPlugin);
|
||||
}
|
||||
|
||||
public GroupManagerPermissions(String name, Plugin permissionsPlugin) {
|
||||
this.name = name;
|
||||
gm = (GroupManager)permissionsPlugin;
|
||||
wh = gm.getWorldsHolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(CommandSender sender, String permission) {
|
||||
Player player = sender instanceof Player ? (Player) sender : null;
|
||||
return (player != null) ? wh.getWorldPermissions(player).has(player, name + "." + permission) : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
|
||||
HashSet<String> hasperms = new HashSet<String>();
|
||||
AnjoPermissionsHandler apm = wh.getWorldPermissionsByPlayerName(player);
|
||||
if (apm != null) {
|
||||
for (String pp : perms) {
|
||||
if (apm.permission(player, name + "." + pp)) {
|
||||
hasperms.add(pp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return hasperms;
|
||||
}
|
||||
@Override
|
||||
public boolean hasOfflinePermission(String player, String perm) {
|
||||
AnjoPermissionsHandler apm = wh.getWorldPermissionsByPlayerName(player);
|
||||
if(apm != null) {
|
||||
return apm.permission(player, name + "." + perm);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
# All paths in this configuration file are relative to Dynmap's data-folder: minecraft_server/plugins/dynmap/
|
||||
|
||||
# All map templates are defined in the templates directory
|
||||
# The 'classic' FlatMap and KzedMap templates are used, which can be found in normal.txt, nether.txt, and skylands.txt
|
||||
# To use these, do not set deftemplatesuffix (make sure deftemplatesuffix is commented, below)
|
||||
# To use the HDMap very-low-res map templates as world defaults (normal-vlowres, nether-vlowres and skylands-vlowres), set value to vlowres
|
||||
# The definitions of these templates are in normal-vlowres.txt, nether-vlowres.txt, and skylands-vlowres.txt
|
||||
# To use the HDMap low-res map templates as world defaults (normal-lowres, nether-lowres and skylands-lowres), set value to lowres
|
||||
# The definitions of these templates are in normal-lowres.txt, nether-lowres.txt, and skylands-lowres.txt
|
||||
# To use the HDMap hi-res map templates (these can take a VERY long time for initial fullrender), set value to hires
|
||||
# The definitions of these templates are in normal-hires.txt, nether-hires.txt, and skylands-hires.txt
|
||||
# To use the HDMap very-low-res (2 ppb) map templates as world defaults, set value to vlowres
|
||||
# The definitions of these templates are in normal-vlowres.txt, nether-vlowres.txt, and the_end-vlowres.txt
|
||||
# To use the HDMap low-res (4 ppb) map templates as world defaults, set value to lowres
|
||||
# The definitions of these templates are in normal-lowres.txt, nether-lowres.txt, and the_end-lowres.txt
|
||||
# To use the HDMap hi-res (16 ppb) map templates (these can take a VERY long time for initial fullrender), set value to hires
|
||||
# The definitions of these templates are in normal-hires.txt, nether-hires.txt, and the_end-hires.txt
|
||||
# To use the HDMap low-res (4 ppb) map templates, with support for boosting resolution selectively to hi-res (16 ppb), set value to low_boost_hi
|
||||
# The definitions of these templates are in normal-low_boost_hi.txt, nether-low_boost_hi.txt, and the_end-low_boost_hi.txt
|
||||
# To use the HDMap hi-res (16 ppb) map templates, with support for boosting resolution selectively to vhi-res (32 ppb), set value to hi_boost_vhi
|
||||
# The definitions of these templates are in normal-hi_boost_vhi.txt, nether-hi_boost_vhi.txt, and the_end-hi_boost_vhi.txt
|
||||
# To use the HDMap hi-res (16 ppb) map templates, with support for boosting resolution selectively to xhi-res (64 ppb), set value to hi_boost_xhi
|
||||
# The definitions of these templates are in normal-hi_boost_xhi.txt, nether-hi_boost_xhi.txt, and the_end-hi_boost_xhi.txt
|
||||
deftemplatesuffix: vlowres
|
||||
|
||||
components:
|
||||
@@ -186,6 +190,9 @@ saverestorepending: true
|
||||
# Zoom-out tile update period - how often to scan for and process tile updates into zoom-out tiles (in seconds)
|
||||
zoomoutperiod: 30
|
||||
|
||||
# Control whether zoom out tiles are validated on startup (can be needed if zoomout processing is interrupted, but can be expensive on large maps)
|
||||
initial-zoomout-validate: true
|
||||
|
||||
# Default delay on processing of updated tiles, in seconds. This can reduce potentially expensive re-rendering
|
||||
# of frequently updated tiles (such as due to machines, pistons, quarries or other automation). Values can
|
||||
# also be set on individual worlds and individual maps.
|
||||
@@ -201,7 +208,7 @@ enabletilehash: true
|
||||
#better-grass: true
|
||||
|
||||
# Optional - enable smooth lighting by default on all maps supporting it (can be set per map as lighting option)
|
||||
smooth-lighting: false
|
||||
smooth-lighting: true
|
||||
|
||||
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100)
|
||||
# Has no effect on maps with explicit format settings
|
||||
@@ -214,6 +221,11 @@ use-generated-textures: true
|
||||
correct-water-lighting: true
|
||||
transparent-leaves: true
|
||||
|
||||
# ctm-support: if true, Connected Texture Mod (CTM) in texture packs is enabled (default)
|
||||
ctm-support: true
|
||||
# custom-colors-support: if true, Custom Colors in texture packs is enabled (default)
|
||||
custom-colors-support: true
|
||||
|
||||
# Control loading of player faces (if set to false, skins are never fetched)
|
||||
#fetchskins: false
|
||||
|
||||
@@ -314,8 +326,10 @@ trusted-proxies:
|
||||
- "127.0.0.1"
|
||||
- "0:0:0:0:0:0:0:1"
|
||||
|
||||
# Join/quit message format for web chat: set to "" to disable notice on web UI
|
||||
joinmessage: "%playername% joined"
|
||||
quitmessage: "%playername% quit"
|
||||
|
||||
spammessage: "You may only chat once every %interval% seconds."
|
||||
# format for messages from web: %playername% substitutes sender ID (typically IP), %message% includes text
|
||||
webmsgformat: "&color;2[WEB] %playername%: &color;f%message%"
|
||||
@@ -373,6 +387,14 @@ spout:
|
||||
# to clean cached textures and force reload on next startup)
|
||||
use-existing-textures: true
|
||||
|
||||
# Customization commands - allows scripts to be run before/after certain events
|
||||
custom-commands:
|
||||
image-updates:
|
||||
# Command run just before any image file is written or updated: run with single parameter with fully qualified file name
|
||||
preupdatecommand: ""
|
||||
# Command run just after any image file is written or updated: run with single parameter with fully qualified file name
|
||||
postupdatecommand: ""
|
||||
|
||||
# Set to true to enable verbose startup messages - can help with debugging map configuration problems
|
||||
# Set to false for a much quieter startup log
|
||||
verbose: false
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
name: dynmap
|
||||
main: org.dynmap.bukkit.DynmapPlugin
|
||||
version: "${project.version}-${BUILD_NUMBER}"
|
||||
authors: [FrozenCow, mikeprimm]
|
||||
authors: [mikeprimm]
|
||||
website: "http://www.minecraftforum.net/topic/1543523-dynmap-dynamic-web-based-maps-for-minecraft/"
|
||||
softdepend: [ Permissions, PermissionEx, bPermissions, PermissionsBukkit ]
|
||||
commands:
|
||||
dynmap:
|
||||
|
||||
Reference in New Issue
Block a user