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,11 +19,16 @@ 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
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
if (returns(invocation, String.class))
|
||||
return "test";
|
||||
if (returns(invocation, Logger.class))
|
||||
|
|
|
@ -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,7 +36,8 @@ public class ChannelComponent extends Component {
|
|||
}
|
||||
|
||||
void registerChannelCommand(Channel channel) {
|
||||
registerCommand(new ChannelCommand(channel));
|
||||
if (!TestPrepare.isTest())
|
||||
registerCommand(new ChannelCommand(channel));
|
||||
}
|
||||
|
||||
@CommandClass
|
||||
|
|
|
@ -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