Penalties: Redo Marianas Trench.

This commit is contained in:
asofold 2018-04-10 09:40:06 +02:00
parent 3e083e4ce7
commit cbfcecf2b4
2 changed files with 16 additions and 3 deletions

View File

@ -24,11 +24,17 @@ package fr.neatmonster.nocheatplus.actions.types.penalty;
public final class CancelPenalty implements Penalty<CancelPenalty> {
public static final CancelPenalty CANCEL = new CancelPenalty();
private static boolean locked = false;
public CancelPenalty() {
super(); // Magic.
if (this != CANCEL) {
throw new IllegalStateException("CancelPenalty.CANCEL is supposed to be the unique instance.");
synchronized(CancelPenalty.class) {
if (CancelPenalty.locked) {
throw new IllegalStateException("CancelPenalty.CANCEL is supposed to be the unique instance.");
}
else {
CancelPenalty.locked = true;
}
}
}

View File

@ -21,6 +21,7 @@ import org.junit.Test;
import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigFile;
import fr.neatmonster.nocheatplus.config.DefaultConfig;
import fr.neatmonster.nocheatplus.config.PathUtils;
import fr.neatmonster.nocheatplus.config.RawConfigFile;
import fr.neatmonster.nocheatplus.logging.StaticLog;
@ -99,4 +100,10 @@ public class TestConfig {
}
}
@Test
public void testActionLists() {
ConfigFile config = new DefaultConfig();
config.getOptimizedActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, null);
}
}