Directory restructure (maven recommended layout) for Unit-Tests

This commit is contained in:
Jascha Starke 2013-01-23 16:31:33 +01:00
parent de57c93844
commit dbce96a5ac
31 changed files with 13 additions and 31 deletions

View file

@ -98,9 +98,10 @@
</dependencies> </dependencies>
<build> <build>
<sourceDirectory>${basedir}/src</sourceDirectory> <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<!--
<resources> <resources>
<!- - <resource> <!- - <resource>
<targetPath>.</targetPath> <targetPath>.</targetPath>
@ -124,7 +125,7 @@
<include>descriptions.jos</include> <include>descriptions.jos</include>
</includes> </includes>
</resource> - -> </resource> - ->
</resources> </resources> -->
<plugins> <plugins>
<plugin> <plugin>

View file

@ -1,5 +1,6 @@
package de.jaschastarke.minecraft.limitedcreative; package de.jaschastarke.minecraft.limitedcreative;
import java.util.Arrays;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -49,9 +50,9 @@ public class FeatureSwitchGameMode extends CoreModule<LimitedCreative> {
} }
public class Commands extends AbstractCommandList implements IMethodCommandContainer, IHasName { public class Commands extends AbstractCommandList implements IMethodCommandContainer, IHasName {
private List<ICommand> commands = MethodCommand.getMethodCommandsFor(this); private MethodCommand[] commands = MethodCommand.getMethodCommandsFor(this);
public List<ICommand> getCommandList() { public List<ICommand> getCommandList() {
return commands; return Arrays.asList((ICommand[]) commands);
} }
@Override @Override

View file

@ -34,10 +34,6 @@ public class LimitedCreative extends Core {
return config; return config;
} }
@Deprecated
public String L(String msg, Object... objects) {
return getLang().trans(msg, objects);
}
public i18n getLocale() { public i18n getLocale() {
return getLang(); return getLang();
} }

View file

@ -3,7 +3,6 @@ package de.jaschastarke.minecraft.limitedcreative.inventories;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData; 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.IConfigurationSubGroup;
import de.jaschastarke.configuration.annotations.IsConfigurationNode; import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments; import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.minecraft.limitedcreative.LimitedCreative;
import de.jaschastarke.minecraft.limitedcreative.ModInventories; import de.jaschastarke.minecraft.limitedcreative.ModInventories;
/** /**
@ -78,7 +76,7 @@ public class ArmoryConfig extends Configuration implements IConfigurationSubGrou
} }
if (md != null) 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"); return config.get("feet", "CHAINMAIL_BOOTS");
} }
@Deprecated
public String L(String msg, Object... objects) { 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() { public ModuleLogger getLog() {
return ((LimitedCreative) Bukkit.getPluginManager().getPlugin("LimitedCreative")).getModule(ModInventories.class).getLog(); return mod.getLog();
} }
} }

View file

@ -18,11 +18,9 @@
package de.jaschastarke.minecraft.limitedcreative.inventories; package de.jaschastarke.minecraft.limitedcreative.inventories;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import de.jaschastarke.minecraft.limitedcreative.Hooks; import de.jaschastarke.minecraft.limitedcreative.Hooks;
@ -34,16 +32,6 @@ public class PlayerListener implements Listener {
this.mod = mod; 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 @EventHandler
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) { public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
boolean isLoggedIn = Hooks.IsLoggedIn.test(event.getPlayer()); boolean isLoggedIn = Hooks.IsLoggedIn.test(event.getPlayer());