Annotation instead of pom registration, with Configuration-Default generation

This commit is contained in:
Jascha Starke 2013-09-25 23:52:43 +02:00
parent ea1921935e
commit 49b528e352
19 changed files with 83 additions and 25 deletions

14
pom.xml
View file

@ -158,20 +158,6 @@
<custom>
<dev-url>http://dev.bukkit.org/server-mods/limited-creative/</dev-url>
</custom>
<registeredPermissions>
<param>de.jaschastarke.minecraft.limitedcreative.Permissions:CONTAINER</param>
<param>de.jaschastarke.minecraft.limitedcreative.SwitchGameModePermissions:ALL</param>
<param>de.jaschastarke.minecraft.limitedcreative.inventories.InventoryPermissions</param>
<param>de.jaschastarke.minecraft.limitedcreative.limits.NoLimitPermissions:PARENT</param>
<param>de.jaschastarke.minecraft.limitedcreative.cmdblocker.CmdBlockPermissions:CONTAINER</param>
<param>de.jaschastarke.minecraft.limitedcreative.regions.RegionPermissions:REGION</param>
<param>de.jaschastarke.minecraft.limitedcreative.blockstate.BlockStatePermissions:PARENT</param>
</registeredPermissions>
<registeredCommands>
<param>de.jaschastarke.minecraft.limitedcreative.MainCommand</param>
<param>de.jaschastarke.minecraft.limitedcreative.regions.RegionsCommand</param>
<param>de.jaschastarke.minecraft.limitedcreative.blockstate.BlockStateCommand</param>
</registeredCommands>
</configuration>
</execution>
</executions>

View file

@ -3,11 +3,13 @@ package de.jaschastarke.minecraft.limitedcreative;
import org.bukkit.configuration.ConfigurationSection;
import de.jaschastarke.bukkit.lib.Core;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.bukkit.lib.configuration.PluginConfiguration;
import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
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;
@ -21,7 +23,11 @@ import de.jaschastarke.modularize.ModuleEntry.ModuleState;
* removed.
*/
@ArchiveDocComments
@PluginConfigurations
public class Config extends PluginConfiguration {
public Config(ConfigurationContainer container) {
super(container);
}
public Config(Core plugin) {
super(plugin);
}
@ -30,9 +36,8 @@ public class Config extends PluginConfiguration {
public void setValues(ConfigurationSection sect) {
super.setValues(sect);
if (plugin.getModules().size() > 0) {
if (plugin.getModules().size() > 0)
setModuleStates();
}
}
public void setModuleStates() {

View file

@ -9,6 +9,7 @@ import de.jaschastarke.bukkit.lib.commands.annotations.Description;
import de.jaschastarke.bukkit.lib.commands.annotations.IsCommand;
import de.jaschastarke.bukkit.lib.commands.annotations.NeedsPermission;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginCommand;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
@ -18,6 +19,7 @@ import de.jaschastarke.minecraft.lib.permissions.IPermission;
* @permission limitedcreative.command
*/
@ArchiveDocComments
@PluginCommand
public class MainCommand extends BukkitCommand implements IHelpDescribed, IMethodCommandContainer {
private LimitedCreative plugin;

View file

@ -20,6 +20,7 @@ package de.jaschastarke.minecraft.limitedcreative;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginPermissions;
import de.jaschastarke.minecraft.lib.permissions.BasicPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
import de.jaschastarke.minecraft.lib.permissions.SimplePermissionContainerNode;
@ -30,6 +31,7 @@ public class Permissions extends SimplePermissionContainerNode {
super(name);
}
@PluginPermissions
public final static Permissions CONTAINER = new Permissions("limitedcreative");
/**

View file

@ -3,6 +3,7 @@ package de.jaschastarke.minecraft.limitedcreative;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginPermissions;
import de.jaschastarke.minecraft.lib.permissions.BasicPermission;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.lib.permissions.IsChildPermission;
@ -13,6 +14,7 @@ public class SwitchGameModePermissions extends ParentPermissionContainerNode {
/**
* Allows switching of own game mode to creative/adventure and back
*/
@PluginPermissions
public final static SwitchGameModePermissions ALL = new SwitchGameModePermissions(Permissions.CONTAINER, "switch_gamemode");
protected SwitchGameModePermissions(IAbstractPermission parent, String name) {

View file

@ -21,6 +21,7 @@ import de.jaschastarke.bukkit.lib.commands.MissingPermissionCommandException;
import de.jaschastarke.bukkit.lib.commands.annotations.IsCommand;
import de.jaschastarke.bukkit.lib.commands.annotations.Usages;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginCommand;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.limitedcreative.ModBlockStates;
import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockState.Source;
@ -33,6 +34,7 @@ import de.jaschastarke.minecraft.limitedcreative.blockstate.DBModel.DBTransactio
* @permission limitedcreative.blockstate.command
*/
@ArchiveDocComments
@PluginCommand
public class BlockStateCommand extends BukkitCommand implements IHelpDescribed {
private ModBlockStates mod;
private HelpCommand help;

View file

@ -4,12 +4,15 @@ import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import de.jaschastarke.bukkit.lib.configuration.Configuration;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.bukkit.lib.configuration.StringList;
import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModBlockStates;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
@ -21,12 +24,16 @@ import de.jaschastarke.modularize.ModuleEntry.ModuleState;
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/blockstate/
*/
@ArchiveDocComments
@PluginConfigurations(parent = Config.class)
public class BlockStateConfig extends Configuration implements IConfigurationSubGroup {
protected ModBlockStates mod;
protected ModuleEntry<IModule> entry;
public BlockStateConfig(ConfigurationContainer container) {
super(container);
}
public BlockStateConfig(ModBlockStates mod, ModuleEntry<IModule> modEntry) {
super(mod.getPlugin());
super(mod.getPlugin().getDocCommentStorage());
this.mod = mod;
entry = modEntry;
}

View file

@ -20,6 +20,7 @@ package de.jaschastarke.minecraft.limitedcreative.blockstate;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginPermissions;
import de.jaschastarke.minecraft.lib.permissions.BasicPermission;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
@ -33,7 +34,7 @@ public class BlockStatePermissions extends SimplePermissionContainerNode {
super(parent, name);
}
@PluginPermissions
public static final IPermissionContainer PARENT = new BlockStatePermissions(Permissions.CONTAINER, "blockstate");
/**

View file

@ -5,6 +5,7 @@ import java.util.Collection;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginPermissions;
import de.jaschastarke.minecraft.lib.permissions.BasicPermission;
import de.jaschastarke.minecraft.lib.permissions.DynamicPermission;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
@ -19,6 +20,7 @@ public class CmdBlockPermissions extends SimplePermissionContainerNode {
super(parent, name);
}
@PluginPermissions
public static final SimplePermissionContainerNode CONTAINER = new CmdBlockPermissions(Permissions.CONTAINER, "cmdblock");
/**

View file

@ -3,11 +3,14 @@ package de.jaschastarke.minecraft.limitedcreative.cmdblocker;
import org.bukkit.configuration.ConfigurationSection;
import de.jaschastarke.bukkit.lib.configuration.Configuration;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModCmdBlocker;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
@ -19,12 +22,16 @@ import de.jaschastarke.modularize.ModuleEntry.ModuleState;
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/command-blocker/
*/
@ArchiveDocComments
@PluginConfigurations(parent = Config.class)
public class CmdBlockerConfig extends Configuration implements IConfigurationSubGroup {
protected ModCmdBlocker mod;
protected ModuleEntry<IModule> entry;
public CmdBlockerConfig(ConfigurationContainer container) {
super(container);
}
public CmdBlockerConfig(ModCmdBlocker modCmdBlocker, ModuleEntry<IModule> modEntry) {
super(modCmdBlocker.getPlugin());
super(modCmdBlocker.getPlugin().getDocCommentStorage());
mod = modCmdBlocker;
entry = modEntry;
}

View file

@ -3,11 +3,14 @@ package de.jaschastarke.minecraft.limitedcreative.gmperm;
import org.bukkit.configuration.ConfigurationSection;
import de.jaschastarke.bukkit.lib.configuration.Configuration;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModGameModePerm;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
@ -21,12 +24,16 @@ import de.jaschastarke.modularize.ModuleEntry.ModuleState;
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/gmperm/
*/
@ArchiveDocComments
@PluginConfigurations(parent = Config.class)
public class GMPermConfig extends Configuration implements IConfigurationSubGroup {
protected ModGameModePerm mod;
protected ModuleEntry<IModule> entry;
public GMPermConfig(ConfigurationContainer container) {
super(container);
}
public GMPermConfig(ModGameModePerm modGameModePerm, ModuleEntry<IModule> modEntry) {
super(modGameModePerm.getPlugin());
super(modGameModePerm.getPlugin().getDocCommentStorage());
mod = modGameModePerm;
entry = modEntry;
}

View file

@ -9,12 +9,14 @@ import org.bukkit.material.MaterialData;
import de.jaschastarke.bukkit.lib.ModuleLogger;
import de.jaschastarke.bukkit.lib.configuration.Configuration;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.bukkit.lib.items.MaterialDataNotRecognizedException;
import de.jaschastarke.bukkit.lib.items.MaterialNotRecognizedException;
import de.jaschastarke.bukkit.lib.items.ItemUtils;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
/**
@ -23,10 +25,15 @@ import de.jaschastarke.minecraft.limitedcreative.ModInventories;
* When set, all creative Player automatically wears the given items as Armor. So they are better seen by other Players.
*/
@ArchiveDocComments
@PluginConfigurations(parent = InventoryConfig.class)
public class ArmoryConfig extends Configuration implements IConfigurationSubGroup {
protected ModInventories mod;
public ArmoryConfig(ConfigurationContainer container) {
super(container);
}
public ArmoryConfig(ModInventories modInventories) {
super(modInventories.getPlugin());
super(modInventories.getPlugin().getDocCommentStorage());
mod = modInventories;
}

View file

@ -3,11 +3,14 @@ package de.jaschastarke.minecraft.limitedcreative.inventories;
import org.bukkit.configuration.ConfigurationSection;
import de.jaschastarke.bukkit.lib.configuration.Configuration;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
@ -19,10 +22,14 @@ import de.jaschastarke.modularize.ModuleEntry.ModuleState;
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/inventory/
*/
@ArchiveDocComments
@PluginConfigurations(parent = Config.class)
public class InventoryConfig extends Configuration implements IConfigurationSubGroup {
protected ModInventories mod;
protected ModuleEntry<IModule> entry;
public InventoryConfig(ConfigurationContainer container) {
super(container);
}
public InventoryConfig(ModInventories modInventories, ModuleEntry<IModule> modEntry) {
super(modInventories.getPlugin());
mod = modInventories;

View file

@ -20,6 +20,7 @@ package de.jaschastarke.minecraft.limitedcreative.inventories;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginPermissions;
import de.jaschastarke.minecraft.lib.permissions.BasicPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
import de.jaschastarke.minecraft.lib.permissions.SimplePermissionContainer;
@ -31,6 +32,7 @@ import de.jaschastarke.minecraft.limitedcreative.Permissions;
*
*/
@ArchiveDocComments
@PluginPermissions
public class InventoryPermissions extends SimplePermissionContainer {
/**

View file

@ -5,12 +5,15 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.EntityType;
import de.jaschastarke.bukkit.lib.configuration.Configuration;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.bukkit.lib.configuration.IToGeneric;
import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModCreativeLimits;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
@ -22,12 +25,16 @@ import de.jaschastarke.modularize.ModuleEntry.ModuleState;
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/limit/
*/
@ArchiveDocComments
@PluginConfigurations(parent = Config.class)
public class LimitConfig extends Configuration implements IConfigurationSubGroup {
protected ModCreativeLimits mod;
protected ModuleEntry<IModule> entry;
public LimitConfig(ConfigurationContainer container) {
super(container);
}
public LimitConfig(ModCreativeLimits modCreativeLimits, ModuleEntry<IModule> modEntry) {
super(modCreativeLimits.getPlugin());
super(modCreativeLimits.getPlugin().getDocCommentStorage());
mod = modCreativeLimits;
entry = modEntry;
}

View file

@ -26,6 +26,7 @@ import org.bukkit.material.MaterialData;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginPermissions;
import de.jaschastarke.minecraft.lib.permissions.BasicPermission;
import de.jaschastarke.minecraft.lib.permissions.DynamicPermission;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
@ -43,7 +44,7 @@ public class NoLimitPermissions extends SimplePermissionContainerNode {
super(parent, name);
}
@PluginPermissions
public static final IPermissionContainer PARENT = new NoLimitPermissions(Permissions.CONTAINER, "nolimit");
/**

View file

@ -3,11 +3,14 @@ package de.jaschastarke.minecraft.limitedcreative.regions;
import org.bukkit.configuration.ConfigurationSection;
import de.jaschastarke.bukkit.lib.configuration.Configuration;
import de.jaschastarke.bukkit.lib.configuration.ConfigurationContainer;
import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginConfigurations;
import de.jaschastarke.minecraft.limitedcreative.Config;
import de.jaschastarke.minecraft.limitedcreative.ModRegions;
import de.jaschastarke.minecraft.limitedcreative.limits.BlackList;
import de.jaschastarke.modularize.IModule;
@ -20,12 +23,16 @@ import de.jaschastarke.modularize.ModuleEntry.ModuleState;
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/region/
*/
@ArchiveDocComments
@PluginConfigurations(parent = Config.class)
public class RegionConfig extends Configuration implements IConfigurationSubGroup {
protected ModRegions mod;
protected ModuleEntry<IModule> entry;
public RegionConfig(ConfigurationContainer container) {
super(container);
}
public RegionConfig(ModRegions modRegions, ModuleEntry<IModule> modEntry) {
super(modRegions.getPlugin());
super(modRegions.getPlugin().getDocCommentStorage());
mod = modRegions;
entry = modEntry;
}

View file

@ -3,6 +3,7 @@ package de.jaschastarke.minecraft.limitedcreative.regions;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginPermissions;
import de.jaschastarke.minecraft.lib.permissions.BasicPermission;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
@ -26,6 +27,7 @@ final public class RegionPermissions extends SimplePermissionContainerNode imple
/**
* Grants access to the /lcr command, which allows to define Limited Creatives region-flags
*/
@PluginPermissions
public static final RegionPermissions REGION = new RegionPermissions(Permissions.CONTAINER, "region");
/**

View file

@ -24,6 +24,7 @@ import de.jaschastarke.bukkit.lib.commands.annotations.IsCommand;
import de.jaschastarke.bukkit.lib.commands.annotations.Usages;
import de.jaschastarke.bukkit.lib.commands.parser.DefinedParameterParser;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.maven.PluginCommand;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.limitedcreative.ModRegions;
import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.FlagList;
@ -36,6 +37,7 @@ import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.Region;
* @permission limitedcreative.region
*/
@ArchiveDocComments
@PluginCommand
public class RegionsCommand extends BukkitCommand implements IHelpDescribed {
private final static String GLOBAL_REGION = "__global__";
private ModRegions mod;