From dbce96a5acaa9beffc9e9a42efd9452f7682b470 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Wed, 23 Jan 2013 16:31:33 +0100 Subject: [PATCH] Directory restructure (maven recommended layout) for Unit-Tests --- pom.xml | 13 +++++++------ .../minecraft/limitedcreative/Config.java | 0 .../limitedcreative/FeatureBlockItemSpawn.java | 0 .../limitedcreative/FeatureSwitchGameMode.java | 5 +++-- .../minecraft/limitedcreative/Hooks.java | 0 .../minecraft/limitedcreative/LimitedCreative.java | 4 ---- .../minecraft/limitedcreative/MainCommand.java | 0 .../minecraft/limitedcreative/ModCmdBlocker.java | 0 .../limitedcreative/ModCreativeLimits.java | 0 .../minecraft/limitedcreative/ModInventories.java | 0 .../minecraft/limitedcreative/ModRegions.java | 0 .../minecraft/limitedcreative/Permissions.java | 0 .../limitedcreative/SwitchGameModePermissions.java | 0 .../limitedcreative/hooks/AuthMeHooks.java | 0 .../limitedcreative/hooks/MultiVerseHooks.java | 0 .../limitedcreative/hooks/PlayerCheckHooker.java | 0 .../limitedcreative/hooks/WorldTypeHooker.java | 0 .../limitedcreative/hooks/package-info.java | 0 .../minecraft/limitedcreative/hooks/xAuthHooks.java | 0 .../limitedcreative/inventories/ArmoryConfig.java | 10 +++------- .../inventories/AuthMeInventories.java | 0 .../limitedcreative/inventories/Inventory.java | 0 .../inventories/InventoryConfig.java | 0 .../inventories/InventoryPermissions.java | 0 .../limitedcreative/inventories/PlayerListener.java | 12 ------------ .../limitedcreative/inventories/store/Fallback.java | 0 .../inventories/store/InvConfStorage.java | 0 .../inventories/store/InvYamlStorage.java | 0 .../inventories/store/PlayerInventoryStorage.java | 0 .../main/resources/lang}/messages.properties | 0 .../main/resources/lang}/messages_de.properties | 0 31 files changed, 13 insertions(+), 31 deletions(-) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/Config.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/FeatureSwitchGameMode.java (94%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/Hooks.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/LimitedCreative.java (87%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/MainCommand.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/ModCmdBlocker.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/ModCreativeLimits.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/ModInventories.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/ModRegions.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/Permissions.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/SwitchGameModePermissions.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/hooks/AuthMeHooks.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/hooks/MultiVerseHooks.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/hooks/PlayerCheckHooker.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/hooks/WorldTypeHooker.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/hooks/package-info.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/hooks/xAuthHooks.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/ArmoryConfig.java (89%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/AuthMeInventories.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/Inventory.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryConfig.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryPermissions.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java (79%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/store/Fallback.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvConfStorage.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvYamlStorage.java (100%) rename src/{ => main/java}/de/jaschastarke/minecraft/limitedcreative/inventories/store/PlayerInventoryStorage.java (100%) rename {lang => src/main/resources/lang}/messages.properties (100%) rename {lang => src/main/resources/lang}/messages_de.properties (100%) diff --git a/pom.xml b/pom.xml index 352151e..5f46b73 100644 --- a/pom.xml +++ b/pom.xml @@ -98,11 +98,12 @@ - ${basedir}/src + ${basedir}/src/main/java ${project.artifactId} + + - -> lang/ ${basedir}/lang/ - - + - -> + --> diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Config.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/Config.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/Config.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/Config.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/FeatureSwitchGameMode.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureSwitchGameMode.java similarity index 94% rename from src/de/jaschastarke/minecraft/limitedcreative/FeatureSwitchGameMode.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureSwitchGameMode.java index 733d68d..2aebe9e 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/FeatureSwitchGameMode.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureSwitchGameMode.java @@ -1,5 +1,6 @@ package de.jaschastarke.minecraft.limitedcreative; +import java.util.Arrays; import java.util.List; import org.bukkit.Bukkit; @@ -49,9 +50,9 @@ public class FeatureSwitchGameMode extends CoreModule { } public class Commands extends AbstractCommandList implements IMethodCommandContainer, IHasName { - private List commands = MethodCommand.getMethodCommandsFor(this); + private MethodCommand[] commands = MethodCommand.getMethodCommandsFor(this); public List getCommandList() { - return commands; + return Arrays.asList((ICommand[]) commands); } @Override diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Hooks.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/Hooks.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/Hooks.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/Hooks.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LimitedCreative.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/LimitedCreative.java similarity index 87% rename from src/de/jaschastarke/minecraft/limitedcreative/LimitedCreative.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/LimitedCreative.java index c6b7c39..802b32f 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/LimitedCreative.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/LimitedCreative.java @@ -34,10 +34,6 @@ public class LimitedCreative extends Core { return config; } - @Deprecated - public String L(String msg, Object... objects) { - return getLang().trans(msg, objects); - } public i18n getLocale() { return getLang(); } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/MainCommand.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/MainCommand.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/MainCommand.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/MainCommand.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/ModCmdBlocker.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/ModCmdBlocker.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/ModCmdBlocker.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/ModCmdBlocker.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/ModCreativeLimits.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/ModCreativeLimits.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/ModCreativeLimits.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/ModCreativeLimits.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/ModInventories.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/ModInventories.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/ModInventories.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/ModInventories.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/ModRegions.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/ModRegions.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/ModRegions.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/ModRegions.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Permissions.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/Permissions.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/Permissions.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/Permissions.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/SwitchGameModePermissions.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/SwitchGameModePermissions.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/SwitchGameModePermissions.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/SwitchGameModePermissions.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/hooks/AuthMeHooks.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/AuthMeHooks.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/hooks/AuthMeHooks.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/AuthMeHooks.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/hooks/MultiVerseHooks.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/MultiVerseHooks.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/hooks/MultiVerseHooks.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/MultiVerseHooks.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/hooks/PlayerCheckHooker.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/PlayerCheckHooker.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/hooks/PlayerCheckHooker.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/PlayerCheckHooker.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/hooks/WorldTypeHooker.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/WorldTypeHooker.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/hooks/WorldTypeHooker.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/WorldTypeHooker.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/hooks/package-info.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/package-info.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/hooks/package-info.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/package-info.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/hooks/xAuthHooks.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/xAuthHooks.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/hooks/xAuthHooks.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/xAuthHooks.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/ArmoryConfig.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/ArmoryConfig.java similarity index 89% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/ArmoryConfig.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/ArmoryConfig.java index 6e8ce8c..93b18a1 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/inventories/ArmoryConfig.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/ArmoryConfig.java @@ -3,7 +3,6 @@ package de.jaschastarke.minecraft.limitedcreative.inventories; import java.util.HashMap; import java.util.Map; -import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; @@ -16,7 +15,6 @@ import de.jaschastarke.bukkit.lib.items.Utils; import de.jaschastarke.configuration.IConfigurationSubGroup; import de.jaschastarke.configuration.annotations.IsConfigurationNode; import de.jaschastarke.maven.ArchiveDocComments; -import de.jaschastarke.minecraft.limitedcreative.LimitedCreative; import de.jaschastarke.minecraft.limitedcreative.ModInventories; /** @@ -78,7 +76,7 @@ public class ArmoryConfig extends Configuration implements IConfigurationSubGrou } if (md != null) - armor.put(entry.getKey(), md.toItemStack()); + armor.put(entry.getKey(), md.toItemStack(1)); } } } @@ -111,12 +109,10 @@ public class ArmoryConfig extends Configuration implements IConfigurationSubGrou return config.get("feet", "CHAINMAIL_BOOTS"); } - @Deprecated public String L(String msg, Object... objects) { - return ((LimitedCreative) Bukkit.getPluginManager().getPlugin("LimitedCreative")).getLocale().trans(msg, objects); + return mod.getPlugin().getLocale().trans(msg, objects); } - @Deprecated public ModuleLogger getLog() { - return ((LimitedCreative) Bukkit.getPluginManager().getPlugin("LimitedCreative")).getModule(ModInventories.class).getLog(); + return mod.getLog(); } } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/AuthMeInventories.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/AuthMeInventories.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/AuthMeInventories.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/AuthMeInventories.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/Inventory.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/Inventory.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/Inventory.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/Inventory.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryConfig.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryConfig.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryConfig.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryConfig.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryPermissions.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryPermissions.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryPermissions.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/InventoryPermissions.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java similarity index 79% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java index 62daafd..f805dc0 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java @@ -18,11 +18,9 @@ package de.jaschastarke.minecraft.limitedcreative.inventories; import org.bukkit.GameMode; -import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerGameModeChangeEvent; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerRespawnEvent; import de.jaschastarke.minecraft.limitedcreative.Hooks; @@ -34,16 +32,6 @@ public class PlayerListener implements Listener { this.mod = mod; } - /** - * The isCancelled in PlayerInteractEvent doesn't check useItemInHand, even this decides (when clicking on - * entity with e.g. a bucket) - * @param event - * @return The relevant "isCancelled" - */ - public static boolean isCancelled(PlayerInteractEvent event) { - return event.useInteractedBlock() == Event.Result.DENY && event.useItemInHand() == Event.Result.DENY; - } - @EventHandler public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) { boolean isLoggedIn = Hooks.IsLoggedIn.test(event.getPlayer()); diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/store/Fallback.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/Fallback.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/store/Fallback.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/Fallback.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvConfStorage.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvConfStorage.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvConfStorage.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvConfStorage.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvYamlStorage.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvYamlStorage.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvYamlStorage.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/InvYamlStorage.java diff --git a/src/de/jaschastarke/minecraft/limitedcreative/inventories/store/PlayerInventoryStorage.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/PlayerInventoryStorage.java similarity index 100% rename from src/de/jaschastarke/minecraft/limitedcreative/inventories/store/PlayerInventoryStorage.java rename to src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/store/PlayerInventoryStorage.java diff --git a/lang/messages.properties b/src/main/resources/lang/messages.properties similarity index 100% rename from lang/messages.properties rename to src/main/resources/lang/messages.properties diff --git a/lang/messages_de.properties b/src/main/resources/lang/messages_de.properties similarity index 100% rename from lang/messages_de.properties rename to src/main/resources/lang/messages_de.properties