Commit ae2d1fe4 authored by github-actions's avatar github-actions Committed by Melledy
Browse files

Fix whitespace [skip actions]

parent 510d564b
......@@ -24,7 +24,7 @@ public class TowerSystem extends BaseGameSystem {
private TowerScheduleConfig towerScheduleConfig;
public synchronized void load(){
public synchronized void load() {
try (Reader fileReader = DataLoader.loadReader("TowerSchedule.json")) {
towerScheduleConfig = Grasscutter.getGsonFactory().fromJson(fileReader, TowerScheduleConfig.class);
} catch (Exception e) {
......@@ -36,9 +36,9 @@ public class TowerSystem extends BaseGameSystem {
return towerScheduleConfig;
}
public TowerScheduleData getCurrentTowerScheduleData(){
public TowerScheduleData getCurrentTowerScheduleData() {
var data = GameData.getTowerScheduleDataMap().get(towerScheduleConfig.getScheduleId());
if(data == null){
if (data == null) {
Grasscutter.getLogger().error("Could not get current tower schedule data by schedule id {}, please check your resource files",
towerScheduleConfig.getScheduleId());
}
......@@ -56,29 +56,29 @@ public class TowerSystem extends BaseGameSystem {
return getCurrentTowerScheduleData().getSchedules().get(0).getFloorList();
}
public int getNextFloorId(int floorId){
public int getNextFloorId(int floorId) {
var entranceFloors = getCurrentTowerScheduleData().getEntranceFloorId();
var scheduleFloors = getScheduleFloors();
var nextId = 0;
// find in entrance floors first
for(int i=0;i<entranceFloors.size()-1;i++){
if(floorId == entranceFloors.get(i)){
for (int i=0;i<entranceFloors.size()-1;i++) {
if (floorId == entranceFloors.get(i)) {
nextId = entranceFloors.get(i+1);
}
}
if(floorId == entranceFloors.get(entranceFloors.size()-1)){
if (floorId == entranceFloors.get(entranceFloors.size()-1)) {
nextId = scheduleFloors.get(0);
}
if(nextId != 0){
if (nextId != 0) {
return nextId;
}
// find in schedule floors
for(int i=0; i < scheduleFloors.size() - 1; i++){
if(floorId == scheduleFloors.get(i)){
for (int i=0; i < scheduleFloors.size() - 1; i++) {
if (floorId == scheduleFloors.get(i)) {
nextId = scheduleFloors.get(i + 1);
}
}return nextId;
......
......@@ -186,8 +186,8 @@ public class Scene {
this.challenge = challenge;
}
public void addDungeonSettleObserver(DungeonSettleListener dungeonSettleListener){
if(dungeonSettleListeners == null){
public void addDungeonSettleObserver(DungeonSettleListener dungeonSettleListener) {
if (dungeonSettleListeners == null) {
dungeonSettleListeners = new ArrayList<>();
}
dungeonSettleListeners.add(dungeonSettleListener);
......@@ -303,12 +303,12 @@ public class Scene {
player.sendPacket(new PacketSceneEntityAppearNotify(entity));
}
public void addEntities(Collection<? extends GameEntity> entities){
public void addEntities(Collection<? extends GameEntity> entities) {
addEntities(entities, VisionType.VISION_TYPE_BORN);
}
public synchronized void addEntities(Collection<? extends GameEntity> entities, VisionType visionType) {
if(entities == null || entities.isEmpty()){
if (entities == null || entities.isEmpty()) {
return;
}
for (GameEntity entity : entities) {
......@@ -420,7 +420,7 @@ public class Scene {
public void onTick() {
// disable script for home
if (this.getSceneType() == SceneType.SCENE_HOME_WORLD || this.getSceneType() == SceneType.SCENE_HOME_ROOM){
if (this.getSceneType() == SceneType.SCENE_HOME_WORLD || this.getSceneType() == SceneType.SCENE_HOME_ROOM) {
return;
}
if (this.getScriptManager().isInit()) {
......@@ -432,7 +432,7 @@ public class Scene {
// Triggers
this.scriptManager.checkRegions();
if(challenge != null){
if (challenge != null) {
challenge.onCheckTimeOut();
}
......@@ -446,7 +446,7 @@ public class Scene {
return level;
}
public void checkNpcGroup(){
public void checkNpcGroup() {
Set<SceneNpcBornEntry> npcBornEntries = ConcurrentHashMap.newKeySet();
for (Player player : this.getPlayers()) {
npcBornEntries.addAll(loadNpcForPlayer(player));
......@@ -458,7 +458,7 @@ public class Scene {
.map(SceneNpcBornEntry::getGroupId)
.toList();
if(toUnload.size() > 0){
if (toUnload.size() > 0) {
broadcastPacket(new PacketGroupUnloadNotify(toUnload));
Grasscutter.getLogger().debug("Unload NPC Group {}", toUnload);
}
......@@ -480,7 +480,7 @@ public class Scene {
Set<SpawnDataEntry> visible = new HashSet<>();
for (var block : loadedGridBlocks) {
var spawns = spawnLists.get(block);
if(spawns!=null) {
if (spawns!=null) {
visible.addAll(spawns);
}
}
......@@ -524,7 +524,7 @@ public class Scene {
gadget.setConfigId(entry.getConfigId());
gadget.setSpawnEntry(entry);
int state = entry.getGadgetState();
if(state>0) {
if (state>0) {
gadget.setState(state);
}
gadget.buildContent();
......@@ -562,7 +562,7 @@ public class Scene {
}
}
public List<SceneBlock> getPlayerActiveBlocks(Player player){
public List<SceneBlock> getPlayerActiveBlocks(Player player) {
// consider the borders' entities of blocks, so we check if contains by index
return SceneIndexManager.queryNeighbors(getScriptManager().getBlocksIndex(),
player.getPosition().toXZDoubleArray(), Grasscutter.getConfig().server.game.loadEntitiesForPlayerRange);
......@@ -585,11 +585,11 @@ public class Scene {
}
}
for(var block : visible){
for (var block : visible) {
if (!this.getLoadedBlocks().contains(block)) {
this.onLoadBlock(block, this.getPlayers());
this.getLoadedBlocks().add(block);
}else{
}else {
// dynamic load the groups for players in a loaded block
var toLoad = this.getPlayers().stream()
.filter(p -> block.contains(p.getPosition()))
......@@ -601,7 +601,7 @@ public class Scene {
}
}
public List<SceneGroup> playerMeetGroups(Player player, SceneBlock block){
public List<SceneGroup> playerMeetGroups(Player player, SceneBlock block) {
List<SceneGroup> sceneGroups = SceneIndexManager.queryNeighbors(block.sceneGroupIndex, player.getPosition().toDoubleArray(),
Grasscutter.getConfig().server.game.loadEntitiesForPlayerRange);
......@@ -631,8 +631,8 @@ public class Scene {
Grasscutter.getLogger().info("Scene {} Block {} loaded.", this.getId(), block.id);
}
public void onLoadGroup(List<SceneGroup> groups){
if(groups == null || groups.isEmpty()){
public void onLoadGroup(List<SceneGroup> groups) {
if (groups == null || groups.isEmpty()) {
return;
}
for (SceneGroup group : groups) {
......@@ -690,10 +690,10 @@ public class Scene {
}
for (SceneGroup group : block.groups.values()) {
if(group.triggers != null){
if (group.triggers != null) {
group.triggers.values().forEach(getScriptManager()::deregisterTrigger);
}
if(group.regions != null){
if (group.regions != null) {
group.regions.values().forEach(getScriptManager()::deregisterRegion);
}
}
......@@ -763,7 +763,7 @@ public class Scene {
}
}
public void addItemEntity(int itemId, int amount, GameEntity bornForm){
public void addItemEntity(int itemId, int amount, GameEntity bornForm) {
ItemData itemData = GameData.getItemDataMap().get(itemId);
if (itemData == null) {
return;
......@@ -780,13 +780,13 @@ public class Scene {
addEntity(entity);
}
}
public void loadNpcForPlayerEnter(Player player){
public void loadNpcForPlayerEnter(Player player) {
this.npcBornEntrySet.addAll(loadNpcForPlayer(player));
}
private List<SceneNpcBornEntry> loadNpcForPlayer(Player player){
private List<SceneNpcBornEntry> loadNpcForPlayer(Player player) {
var pos = player.getPosition();
var data = GameData.getSceneNpcBornData().get(getId());
if(data == null){
if (data == null) {
return List.of();
}
......@@ -797,7 +797,7 @@ public class Scene {
.filter(i -> !this.npcBornEntrySet.contains(i))
.toList();
if(sceneNpcBornEntries.size() > 0){
if (sceneNpcBornEntries.size() > 0) {
this.broadcastPacket(new PacketGroupSuiteNotify(sceneNpcBornEntries));
Grasscutter.getLogger().debug("Loaded Npc Group Suite {}", sceneNpcBornEntries);
}
......@@ -805,17 +805,17 @@ public class Scene {
}
public void loadGroupForQuest(List<QuestGroupSuite> sceneGroupSuite) {
if(!scriptManager.isInit()){
if (!scriptManager.isInit()) {
return;
}
sceneGroupSuite.forEach(i -> {
var group = scriptManager.getGroupById(i.getGroup());
if(group == null){
if (group == null) {
return;
}
var suite = group.getSuiteByIndex(i.getSuite());
if(suite == null){
if (suite == null) {
return;
}
scriptManager.addGroupSuite(group, suite);
......
......@@ -62,7 +62,7 @@ public class SpawnDataEntry {
return rot;
}
public GridBlockId getBlockId(){
public GridBlockId getBlockId() {
int scale = GridBlockId.getScale(gadgetId);
return new GridBlockId(group.sceneId,scale,
(int)(pos.getX() / GameDepot.BLOCK_SIZE[scale]),
......@@ -133,7 +133,7 @@ public class SpawnDataEntry {
return Objects.hash(sceneId, scale, x, z);
}
public static GridBlockId[] getAdjacentGridBlockIds(int sceneId, Position pos){
public static GridBlockId[] getAdjacentGridBlockIds(int sceneId, Position pos) {
GridBlockId[] results = new GridBlockId[5*5*GameDepot.BLOCK_SIZE.length];
int t=0;
for (int scale = 0; scale < GameDepot.BLOCK_SIZE.length; scale++) {
......@@ -148,7 +148,7 @@ public class SpawnDataEntry {
return results;
}
public static int getScale(int gadgetId){
public static int getScale(int gadgetId) {
return 0;//you should implement here,this is index of GameDepot.BLOCK_SIZE
}
}
......
......@@ -30,7 +30,7 @@ public class WorldDataSystem extends BaseGameSystem {
private final Map<String, ChestInteractHandler> chestInteractHandlerMap; // chestType-Handler
private final Map<String, SceneGroup> sceneInvestigationGroupMap; // <sceneId_groupId, Group>
public WorldDataSystem(GameServer server){
public WorldDataSystem(GameServer server) {
super(server);
this.chestInteractHandlerMap = new HashMap<>();
this.sceneInvestigationGroupMap = new ConcurrentHashMap<>();
......@@ -38,11 +38,11 @@ public class WorldDataSystem extends BaseGameSystem {
loadChestConfig();
}
public synchronized void loadChestConfig(){
public synchronized void loadChestConfig() {
// set the special chest first
chestInteractHandlerMap.put("SceneObj_Chest_Flora", new BossChestInteractHandler());
try(Reader reader = DataLoader.loadReader("ChestReward.json")) {
try (Reader reader = DataLoader.loadReader("ChestReward.json")) {
List<ChestReward> chestReward = Grasscutter.getGsonFactory().fromJson(
reader,
TypeToken.getParameterized(List.class, ChestReward.class).getType());
......@@ -60,21 +60,21 @@ public class WorldDataSystem extends BaseGameSystem {
return chestInteractHandlerMap;
}
public RewardPreviewData getRewardByBossId(int monsterId){
public RewardPreviewData getRewardByBossId(int monsterId) {
var investigationMonsterData = GameData.getInvestigationMonsterDataMap().values().parallelStream()
.filter(imd -> imd.getMonsterIdList() != null && !imd.getMonsterIdList().isEmpty())
.filter(imd -> imd.getMonsterIdList().get(0) == monsterId)
.findFirst();
if(investigationMonsterData.isEmpty()){
if (investigationMonsterData.isEmpty()) {
return null;
}
return GameData.getRewardPreviewDataMap().get(investigationMonsterData.get().getRewardPreviewId());
}
private SceneGroup getInvestigationGroup(int sceneId, int groupId){
private SceneGroup getInvestigationGroup(int sceneId, int groupId) {
var key = sceneId + "_" + groupId;
if(!sceneInvestigationGroupMap.containsKey(key)){
if (!sceneInvestigationGroupMap.containsKey(key)) {
var group = SceneGroup.of(groupId).load(sceneId);
sceneInvestigationGroupMap.putIfAbsent(key, group);
return group;
......@@ -82,7 +82,7 @@ public class WorldDataSystem extends BaseGameSystem {
return sceneInvestigationGroupMap.get(key);
}
public int getMonsterLevel(SceneMonster monster, World world){
public int getMonsterLevel(SceneMonster monster, World world) {
// Calculate level
int level = monster.level;
WorldLevelData worldLevelData = GameData.getWorldLevelDataMap().get(world.getWorldLevel());
......@@ -98,14 +98,14 @@ public class WorldDataSystem extends BaseGameSystem {
var sceneId = imd.getCityData().getSceneId();
var group = getInvestigationGroup(sceneId, groupId);
if(group == null || group.monsters == null){
if (group == null || group.monsters == null) {
return null;
}
var monster = group.monsters.values().stream()
.filter(x -> x.monster_id == monsterId)
.findFirst();
if(monster.isEmpty()){
if (monster.isEmpty()) {
return null;
}
......@@ -122,9 +122,9 @@ public class WorldDataSystem extends BaseGameSystem {
.setRefreshInterval(Integer.MAX_VALUE)
.setPos(monster.get().pos.toProto());
if("Boss".equals(imd.getMonsterCategory())){
if ("Boss".equals(imd.getMonsterCategory())) {
var bossChest = group.searchBossChestInGroup();
if(bossChest.isPresent()){
if (bossChest.isPresent()) {
builder.setResin(bossChest.get().resin);
builder.setBossChestNum(bossChest.get().take_num);
}
......@@ -132,9 +132,9 @@ public class WorldDataSystem extends BaseGameSystem {
return builder.build();
}
public List<InvestigationMonsterOuterClass.InvestigationMonster> getInvestigationMonstersByCityId(Player player, int cityId){
public List<InvestigationMonsterOuterClass.InvestigationMonster> getInvestigationMonstersByCityId(Player player, int cityId) {
var cityData = GameData.getCityDataMap().get(cityId);
if(cityData == null){
if (cityData == null) {
Grasscutter.getLogger().warn("City not exist {}", cityId);
return List.of();
}
......
......@@ -37,7 +37,7 @@ public class PacketOpcodesUtils {
Field[] fields = PacketOpcodes.class.getFields();
for (Field f : fields) {
if(f.getType().equals(int.class)) {
if (f.getType().equals(int.class)) {
try {
opcodeMap.put(f.getInt(null), f.getName());
} catch (Exception e) {
......
......@@ -30,7 +30,7 @@ public abstract class Plugin {
* @param identifier The plugin's identifier.
*/
private void initializePlugin(PluginIdentifier identifier, URLClassLoader classLoader) {
if(this.identifier != null) {
if (this.identifier != null) {
Grasscutter.getLogger().warn(this.identifier.name + " had a reinitialization attempt.");
return;
}
......@@ -40,7 +40,7 @@ public abstract class Plugin {
this.dataFolder = new File(PLUGIN(), identifier.name);
this.logger = LoggerFactory.getLogger(identifier.name);
if(!this.dataFolder.exists() && !this.dataFolder.mkdirs()) {
if (!this.dataFolder.exists() && !this.dataFolder.mkdirs()) {
Grasscutter.getLogger().warn("Failed to create plugin data folder for " + this.identifier.name);
return;
}
......@@ -50,7 +50,7 @@ public abstract class Plugin {
* The plugin's identifier instance.
* @return An instance of {@link PluginIdentifier}.
*/
public final PluginIdentifier getIdentifier(){
public final PluginIdentifier getIdentifier() {
return this.identifier;
}
......
......@@ -72,7 +72,7 @@ public final class PluginManager {
List<PluginData> dependencies = new ArrayList<>();
// Initialize all plugins.
for(var plugin : plugins) {
for (var plugin : plugins) {
try {
URL url = plugin.toURI().toURL();
try (URLClassLoader loader = new URLClassLoader(new URL[]{url})) {
......@@ -109,7 +109,7 @@ public final class PluginManager {
fileReader.close();
// Check if the plugin has alternate dependencies.
if(pluginConfig.loadAfter != null && pluginConfig.loadAfter.length > 0) {
if (pluginConfig.loadAfter != null && pluginConfig.loadAfter.length > 0) {
// Add the plugin to a "load later" list.
dependencies.add(new PluginData(
pluginInstance, PluginIdentifier.fromPluginConfig(pluginConfig),
......@@ -131,9 +131,9 @@ public final class PluginManager {
// Load plugins with dependencies.
int depth = 0; final int maxDepth = 30;
while(!dependencies.isEmpty()) {
while (!dependencies.isEmpty()) {
// Check if the depth is too high.
if(depth >= maxDepth) {
if (depth >= maxDepth) {
Grasscutter.getLogger().error("Failed to load plugins with dependencies.");
break;
}
......@@ -143,7 +143,7 @@ public final class PluginManager {
var pluginData = dependencies.get(0);
// Check if the plugin's dependencies are loaded.
if(!this.plugins.keySet().containsAll(List.of(pluginData.getDependencies()))) {
if (!this.plugins.keySet().containsAll(List.of(pluginData.getDependencies()))) {
depth++; // Increase depth counter.
continue; // Continue to next plugin.
}
......
......@@ -45,8 +45,8 @@ public class SceneBlock {
pos.getZ() <= this.max.getZ() && pos.getZ() >= this.min.getZ();
}
public SceneBlock load(int sceneId, Bindings bindings){
if(this.loaded){
public SceneBlock load(int sceneId, Bindings bindings) {
if (this.loaded) {
return this;
}
this.sceneId = sceneId;
......
......@@ -75,8 +75,8 @@ public class SceneGroup {
return this.bindings;
}
public synchronized SceneGroup load(int sceneId){
if(this.loaded){
public synchronized SceneGroup load(int sceneId) {
if (this.loaded) {
return this;
}
// Set flag here so if there is no script, we don't call this function over and over again.
......
......@@ -33,7 +33,7 @@ public class SceneMeta {
return new SceneMeta().load(sceneId);
}
public SceneMeta load(int sceneId){
public SceneMeta load(int sceneId) {
// Get compiled script if cached
CompiledScript cs = ScriptLoader.getScriptByPath(
SCRIPT("Scene/" + sceneId + "/scene" + sceneId + "." + ScriptLoader.getScriptType()));
......
......@@ -150,11 +150,11 @@ public final class GameServer extends KcpServer {
this.chatManager = chatManager;
}
private static InetSocketAddress getAdapterInetSocketAddress(){
private static InetSocketAddress getAdapterInetSocketAddress() {
InetSocketAddress inetSocketAddress;
if(GAME_INFO.bindAddress.equals("")){
if (GAME_INFO.bindAddress.equals("")) {
inetSocketAddress=new InetSocketAddress(GAME_INFO.bindPort);
}else{
}else {
inetSocketAddress=new InetSocketAddress(
GAME_INFO.bindAddress,
GAME_INFO.bindPort
......
......@@ -84,7 +84,7 @@ public class GameServerPacketHandler {
// Invoke event.
ReceivePacketEvent event = new ReceivePacketEvent(session, opcode, payload); event.call();
if(!event.isCanceled()) // If event is not canceled, continue.
if (!event.isCanceled()) // If event is not canceled, continue.
handler.handle(session, header, event.getPacketData());
} catch (Exception ex) {
// TODO Remove this when no more needed
......
......@@ -45,9 +45,9 @@ public class GameSession implements GameSessionManager.KcpChannel {
}
public InetSocketAddress getAddress() {
try{
try {
return tunnel.getAddress();
}catch (Throwable ignore){
}catch (Throwable ignore) {
return null;
}
}
......@@ -138,7 +138,7 @@ public class GameSession implements GameSessionManager.KcpChannel {
// DO NOT REMOVE (unless we find a way to validate code before sending to client which I don't think we can)
// Stop WindSeedClientNotify from being sent for security purposes.
if(PacketOpcodesUtils.BANNED_PACKETS.contains(packet.getOpcode())) {
if (PacketOpcodesUtils.BANNED_PACKETS.contains(packet.getOpcode())) {
return;
}
......@@ -169,7 +169,7 @@ public class GameSession implements GameSessionManager.KcpChannel {
// Invoke event.
SendPacketEvent event = new SendPacketEvent(this, packet); event.call();
if(!event.isCanceled()) { // If event is not cancelled, continue.
if (!event.isCanceled()) { // If event is not cancelled, continue.
tunnel.writeData(event.getPacket().build());
}
}
......@@ -200,7 +200,7 @@ public class GameSession implements GameSessionManager.KcpChannel {
// Packet sanity check
int const1 = packet.readShort();
if (const1 != 17767) {
if(allDebug){
if (allDebug) {
Grasscutter.getLogger().error("Bad Data Package Received: got {} ,expect 17767",const1);
}
return; // Bad packet
......@@ -217,7 +217,7 @@ public class GameSession implements GameSessionManager.KcpChannel {
// Sanity check #2
int const2 = packet.readShort();
if (const2 != -30293) {
if(allDebug){
if (allDebug) {
Grasscutter.getLogger().error("Bad Data Package Received: got {} ,expect -30293",const2);
}
return; // Bad packet
......@@ -267,7 +267,7 @@ public class GameSession implements GameSessionManager.KcpChannel {
}
try {
send(new BasePacket(PacketOpcodes.ServerDisconnectClientNotify));
}catch (Throwable ignore){
}catch (Throwable ignore) {
Grasscutter.getLogger().warn("closing {} error",getAddress().getAddress().getHostAddress());
}
tunnel = null;
......
......@@ -35,7 +35,7 @@ public final class HttpServer {
config.enforceSsl = HTTP_ENCRYPTION.useEncryption;
// Configure HTTP policies.
if(HTTP_POLICIES.cors.enabled) {
if (HTTP_POLICIES.cors.enabled) {
var allowedOrigins = HTTP_POLICIES.cors.allowedOrigins;
if (allowedOrigins.length > 0)
config.enableCorsForOrigin(allowedOrigins);
......@@ -43,7 +43,7 @@ public final class HttpServer {
}
// Configure debug logging.
if(DISPATCH_INFO.logRequests == ServerDebugMode.ALL)
if (DISPATCH_INFO.logRequests == ServerDebugMode.ALL)
config.enableDevLogging();
// Disable compression on static files.
......@@ -61,11 +61,11 @@ public final class HttpServer {
ServerConnector serverConnector
= new ServerConnector(server);
if(HTTP_ENCRYPTION.useEncryption) {
if (HTTP_ENCRYPTION.useEncryption) {
var sslContextFactory = new SslContextFactory.Server();
var keystoreFile = new File(HTTP_ENCRYPTION.keystore);
if(!keystoreFile.exists()) {
if (!keystoreFile.exists()) {
HTTP_ENCRYPTION.useEncryption = false;
HTTP_ENCRYPTION.useInRouting = false;
......@@ -112,7 +112,7 @@ public final class HttpServer {
public HttpServer addRouter(Class<? extends Router> router, Object... args) {
// Get all constructor parameters.
Class<?>[] types = new Class<?>[args.length];
for(var argument : args)
for (var argument : args)
types[args.length - 1] = argument.getClass();
try { // Create a router instance & apply routes.
......@@ -130,9 +130,9 @@ public final class HttpServer {
*/
public void start() throws UnsupportedEncodingException {
// Attempt to start the HTTP server.
if(HTTP_INFO.bindAddress.equals("")){
if (HTTP_INFO.bindAddress.equals("")) {
this.express.listen(HTTP_INFO.bindPort);
}else{
}else {
this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort);
}
......@@ -147,7 +147,7 @@ public final class HttpServer {
@Override public void applyRoutes(Express express, Javalin handle) {
express.get("/", (request, response) -> {
File file = new File(HTTP_STATIC_FILES.indexFile);
if(!file.exists())
if (!file.exists())
response.send("""
<!DOCTYPE html>
<html>
......@@ -173,12 +173,12 @@ public final class HttpServer {
public static class UnhandledRequestRouter implements Router {
@Override public void applyRoutes(Express express, Javalin handle) {
handle.error(404, context -> {
if(DISPATCH_INFO.logRequests == ServerDebugMode.MISSING)
if (DISPATCH_INFO.logRequests == ServerDebugMode.MISSING)
Grasscutter.getLogger().info(translate("messages.dispatch.unhandled_request_error", context.method(), context.url()));
context.contentType("text/html");
File file = new File(HTTP_STATIC_FILES.errorFile);
if(!file.exists())
if (!file.exists())
context.result("""
<!DOCTYPE html>
<html>
......
......@@ -60,7 +60,7 @@ public final class RegionHandler implements Router {
List<String> usedNames = new ArrayList<>(); // List to check for potential naming conflicts.
var configuredRegions = new ArrayList<>(List.of(DISPATCH_INFO.regions));
if(SERVER.runMode != ServerRunMode.HYBRID && configuredRegions.size() == 0) {
if (SERVER.runMode != ServerRunMode.HYBRID && configuredRegions.size() == 0) {
Grasscutter.getLogger().error("[Dispatch] There are no game servers available. Exiting due to unplayable state.");
System.exit(1);
} else if (configuredRegions.size() == 0)
......@@ -136,11 +136,11 @@ public final class RegionHandler implements Router {
// Get region data.
String regionData = "CAESGE5vdCBGb3VuZCB2ZXJzaW9uIGNvbmZpZw==";
if (request.query().values().size() > 0) {
if(region != null)
if (region != null)
regionData = region.getBase64();
}
if( versionName.contains("2.7.5") || versionName.contains("2.8.")) {
if ( versionName.contains("2.7.5") || versionName.contains("2.8.")) {
try {
QueryCurrentRegionEvent event = new QueryCurrentRegionEvent(regionData); event.call();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment