mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +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">
|
||||
<option name="myName" value="Project Default" />
|
||||
<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 class="WriteOnlyObject" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
||||
@@ -8,7 +8,7 @@ import org.toop.framework.networking.NetworkingClientManager;
|
||||
import org.toop.framework.networking.NetworkingInitializationException;
|
||||
|
||||
public final class Main {
|
||||
public static void main(String[] args) {
|
||||
static void main(String[] args) {
|
||||
initSystems();
|
||||
App.run(args);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.toop.app.layer.layers.game;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -153,6 +154,7 @@ public final class TicTacToeLayer extends Layer {
|
||||
if (legalMove.position() == wants.position()
|
||||
&& legalMove.value() == wants.value()) {
|
||||
move = wants;
|
||||
// TODO: maybe add break?
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException _) {
|
||||
@@ -315,7 +317,7 @@ public final class TicTacToeLayer extends Layer {
|
||||
ticTacToe.get(),
|
||||
compurterDifficultyToDepth(10, information.computerDifficulty()[0]));
|
||||
|
||||
position = move.position();
|
||||
position = Objects.requireNonNull(move).position();
|
||||
}
|
||||
|
||||
new EventFlow()
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.toop.framework.asset.resources.*;
|
||||
/**
|
||||
* 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
|
||||
* 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 {
|
||||
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 =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -61,7 +61,8 @@ public class JsonAsset<T> extends BaseResource implements LoadableResource {
|
||||
File file = getFile();
|
||||
File parent = file.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
parent.mkdirs();
|
||||
boolean isDirectoryMade = parent.mkdirs();
|
||||
assert isDirectoryMade;
|
||||
}
|
||||
try (FileWriter writer = new FileWriter(file)) {
|
||||
gson.toJson(content, writer);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class SoundManager {
|
||||
logger.info("Playing background music: {}", ma.getFile().getName());
|
||||
logger.info(
|
||||
"Background music next in line: {}",
|
||||
backgroundMusicQueue.peek().getFile().getName());
|
||||
backgroundMusicQueue.peek() != null ? backgroundMusicQueue.peek().getFile().getName() : null);
|
||||
}
|
||||
|
||||
private long playSound(String audioFileName, boolean loop)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.toop.framework.eventbus;
|
||||
|
||||
public class ListenerHandler {
|
||||
private Object listener = null;
|
||||
private Object listener;
|
||||
|
||||
// private boolean unsubscribeAfterSuccess = true;
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@ public class NetworkingClient {
|
||||
if (isChannelActive()) {
|
||||
this.channel.writeAndFlush(msg);
|
||||
logger.info(
|
||||
"Connection {} sent message: '{}'", this.channel.remoteAddress(), literalMsg);
|
||||
"Connection {} sent message: '{}' ", this.channel.remoteAddress(), literalMsg);
|
||||
} else {
|
||||
logger.warn("Cannot send message: '{}', connection inactive.", literalMsg);
|
||||
logger.warn("Cannot send message: '{}', connection inactive. ", literalMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class NetworkingGameClientHandler extends ChannelInboundHandlerAdapter {
|
||||
try {
|
||||
String[] msg =
|
||||
Pattern.compile(
|
||||
"(?:CHALLENGER|GAMETYPE|CHALLENGENUMBER):\\s*\"?(.*?)\"?\\s*(?:,|})")
|
||||
"(?:CHALLENGER|GAMETYPE|CHALLENGENUMBER):\\s*\"?(.*?)\"?\\s*[,}]")
|
||||
.matcher(rec)
|
||||
.results()
|
||||
.map(m -> m.group().trim())
|
||||
|
||||
Reference in New Issue
Block a user