Test and config fixes

Added method to check if testing
This commit is contained in:
Norbi Peti 2020-09-04 17:52:36 +02:00
parent 5b27af8925
commit ab4dd75684
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
4 changed files with 11 additions and 3 deletions

View file

@ -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

View file

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

View file

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

View file

@ -186,6 +186,7 @@ public final class IHaveConfig {
*/
public void reset(ConfigurationSection config) {
this.config = config;
datamap.forEach((path, data) -> data.reset());
}
/**