Merge remote-tracking branch 'origin/master' into CustomFactionEvents

This commit is contained in:
donington 2012-03-09 17:49:10 -05:00
commit 88bdadcb2b
3 changed files with 31 additions and 21 deletions

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions;
import java.util.*;
import org.bukkit.*;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.EntityType;
import com.massivecraft.factions.struct.FFlag;
import com.massivecraft.factions.struct.FPerm;
@ -155,7 +155,7 @@ public class Conf
//public static Set<Material> territoryDenyUseageMaterialsWhenOffline = EnumSet.noneOf(Material.class);
// TODO: Rename to monsterCreatureTypes
public static transient Set<CreatureType> monsters = EnumSet.noneOf(CreatureType.class);
public static transient Set<EntityType> monsters = EnumSet.noneOf(EntityType.class);
// Spout features
public static boolean spoutFactionTagsOverNames = true; // show faction tags over names over player heads
@ -268,20 +268,20 @@ public class Conf
materialsEditTools.add(Material.WATER_BUCKET);
materialsEditTools.add(Material.LAVA_BUCKET);
monsters.add(CreatureType.BLAZE);
monsters.add(CreatureType.CAVE_SPIDER);
monsters.add(CreatureType.CREEPER);
monsters.add(CreatureType.ENDERMAN);
monsters.add(CreatureType.ENDER_DRAGON);
monsters.add(CreatureType.GHAST);
monsters.add(CreatureType.GIANT);
monsters.add(CreatureType.MAGMA_CUBE);
monsters.add(CreatureType.PIG_ZOMBIE);
monsters.add(CreatureType.SILVERFISH);
monsters.add(CreatureType.SKELETON);
monsters.add(CreatureType.SLIME);
monsters.add(CreatureType.SPIDER);
monsters.add(CreatureType.ZOMBIE);
monsters.add(EntityType.BLAZE);
monsters.add(EntityType.CAVE_SPIDER);
monsters.add(EntityType.CREEPER);
monsters.add(EntityType.ENDERMAN);
monsters.add(EntityType.ENDER_DRAGON);
monsters.add(EntityType.GHAST);
monsters.add(EntityType.GIANT);
monsters.add(EntityType.MAGMA_CUBE);
monsters.add(EntityType.PIG_ZOMBIE);
monsters.add(EntityType.SILVERFISH);
monsters.add(EntityType.SKELETON);
monsters.add(EntityType.SLIME);
monsters.add(EntityType.SPIDER);
monsters.add(EntityType.ZOMBIE);
}
// -------------------------------------------- //

View File

@ -78,7 +78,8 @@ public class P extends MPlugin
public void onEnable()
{
if ( ! preEnable()) return;
this.loadSuccessful = false;
// Load Conf from disk
Conf.load();
FPlayers.i.loadFromDisc();
@ -112,6 +113,7 @@ public class P extends MPlugin
getServer().getPluginManager().registerEvents(serverListener, this);
postEnable();
this.loadSuccessful = true;
}
@Override
@ -133,8 +135,12 @@ public class P extends MPlugin
@Override
public void onDisable()
{
Board.save();
Conf.save();
// only save data if plugin actually completely loaded successfully
if (this.loadSuccessful)
{
Board.save();
Conf.save();
}
EssentialsFeatures.unhookChat();
if (AutoLeaveTask != null)
{

View File

@ -34,6 +34,7 @@ public abstract class MPlugin extends JavaPlugin
public Gson gson;
private Integer saveTask = null;
private boolean autoSave = true;
protected boolean loadSuccessful = false;
public boolean getAutoSave() {return this.autoSave;}
public void setAutoSave(boolean val) {this.autoSave = val;}
@ -81,7 +82,8 @@ public abstract class MPlugin extends JavaPlugin
{
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
}
loadSuccessful = true;
return true;
}
@ -97,7 +99,9 @@ public abstract class MPlugin extends JavaPlugin
this.getServer().getScheduler().cancelTask(saveTask);
saveTask = null;
}
EM.saveAllToDisc();
// only save data if plugin actually loaded successfully
if (loadSuccessful)
EM.saveAllToDisc();
log("Disabled");
}