mirror of
https://github.com/array-in-a-matrix/brainwine.git
synced 2025-04-02 11:11:58 -04:00
Registered commands now get added the to game config
This commit is contained in:
parent
8249fe69cd
commit
ae8befc0fd
3 changed files with 14 additions and 1 deletions
|
@ -22,6 +22,7 @@ import com.fasterxml.jackson.databind.InjectableValues;
|
|||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import brainwine.gameserver.command.CommandManager;
|
||||
import brainwine.gameserver.item.Item;
|
||||
import brainwine.gameserver.item.ItemRegistry;
|
||||
import brainwine.gameserver.server.messages.ConfigurationMessage;
|
||||
|
@ -84,6 +85,13 @@ public class GameConfiguration {
|
|||
Map<String, Object> shop = getConfiguration("shop");
|
||||
shop.put("currency", new HashMap<>()); // Client wants this.
|
||||
|
||||
// Add custom registered commands to the client config.
|
||||
Map<String, Object> commands = getConfiguration("commands");
|
||||
|
||||
for(String command : CommandManager.getCommandNames()) {
|
||||
commands.put(command, true);
|
||||
}
|
||||
|
||||
try {
|
||||
configureItems();
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -32,11 +32,11 @@ public class GameServer implements CommandExecutor {
|
|||
handlerThread = Thread.currentThread();
|
||||
long startTime = System.currentTimeMillis();
|
||||
logger.info("Starting GameServer ...");
|
||||
CommandManager.init();
|
||||
GameConfiguration.init();
|
||||
MessagePackHelper.init();
|
||||
zoneManager = new ZoneManager();
|
||||
playerManager = new PlayerManager();
|
||||
CommandManager.init();
|
||||
NetworkRegistry.init();
|
||||
server = new Server();
|
||||
server.addEndpoint(5002);
|
||||
|
|
|
@ -2,6 +2,7 @@ package brainwine.gameserver.command;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -85,4 +86,8 @@ public class CommandManager {
|
|||
|
||||
commands.put(name, command);
|
||||
}
|
||||
|
||||
public static Set<String> getCommandNames() {
|
||||
return commands.keySet();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue