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