mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-01 21:11:44 +01:00
Fix tests
We really need to improve our tests, this will work for now
This commit is contained in:
parent
1c8060341f
commit
84d3138b21
@ -158,6 +158,7 @@ import static com.earth2me.essentials.I18n.tlLocale;
|
||||
public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
private static final Logger BUKKIT_LOGGER = Logger.getLogger("Essentials");
|
||||
private static Logger LOGGER = null;
|
||||
public static boolean TESTING = false;
|
||||
private final transient TNTExplodeListener tntListener = new TNTExplodeListener();
|
||||
private final transient Set<String> vanishedPlayers = new LinkedHashSet<>();
|
||||
private final transient Map<String, IEssentialsCommand> commandMap = new HashMap<>();
|
||||
@ -226,6 +227,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
}
|
||||
|
||||
public void setupForTesting(final Server server) throws IOException, InvalidDescriptionException {
|
||||
TESTING = true;
|
||||
LOGGER = new BaseLoggerProvider(this, BUKKIT_LOGGER);
|
||||
final File dataFolder = File.createTempFile("essentialstest", "");
|
||||
if (!dataFolder.delete()) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.utils;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.TranslatableException;
|
||||
@ -40,10 +41,14 @@ public final class LocationUtil {
|
||||
private static final Set<Material> TRANSPARENT_MATERIALS = EnumSet.noneOf(Material.class);
|
||||
|
||||
static {
|
||||
// Materials from Material.isTransparent()
|
||||
for (final Material mat : Material.values()) {
|
||||
if (mat.isTransparent()) {
|
||||
HOLLOW_MATERIALS.add(mat);
|
||||
// If the server is running in a test environment, the isTransparent() method will blow up since
|
||||
// it requires the registry to be initialized. This is a workaround to prevent that from happening.
|
||||
if (!Essentials.TESTING) {
|
||||
// Materials from Material.isTransparent()
|
||||
for (final Material mat : Material.values()) {
|
||||
if (mat.isTransparent()) {
|
||||
HOLLOW_MATERIALS.add(mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user