Skip to content

Commit

Permalink
Add option to disable Dynmap integration.
Browse files Browse the repository at this point in the history
Fix bug onDisable when Dynmap isn't loaded/enabled.
  • Loading branch information
Southpaw018 committed Oct 1, 2012
1 parent 4beece7 commit 8f3ece3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/com/MoofIT/Minecraft/Cenotaph/Cenotaph.java
Expand Up @@ -108,6 +108,7 @@ public class Cenotaph extends JavaPlugin {
public String dateFormat = "MM/dd/yyyy";
public String timeFormat = "hh:mm a";
public List<String> disableInWorlds;
public boolean dynmapEnable = true;

//Removal
public boolean destroyQuickLoot = false;
Expand All @@ -126,7 +127,7 @@ public class Cenotaph extends JavaPlugin {
public boolean lwcPublic = false;

//DeathMessages
public HashMap<String, Object> deathMessages = new HashMap<String, Object>() {
public HashMap<String, Object> deathMessages = new HashMap<String, Object>() { //TODO apparently this is a bad hack, and Java does not support Map or Collection literals.
public static final long serialVersionUID = 1L;
{
put("Monster.Zombie", "a Zombie");
Expand Down Expand Up @@ -186,7 +187,7 @@ public void onEnable() {
dynmap = (DynmapAPI)loadPlugin("dynmap");

loadConfig();
if (dynmap != null) dynThread.activate(dynmap);
if (dynmapEnable && dynmap != null) dynThread.activate(dynmap);
for (World w : getServer().getWorlds())
loadTombList(w.getName());

Expand Down Expand Up @@ -225,6 +226,7 @@ else if (configVer < configCurrent) {
signMessage = loadSign();
dateFormat = config.getString("Core.Sign.dateFormat", dateFormat);
timeFormat = config.getString("Core.Sign.timeFormat", timeFormat);
dynmapEnable = config.getBoolean("Core.dynmapEnable", dynmapEnable);

try {
disableInWorlds = config.getStringList("Core.disableInWorlds");
Expand Down Expand Up @@ -349,7 +351,7 @@ private Block readBlock(String b) {
@Override
public void onDisable() {
for (World w : getServer().getWorlds()) saveCenotaphList(w.getName());
dynThread.cenotaphLayer.cleanup();
if (dynmapEnable && dynmap != null) dynThread.cenotaphLayer.cleanup();
getServer().getScheduler().cancelTasks(this);
}
private String[] loadSign() {
Expand Down
4 changes: 3 additions & 1 deletion src/config.yml
Expand Up @@ -45,6 +45,8 @@ Core:
#- world
#- world2

dynmapEnable: true

Removal:
#Destroy cenotaph on player quickloot if true
destroyQuickLoot: true
Expand Down Expand Up @@ -111,4 +113,4 @@ DeathMessages:
Void: "the Void"
Other: "Unknown"

configVer: 15
configVer: 16

0 comments on commit 8f3ece3

Please sign in to comment.