2013-03-24 21:26:53 +00:00
|
|
|
package de.jaschastarke.minecraft.limitedcreative;
|
|
|
|
|
|
|
|
import de.jaschastarke.bukkit.lib.CoreModule;
|
|
|
|
import de.jaschastarke.minecraft.limitedcreative.gmperm.GMPermConfig;
|
2013-03-25 16:51:01 +00:00
|
|
|
import de.jaschastarke.minecraft.limitedcreative.gmperm.PermissionInterface;
|
2013-03-24 21:26:53 +00:00
|
|
|
import de.jaschastarke.minecraft.limitedcreative.gmperm.PlayerListener;
|
|
|
|
import de.jaschastarke.modularize.IModule;
|
|
|
|
import de.jaschastarke.modularize.ModuleEntry;
|
|
|
|
|
|
|
|
public class ModGameModePerm extends CoreModule<LimitedCreative> {
|
|
|
|
private GMPermConfig config;
|
2013-03-25 16:51:01 +00:00
|
|
|
private PermissionInterface permission = null;
|
2013-03-24 21:26:53 +00:00
|
|
|
|
|
|
|
public ModGameModePerm(LimitedCreative plugin) {
|
|
|
|
super(plugin);
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public String getName() {
|
|
|
|
return "GameModePerm";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void initialize(ModuleEntry<IModule> entry) {
|
|
|
|
super.initialize(entry);
|
|
|
|
listeners.addListener(new PlayerListener(this));
|
|
|
|
config = new GMPermConfig(this, entry);
|
|
|
|
plugin.getPluginConfig().registerSection(config);
|
|
|
|
|
2013-03-25 16:51:01 +00:00
|
|
|
if (!plugin.getServer().getPluginManager().isPluginEnabled("Vault")) {
|
|
|
|
if (config.getEnabled())
|
|
|
|
getLog().warn(plugin.getLocale().trans("gmperm.warning.vault_not_found", getName()));
|
2013-10-01 13:57:04 +00:00
|
|
|
entry.deactivateUsage();
|
2013-03-25 16:51:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
permission = new PermissionInterface(this);
|
2013-03-24 21:26:53 +00:00
|
|
|
|
|
|
|
if (config.getEnabled()) {
|
2013-03-25 16:51:01 +00:00
|
|
|
if (!permission.isPresent()) {
|
2013-03-24 21:26:53 +00:00
|
|
|
getLog().warn(plugin.getLocale().trans("gmperm.warning.vault_not_found", getName()));
|
2013-10-01 13:57:04 +00:00
|
|
|
entry.deactivateUsage();
|
2013-03-25 16:51:01 +00:00
|
|
|
return;
|
2013-03-24 21:26:53 +00:00
|
|
|
} /*else if (!getVaultPermission().hasGroupSupport()) {
|
|
|
|
getLog().warn(plugin.getLocale().trans("gmperm.warning.no_group_support", getName()));
|
|
|
|
entry.initialState = ModuleState.NOT_INITIALIZED;
|
2013-03-25 16:51:01 +00:00
|
|
|
return;
|
2013-03-24 21:26:53 +00:00
|
|
|
}*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public void onEnable() {
|
|
|
|
super.onEnable();
|
|
|
|
|
|
|
|
getLog().info(plugin.getLocale().trans("basic.loaded.module"));
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public void onDisable() {
|
|
|
|
super.onDisable();
|
2013-03-25 16:51:01 +00:00
|
|
|
permission.clear();
|
2013-03-24 21:26:53 +00:00
|
|
|
}
|
|
|
|
public GMPermConfig getConfig() {
|
|
|
|
return config;
|
|
|
|
}
|
2013-03-25 16:51:01 +00:00
|
|
|
public PermissionInterface getPermissionInterface() {
|
2013-03-24 21:26:53 +00:00
|
|
|
return permission;
|
|
|
|
}
|
|
|
|
}
|