Use of reworked Module-System. Dependend submodules

This commit is contained in:
Jascha Starke 2013-10-01 15:57:04 +02:00
parent 9061e18db9
commit 4b345cf880
19 changed files with 115 additions and 155 deletions

View file

@ -12,7 +12,6 @@ import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
/**
* Limited Creative - Configuration
@ -36,14 +35,13 @@ public class Config extends PluginConfiguration {
public void setValues(ConfigurationSection sect) {
super.setValues(sect);
if (plugin.getModules().size() > 0)
if (plugin.getModules().count() > 0)
setModuleStates();
}
public void setModuleStates() {
ModuleEntry<IModule> metricsEntry = plugin.getModule(FeatureMetrics.class).getModuleEntry();
if (metricsEntry.initialState != ModuleState.NOT_INITIALIZED)
metricsEntry.initialState = getMetrics() ? ModuleState.ENABLED : ModuleState.DISABLED;
metricsEntry.setEnabled(getMetrics());
}
@Override
@ -51,13 +49,7 @@ public class Config extends PluginConfiguration {
super.setValue(node, pValue);
if (node.getName().equals("metrics")) {
ModuleEntry<IModule> metricsEntry = plugin.getModule(FeatureMetrics.class).getModuleEntry();
if (getMetrics()) {
if (metricsEntry.initialState != ModuleState.NOT_INITIALIZED)
metricsEntry.enable();
} else {
metricsEntry.disable();
}
setModuleStates();
}
}

View file

@ -24,8 +24,7 @@ public class DependencyListener implements Listener {
String incomp = Hooks.InventoryIncompatible.test();
if (incomp != null) {
mod.getLog().warn(plugin.getLocale().trans("inventory.warning.conflict", incomp, mod.getName()));
mod.getModuleEntry().initialState = ModuleState.NOT_INITIALIZED;
mod.getModuleEntry().disable();
mod.getModuleEntry().deactivateUsage();
}
}
}
@ -36,15 +35,13 @@ public class DependencyListener implements Listener {
ModGameModePerm mod = plugin.getModule(ModGameModePerm.class);
if (mod != null && mod.getModuleEntry().getState() == ModuleState.ENABLED) {
mod.getLog().warn(plugin.getLocale().trans("gmperm.warning.vault_not_found", mod.getName()));
mod.getModuleEntry().initialState = ModuleState.NOT_INITIALIZED;
mod.getModuleEntry().disable();
mod.getModuleEntry().deactivateUsage();
}
} else if (event.getPlugin().getName().equals("WorldGuard")) {
ModRegions mod = plugin.getModule(ModRegions.class);
if (mod != null && mod.getModuleEntry().getState() == ModuleState.ENABLED) {
mod.getLog().warn(plugin.getLocale().trans("region.warning.worldguard_not_found", mod.getName()));
mod.getModuleEntry().initialState = ModuleState.NOT_INITIALIZED;
mod.getModuleEntry().disable();
mod.getModuleEntry().deactivateUsage();
}
}
}

View file

@ -97,10 +97,8 @@ public class FeatureBlockItemSpawn extends CoreModule<LimitedCreative> implement
scheduleCleanUp();
}
@EventHandler
@EventHandler(ignoreCancelled = true)
public void onItemSpawn(ItemSpawnEvent event) {
if (event.isCancelled())
return;
if (event.getEntity() instanceof Item) {
if (this.isBlocked(event.getLocation().getBlock().getLocation(), ((Item) event.getEntity()).getItemStack().getType())) {
event.setCancelled(true);

View file

@ -4,6 +4,7 @@ import de.jaschastarke.I18n;
import de.jaschastarke.bukkit.lib.Core;
import de.jaschastarke.bukkit.lib.PluginLang;
import de.jaschastarke.bukkit.lib.configuration.command.ConfigCommand;
import de.jaschastarke.bukkit.lib.modules.AdditionalBlockBreaks;
import de.jaschastarke.utils.ClassDescriptorStorage;
public class LimitedCreative extends Core {
@ -25,6 +26,8 @@ public class LimitedCreative extends Core {
Hooks.inizializeHooks(this);
modules.addSharedModule(new AdditionalBlockBreaks(this));
modules.addSharedModule(new FeatureBlockItemSpawn(this));
addModule(new FeatureSwitchGameMode(this));
addModule(new ModInventories(this));
addModule(new ModCreativeLimits(this));

View file

@ -18,7 +18,6 @@ import de.jaschastarke.minecraft.limitedcreative.blockstate.ThreadedModel;
import de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit.LCEditSessionFactory;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
public class ModBlockStates extends CoreModule<LimitedCreative> {
private BlockStateConfig config;
@ -38,17 +37,12 @@ public class ModBlockStates extends CoreModule<LimitedCreative> {
public void initialize(ModuleEntry<IModule> entry) {
super.initialize(entry);
blockDrops = plugin.getModule(FeatureBlockItemSpawn.class);
if (blockDrops == null)
blockDrops = plugin.addModule(new FeatureBlockItemSpawn(plugin)).getModule();
config = new BlockStateConfig(this, entry);
plugin.getPluginConfig().registerSection(config);
if (plugin.getModule(AdditionalBlockBreaks.class) == null) {
plugin.addModule(new AdditionalBlockBreaks(plugin));
}
addModule(new BlockFall(plugin));
blockDrops = modules.linkSharedModule(FeatureBlockItemSpawn.class, plugin.getModules());
modules.linkSharedModule(AdditionalBlockBreaks.class, plugin.getModules());
this.addModule(new BlockFall(plugin));
listeners.addListener(new BlockListener(this));
listeners.addListener(new HangingListener(this));
@ -72,7 +66,7 @@ public class ModBlockStates extends CoreModule<LimitedCreative> {
} catch (Exception e) {
e.printStackTrace();
getLog().warn(plugin.getLocale().trans("block_state.error.sql_connection_failed", getName()));
entry.initialState = ModuleState.NOT_INITIALIZED;
entry.deactivateUsage();
return;
}
super.onEnable();

View file

@ -12,7 +12,6 @@ import de.jaschastarke.minecraft.limitedcreative.limits.LimitConfig;
import de.jaschastarke.minecraft.limitedcreative.limits.PlayerListener;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
public class ModCreativeLimits extends CoreModule<LimitedCreative> {
protected LimitConfig config;
@ -37,18 +36,8 @@ public class ModCreativeLimits extends CoreModule<LimitedCreative> {
listeners.addListener(new BlockListener(this));
config = plugin.getPluginConfig().registerSection(new LimitConfig(this, entry));
blockDrops = plugin.getModule(FeatureBlockItemSpawn.class);
if (blockDrops == null)
blockDrops = plugin.addModule(new FeatureBlockItemSpawn(plugin)).getModule();
if (plugin.getModule(AdditionalBlockBreaks.class) == null) {
plugin.addModule(new AdditionalBlockBreaks(plugin));
}
if (!config.getEnabled()) {
entry.initialState = ModuleState.DISABLED;
return;
}
blockDrops = modules.linkSharedModule(FeatureBlockItemSpawn.class, plugin.getModules());
modules.linkSharedModule(AdditionalBlockBreaks.class, plugin.getModules());
}
public FeatureBlockItemSpawn getBlockSpawn() {

View file

@ -6,7 +6,6 @@ import de.jaschastarke.minecraft.limitedcreative.gmperm.PermissionInterface;
import de.jaschastarke.minecraft.limitedcreative.gmperm.PlayerListener;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
public class ModGameModePerm extends CoreModule<LimitedCreative> {
private GMPermConfig config;
@ -30,7 +29,7 @@ public class ModGameModePerm extends CoreModule<LimitedCreative> {
if (!plugin.getServer().getPluginManager().isPluginEnabled("Vault")) {
if (config.getEnabled())
getLog().warn(plugin.getLocale().trans("gmperm.warning.vault_not_found", getName()));
entry.initialState = ModuleState.NOT_INITIALIZED;
entry.deactivateUsage();
return;
}
@ -39,7 +38,7 @@ public class ModGameModePerm extends CoreModule<LimitedCreative> {
if (config.getEnabled()) {
if (!permission.isPresent()) {
getLog().warn(plugin.getLocale().trans("gmperm.warning.vault_not_found", getName()));
entry.initialState = ModuleState.NOT_INITIALIZED;
entry.deactivateUsage();
return;
} /*else if (!getVaultPermission().hasGroupSupport()) {
getLog().warn(plugin.getLocale().trans("gmperm.warning.no_group_support", getName()));

View file

@ -19,7 +19,6 @@ import de.jaschastarke.minecraft.limitedcreative.inventories.store.InvYamlStorag
import de.jaschastarke.minecraft.limitedcreative.inventories.store.PlayerInventoryStorage;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
public class ModInventories extends CoreModule<LimitedCreative> {
protected PlayerInventoryStorage storage;
@ -42,17 +41,13 @@ public class ModInventories extends CoreModule<LimitedCreative> {
config = plugin.getPluginConfig().registerSection(new InventoryConfig(this, entry));
armor_config = config.registerSection(new ArmoryConfig(this));
if (!config.getEnabled()) {
entry.initialState = ModuleState.DISABLED;
return;
}
if (plugin.getServer().getPluginManager().isPluginEnabled("AuthMe")) {
addModule(new AuthMeInventories(plugin, this));
}
String incomp = Hooks.InventoryIncompatible.test();
if (config.getEnabled() && incomp != null) {
getLog().warn(plugin.getLocale().trans("inventory.warning.conflict", incomp, this.getName()));
entry.initialState = ModuleState.NOT_INITIALIZED;
entry.deactivateUsage();
}
}
@Override

View file

@ -18,7 +18,6 @@ import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.CustomRegion
import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.PlayerRegionListener;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
public class ModRegions extends CoreModule<LimitedCreative> {
private CustomRegionManager mgr;
@ -40,16 +39,14 @@ public class ModRegions extends CoreModule<LimitedCreative> {
public void initialize(ModuleEntry<IModule> pEntry) {
super.initialize(pEntry);
blockDrops = plugin.getModule(FeatureBlockItemSpawn.class);
if (blockDrops == null)
blockDrops = plugin.addModule(new FeatureBlockItemSpawn(plugin)).getModule();
blockDrops = modules.linkSharedModule(FeatureBlockItemSpawn.class, plugin.getModules());
config = plugin.getPluginConfig().registerSection(new RegionConfig(this, entry));
if (!plugin.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
if (config.getEnabled())
getLog().warn(plugin.getLocale().trans("region.warning.worldguard_not_found", getName()));
entry.initialState = ModuleState.NOT_INITIALIZED;
entry.deactivateUsage();
return;
}

View file

@ -20,7 +20,7 @@ public abstract class AbstractModel {
protected void moveMetaState(Block from, Block to) {
HasBlockState metaBlock = getMetaBlock(from);
if (metaBlock.set && metaBlock.state != null) {
if (metaBlock.isSet() && metaBlock.getState() != null) {
BlockState state = metaBlock.state;
state.setLocation(to.getLocation());
setMetaBlock(to, state);
@ -45,28 +45,43 @@ public abstract class AbstractModel {
m.setMetadata(BSMDKEY, new FixedMetadataValue(plugin, s));
}
protected HasBlockState getMetaBlock(Metadatable m) {
HasBlockState has = new HasBlockState();
HasBlockState has = null;
List<MetadataValue> metadata = m.getMetadata(BSMDKEY);
for (MetadataValue v : metadata) {
if (v.value() instanceof BlockState) {
has.set = true;
has.state = (BlockState) v.value();
has = new HasBlockState((BlockState) v.value());
break;
} else if (v == metadataNull) {
has.set = true;
has.state = null;
// Metadata Knows, that there is no entry in DB
has = new HasBlockState(true);
break;
}
}
return has;
if (has == null)
return new HasBlockState(false);
else
return has;
}
protected void removeMetaBlock(Metadatable m) {
m.removeMetadata(BSMDKEY, plugin);
}
public static class HasBlockState {
public boolean set = false;
public BlockState state = null;
private boolean set = false;
private BlockState state = null;
public HasBlockState(BlockState state) {
set = true;
this.state = state;
}
public HasBlockState(boolean isSet) {
set = isSet;
}
public boolean isSet() {
return set;
}
public BlockState getState() {
return state;
}
}
}

View file

@ -16,7 +16,6 @@ import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModBlockStates;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
/**
* BlockState-Feature
@ -45,14 +44,9 @@ public class BlockStateConfig extends Configuration implements IConfigurationSub
else
super.setValue(node, pValue);
if (node.getName().equals("enabled")) {
if (getEnabled()) {
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.enable();
} else {
entry.disable();
}
entry.setEnabled(getEnabled());
} else if (node.getName().equals("useThreading")) {
if (entry.getState() == ModuleState.ENABLED) {
if (entry.isEnabled()) {
entry.disable();
entry.enable();
}
@ -62,8 +56,7 @@ public class BlockStateConfig extends Configuration implements IConfigurationSub
@Override
public void setValues(ConfigurationSection sect) {
super.setValues(sect);
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.initialState = getEnabled() ? ModuleState.ENABLED : ModuleState.DISABLED;
entry.setEnabled(getEnabled());
}
@Override
public String getName() {

View file

@ -71,8 +71,8 @@ public class SyncronizedModel extends AbstractModel implements DBModel {
Cuboid c = new Cuboid();
for (Block block : blocks) {
HasBlockState has = getMetaBlock(block);
if (has.set) {
ret.put(block, has.state);
if (has.isSet()) {
ret.put(block, has.getState());
} else {
c.add(block.getLocation());
}
@ -120,7 +120,7 @@ public class SyncronizedModel extends AbstractModel implements DBModel {
public BlockState getState(Block block) {
HasBlockState has = getMetaBlock(block);
if (!has.set) {
if (!has.isSet()) {
try {
BlockState state = q.find(block.getLocation());
setMetaBlock(block, state);
@ -131,7 +131,7 @@ public class SyncronizedModel extends AbstractModel implements DBModel {
return null;
}
}
return has.state;
return has.getState();
}
public void setState(BlockState state) {
Block block = state.getLocation().getBlock();

View file

@ -91,7 +91,7 @@ public class ThreadedModel extends AbstractModel implements DBModel, Listener {
Map<Block, Boolean> ret = new HashMap<Block, Boolean>();
for (Block block : blocks) {
HasBlockState has = getMetaBlock(block);
ret.put(block, has.restricted);
ret.put(block, has.isRestricted());
}
return ret;
}
@ -104,8 +104,8 @@ public class ThreadedModel extends AbstractModel implements DBModel, Listener {
c = new Cuboid();
for (Block block : blocks) {
HasBlockState has = getMetaBlock(block);
if (has.set) {
ret.put(block, has.state);
if (has.getState() != null || has.isNull()) {
ret.put(block, has.getState());
} else {
c.add(block.getLocation());
ret.put(block, null);
@ -125,14 +125,17 @@ public class ThreadedModel extends AbstractModel implements DBModel, Listener {
@Override
public BlockState getState(Block block) {
HasBlockState has = getMetaBlock(block);
if (!has.set || (has.dbSet && has.state == null)) {
if (has.getState() == null && !has.isNull()) {
// The DB-Entry isn't set
// and the entry doesn't tell us that it knows that it isn't set
// (while using the threaded model, even having no Metadata entry, tells us there is no one in DB)
return threads.callUpdate(block);
}
return has.state;
return has.getState();
}
@Override
public boolean isRestricted(Block block) {
return getMetaBlock(block).restricted;
return getMetaBlock(block).isRestricted();
}
@Override
@ -201,37 +204,56 @@ public class ThreadedModel extends AbstractModel implements DBModel, Listener {
block.setMetadata(BSMDKEY, metadataSet);
}
protected HasBlockState getMetaBlock(Metadatable m) {
HasBlockState has = new HasBlockState();
HasBlockState has = null;
List<MetadataValue> metadata = m.getMetadata(BSMDKEY);
for (MetadataValue v : metadata) {
if (v.value() instanceof BlockState) {
has.set = true;
has.state = (BlockState) v.value();
has.dbSet = true;
has.restricted = has.state.isRestricted();
// The actual DB-entry is in Metadata (requires more memory)
has = new HasBlockState((BlockState) v.value());
break;
} else if (v.getOwningPlugin() == mod.getPlugin()) {
if (v == metadataNull) {
has.set = true;
has.state = null;
// Metadata knows, that there is no entry in DB
has = new HasBlockState(true);
break;
} else if (v == metadataSet) {
has.set = true;
has.state = null;
has.dbSet = true;
// Metadata knows, that there is survival-entry in DB
has = new HasBlockState(true, false);
break;
} else if (v == metadataSetRestricted) {
has.set = true;
has.state = null;
has.dbSet = true;
has.restricted = true;
// Metadata knows, that there is creative-entry in DB
has = new HasBlockState(true, true);
}
break;
}
}
return has;
if (has == null)
return new HasBlockState(false);
else
return has;
}
public static class HasBlockState extends AbstractModel.HasBlockState {
public boolean dbSet = false;
public boolean restricted = false;
private boolean restricted = false;
private boolean isNull = false;
public HasBlockState(BlockState state) {
super(state);
restricted = state.isRestricted();
}
public HasBlockState(boolean isSet) {
super(isSet);
isNull = true;
}
public HasBlockState(boolean isSet, boolean isRestricted) {
super(isSet);
restricted = isRestricted;
}
public boolean isRestricted() {
return restricted;
}
public boolean isNull() {
return isNull;
}
}
public ModBlockStates getModel() {

View file

@ -16,14 +16,14 @@ public class UpdateBlockStateAction extends TransactionAction implements Action
@Override
public void process(ThreadLink link, DBQueries q) {
HasBlockState state = link.getMetaState(block);
if (state.set) {
if (state.isSet()) {
try {
q.delete(block.getLocation());
if (state.state != null)
q.insert(state.state);
if (state.getState() != null)
q.insert(state.getState());
} catch (SQLException e) {
link.getLog().severe(e.getMessage());
link.getLog().warn("Thread " + Thread.currentThread().getName() + " failed to save BlockState to DB: " + state.state);
link.getLog().warn("Thread " + Thread.currentThread().getName() + " failed to save BlockState to DB: " + state.getState());
}
}
}
@ -31,10 +31,10 @@ public class UpdateBlockStateAction extends TransactionAction implements Action
@Override
public void processInTransaction(ThreadLink link, DBQueries q) throws SQLException {
HasBlockState state = link.getMetaState(block);
if (state.set) {
if (state.isSet()) {
q.delete(block.getLocation());
if (state.state != null)
q.insert(state.state);
if (state.getState() != null)
q.insert(state.getState());
}
}

View file

@ -14,7 +14,6 @@ import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModCmdBlocker;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
/**
* CommandBlocker-Feature
@ -39,20 +38,14 @@ public class CmdBlockerConfig extends Configuration implements IConfigurationSub
@Override
public void setValues(ConfigurationSection sect) {
super.setValues(sect);
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.initialState = getEnabled() ? ModuleState.ENABLED : ModuleState.DISABLED;
entry.setEnabled(getEnabled());
}
@Override
public void setValue(IConfigurationNode node, Object pValue) throws InvalidValueException {
super.setValue(node, pValue);
if (node.getName().equals("enabled")) {
if (getEnabled()) {
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.enable();
} else {
entry.disable();
}
entry.setEnabled(getEnabled());
}
}

View file

@ -14,7 +14,6 @@ import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModGameModePerm;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
/**
* GameMode-Permissions-Feature
@ -42,20 +41,14 @@ public class GMPermConfig extends Configuration implements IConfigurationSubGrou
public void setValue(IConfigurationNode node, Object pValue) throws InvalidValueException {
super.setValue(node, pValue);
if (node.getName().equals("enabled")) {
if (getEnabled()) {
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.enable();
} else {
entry.disable();
}
entry.setEnabled(getEnabled());
}
}
@Override
public void setValues(ConfigurationSection sect) {
super.setValues(sect);
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.initialState = getEnabled() ? ModuleState.ENABLED : ModuleState.DISABLED;
entry.setEnabled(getEnabled());
}
@Override
public String getName() {

View file

@ -14,7 +14,6 @@ import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
/**
* Inventory-Feature
@ -40,12 +39,7 @@ public class InventoryConfig extends Configuration implements IConfigurationSubG
public void setValue(IConfigurationNode node, Object pValue) throws InvalidValueException {
super.setValue(node, pValue);
if (node.getName().equals("enabled")) {
if (getEnabled()) {
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.enable();
} else {
entry.disable();
}
entry.setEnabled(getEnabled());
}
}
@ -59,8 +53,8 @@ public class InventoryConfig extends Configuration implements IConfigurationSubG
}
super.setValues(sect);
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.initialState = getEnabled() ? ModuleState.ENABLED : ModuleState.DISABLED;
entry.setEnabled(getEnabled());
// Config Upgrade
if (!sect.contains("storeCreative") && sect.contains("creative"))
sect.set("storeCreative", sect.getBoolean("creative"));

View file

@ -17,7 +17,6 @@ import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModCreativeLimits;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
/**
* Creative Limits-Feature
@ -44,20 +43,14 @@ public class LimitConfig extends Configuration implements IConfigurationSubGroup
if (!(pValue instanceof BlackList))
super.setValue(node, pValue);
if (node.getName().equals("enabled")) {
if (getEnabled()) {
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.enable();
} else {
entry.disable();
}
entry.setEnabled(getEnabled());
}
}
@Override
public void setValues(ConfigurationSection sect) {
super.setValues(sect);
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.initialState = getEnabled() ? ModuleState.ENABLED : ModuleState.DISABLED;
entry.setEnabled(getEnabled());
// Config Upgrade
if (!sect.contains("interact") && sect.contains("sign")) {

View file

@ -15,7 +15,6 @@ import de.jaschastarke.minecraft.limitedcreative.ModRegions;
import de.jaschastarke.minecraft.limitedcreative.limits.BlackList;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
/**
* Region GameModes-Feature
@ -42,19 +41,13 @@ public class RegionConfig extends Configuration implements IConfigurationSubGrou
if (!(pValue instanceof BlackList))
super.setValue(node, pValue);
if (node.getName().equals("enabled")) {
if (getEnabled()) {
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.enable();
} else {
entry.disable();
}
entry.setEnabled(getEnabled());
}
}
@Override
public void setValues(ConfigurationSection sect) {
super.setValues(sect);
if (entry.initialState != ModuleState.NOT_INITIALIZED)
entry.initialState = getEnabled() ? ModuleState.ENABLED : ModuleState.DISABLED;
entry.setEnabled(getEnabled());
// Config Upgrade
if (!sect.contains("rememberOptional") && sect.contains("remember"))