mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-22 08:11:45 +01:00
Add TestingMode util.
This commit is contained in:
parent
0a99258f3e
commit
864e50e38c
@ -93,6 +93,7 @@ import com.onarandombox.MultiverseCore.utils.MVMessaging;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
|
||||
import com.onarandombox.MultiverseCore.utils.MaterialConverter;
|
||||
import com.onarandombox.MultiverseCore.utils.TestingMode;
|
||||
import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
|
||||
@ -343,7 +344,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
}
|
||||
|
||||
private void setupMetrics() {
|
||||
MetricsConfigurator.configureMetrics(this);
|
||||
if (TestingMode.isDisabled()) {
|
||||
MetricsConfigurator.configureMetrics(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
/**
|
||||
* A utility class that enables automated tests to flag Multiverse for testing. This allows Multiverse to not perform
|
||||
* certain behaviors such as enabled stats uploads.
|
||||
*/
|
||||
public class TestingMode {
|
||||
|
||||
private static boolean enabled = false;
|
||||
|
||||
public static void enable() {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public static boolean isDisabled() {
|
||||
return !enabled;
|
||||
}
|
||||
}
|
@ -64,6 +64,7 @@ public class TestInstanceCreator {
|
||||
public static final File worldsDirectory = new File("bin/test/server");
|
||||
|
||||
public boolean setUp() {
|
||||
TestingMode.enable();
|
||||
try {
|
||||
pluginDirectory.mkdirs();
|
||||
assertTrue(pluginDirectory.exists());
|
||||
|
Loading…
Reference in New Issue
Block a user