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

13
pom.xml
View file

@ -98,11 +98,12 @@
</dependencies>
<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<finalName>${project.artifactId}</finalName>
<!--
<resources>
<!-- <resource>
<!- - <resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/</directory>
@ -111,20 +112,20 @@
<include>config.yml</include>
<include>META-INF/descriptions.jos</include>
</includes>
</resource>-->
</resource>- ->
<resource>
<targetPath>lang/</targetPath>
<directory>${basedir}/lang/</directory>
</resource>
<!-- <resource>
<!- - <resource>
<targetPath>META-INF/</targetPath>
<filtering>true</filtering>
<directory>${project.build.directory}/generated-sources/annotations/META-INF/</directory>
<includes>
<include>descriptions.jos</include>
</includes>
</resource> -->
</resources>
</resource> - ->
</resources> -->
<plugins>
<plugin>

View file

@ -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<LimitedCreative> {
}
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() {
return commands;
return Arrays.asList((ICommand[]) commands);
}
@Override

View file

@ -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();
}

View file

@ -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();
}
}

View file

@ -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());