LimitedCreative/src/main/java/de/jaschastarke/minecraft/limitedcreative/ModCreativeLimits.java

73 lines
2.3 KiB
Java
Raw Normal View History

package de.jaschastarke.minecraft.limitedcreative;
import java.util.WeakHashMap;
import org.bukkit.entity.Entity;
import de.jaschastarke.bukkit.lib.CoreModule;
import de.jaschastarke.bukkit.lib.modules.AttachedBlocksDestroy;
import de.jaschastarke.minecraft.limitedcreative.limits.BlockListener;
import de.jaschastarke.minecraft.limitedcreative.limits.EntityListener;
2013-02-01 21:25:43 +00:00
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> {
2013-02-01 21:25:43 +00:00
protected LimitConfig config;
private WeakHashMap<Entity, Void> no_xp_mobs = new WeakHashMap<Entity, Void>();
2013-02-01 21:25:43 +00:00
public ModCreativeLimits(LimitedCreative plugin) {
super(plugin);
}
protected FeatureBlockItemSpawn blockDrops = null;
@Override
public String getName() {
return "Limits";
}
@Override
2013-02-01 21:25:43 +00:00
public void initialize(ModuleEntry<IModule> entry) {
super.initialize(entry);
listeners.addListener(new PlayerListener(this));
listeners.addListener(new EntityListener(this));
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(AttachedBlocksDestroy.class) == null) {
plugin.addModule(new AttachedBlocksDestroy(plugin));
}
if (!config.getEnabled()) {
entry.initialState = ModuleState.DISABLED;
return;
}
}
public FeatureBlockItemSpawn getBlockSpawn() {
return blockDrops;
}
@Override
public void onEnable() {
super.onEnable();
getLog().info(plugin.getLocale().trans("basic.loaded.module"));
}
public LimitConfig getConfig() {
return config;
}
public WeakHashMap<Entity, Void> getNoXPMobs() {
return no_xp_mobs;
}
}