mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 05:05:16 +01:00
Add support for automatic enabling of mod-specific blocks and textures
This commit is contained in:
parent
c03365d574
commit
cbb8cc061e
@ -2,6 +2,8 @@ package org.dynmap.bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -102,6 +104,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public PluginManager pm;
|
||||
private Metrics metrics;
|
||||
private BukkitEnableCoreCallback enabCoreCB = new BukkitEnableCoreCallback();
|
||||
private Method ismodloaded;
|
||||
|
||||
private class BukkitEnableCoreCallback extends DynmapCore.EnableCoreCallbacks {
|
||||
@Override
|
||||
@ -139,6 +142,12 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
|
||||
public DynmapPlugin() {
|
||||
plugin = this;
|
||||
try {
|
||||
Class<?> c = Class.forName("cpw.mods.fml.common.Loader");
|
||||
ismodloaded = c.getMethod("isModLoaded", String.class);
|
||||
} catch (NoSuchMethodException nsmx) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -435,6 +444,22 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public int getCurrentPlayers() {
|
||||
return getServer().getOnlinePlayers().length;
|
||||
}
|
||||
@Override
|
||||
public boolean isModLoaded(String name) {
|
||||
boolean loaded = false;
|
||||
if(ismodloaded != null) {
|
||||
try {
|
||||
Object rslt =ismodloaded.invoke(null, name);
|
||||
if(rslt instanceof Boolean) {
|
||||
loaded = ((Boolean)rslt).booleanValue();
|
||||
}
|
||||
} catch (IllegalArgumentException iax) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
}
|
||||
return loaded;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Player access abstraction class
|
||||
|
@ -218,43 +218,6 @@ skin-url: "http://s3.amazonaws.com/MinecraftSkins/%player%.png"
|
||||
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
|
||||
compass-mode: newnorth
|
||||
|
||||
### Mod block support ###
|
||||
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters, Compact Solars, Nuclear Control)
|
||||
#ic2-support: true
|
||||
#ic2-advancesmachines-support: true
|
||||
#ic2-chargingbench-support: true
|
||||
#ic2-powerconverters-support: true
|
||||
#ic2-compactsolars-support: true
|
||||
#ic2-nuclearcontrol-support: true
|
||||
# Enable BuildCraft block rendering support
|
||||
#buildcraft-support: true
|
||||
# Enable RedPower2 block rendering support
|
||||
#redpower2-support: true
|
||||
# Enable NetherOres block rendering support
|
||||
#netherores-support: true
|
||||
# Enable RailCraft block rendering support
|
||||
#railcraft-support: true
|
||||
# Enable Kaevator's Superslopes block rendering support
|
||||
#superslopes-support: true
|
||||
# Enabled ComputerCraft block rendering support
|
||||
#computercraft-support: true
|
||||
# Enabled LC Trees++ block rendering support
|
||||
#lctrees-support: true
|
||||
# Enable Forestry block rending support
|
||||
#forestry-support: true
|
||||
# Enable IronCheck block rendering support
|
||||
#ironchest-support: true
|
||||
# Enable TubeStuff block rendering support
|
||||
#tubestuff-support: true
|
||||
# Enable Ender Storage block rendering support
|
||||
#enderstorage-support: true
|
||||
# Enable ExtraBiomesXL block rendering support
|
||||
#extrabiomesxl-support: true
|
||||
# Enable ExtraBiomesXL Bunyan block rendering support
|
||||
#extrabiomesxl-bunyan-support: true
|
||||
# Equivalent Exchange 2 block rendering support
|
||||
#ee2-support: true
|
||||
|
||||
render-triggers:
|
||||
#- playermove
|
||||
#- playerjoin
|
||||
|
Loading…
Reference in New Issue
Block a user