mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 05:44:36 +01:00
Rename project to Lunar Core
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -58,17 +58,17 @@ tmp/
|
||||
.DS_Store
|
||||
.directory
|
||||
|
||||
# Lunar Rail generated/resource/log folders
|
||||
# Lunar Core generated/resource/log folders
|
||||
/resources
|
||||
/logs
|
||||
/proto
|
||||
|
||||
# Lunar Rail compiled
|
||||
# Lunar Core compiled
|
||||
/*.jar
|
||||
/*.sh
|
||||
|
||||
# Lunar Rail extra
|
||||
Star Rail Handbook.txt
|
||||
# Lunar Core extra
|
||||
Lunar Core Handbook.txt
|
||||
config.json
|
||||
*.mv
|
||||
*.exe
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Lunar Rail
|
||||
A WIP server emulator for version 1.4.0 of a certain turn based anime game.
|
||||
# Lunar Core
|
||||
A server emulator for version 1.4.0 of a certain turn based anime game.
|
||||
|
||||
# Running the server and client
|
||||
|
||||
|
||||
@@ -98,18 +98,18 @@ clean {
|
||||
|
||||
application {
|
||||
// Define the main class for the application
|
||||
mainClassName = 'emu.lunarcore.LunarRail'
|
||||
mainClassName = 'emu.lunarcore.LunarCore'
|
||||
}
|
||||
|
||||
jar {
|
||||
exclude '*.proto'
|
||||
|
||||
manifest {
|
||||
attributes 'Main-Class': 'emu.lunarcore.LunarRail'
|
||||
attributes 'Main-Class': 'emu.lunarcore.LunarCore'
|
||||
}
|
||||
|
||||
jar {
|
||||
archiveBaseName = 'LunarRail'
|
||||
archiveBaseName = 'LunarCore'
|
||||
archiveVersion = ''
|
||||
}
|
||||
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
* in the user manual at https://docs.gradle.org/5.6.3/userguide/multi_project_builds.html
|
||||
*/
|
||||
|
||||
rootProject.name = 'Lunar Rail'
|
||||
rootProject.name = 'Lunar Core'
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Config {
|
||||
@Getter
|
||||
public static class DatabaseInfo {
|
||||
public String uri = "mongodb://localhost:27017";
|
||||
public String collection = "lunarrail";
|
||||
public String collection = "lunarcore";
|
||||
public boolean useInternal = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import emu.lunarcore.util.Handbook;
|
||||
import emu.lunarcore.util.JsonUtils;
|
||||
import lombok.Getter;
|
||||
|
||||
public class LunarRail {
|
||||
private static Logger log = (Logger) LoggerFactory.getLogger(LunarRail.class);
|
||||
public class LunarCore {
|
||||
private static Logger log = (Logger) LoggerFactory.getLogger(LunarCore.class);
|
||||
private static File configFile = new File("./config.json");
|
||||
private static Config config;
|
||||
|
||||
@@ -39,16 +39,16 @@ public class LunarRail {
|
||||
|
||||
// Load config first before doing anything
|
||||
static {
|
||||
LunarRail.loadConfig();
|
||||
LunarCore.loadConfig();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Start Server
|
||||
LunarRail.getLogger().info("Starting Lunar Rail...");
|
||||
LunarCore.getLogger().info("Starting Lunar Core...");
|
||||
boolean generateHandbook = true;
|
||||
|
||||
// Load commands
|
||||
LunarRail.commandManager = new CommandManager();
|
||||
LunarCore.commandManager = new CommandManager();
|
||||
|
||||
// Parse arguments
|
||||
for (String arg : args) {
|
||||
@@ -66,10 +66,10 @@ public class LunarRail {
|
||||
case "-database":
|
||||
// Database only
|
||||
DatabaseManager databaseManager = new DatabaseManager();
|
||||
databaseManager.startInternalMongoServer(LunarRail.getConfig().getInternalMongoServer());
|
||||
LunarRail.getLogger().info("Running local mongo server at " + databaseManager.getServer().getConnectionString());
|
||||
databaseManager.startInternalMongoServer(LunarCore.getConfig().getInternalMongoServer());
|
||||
LunarCore.getLogger().info("Running local mongo server at " + databaseManager.getServer().getConnectionString());
|
||||
// Console
|
||||
LunarRail.startConsole();
|
||||
LunarCore.startConsole();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class LunarRail {
|
||||
}
|
||||
|
||||
// Start Database(s)
|
||||
LunarRail.initDatabases();
|
||||
LunarCore.initDatabases();
|
||||
|
||||
// Always run http server as it is needed by for dispatch and gateserver
|
||||
httpServer = new HttpServer(serverType);
|
||||
@@ -99,7 +99,7 @@ public class LunarRail {
|
||||
}
|
||||
|
||||
// Start console
|
||||
LunarRail.startConsole();
|
||||
LunarCore.startConsole();
|
||||
}
|
||||
|
||||
public static Config getConfig() {
|
||||
@@ -113,19 +113,19 @@ public class LunarRail {
|
||||
// Database
|
||||
|
||||
private static void initDatabases() {
|
||||
if (LunarRail.getConfig().useSameDatabase) {
|
||||
if (LunarCore.getConfig().useSameDatabase) {
|
||||
// Setup account and game database
|
||||
accountDatabase = new DatabaseManager(LunarRail.getConfig().getAccountDatabase(), serverType);
|
||||
accountDatabase = new DatabaseManager(LunarCore.getConfig().getAccountDatabase(), serverType);
|
||||
// Optimization: Dont run a 2nd database manager if we are not running a gameserver
|
||||
if (serverType.runGame()) {
|
||||
gameDatabase = accountDatabase;
|
||||
}
|
||||
} else {
|
||||
// Run separate databases
|
||||
accountDatabase = new DatabaseManager(LunarRail.getConfig().getAccountDatabase(), ServerType.DISPATCH);
|
||||
accountDatabase = new DatabaseManager(LunarCore.getConfig().getAccountDatabase(), ServerType.DISPATCH);
|
||||
// Optimization: Dont run a 2nd database manager if we are not running a gameserver
|
||||
if (serverType.runGame()) {
|
||||
gameDatabase = new DatabaseManager(LunarRail.getConfig().getGameDatabase(), ServerType.GAME);
|
||||
gameDatabase = new DatabaseManager(LunarCore.getConfig().getGameDatabase(), ServerType.GAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class LunarRail {
|
||||
try (FileReader file = new FileReader(configFile)) {
|
||||
config = JsonUtils.loadToClass(file, Config.class);
|
||||
} catch (Exception e) {
|
||||
LunarRail.config = new Config();
|
||||
LunarCore.config = new Config();
|
||||
}
|
||||
saveConfig();
|
||||
}
|
||||
@@ -164,13 +164,13 @@ public class LunarRail {
|
||||
continue;
|
||||
}
|
||||
|
||||
LunarRail.getCommandManager().invoke(null, input);
|
||||
LunarCore.getCommandManager().invoke(null, input);
|
||||
}
|
||||
} catch (UserInterruptException | EndOfFileException e) {
|
||||
// CTRL + C / CTRL + D
|
||||
System.exit(0);
|
||||
} catch (Exception e) {
|
||||
LunarRail.getLogger().error("Terminal error: ", e);
|
||||
LunarCore.getLogger().error("Terminal error: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.util.Utils;
|
||||
import lombok.Getter;
|
||||
@@ -59,8 +59,8 @@ public class CommandArgs {
|
||||
|
||||
// Get target player
|
||||
if (targetUid != 0) {
|
||||
if (LunarRail.getGameServer() != null) {
|
||||
target = LunarRail.getGameServer().getOnlinePlayerByUid(targetUid);
|
||||
if (LunarCore.getGameServer() != null) {
|
||||
target = LunarCore.getGameServer().getOnlinePlayerByUid(targetUid);
|
||||
}
|
||||
} else {
|
||||
target = sender;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package emu.lunarcore.command;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
|
||||
public interface CommandHandler {
|
||||
@@ -13,7 +13,7 @@ public interface CommandHandler {
|
||||
if (player != null) {
|
||||
player.sendMessage(message);
|
||||
} else {
|
||||
LunarRail.getLogger().info(message);
|
||||
LunarCore.getLogger().info(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
@@ -118,8 +118,8 @@ public class CommandManager {
|
||||
return;
|
||||
}
|
||||
// Log
|
||||
if (sender != null && LunarRail.getConfig().getLogOptions().commands) {
|
||||
LunarRail.getLogger().info("[UID: " + sender.getUid() + "] " + sender.getName() + " used command: " + message);
|
||||
if (sender != null && LunarCore.getConfig().getLogOptions().commands) {
|
||||
LunarCore.getLogger().info("[UID: " + sender.getUid() + "] " + sender.getName() + " used command: " + message);
|
||||
}
|
||||
// Run command
|
||||
handler.execute(sender, cmdArgs);
|
||||
@@ -130,7 +130,7 @@ public class CommandManager {
|
||||
if (sender != null) {
|
||||
sender.sendMessage("Inavlid Command!");
|
||||
} else {
|
||||
LunarRail.getLogger().info("Inavlid Command!");
|
||||
LunarCore.getLogger().info("Inavlid Command!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package emu.lunarcore.command.commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.bwaldvogel.mongo.backend.Utils;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
@@ -11,7 +11,7 @@ public class ReloadCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
LunarRail.loadConfig();
|
||||
LunarCore.loadConfig();
|
||||
this.sendMessage(sender, "Reloaded the server config");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.game.player.PlayerGender;
|
||||
import emu.lunarcore.server.packet.send.PacketGetHeroBasicTypeInfoScRsp;
|
||||
|
||||
@Command(label = "unstuck", permission = "admin.unstuck", desc = "/unstuck @[player id]. Unstucks an offline player if theyre in a scene that doesnt load.")
|
||||
public class UnstuckCommand implements CommandHandler {
|
||||
@@ -14,7 +12,7 @@ public class UnstuckCommand implements CommandHandler {
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
// Make sure were on the game server
|
||||
if (LunarRail.getGameDatabase() == null) {
|
||||
if (LunarCore.getGameDatabase() == null) {
|
||||
this.sendMessage(sender, "Error: Game database not connected");
|
||||
return;
|
||||
}
|
||||
@@ -26,7 +24,7 @@ public class UnstuckCommand implements CommandHandler {
|
||||
}
|
||||
|
||||
// Get player from the database
|
||||
Player player = LunarRail.getGameDatabase().getObjectByField(Player.class, "_id", args.getTargetUid());
|
||||
Player player = LunarCore.getGameDatabase().getObjectByField(Player.class, "_id", args.getTargetUid());
|
||||
|
||||
if (player != null) {
|
||||
// Reset position for the player
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.google.gson.JsonParseException;
|
||||
|
||||
public class ResourceDeserializers {
|
||||
|
||||
protected static class LunarRailDoubleDeserializer implements JsonDeserializer<Double> {
|
||||
protected static class LunarCoreDoubleDeserializer implements JsonDeserializer<Double> {
|
||||
@Override
|
||||
public Double deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
if (json.isJsonPrimitive()) {
|
||||
@@ -22,7 +22,7 @@ public class ResourceDeserializers {
|
||||
}
|
||||
}
|
||||
|
||||
protected static class LunarRailHashDeserializer implements JsonDeserializer<Long> {
|
||||
protected static class LunarCoreHashDeserializer implements JsonDeserializer<Long> {
|
||||
@Override
|
||||
public Long deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
if (json.isJsonPrimitive()) {
|
||||
|
||||
@@ -2,8 +2,6 @@ package emu.lunarcore.data;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Stream;
|
||||
@@ -16,9 +14,9 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.data.ResourceDeserializers.LunarRailDoubleDeserializer;
|
||||
import emu.lunarcore.data.ResourceDeserializers.LunarRailHashDeserializer;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.ResourceDeserializers.LunarCoreDoubleDeserializer;
|
||||
import emu.lunarcore.data.ResourceDeserializers.LunarCoreHashDeserializer;
|
||||
import emu.lunarcore.data.config.FloorInfo;
|
||||
import emu.lunarcore.data.config.FloorInfo.FloorGroupSimpleInfo;
|
||||
import emu.lunarcore.data.config.GroupInfo;
|
||||
@@ -30,8 +28,8 @@ public class ResourceLoader {
|
||||
|
||||
// Special gson factory we create for loading resources
|
||||
private static final Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(double.class, new LunarRailDoubleDeserializer())
|
||||
.registerTypeAdapter(long.class, new LunarRailHashDeserializer())
|
||||
.registerTypeAdapter(double.class, new LunarCoreDoubleDeserializer())
|
||||
.registerTypeAdapter(long.class, new LunarCoreHashDeserializer())
|
||||
.create();
|
||||
|
||||
// Load all resources
|
||||
@@ -83,7 +81,7 @@ public class ResourceLoader {
|
||||
try {
|
||||
loadFromResource(resourceDefinition, type, map);
|
||||
} catch (Exception e) {
|
||||
LunarRail.getLogger().error("Error loading resource file: " + Arrays.toString(type.name()), e);
|
||||
LunarCore.getLogger().error("Error loading resource file: " + Arrays.toString(type.name()), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,12 +94,12 @@ public class ResourceLoader {
|
||||
count += loadFromResource(c, type, name, map);
|
||||
}
|
||||
|
||||
LunarRail.getLogger().info("Loaded " + count + " " + c.getSimpleName() + "s.");
|
||||
LunarCore.getLogger().info("Loaded " + count + " " + c.getSimpleName() + "s.");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private static <T> int loadFromResource(Class<T> c, ResourceType type, String fileName, Int2ObjectMap map) throws Exception {
|
||||
String file = LunarRail.getConfig().getResourceDir() + "/ExcelOutput/" + fileName;
|
||||
String file = LunarCore.getConfig().getResourceDir() + "/ExcelOutput/" + fileName;
|
||||
|
||||
// Load reader from file
|
||||
try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)) {
|
||||
@@ -169,10 +167,10 @@ public class ResourceLoader {
|
||||
// Might be better to cache
|
||||
private static void loadFloorInfos() {
|
||||
// Load floor infos
|
||||
File floorDir = new File(LunarRail.getConfig().getResourceDir() + "/Config/LevelOutput/Floor/");
|
||||
File floorDir = new File(LunarCore.getConfig().getResourceDir() + "/Config/LevelOutput/Floor/");
|
||||
|
||||
if (!floorDir.exists()) {
|
||||
LunarRail.getLogger().warn("Floor infos are missing, please check your resources.");
|
||||
LunarCore.getLogger().warn("Floor infos are missing, please check your resources.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +188,7 @@ public class ResourceLoader {
|
||||
// Load group infos
|
||||
for (FloorInfo floor : GameData.getFloorInfos().values()) {
|
||||
for (FloorGroupSimpleInfo simpleGroup : floor.getSimpleGroupList()) {
|
||||
File file = new File(LunarRail.getConfig().getResourceDir() + "/" + simpleGroup.getGroupPath());
|
||||
File file = new File(LunarCore.getConfig().getResourceDir() + "/" + simpleGroup.getGroupPath());
|
||||
|
||||
if (!file.exists()) {
|
||||
continue;
|
||||
@@ -211,7 +209,7 @@ public class ResourceLoader {
|
||||
}
|
||||
|
||||
// Done
|
||||
LunarRail.getLogger().info("Loaded " + GameData.getFloorInfos().size() + " FloorInfos.");
|
||||
LunarCore.getLogger().info("Loaded " + GameData.getFloorInfos().size() + " FloorInfos.");
|
||||
}
|
||||
|
||||
// Might be better to cache
|
||||
@@ -220,7 +218,7 @@ public class ResourceLoader {
|
||||
|
||||
for (var avatarExcel : GameData.getAvatarExcelMap().values()) {
|
||||
// Get file
|
||||
File file = new File(LunarRail.getConfig().getResourceDir() + "/Config/ConfigAdventureAbility/LocalPlayer/LocalPlayer_" + avatarExcel.getNameKey() + "_Ability.json");
|
||||
File file = new File(LunarCore.getConfig().getResourceDir() + "/Config/ConfigAdventureAbility/LocalPlayer/LocalPlayer_" + avatarExcel.getNameKey() + "_Ability.json");
|
||||
if (!file.exists()) continue;
|
||||
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
@@ -235,11 +233,11 @@ public class ResourceLoader {
|
||||
}
|
||||
|
||||
// Done
|
||||
LunarRail.getLogger().info("Loaded " + count + " maze abilities for avatars.");
|
||||
LunarCore.getLogger().info("Loaded " + count + " maze abilities for avatars.");
|
||||
}
|
||||
|
||||
private static void loadRogueMapGen() {
|
||||
File file = new File(LunarRail.getConfig().getDataDir() + "/RogueMapGen.json");
|
||||
File file = new File(LunarCore.getConfig().getDataDir() + "/RogueMapGen.json");
|
||||
if (!file.exists()) return;
|
||||
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
@@ -253,6 +251,6 @@ public class ResourceLoader {
|
||||
}
|
||||
|
||||
// Done
|
||||
LunarRail.getLogger().info("Loaded rogue maps");
|
||||
LunarCore.getLogger().info("Loaded rogue maps");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package emu.lunarcore.data.excel;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.data.GameResource;
|
||||
import emu.lunarcore.data.ResourceType;
|
||||
import lombok.AccessLevel;
|
||||
|
||||
@@ -24,8 +24,8 @@ import dev.morphia.mapping.MapperOptions;
|
||||
import dev.morphia.query.filters.Filters;
|
||||
import emu.lunarcore.Config.DatabaseInfo;
|
||||
import emu.lunarcore.Config.InternalMongoInfo;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarRail.ServerType;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.LunarCore.ServerType;
|
||||
|
||||
public final class DatabaseManager {
|
||||
private MongoServer server;
|
||||
@@ -42,8 +42,8 @@ public final class DatabaseManager {
|
||||
|
||||
// Local mongo server
|
||||
if (info.isUseInternal()) {
|
||||
connectionString = startInternalMongoServer(LunarRail.getConfig().getInternalMongoServer());
|
||||
LunarRail.getLogger().info("Using local mongo server at " + server.getConnectionString());
|
||||
connectionString = startInternalMongoServer(LunarCore.getConfig().getInternalMongoServer());
|
||||
LunarCore.getLogger().info("Using local mongo server at " + server.getConnectionString());
|
||||
}
|
||||
|
||||
// Initialize
|
||||
@@ -59,7 +59,7 @@ public final class DatabaseManager {
|
||||
datastore = Morphia.createDatastore(gameMongoClient, info.getCollection(), mapperOptions);
|
||||
|
||||
// Map classes
|
||||
var entities = new Reflections(LunarRail.class.getPackageName())
|
||||
var entities = new Reflections(LunarCore.class.getPackageName())
|
||||
.getTypesAnnotatedWith(Entity.class)
|
||||
.stream()
|
||||
.filter(cls -> {
|
||||
@@ -105,7 +105,7 @@ public final class DatabaseManager {
|
||||
try {
|
||||
datastore.ensureIndexes();
|
||||
} catch (MongoCommandException exception) {
|
||||
LunarRail.getLogger().warn("Mongo index error: ", exception);
|
||||
LunarCore.getLogger().warn("Mongo index error: ", exception);
|
||||
// Duplicate index error
|
||||
if (exception.getCode() == 85) {
|
||||
// Drop all indexes and re add them
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import dev.morphia.annotations.*;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.database.AccountDatabaseOnly;
|
||||
import emu.lunarcore.util.Crypto;
|
||||
import emu.lunarcore.util.Snowflake32;
|
||||
@@ -99,7 +99,7 @@ public class Account {
|
||||
}
|
||||
|
||||
// Default permissions
|
||||
var defaultPermissions = LunarRail.getConfig().getServerOptions().getDefaultPermissions();
|
||||
var defaultPermissions = LunarCore.getConfig().getServerOptions().getDefaultPermissions();
|
||||
|
||||
if (defaultPermissions.contains("*")) {
|
||||
return true;
|
||||
@@ -151,6 +151,6 @@ public class Account {
|
||||
// Database
|
||||
|
||||
public void save() {
|
||||
LunarRail.getAccountDatabase().save(this);
|
||||
LunarCore.getAccountDatabase().save(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package emu.lunarcore.game.account;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
|
||||
/**
|
||||
* Helper class for handling account related stuff
|
||||
@@ -8,7 +8,7 @@ import emu.lunarcore.LunarRail;
|
||||
public class AccountHelper {
|
||||
|
||||
public static boolean createAccount(String username, String password, int reservedUid) {
|
||||
Account account = LunarRail.getAccountDatabase().getObjectByField(Account.class, "username", username);
|
||||
Account account = LunarCore.getAccountDatabase().getObjectByField(Account.class, "username", username);
|
||||
|
||||
if (account != null) {
|
||||
return false;
|
||||
@@ -22,13 +22,13 @@ public class AccountHelper {
|
||||
}
|
||||
|
||||
public static boolean deleteAccount(String username) {
|
||||
Account account = LunarRail.getAccountDatabase().getObjectByField(Account.class, "username", username);
|
||||
Account account = LunarCore.getAccountDatabase().getObjectByField(Account.class, "username", username);
|
||||
|
||||
if (account == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return LunarRail.getAccountDatabase().delete(account);
|
||||
return LunarCore.getAccountDatabase().delete(account);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.excel.AvatarExcel;
|
||||
import emu.lunarcore.data.excel.HeroExcel;
|
||||
@@ -94,7 +94,7 @@ public class AvatarStorage extends BasePlayerManager implements Iterable<GameAva
|
||||
|
||||
public void loadFromDatabase() {
|
||||
// Load hero paths
|
||||
Stream<HeroPath> heroStream = LunarRail.getGameDatabase().getObjects(HeroPath.class, "ownerUid", this.getPlayer().getUid());
|
||||
Stream<HeroPath> heroStream = LunarCore.getGameDatabase().getObjects(HeroPath.class, "ownerUid", this.getPlayer().getUid());
|
||||
|
||||
heroStream.forEach(heroPath -> {
|
||||
// Load avatar excel data
|
||||
@@ -109,7 +109,7 @@ public class AvatarStorage extends BasePlayerManager implements Iterable<GameAva
|
||||
});
|
||||
|
||||
// Load avatars
|
||||
Stream<GameAvatar> stream = LunarRail.getGameDatabase().getObjects(GameAvatar.class, "ownerUid", this.getPlayer().getUid());
|
||||
Stream<GameAvatar> stream = LunarCore.getGameDatabase().getObjects(GameAvatar.class, "ownerUid", this.getPlayer().getUid());
|
||||
|
||||
stream.forEach(avatar -> {
|
||||
// Should never happen
|
||||
|
||||
@@ -10,7 +10,7 @@ import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.excel.AvatarExcel;
|
||||
import emu.lunarcore.game.inventory.GameItem;
|
||||
@@ -374,7 +374,7 @@ public class GameAvatar implements GameEntity {
|
||||
|
||||
public void save() {
|
||||
// Save avatar
|
||||
LunarRail.getGameDatabase().save(this);
|
||||
LunarCore.getGameDatabase().save(this);
|
||||
// Save hero path
|
||||
if (this.getHeroPath() != null) {
|
||||
this.getHeroPath().save();
|
||||
|
||||
@@ -6,7 +6,7 @@ import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.excel.AvatarExcel;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.AvatarSkillTreeOuterClass.AvatarSkillTree;
|
||||
@@ -70,6 +70,6 @@ public class HeroPath {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
LunarRail.getGameDatabase().save(this);
|
||||
LunarCore.getGameDatabase().save(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.bson.types.ObjectId;
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.ChallengeOuterClass.Challenge;
|
||||
import lombok.Getter;
|
||||
@@ -42,10 +42,10 @@ public class ChallengeHistory {
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
LunarRail.getGameDatabase().delete(this);
|
||||
LunarCore.getGameDatabase().delete(this);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
LunarRail.getGameDatabase().save(this);
|
||||
LunarCore.getGameDatabase().save(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.game.challenge;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.excel.ChallengeExcel;
|
||||
import emu.lunarcore.game.player.BasePlayerManager;
|
||||
@@ -85,7 +85,7 @@ public class ChallengeManager extends BasePlayerManager {
|
||||
}
|
||||
|
||||
public void loadFromDatabase() {
|
||||
Stream<ChallengeHistory> stream = LunarRail.getGameDatabase().getObjects(ChallengeHistory.class, "ownerUid", this.getPlayer().getUid());
|
||||
Stream<ChallengeHistory> stream = LunarCore.getGameDatabase().getObjects(ChallengeHistory.class, "ownerUid", this.getPlayer().getUid());
|
||||
|
||||
stream.forEach(info -> {
|
||||
this.getHistory().put(info.getChallengeId(), info);
|
||||
|
||||
@@ -3,7 +3,7 @@ package emu.lunarcore.game.chat;
|
||||
import java.util.Collection;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.player.BasePlayerManager;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.server.packet.send.PacketRevcMsgScNotify;
|
||||
@@ -52,7 +52,7 @@ public class ChatManager extends BasePlayerManager {
|
||||
|
||||
// Check if command
|
||||
if (text.charAt(0) == '!' || text.charAt(0) == '/') {
|
||||
LunarRail.getCommandManager().invoke(getPlayer(), text);
|
||||
LunarCore.getCommandManager().invoke(getPlayer(), text);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package emu.lunarcore.game.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum PropType {
|
||||
PROP_NONE (0),
|
||||
PROP_ORDINARY (1),
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.excel.ItemExcel;
|
||||
import emu.lunarcore.game.avatar.GameAvatar;
|
||||
@@ -58,14 +58,14 @@ public class GachaService extends BaseGameService {
|
||||
}
|
||||
|
||||
public synchronized void load() {
|
||||
try (FileReader fileReader = new FileReader(LunarRail.getConfig().getDataDir() + "/Banners.json")) {
|
||||
try (FileReader fileReader = new FileReader(LunarCore.getConfig().getDataDir() + "/Banners.json")) {
|
||||
List<GachaBanner> banners = JsonUtils.loadToList(fileReader, GachaBanner.class);
|
||||
for (GachaBanner banner : banners) {
|
||||
getGachaBanners().put(banner.getId(), banner);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
LunarRail.getLogger().warn("No gacha banners loaded!");
|
||||
LunarCore.getLogger().warn("No gacha banners loaded!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bson.types.ObjectId;
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.GameDepot;
|
||||
import emu.lunarcore.data.excel.ItemExcel;
|
||||
@@ -210,9 +210,9 @@ public class GameItem {
|
||||
|
||||
public void save() {
|
||||
if (this.count > 0 && this.ownerUid > 0) {
|
||||
LunarRail.getGameDatabase().save(this);
|
||||
LunarCore.getGameDatabase().save(this);
|
||||
} else if (this.getId() != null) {
|
||||
LunarRail.getGameDatabase().delete(this);
|
||||
LunarCore.getGameDatabase().delete(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.common.ItemParam;
|
||||
import emu.lunarcore.data.common.ItemParam.ItemParamType;
|
||||
@@ -428,7 +428,7 @@ public class Inventory extends BasePlayerManager {
|
||||
// Database
|
||||
|
||||
public void loadFromDatabase() {
|
||||
Stream<GameItem> stream = LunarRail.getGameDatabase().getObjects(GameItem.class, "ownerUid", this.getPlayer().getUid());
|
||||
Stream<GameItem> stream = LunarCore.getGameDatabase().getObjects(GameItem.class, "ownerUid", this.getPlayer().getUid());
|
||||
|
||||
stream.forEach(item -> {
|
||||
// Should never happen
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.bson.types.ObjectId;
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.inventory.GameItem;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.ClientMailOuterClass.ClientMail;
|
||||
@@ -66,11 +66,11 @@ public class Mail {
|
||||
// Database
|
||||
|
||||
public void save() {
|
||||
LunarRail.getGameDatabase().save(this);
|
||||
LunarCore.getGameDatabase().save(this);
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
LunarRail.getGameDatabase().delete(this);
|
||||
LunarCore.getGameDatabase().delete(this);
|
||||
}
|
||||
|
||||
// Proto
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.inventory.GameItem;
|
||||
import emu.lunarcore.game.player.BasePlayerManager;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
@@ -130,7 +130,7 @@ public class Mailbox extends BasePlayerManager implements Iterable<Mail> {
|
||||
// Database
|
||||
|
||||
public void loadFromDatabase() {
|
||||
Stream<Mail> stream = LunarRail.getGameDatabase().getObjects(Mail.class, "ownerUid", this.getPlayer().getUid());
|
||||
Stream<Mail> stream = LunarCore.getGameDatabase().getObjects(Mail.class, "ownerUid", this.getPlayer().getUid());
|
||||
|
||||
stream.forEach(this::putMail);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.config.AnchorInfo;
|
||||
import emu.lunarcore.data.config.FloorInfo;
|
||||
@@ -277,8 +277,8 @@ public class Player {
|
||||
nextUid = 0;
|
||||
}
|
||||
|
||||
while (nextUid == 0 || LunarRail.getGameDatabase().checkIfObjectExists(Player.class, nextUid)) {
|
||||
nextUid = LunarRail.getGameDatabase().getNextObjectId(Player.class);
|
||||
while (nextUid == 0 || LunarCore.getGameDatabase().checkIfObjectExists(Player.class, nextUid)) {
|
||||
nextUid = LunarCore.getGameDatabase().getNextObjectId(Player.class);
|
||||
}
|
||||
|
||||
this.uid = nextUid;
|
||||
@@ -516,11 +516,11 @@ public class Player {
|
||||
|
||||
public void save() {
|
||||
if (this.uid <= 0) {
|
||||
LunarRail.getLogger().error("Tried to save a player object without a uid!");
|
||||
LunarCore.getLogger().error("Tried to save a player object without a uid!");
|
||||
return;
|
||||
}
|
||||
|
||||
LunarRail.getGameDatabase().save(this);
|
||||
LunarCore.getGameDatabase().save(this);
|
||||
}
|
||||
|
||||
public void onLogin() {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package emu.lunarcore.game.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.server.packet.send.PacketSyncLineupNotify;
|
||||
import lombok.Getter;
|
||||
|
||||
public class PlayerExtraLineup extends PlayerLineup {
|
||||
private int extraLineupType;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package emu.lunarcore.game.scene.entity;
|
||||
|
||||
import emu.lunarcore.data.excel.NpcMonsterExcel;
|
||||
import emu.lunarcore.data.excel.StageExcel;
|
||||
import emu.lunarcore.game.scene.Scene;
|
||||
import emu.lunarcore.game.scene.triggers.PropTriggerType;
|
||||
import emu.lunarcore.proto.MotionInfoOuterClass.MotionInfo;
|
||||
import emu.lunarcore.proto.SceneEntityInfoOuterClass.SceneEntityInfo;
|
||||
import emu.lunarcore.proto.SceneNpcMonsterInfoOuterClass.SceneNpcMonsterInfo;
|
||||
import emu.lunarcore.proto.VectorOuterClass.Vector;
|
||||
import emu.lunarcore.util.Position;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package emu.lunarcore.game.scene.triggers;
|
||||
|
||||
import emu.lunarcore.game.enums.PropState;
|
||||
import emu.lunarcore.game.enums.PropType;
|
||||
import emu.lunarcore.game.scene.Scene;
|
||||
import emu.lunarcore.game.scene.entity.EntityProp;
|
||||
import emu.lunarcore.game.scene.entity.GameEntity;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.lunarcore.Config.GameServerConfig;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.battle.BattleService;
|
||||
import emu.lunarcore.game.gacha.GachaService;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
@@ -89,10 +89,10 @@ public class GameServer extends KcpServer {
|
||||
// Setup region info
|
||||
this.info.setUp(true);
|
||||
this.info.save();
|
||||
LunarRail.getHttpServer().forceRegionListRefresh();
|
||||
LunarCore.getHttpServer().forceRegionListRefresh();
|
||||
|
||||
// Done
|
||||
LunarRail.getLogger().info("Game Server started on " + address.getPort());
|
||||
LunarCore.getLogger().info("Game Server started on " + address.getPort());
|
||||
}
|
||||
|
||||
private void onShutdown() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Set;
|
||||
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@@ -39,7 +39,7 @@ public class GameServerPacketHandler {
|
||||
}
|
||||
|
||||
public void registerHandlers() {
|
||||
Reflections reflections = new Reflections(LunarRail.class.getPackageName());
|
||||
Reflections reflections = new Reflections(LunarCore.class.getPackageName());
|
||||
Set<?> handlerClasses = reflections.getSubTypesOf(PacketHandler.class);
|
||||
|
||||
for (Object obj : handlerClasses) {
|
||||
@@ -47,7 +47,7 @@ public class GameServerPacketHandler {
|
||||
}
|
||||
|
||||
// Debug
|
||||
LunarRail.getLogger().info("Game Server registered " + this.handlers.size() + " packet handlers");
|
||||
LunarCore.getLogger().info("Game Server registered " + this.handlers.size() + " packet handlers");
|
||||
}
|
||||
|
||||
public void handle(GameSession session, int opcode, byte[] header, byte[] data) {
|
||||
@@ -68,15 +68,7 @@ public class GameServerPacketHandler {
|
||||
if (state != SessionState.WAITING_FOR_LOGIN) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
else if (opcode == PacketOpcodes.SetPlayerBornDataReq) {
|
||||
if (state != SessionState.PICKING_CHARACTER) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
else {
|
||||
} else {
|
||||
if (state != SessionState.ACTIVE) {
|
||||
return;
|
||||
}
|
||||
@@ -92,6 +84,6 @@ public class GameServerPacketHandler {
|
||||
}
|
||||
|
||||
// Log unhandled packets
|
||||
//LunarRail.getLogger().info("Unhandled packet (" + opcode + "): " + CmdIdUtils.getOpcodeName(opcode));
|
||||
//LunarCore.getLogger().info("Unhandled packet (" + opcode + "): " + CmdIdUtils.getOpcodeName(opcode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.server.game;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.account.Account;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
@@ -65,14 +65,14 @@ public class GameSession {
|
||||
}
|
||||
|
||||
public void onConnect() {
|
||||
if (LunarRail.getConfig().getLogOptions().connections) {
|
||||
LunarRail.getLogger().info("Client connected from " + address.getHostString());
|
||||
if (LunarCore.getConfig().getLogOptions().connections) {
|
||||
LunarCore.getLogger().info("Client connected from " + address.getHostString());
|
||||
}
|
||||
}
|
||||
|
||||
public void onDisconnect() {
|
||||
if (LunarRail.getConfig().getLogOptions().connections) {
|
||||
LunarRail.getLogger().info("Client disconnected from " + address.getHostString());
|
||||
if (LunarCore.getConfig().getLogOptions().connections) {
|
||||
LunarCore.getLogger().info("Client disconnected from " + address.getHostString());
|
||||
}
|
||||
|
||||
this.state = SessionState.INACTIVE;
|
||||
@@ -120,7 +120,7 @@ public class GameSession {
|
||||
}
|
||||
|
||||
// Log packet
|
||||
if (LunarRail.getConfig().getLogOptions().packets) {
|
||||
if (LunarCore.getConfig().getLogOptions().packets) {
|
||||
logPacket("RECV", opcode, data);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class GameSession {
|
||||
public void send(BasePacket packet) {
|
||||
// Test
|
||||
if (packet.getOpcode() <= 0) {
|
||||
LunarRail.getLogger().warn("Tried to send packet with missing cmd id!");
|
||||
LunarCore.getLogger().warn("Tried to send packet with missing cmd id!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class GameSession {
|
||||
this.send(packet.build());
|
||||
|
||||
// Log
|
||||
if (LunarRail.getConfig().getLogOptions().packets) {
|
||||
if (LunarCore.getConfig().getLogOptions().packets) {
|
||||
logPacket("SEND", packet.getOpcode(), packet.getData());
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class GameSession {
|
||||
}
|
||||
|
||||
public void logPacket(String sendOrRecv, int opcode, byte[] payload) {
|
||||
LunarRail.getLogger().info(sendOrRecv + ": " + CmdIdUtils.getOpcodeName(opcode) + " (" + opcode + ")");
|
||||
LunarCore.getLogger().info(sendOrRecv + ": " + CmdIdUtils.getOpcodeName(opcode) + " (" + opcode + ")");
|
||||
System.out.println(Utils.bytesToHex(payload));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.server.game;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.database.AccountDatabaseOnly;
|
||||
import emu.lunarcore.proto.RegionEntryOuterClass.RegionEntry;
|
||||
import lombok.Getter;
|
||||
@@ -29,7 +29,7 @@ public class RegionInfo {
|
||||
this.id = server.getServerConfig().getId();
|
||||
this.name = server.getServerConfig().getName();
|
||||
this.desc = server.getServerConfig().getDescription();
|
||||
this.gateAddress = LunarRail.getHttpServer().getServerConfig().getDisplayAddress();
|
||||
this.gateAddress = LunarCore.getHttpServer().getServerConfig().getDisplayAddress();
|
||||
this.up = true;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,6 @@ public class RegionInfo {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
LunarRail.getAccountDatabase().save(this);
|
||||
LunarCore.getAccountDatabase().save(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
import emu.lunarcore.Config.HttpServerConfig;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarRail.ServerType;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.LunarCore.ServerType;
|
||||
import emu.lunarcore.proto.DispatchRegionDataOuterClass.DispatchRegionData;
|
||||
import emu.lunarcore.server.game.RegionInfo;
|
||||
import emu.lunarcore.server.http.handlers.*;
|
||||
@@ -52,7 +52,7 @@ public class HttpServer {
|
||||
}
|
||||
|
||||
public HttpServerConfig getServerConfig() {
|
||||
return LunarRail.getConfig().getHttpServer();
|
||||
return LunarCore.getConfig().getHttpServer();
|
||||
}
|
||||
|
||||
private HttpConnectionFactory getHttpFactory() {
|
||||
@@ -65,8 +65,8 @@ public class HttpServer {
|
||||
|
||||
private SslContextFactory.Server getSSLContextFactory() {
|
||||
SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
|
||||
sslContextFactory.setKeyStorePath(LunarRail.getConfig().getKeystore().getPath());
|
||||
sslContextFactory.setKeyStorePassword(LunarRail.getConfig().getKeystore().getPassword());
|
||||
sslContextFactory.setKeyStorePath(LunarCore.getConfig().getKeystore().getPath());
|
||||
sslContextFactory.setKeyStorePassword(LunarCore.getConfig().getKeystore().getPassword());
|
||||
sslContextFactory.setSniRequired(false);
|
||||
sslContextFactory.setRenegotiationAllowed(false);
|
||||
return sslContextFactory;
|
||||
@@ -84,7 +84,7 @@ public class HttpServer {
|
||||
this.regions.clear();
|
||||
|
||||
// Pull region infos from database
|
||||
LunarRail.getAccountDatabase().getObjects(RegionInfo.class)
|
||||
LunarCore.getAccountDatabase().getObjects(RegionInfo.class)
|
||||
.forEach(region -> {
|
||||
this.regions.put(region.getId(), region);
|
||||
});
|
||||
@@ -119,8 +119,8 @@ public class HttpServer {
|
||||
}
|
||||
|
||||
// Done
|
||||
LunarRail.getLogger().info("Http Server running as: " + this.modes.stream().collect(Collectors.joining(", ")));
|
||||
LunarRail.getLogger().info("Http Server started on " + getServerConfig().getPort());
|
||||
LunarCore.getLogger().info("Http Server running as: " + this.modes.stream().collect(Collectors.joining(", ")));
|
||||
LunarCore.getLogger().info("Http Server started on " + getServerConfig().getPort());
|
||||
}
|
||||
|
||||
private void addRoutes() {
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.server.http.handlers;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.account.Account;
|
||||
import emu.lunarcore.server.http.objects.ComboTokenReqJson;
|
||||
import emu.lunarcore.server.http.objects.ComboTokenReqJson.LoginTokenData;
|
||||
@@ -45,7 +45,7 @@ public class ComboTokenGranterHandler implements Handler {
|
||||
}
|
||||
|
||||
// Login
|
||||
Account account = LunarRail.getAccountDatabase().getObjectByField(Account.class, "_id", data.uid);
|
||||
Account account = LunarCore.getAccountDatabase().getObjectByField(Account.class, "_id", data.uid);
|
||||
|
||||
if (account == null || !account.getDispatchToken().equals(data.token)) {
|
||||
res.retcode = -201;
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.server.http.handlers;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.server.http.HttpServer;
|
||||
|
||||
import io.javalin.http.Context;
|
||||
@@ -18,8 +18,8 @@ public class QueryDispatchHandler implements Handler {
|
||||
@Override
|
||||
public void handle(@NotNull Context ctx) throws Exception {
|
||||
// Log
|
||||
if (LunarRail.getConfig().getLogOptions().connections) {
|
||||
LunarRail.getLogger().info("Client request: query_dispatch");
|
||||
if (LunarCore.getConfig().getLogOptions().connections) {
|
||||
LunarCore.getLogger().info("Client request: query_dispatch");
|
||||
}
|
||||
|
||||
// Send region list to client
|
||||
|
||||
@@ -3,7 +3,7 @@ package emu.lunarcore.server.http.handlers;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.proto.GateserverOuterClass.Gateserver;
|
||||
import emu.lunarcore.util.Utils;
|
||||
import io.javalin.http.Context;
|
||||
@@ -19,16 +19,16 @@ public class QueryGatewayHandler implements Handler {
|
||||
public void handle(@NotNull Context ctx) throws Exception {
|
||||
// Build gateserver proto
|
||||
Gateserver gateserver = Gateserver.newInstance()
|
||||
.setRegionName(LunarRail.getConfig().getGameServer().getId())
|
||||
.setIp(LunarRail.getConfig().getGameServer().getPublicAddress())
|
||||
.setPort(LunarRail.getConfig().getGameServer().getPort())
|
||||
.setRegionName(LunarCore.getConfig().getGameServer().getId())
|
||||
.setIp(LunarCore.getConfig().getGameServer().getPublicAddress())
|
||||
.setPort(LunarCore.getConfig().getGameServer().getPort())
|
||||
.setUnk1(true)
|
||||
.setUnk2(true)
|
||||
.setUnk3(true)
|
||||
.setMdkResVersion(GameConstants.MDK_VERSION);
|
||||
|
||||
// Set streaming data urls
|
||||
var data = LunarRail.getConfig().getDownloadData();
|
||||
var data = LunarCore.getConfig().getDownloadData();
|
||||
|
||||
if (data.assetBundleUrl != null) {
|
||||
gateserver.setAssetBundleUrl(data.assetBundleUrl);
|
||||
@@ -44,8 +44,8 @@ public class QueryGatewayHandler implements Handler {
|
||||
}
|
||||
|
||||
// Log
|
||||
if (LunarRail.getConfig().getLogOptions().connections) {
|
||||
LunarRail.getLogger().info("Client request: query_gateway");
|
||||
if (LunarCore.getConfig().getLogOptions().connections) {
|
||||
LunarCore.getLogger().info("Client request: query_gateway");
|
||||
}
|
||||
|
||||
// Encode to base64 and send to client
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.server.http.handlers;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.account.Account;
|
||||
import emu.lunarcore.server.http.objects.LoginResJson;
|
||||
import emu.lunarcore.server.http.objects.LoginResJson.VerifyData;
|
||||
@@ -34,7 +34,7 @@ public class TokenLoginHandler implements Handler {
|
||||
}
|
||||
|
||||
// Login
|
||||
Account account = LunarRail.getAccountDatabase().getObjectByField(Account.class, "_id", req.uid);
|
||||
Account account = LunarCore.getAccountDatabase().getObjectByField(Account.class, "_id", req.uid);
|
||||
|
||||
if (account == null || !account.getDispatchToken().equals(req.token)) {
|
||||
res.retcode = -201;
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.server.http.handlers;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.account.Account;
|
||||
import emu.lunarcore.server.http.objects.LoginAccountReqJson;
|
||||
import emu.lunarcore.server.http.objects.LoginResJson;
|
||||
@@ -34,7 +34,7 @@ public class UsernameLoginHandler implements Handler {
|
||||
}
|
||||
|
||||
// Login
|
||||
Account account = LunarRail.getAccountDatabase().getObjectByField(Account.class, "username", req.account);
|
||||
Account account = LunarCore.getAccountDatabase().getObjectByField(Account.class, "username", req.account);
|
||||
|
||||
if (account == null) {
|
||||
res.retcode = -201;
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.util.JsonUtils;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@@ -45,7 +45,7 @@ public class CmdIdUtils {
|
||||
.collect(Collectors.toMap(Int2ObjectMap.Entry::getIntKey, Int2ObjectMap.Entry::getValue, (k, v) -> v, TreeMap::new));
|
||||
// Write to file
|
||||
writer.write(JsonUtils.encode(packetIds));
|
||||
LunarRail.getLogger().info("Dumped packet ids.");
|
||||
LunarCore.getLogger().info("Dumped packet ids.");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.DressAvatarCsReqOuterClass.DressAvatarCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@@ -15,7 +14,7 @@ public class HandlerDressAvatarCsReq extends PacketHandler {
|
||||
var req = DressAvatarCsReq.parseFrom(data);
|
||||
|
||||
session.getPlayer().getInventory().equipItem(req.getBaseAvatarId(), req.getEquipmentUniqueId());
|
||||
session.send(new BasePacket(CmdId.DressAvatarScRsp));
|
||||
session.send(CmdId.DressAvatarScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.DressRelicAvatarCsReqOuterClass.DressRelicAvatarCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@@ -18,7 +17,7 @@ public class HandlerDressRelicAvatarCsReq extends PacketHandler {
|
||||
session.getPlayer().getInventory().equipItem(req.getBaseAvatarId(), param.getRelicUniqueId());
|
||||
}
|
||||
|
||||
session.send(new BasePacket(CmdId.DressRelicAvatarScRsp));
|
||||
session.send(CmdId.DressRelicAvatarScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import emu.lunarcore.server.packet.send.PacketGetPlayerDetailInfoScRsp;
|
||||
@Opcodes(CmdId.GetPlayerDetailInfoCsReq)
|
||||
public class HandlerGetPlayerDetailInfoCsReq extends PacketHandler {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] header, byte[] data) throws Exception {
|
||||
var req = GetPlayerDetailInfoCsReq.parseFrom(data);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.game.account.Account;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.PlayerGetTokenCsReqOuterClass.PlayerGetTokenCsReq;
|
||||
@@ -20,7 +20,7 @@ public class HandlerPlayerGetTokenCsReq extends PacketHandler {
|
||||
var req = PlayerGetTokenCsReq.parseFrom(data);
|
||||
|
||||
// Authenticate
|
||||
Account account = LunarRail.getAccountDatabase().getObjectByField(Account.class, "_id", req.getAccountUid());
|
||||
Account account = LunarCore.getAccountDatabase().getObjectByField(Account.class, "_id", req.getAccountUid());
|
||||
if (account == null || !account.getComboToken().equals(req.getToken())) {
|
||||
return;
|
||||
}
|
||||
@@ -29,11 +29,11 @@ public class HandlerPlayerGetTokenCsReq extends PacketHandler {
|
||||
session.setAccount(account);
|
||||
|
||||
// Get player from database, if it doesnt exist, we create it
|
||||
Player player = LunarRail.getGameDatabase().getObjectByField(Player.class, "accountUid", account.getUid());
|
||||
Player player = LunarCore.getGameDatabase().getObjectByField(Player.class, "accountUid", account.getUid());
|
||||
|
||||
if (player == null) {
|
||||
player = new Player(session);
|
||||
LunarRail.getGameDatabase().save(player);
|
||||
LunarCore.getGameDatabase().save(player);
|
||||
}
|
||||
|
||||
// Dont let people log on to the same player at the same time
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
|
||||
@@ -3,7 +3,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.proto.TakeOffEquipmentCsReqOuterClass.TakeOffEquipmentCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@@ -16,7 +15,7 @@ public class HandlerTakeOffEquipmentCsReq extends PacketHandler {
|
||||
var req = TakeOffEquipmentCsReq.parseFrom(data);
|
||||
|
||||
session.getPlayer().getInventory().unequipItem(req.getBaseAvatarId(), GameConstants.EQUIPMENT_SLOT_ID);
|
||||
session.send(new BasePacket(CmdId.TakeOffEquipmentScRsp));
|
||||
session.send(CmdId.TakeOffEquipmentScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.TakeOffRelicCsReqOuterClass.TakeOffRelicCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@@ -18,7 +17,7 @@ public class HandlerTakeOffRelicCsReq extends PacketHandler {
|
||||
session.getPlayer().getInventory().unequipItem(req.getBaseAvatarId(), slot);
|
||||
}
|
||||
|
||||
session.send(new BasePacket(CmdId.TakeOffRelicScRsp));
|
||||
session.send(CmdId.TakeOffRelicScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
import emu.lunarcore.server.packet.send.PacketTakePromotionRewardScRsp;
|
||||
|
||||
@Opcodes(CmdId.TakePromotionRewardCsReq)
|
||||
public class HandlerTakePromotionRewardCsReq extends PacketHandler {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package emu.lunarcore.server.packet.send;
|
||||
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.proto.ArchiveDataOuterClass.ArchiveData;
|
||||
import emu.lunarcore.proto.GetArchiveDataScRspOuterClass.GetArchiveDataScRsp;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
|
||||
@@ -3,7 +3,6 @@ package emu.lunarcore.server.packet.send;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.MotionInfoOuterClass.MotionInfo;
|
||||
import emu.lunarcore.proto.SceneEntityMoveScNotifyOuterClass.SceneEntityMoveScNotify;
|
||||
import emu.lunarcore.proto.VectorOuterClass.Vector;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package emu.lunarcore.server.packet.send;
|
||||
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.ChallengeInfoOuterClass.ChallengeInfo;
|
||||
import emu.lunarcore.proto.ChallengeStatusOuterClass.ChallengeStatus;
|
||||
import emu.lunarcore.proto.ExtraLineupTypeOuterClass.ExtraLineupType;
|
||||
import emu.lunarcore.proto.StartChallengeScRspOuterClass.StartChallengeScRsp;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
|
||||
@@ -2,7 +2,7 @@ package emu.lunarcore.util;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
|
||||
public final class Crypto {
|
||||
private static final SecureRandom secureRandom = new SecureRandom();
|
||||
@@ -13,7 +13,7 @@ public final class Crypto {
|
||||
packet[i] ^= key[i % key.length];
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LunarRail.getLogger().error("Crypto error.", e);
|
||||
LunarCore.getLogger().error("Crypto error.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
|
||||
public class FileUtils {
|
||||
public static void write(String dest, byte[] bytes) {
|
||||
@@ -15,7 +15,7 @@ public class FileUtils {
|
||||
try {
|
||||
Files.write(path, bytes);
|
||||
} catch (IOException e) {
|
||||
LunarRail.getLogger().warn("Failed to write file: " + dest);
|
||||
LunarCore.getLogger().warn("Failed to write file: " + dest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class FileUtils {
|
||||
try {
|
||||
return Files.readAllBytes(path);
|
||||
} catch (IOException e) {
|
||||
LunarRail.getLogger().warn("Failed to read file: " + path);
|
||||
LunarCore.getLogger().warn("Failed to read file: " + path);
|
||||
}
|
||||
|
||||
return new byte[0];
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.excel.*;
|
||||
@@ -24,14 +24,14 @@ public class Handbook {
|
||||
List<Integer> list = null;
|
||||
|
||||
try {
|
||||
textMap = JsonUtils.loadToMap(LunarRail.getConfig().getResourceDir() + "/TextMap/TextMapEN.json", Long.class, String.class);
|
||||
textMap = JsonUtils.loadToMap(LunarCore.getConfig().getResourceDir() + "/TextMap/TextMapEN.json", Long.class, String.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
// Save to file
|
||||
String file = "./Star Rail Handbook.txt";
|
||||
String file = "./Lunar Core Handbook.txt";
|
||||
|
||||
try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8), true)) {
|
||||
// Format date for header
|
||||
@@ -46,7 +46,7 @@ public class Handbook {
|
||||
writer.println(System.lineSeparator());
|
||||
writer.println("# Commands");
|
||||
list = GameData.getAvatarExcelMap().keySet().intStream().sorted().boxed().toList();
|
||||
for (var entry : LunarRail.getCommandManager().getLabels().entrySet()) {
|
||||
for (var entry : LunarCore.getCommandManager().getLabels().entrySet()) {
|
||||
Command command = entry.getValue().getClass().getAnnotation(Command.class);
|
||||
if (command == null) continue;
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import emu.lunarcore.Config;
|
||||
|
||||
public class JsonUtils {
|
||||
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
private static final Gson gsonCompact = new GsonBuilder().create();
|
||||
|
||||
Reference in New Issue
Block a user