mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 20:03:21 +00:00
Format code [skip actions]
This commit is contained in:
parent
8c0045a8d7
commit
ff124095bb
@ -41,15 +41,14 @@ import emu.grasscutter.server.packet.send.*;
|
||||
import emu.grasscutter.utils.KahnsSort;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.val;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.val;
|
||||
|
||||
public final class Scene {
|
||||
@Getter private final World world;
|
||||
|
@ -1,15 +1,13 @@
|
||||
package emu.grasscutter.plugin;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.server.event.Event;
|
||||
import emu.grasscutter.server.event.EventHandler;
|
||||
import emu.grasscutter.server.event.HandlerPriority;
|
||||
import emu.grasscutter.utils.FileUtils;
|
||||
import emu.grasscutter.utils.JsonUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStreamReader;
|
||||
@ -20,8 +18,9 @@ import java.net.URLClassLoader;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/** Manages the server's plugins and the event system. */
|
||||
public final class PluginManager {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package emu.grasscutter.server.http.documentation;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.HANDBOOK;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.Grasscutter.ServerRunMode;
|
||||
import emu.grasscutter.data.GameData;
|
||||
@ -11,11 +13,8 @@ import emu.grasscutter.utils.FileUtils;
|
||||
import emu.grasscutter.utils.objects.HandbookBody;
|
||||
import io.javalin.Javalin;
|
||||
import io.javalin.http.Context;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.HANDBOOK;
|
||||
|
||||
/** Handles requests for the new GM Handbook. */
|
||||
public final class HandbookHandler implements Router {
|
||||
private final byte[] handbook;
|
||||
@ -103,8 +102,7 @@ public final class HandbookHandler implements Router {
|
||||
var avatar = new Avatar(avatarData);
|
||||
avatar.setLevel(request.getLevel());
|
||||
avatar.setPromoteLevel(Avatar.getMinPromoteLevel(avatar.getLevel()));
|
||||
Objects.requireNonNull(avatar
|
||||
.getSkillDepot())
|
||||
Objects.requireNonNull(avatar.getSkillDepot())
|
||||
.getSkillsAndEnergySkill()
|
||||
.forEach(id -> avatar.setSkillLevel(id, request.getTalentLevels()));
|
||||
avatar.forceConstellationLevel(request.getConstellations());
|
||||
@ -215,8 +213,7 @@ public final class HandbookHandler implements Router {
|
||||
var position = scene.getDefaultLocation(player);
|
||||
var rotation = scene.getDefaultRotation(player);
|
||||
// Teleport the player.
|
||||
scene.getWorld().transferPlayerToScene(
|
||||
player, scene.getId(), position);
|
||||
scene.getWorld().transferPlayerToScene(player, scene.getId(), position);
|
||||
player.getRotation().set(rotation);
|
||||
|
||||
ctx.json(HandbookBody.Response.builder().status(200).message("Player teleported.").build());
|
||||
|
@ -1,5 +1,8 @@
|
||||
package emu.grasscutter.tools;
|
||||
|
||||
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
||||
import static emu.grasscutter.utils.Language.getTextMapKey;
|
||||
|
||||
import emu.grasscutter.GameConstants;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.command.CommandHandler;
|
||||
@ -17,10 +20,6 @@ import emu.grasscutter.utils.Language;
|
||||
import emu.grasscutter.utils.Language.TextStrings;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.val;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
@ -32,9 +31,9 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.LongStream;
|
||||
|
||||
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
||||
import static emu.grasscutter.utils.Language.getTextMapKey;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.val;
|
||||
|
||||
public final class Tools {
|
||||
/**
|
||||
@ -413,36 +412,37 @@ public final class Tools {
|
||||
var file = FileUtils.getResourcePath("resources.info");
|
||||
try (var reader = Files.newBufferedReader(file, StandardCharsets.UTF_8)) {
|
||||
var resourceInfo = ResourceInfo.builder();
|
||||
reader.lines().forEach(line -> {
|
||||
var split = line.split(":");
|
||||
if (split.length != 2) return;
|
||||
reader
|
||||
.lines()
|
||||
.forEach(
|
||||
line -> {
|
||||
var split = line.split(":");
|
||||
if (split.length != 2) return;
|
||||
|
||||
var key = split[0].trim();
|
||||
var value = split[1].trim();
|
||||
var key = split[0].trim();
|
||||
var value = split[1].trim();
|
||||
|
||||
// Apply the value to the correct field.
|
||||
switch (key) {
|
||||
case "repo" -> resourceInfo.repository(value);
|
||||
case "ver" -> resourceInfo.version(value);
|
||||
case "patches" -> resourceInfo.patches(value);
|
||||
case "scripts" -> resourceInfo.scripts(
|
||||
ScriptsType.valueOf(value.toUpperCase()));
|
||||
case "hasserverres" -> resourceInfo.hasServerResources(
|
||||
Boolean.parseBoolean(value));
|
||||
case "hasscenescriptdata" -> resourceInfo.hasSceneScriptData(
|
||||
Boolean.parseBoolean(value));
|
||||
}
|
||||
});
|
||||
// Apply the value to the correct field.
|
||||
switch (key) {
|
||||
case "repo" -> resourceInfo.repository(value);
|
||||
case "ver" -> resourceInfo.version(value);
|
||||
case "patches" -> resourceInfo.patches(value);
|
||||
case "scripts" -> resourceInfo.scripts(ScriptsType.valueOf(value.toUpperCase()));
|
||||
case "hasserverres" -> resourceInfo.hasServerResources(
|
||||
Boolean.parseBoolean(value));
|
||||
case "hasscenescriptdata" -> resourceInfo.hasSceneScriptData(
|
||||
Boolean.parseBoolean(value));
|
||||
}
|
||||
});
|
||||
|
||||
return resourceInfo.build();
|
||||
} catch (Exception ignored) {
|
||||
return new ResourceInfo(
|
||||
null, null, null,
|
||||
ScriptsType.UNKNOWN, false, false);
|
||||
return new ResourceInfo(null, null, null, ScriptsType.UNKNOWN, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@AllArgsConstructor @Builder
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class ResourceInfo {
|
||||
private final String repository;
|
||||
private final String version;
|
||||
|
Loading…
Reference in New Issue
Block a user