mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
Fixed bugs and oversights
This commit is contained in:
3
.idea/inspectionProfiles/Project_Default.xml
generated
3
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -2,7 +2,8 @@
|
|||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,org.toop.framework.audio.AudioPlayer,play" />
|
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,org.toop.framework.audio.AudioPlayer,play,java.util.Map,remove" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
|
<inspection_tool class="WriteOnlyObject" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
||||||
@@ -8,7 +8,7 @@ import org.toop.framework.networking.NetworkingClientManager;
|
|||||||
import org.toop.framework.networking.NetworkingInitializationException;
|
import org.toop.framework.networking.NetworkingInitializationException;
|
||||||
|
|
||||||
public final class Main {
|
public final class Main {
|
||||||
public static void main(String[] args) {
|
static void main(String[] args) {
|
||||||
initSystems();
|
initSystems();
|
||||||
App.run(args);
|
App.run(args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.toop.app.layer.layers.game;
|
package org.toop.app.layer.layers.game;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@@ -153,6 +154,7 @@ public final class TicTacToeLayer extends Layer {
|
|||||||
if (legalMove.position() == wants.position()
|
if (legalMove.position() == wants.position()
|
||||||
&& legalMove.value() == wants.value()) {
|
&& legalMove.value() == wants.value()) {
|
||||||
move = wants;
|
move = wants;
|
||||||
|
// TODO: maybe add break?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException _) {
|
} catch (InterruptedException _) {
|
||||||
@@ -315,7 +317,7 @@ public final class TicTacToeLayer extends Layer {
|
|||||||
ticTacToe.get(),
|
ticTacToe.get(),
|
||||||
compurterDifficultyToDepth(10, information.computerDifficulty()[0]));
|
compurterDifficultyToDepth(10, information.computerDifficulty()[0]));
|
||||||
|
|
||||||
position = move.position();
|
position = Objects.requireNonNull(move).position();
|
||||||
}
|
}
|
||||||
|
|
||||||
new EventFlow()
|
new EventFlow()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import org.toop.framework.asset.resources.*;
|
|||||||
/**
|
/**
|
||||||
* Centralized manager for all loaded assets in the application.
|
* Centralized manager for all loaded assets in the application.
|
||||||
*
|
*
|
||||||
* <p>{@code ResourceManager} maintains a thread-safe registry of {@link Asset} objects and provides
|
* <p>{@code ResourceManager} maintains a thread-safe registry of {@link ResourceMeta} objects and provides
|
||||||
* utility methods to retrieve assets by name, ID, or type. It works together with {@link
|
* utility methods to retrieve assets by name, ID, or type. It works together with {@link
|
||||||
* ResourceLoader} to register assets automatically when they are loaded from the file system.
|
* ResourceLoader} to register assets automatically when they are loaded from the file system.
|
||||||
*
|
*
|
||||||
@@ -50,21 +50,11 @@ import org.toop.framework.asset.resources.*;
|
|||||||
*/
|
*/
|
||||||
public class ResourceManager {
|
public class ResourceManager {
|
||||||
private static final Logger logger = LogManager.getLogger(ResourceManager.class);
|
private static final Logger logger = LogManager.getLogger(ResourceManager.class);
|
||||||
private static final ResourceManager INSTANCE = new ResourceManager();
|
|
||||||
private static final Map<String, ResourceMeta<? extends BaseResource>> assets =
|
private static final Map<String, ResourceMeta<? extends BaseResource>> assets =
|
||||||
new ConcurrentHashMap<>();
|
new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private ResourceManager() {}
|
private ResourceManager() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the singleton instance of {@code ResourceManager}.
|
|
||||||
*
|
|
||||||
* @return the shared instance
|
|
||||||
*/
|
|
||||||
public static ResourceManager getInstance() {
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all assets from a given {@link ResourceLoader} into the manager.
|
* Loads all assets from a given {@link ResourceLoader} into the manager.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ public class JsonAsset<T> extends BaseResource implements LoadableResource {
|
|||||||
File file = getFile();
|
File file = getFile();
|
||||||
File parent = file.getParentFile();
|
File parent = file.getParentFile();
|
||||||
if (parent != null && !parent.exists()) {
|
if (parent != null && !parent.exists()) {
|
||||||
parent.mkdirs();
|
boolean isDirectoryMade = parent.mkdirs();
|
||||||
|
assert isDirectoryMade;
|
||||||
}
|
}
|
||||||
try (FileWriter writer = new FileWriter(file)) {
|
try (FileWriter writer = new FileWriter(file)) {
|
||||||
gson.toJson(content, writer);
|
gson.toJson(content, writer);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class SoundManager {
|
|||||||
logger.info("Playing background music: {}", ma.getFile().getName());
|
logger.info("Playing background music: {}", ma.getFile().getName());
|
||||||
logger.info(
|
logger.info(
|
||||||
"Background music next in line: {}",
|
"Background music next in line: {}",
|
||||||
backgroundMusicQueue.peek().getFile().getName());
|
backgroundMusicQueue.peek() != null ? backgroundMusicQueue.peek().getFile().getName() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private long playSound(String audioFileName, boolean loop)
|
private long playSound(String audioFileName, boolean loop)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.toop.framework.eventbus;
|
package org.toop.framework.eventbus;
|
||||||
|
|
||||||
public class ListenerHandler {
|
public class ListenerHandler {
|
||||||
private Object listener = null;
|
private Object listener;
|
||||||
|
|
||||||
// private boolean unsubscribeAfterSuccess = true;
|
// private boolean unsubscribeAfterSuccess = true;
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class NetworkingGameClientHandler extends ChannelInboundHandlerAdapter {
|
|||||||
try {
|
try {
|
||||||
String[] msg =
|
String[] msg =
|
||||||
Pattern.compile(
|
Pattern.compile(
|
||||||
"(?:CHALLENGER|GAMETYPE|CHALLENGENUMBER):\\s*\"?(.*?)\"?\\s*(?:,|})")
|
"(?:CHALLENGER|GAMETYPE|CHALLENGENUMBER):\\s*\"?(.*?)\"?\\s*[,}]")
|
||||||
.matcher(rec)
|
.matcher(rec)
|
||||||
.results()
|
.results()
|
||||||
.map(m -> m.group().trim())
|
.map(m -> m.group().trim())
|
||||||
|
|||||||
Reference in New Issue
Block a user