mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-29 07:07:05 +00:00
Format code [skip actions]
This commit is contained in:
parent
f277f59725
commit
07205d9a3a
@ -1,5 +1,8 @@
|
|||||||
package emu.grasscutter.auth;
|
package emu.grasscutter.auth;
|
||||||
|
|
||||||
|
import static emu.grasscutter.config.Configuration.ACCOUNT;
|
||||||
|
import static emu.grasscutter.utils.lang.Language.translate;
|
||||||
|
|
||||||
import at.favre.lib.crypto.bcrypt.BCrypt;
|
import at.favre.lib.crypto.bcrypt.BCrypt;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.Grasscutter.ServerRunMode;
|
import emu.grasscutter.Grasscutter.ServerRunMode;
|
||||||
@ -14,17 +17,13 @@ import emu.grasscutter.utils.DispatchUtils;
|
|||||||
import emu.grasscutter.utils.FileUtils;
|
import emu.grasscutter.utils.FileUtils;
|
||||||
import emu.grasscutter.utils.Utils;
|
import emu.grasscutter.utils.Utils;
|
||||||
import io.javalin.http.ContentType;
|
import io.javalin.http.ContentType;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.KeyFactory;
|
import java.security.KeyFactory;
|
||||||
import java.security.interfaces.RSAPrivateKey;
|
import java.security.interfaces.RSAPrivateKey;
|
||||||
import java.security.spec.PKCS8EncodedKeySpec;
|
import java.security.spec.PKCS8EncodedKeySpec;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.crypto.Cipher;
|
||||||
import static emu.grasscutter.config.Configuration.ACCOUNT;
|
|
||||||
import static emu.grasscutter.utils.lang.Language.translate;
|
|
||||||
|
|
||||||
/** A class containing default authenticators. */
|
/** A class containing default authenticators. */
|
||||||
public final class DefaultAuthenticators {
|
public final class DefaultAuthenticators {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package emu.grasscutter.server.http.dispatch;
|
package emu.grasscutter.server.http.dispatch;
|
||||||
|
|
||||||
|
import static emu.grasscutter.utils.lang.Language.translate;
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.auth.AuthenticationSystem;
|
import emu.grasscutter.auth.AuthenticationSystem;
|
||||||
import emu.grasscutter.auth.OAuthAuthenticator.ClientType;
|
import emu.grasscutter.auth.OAuthAuthenticator.ClientType;
|
||||||
@ -13,8 +15,6 @@ import emu.grasscutter.utils.Utils;
|
|||||||
import io.javalin.Javalin;
|
import io.javalin.Javalin;
|
||||||
import io.javalin.http.Context;
|
import io.javalin.http.Context;
|
||||||
|
|
||||||
import static emu.grasscutter.utils.lang.Language.translate;
|
|
||||||
|
|
||||||
/** Handles requests related to authentication. */
|
/** Handles requests related to authentication. */
|
||||||
public final class AuthenticationHandler implements Router {
|
public final class AuthenticationHandler implements Router {
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,8 @@ public final class AuthenticationHandler implements Router {
|
|||||||
ctx.json(responseData);
|
ctx.json(responseData);
|
||||||
|
|
||||||
// Log to console.
|
// Log to console.
|
||||||
Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx)));
|
Grasscutter.getLogger()
|
||||||
|
.info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +61,8 @@ public final class AuthenticationHandler implements Router {
|
|||||||
ctx.json(responseData);
|
ctx.json(responseData);
|
||||||
|
|
||||||
// Log to console.
|
// Log to console.
|
||||||
Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx)));
|
Grasscutter.getLogger()
|
||||||
|
.info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +88,8 @@ public final class AuthenticationHandler implements Router {
|
|||||||
ctx.json(responseData);
|
ctx.json(responseData);
|
||||||
|
|
||||||
// Log to console.
|
// Log to console.
|
||||||
Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx)));
|
Grasscutter.getLogger()
|
||||||
|
.info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package emu.grasscutter.server.http.dispatch;
|
package emu.grasscutter.server.http.dispatch;
|
||||||
|
|
||||||
|
import static emu.grasscutter.config.Configuration.*;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
@ -21,15 +23,12 @@ import emu.grasscutter.utils.JsonUtils;
|
|||||||
import emu.grasscutter.utils.Utils;
|
import emu.grasscutter.utils.Utils;
|
||||||
import io.javalin.Javalin;
|
import io.javalin.Javalin;
|
||||||
import io.javalin.http.Context;
|
import io.javalin.http.Context;
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import static emu.grasscutter.config.Configuration.*;
|
|
||||||
|
|
||||||
/** Handles requests related to region queries. */
|
/** Handles requests related to region queries. */
|
||||||
public final class RegionHandler implements Router {
|
public final class RegionHandler implements Router {
|
||||||
@ -314,7 +313,9 @@ public final class RegionHandler implements Router {
|
|||||||
}
|
}
|
||||||
// Log to console.
|
// Log to console.
|
||||||
Grasscutter.getLogger()
|
Grasscutter.getLogger()
|
||||||
.info(String.format("Client %s request: query_cur_region/%s", Utils.address(ctx), regionName));
|
.info(
|
||||||
|
String.format(
|
||||||
|
"Client %s request: query_cur_region/%s", Utils.address(ctx), regionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Region data container. */
|
/** Region data container. */
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
package emu.grasscutter.server.http.objects;
|
package emu.grasscutter.server.http.objects;
|
||||||
|
|
||||||
|
import static emu.grasscutter.config.Configuration.DISPATCH_INFO;
|
||||||
|
import static emu.grasscutter.utils.lang.Language.translate;
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.Grasscutter.ServerDebugMode;
|
import emu.grasscutter.Grasscutter.ServerDebugMode;
|
||||||
import emu.grasscutter.utils.Utils;
|
import emu.grasscutter.utils.Utils;
|
||||||
import io.javalin.http.Context;
|
import io.javalin.http.Context;
|
||||||
import io.javalin.http.Handler;
|
import io.javalin.http.Handler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import static emu.grasscutter.config.Configuration.DISPATCH_INFO;
|
|
||||||
import static emu.grasscutter.utils.lang.Language.translate;
|
|
||||||
|
|
||||||
public final class HttpJsonResponse implements Handler {
|
public final class HttpJsonResponse implements Handler {
|
||||||
private final String response;
|
private final String response;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package emu.grasscutter.utils;
|
package emu.grasscutter.utils;
|
||||||
|
|
||||||
|
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
||||||
|
import static emu.grasscutter.utils.lang.Language.translate;
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.config.ConfigContainer;
|
import emu.grasscutter.config.ConfigContainer;
|
||||||
import emu.grasscutter.data.DataLoader;
|
import emu.grasscutter.data.DataLoader;
|
||||||
@ -10,9 +13,6 @@ import io.netty.buffer.ByteBufUtil;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -24,9 +24,8 @@ import java.time.ZonedDateTime;
|
|||||||
import java.time.temporal.TemporalAdjusters;
|
import java.time.temporal.TemporalAdjusters;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
import org.slf4j.Logger;
|
||||||
import static emu.grasscutter.utils.lang.Language.translate;
|
|
||||||
|
|
||||||
@SuppressWarnings({"UnusedReturnValue", "BooleanMethodIsAlwaysInverted"})
|
@SuppressWarnings({"UnusedReturnValue", "BooleanMethodIsAlwaysInverted"})
|
||||||
public final class Utils {
|
public final class Utils {
|
||||||
|
Loading…
Reference in New Issue
Block a user