Test and config fixes
Added method to check if testing
This commit is contained in:
parent
5b27af8925
commit
ab4dd75684
4 changed files with 11 additions and 3 deletions
|
@ -19,7 +19,12 @@ import java.util.Collections;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
public class TestPrepare {
|
||||
private static boolean test = false;
|
||||
|
||||
public static boolean isTest() { return test; }
|
||||
|
||||
public static void PrepareServer() {
|
||||
test = true;
|
||||
Bukkit.setServer(Mockito.mock(Server.class, new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package buttondevteam.core.component.channel;
|
||||
|
||||
import buttondevteam.core.TestPrepare;
|
||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import buttondevteam.lib.chat.*;
|
||||
|
@ -35,6 +36,7 @@ public class ChannelComponent extends Component {
|
|||
}
|
||||
|
||||
void registerChannelCommand(Channel channel) {
|
||||
if (!TestPrepare.isTest())
|
||||
registerCommand(new ChannelCommand(channel));
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public class ConfigData<T> {
|
|||
if (setter != null && value != null)
|
||||
val = setter.apply(value);
|
||||
else val = value;
|
||||
if (config != null)
|
||||
if (config.getConfig() != null)
|
||||
setInternal(val);
|
||||
this.value = value;
|
||||
}
|
||||
|
|
|
@ -186,6 +186,7 @@ public final class IHaveConfig {
|
|||
*/
|
||||
public void reset(ConfigurationSection config) {
|
||||
this.config = config;
|
||||
datamap.forEach((path, data) -> data.reset());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue