This repository has been archived by the owner on Aug 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mdxd44
committed
Aug 13, 2021
1 parent
a3acac5
commit 4aa2677
Showing
8 changed files
with
152 additions
and
342 deletions.
There are no files selected for viewing
Submodule Velocity
updated
from f79736 to d3ff6f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,56 @@ | ||
From 66b37b548fa8648cbba843508a225998ba6cbebb Mon Sep 17 00:00:00 2001 | ||
From 28e877fad8d693efbaac1074bbfe767e8f788faf Mon Sep 17 00:00:00 2001 | ||
From: mdxd44 <[email protected]> | ||
Date: Mon, 7 Jun 2021 04:45:40 +0900 | ||
Subject: [PATCH] Move Messages Section To ElytraProxy Config | ||
|
||
|
||
diff --git a/api/src/main/java/com/velocitypowered/api/proxy/Player.java b/api/src/main/java/com/velocitypowered/api/proxy/Player.java | ||
index 76278f90..bad86d0a 100644 | ||
--- a/api/src/main/java/com/velocitypowered/api/proxy/Player.java | ||
+++ b/api/src/main/java/com/velocitypowered/api/proxy/Player.java | ||
@@ -46,22 +46,26 @@ public interface Player extends CommandSource, Identified, InboundConnection, | ||
*/ | ||
String getUsername(); | ||
|
||
- /** | ||
- * Returns the locale the proxy will use to send messages translated via the Adventure global translator. | ||
- * By default, the value of {@link PlayerSettings#getLocale()} is used. | ||
- * | ||
- * <p>This can be {@code null} when the client has not yet connected to any server.</p> | ||
- * | ||
- * @return the locale. | ||
- */ | ||
- @Nullable Locale getEffectiveLocale(); | ||
- | ||
- /** | ||
- * Change the locale the proxy will be translating its messages to. | ||
- * | ||
- * @param locale the locale to translate to | ||
- */ | ||
- void setEffectiveLocale(Locale locale); | ||
+ // ElytraProxy Start: Removed as unnecessary | ||
+ | ||
+ ///** | ||
+ // * Returns the locale the proxy will use to send messages translated via the Adventure global translator. | ||
+ // * By default, the value of {@link PlayerSettings#getLocale()} is used. | ||
+ // * | ||
+ // * <p>This can be {@code null} when the client has not yet connected to any server.</p> | ||
+ // * | ||
+ // * @return the locale. | ||
+ // */ | ||
+ //@Nullable Locale getEffectiveLocale(); | ||
+ | ||
+ ///** | ||
+ // * Change the locale the proxy will be translating its messages to. | ||
+ // * | ||
+ // * @param locale the locale to translate to | ||
+ // */ | ||
+ //void setEffectiveLocale(Locale locale); | ||
+ | ||
+ // ElytraProxy End | ||
|
||
/** | ||
* Returns the player's UUID. | ||
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml | ||
index 083337a8..76a9665e 100644 | ||
--- a/config/checkstyle/checkstyle.xml | ||
|
@@ -370,7 +417,7 @@ index 9f408310..227ea644 100644 | |
private final VelocityServer server; | ||
private final VelocityServerConnection serverConn; | ||
diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java | ||
index c07ac639..0ebf62e5 100644 | ||
index 2d2c7908..81cf1a4b 100644 | ||
--- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java | ||
+++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java | ||
@@ -69,8 +69,6 @@ import java.util.Queue; | ||
|
@@ -447,7 +494,7 @@ index c07ac639..0ebf62e5 100644 | |
} | ||
|
||
@Override | ||
@@ -597,7 +613,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { | ||
@@ -600,7 +616,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { | ||
}, player.getConnection().eventLoop()) | ||
.exceptionally((ex) -> { | ||
logger.error( | ||
|
@@ -457,26 +504,18 @@ index c07ac639..0ebf62e5 100644 | |
return null; | ||
}); | ||
diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java | ||
index 10d05c8b..68ac3abb 100644 | ||
index 24d203b1..59bd0fab 100644 | ||
--- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java | ||
+++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java | ||
@@ -48,7 +48,6 @@ import com.velocitypowered.api.proxy.server.RegisteredServer; | ||
import com.velocitypowered.api.util.GameProfile; | ||
import com.velocitypowered.api.util.ModInfo; | ||
import com.velocitypowered.proxy.VelocityServer; | ||
-import com.velocitypowered.proxy.config.VelocityConfiguration; | ||
import com.velocitypowered.proxy.connection.MinecraftConnection; | ||
import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation; | ||
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; | ||
@@ -93,7 +92,6 @@ import net.kyori.adventure.permission.PermissionChecker; | ||
@@ -91,7 +91,6 @@ import net.kyori.adventure.permission.PermissionChecker; | ||
import net.kyori.adventure.pointer.Pointers; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.TranslatableComponent; | ||
-import net.kyori.adventure.text.format.NamedTextColor; | ||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; | ||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; | ||
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; | ||
@@ -106,12 +104,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; | ||
@@ -102,12 +101,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.jetbrains.annotations.NotNull; | ||
|
@@ -490,7 +529,44 @@ index 10d05c8b..68ac3abb 100644 | |
static final PermissionProvider DEFAULT_PERMISSIONS = s -> PermissionFunction.ALWAYS_UNDEFINED; | ||
|
||
private static final Logger logger = LogManager.getLogger(ConnectedPlayer.class); | ||
@@ -500,15 +497,23 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
@@ -145,7 +143,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
.withStatic(PermissionChecker.POINTER, getPermissionChecker()) | ||
.build(); | ||
private @Nullable String clientBrand; | ||
- private @Nullable Locale effectiveLocale; | ||
+ // ElytraProxy: Removed as unnecessary | ||
+ //private @Nullable Locale effectiveLocale; | ||
|
||
ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection, | ||
@Nullable InetSocketAddress virtualHost, boolean onlineMode) { | ||
@@ -175,6 +174,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
return profile.getName(); | ||
} | ||
|
||
+ // ElytraProxy: Removed as unnecessary | ||
+ /* | ||
@Override | ||
public Locale getEffectiveLocale() { | ||
if (effectiveLocale == null && settings != null) { | ||
@@ -187,6 +188,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
public void setEffectiveLocale(Locale locale) { | ||
effectiveLocale = locale; | ||
} | ||
+ */ | ||
|
||
@Override | ||
public UUID getUniqueId() { | ||
@@ -286,7 +288,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
*/ | ||
public Component translateMessage(Component message) { | ||
Locale locale = ClosestLocaleMatcher.INSTANCE | ||
- .lookupClosest(getEffectiveLocale() == null ? Locale.getDefault() : getEffectiveLocale()); | ||
+ // ElytraProxy: Removed as unnecessary | ||
+ .lookupClosest(/*getEffectiveLocale()*/this.settings == null ? Locale.getDefault() : /*getEffectiveLocale()*/this.settings.getLocale()); | ||
return GlobalTranslator.render(message, locale); | ||
} | ||
|
||
@@ -510,15 +513,23 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
|
||
Component friendlyError; | ||
if (connectedServer != null && connectedServer.getServerInfo().equals(server.getServerInfo())) { | ||
|
@@ -519,7 +595,7 @@ index 10d05c8b..68ac3abb 100644 | |
} | ||
|
||
/** | ||
@@ -525,21 +530,42 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
@@ -535,21 +546,42 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
} | ||
|
||
Component disconnectReason = GsonComponentSerializer.gson().deserialize(disconnect.getReason()); | ||
|
@@ -571,34 +647,6 @@ index 10d05c8b..68ac3abb 100644 | |
} | ||
} | ||
|
||
@@ -627,14 +653,19 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
getProtocolVersion()), ((Impl) status).isSafe()); | ||
break; | ||
case SUCCESS: | ||
- Component requestedMessage = res.getMessageComponent(); | ||
- if (requestedMessage == null) { | ||
- requestedMessage = Component.translatable("velocity.error.moved-to-new-server", | ||
- NamedTextColor.RED, | ||
- Component.text(originalEvent.getServer().getServerInfo().getName()), | ||
- friendlyReason); | ||
- } | ||
- sendMessage(requestedMessage); | ||
+ sendMessage(Identity.nil(), | ||
+ LegacyComponentSerializer | ||
+ .legacyAmpersand() | ||
+ .deserialize(( | ||
+ Settings.IMP.MESSAGES.VELOCITY.ERROR.MOVED_TO_NEW_SERVER) | ||
+ .replace("%nl%","\n") | ||
+ .replace("{0}", originalEvent.getServer() | ||
+ .getServerInfo().getName()) | ||
+ .replace("{1}", | ||
+ LegacyComponentSerializer | ||
+ .legacySection() | ||
+ .serialize( | ||
+ friendlyReason)))); | ||
break; | ||
default: | ||
// The only remaining value is successful (no need to do anything!) | ||
diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java | ||
index 12b6f38f..ed8765e1 100644 | ||
--- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
From 5d16213609b4620b7d082d1bb538da6d3d3f0538 Mon Sep 17 00:00:00 2001 | ||
From 0cee0df0babf85dfaff5920a2189cb26ca0d2e0d Mon Sep 17 00:00:00 2001 | ||
From: mdxd44 <[email protected]> | ||
Date: Thu, 17 Jun 2021 04:09:51 +0900 | ||
Subject: [PATCH] Merge botfilter upstream, checkstyle fixes, settings and | ||
brand checks | ||
|
||
|
||
diff --git a/api/build.gradle b/api/build.gradle | ||
index 88036f3a..c4f10d2c 100644 | ||
index 6fc5999b..34832fdc 100644 | ||
--- a/api/build.gradle | ||
+++ b/api/build.gradle | ||
@@ -37,6 +37,11 @@ dependencies { | ||
|
@@ -21,7 +21,7 @@ index 88036f3a..c4f10d2c 100644 | |
api "org.slf4j:slf4j-api:${slf4jVersion}" | ||
api 'com.google.inject:guice:5.0.1' | ||
api "org.checkerframework:checker-qual:${checkerFrameworkVersion}" | ||
@@ -83,7 +88,7 @@ javadoc { | ||
@@ -86,7 +91,7 @@ javadoc { | ||
'http://www.slf4j.org/apidocs/', | ||
'https://google.github.io/guava/releases/25.1-jre/api/docs/', | ||
'https://google.github.io/guice/api-docs/5.0.1/javadoc/', | ||
|
@@ -386,7 +386,7 @@ index 227ea644..298552e3 100644 | |
private final VelocityServer server; | ||
private final VelocityServerConnection serverConn; | ||
diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java | ||
index db97ab23..f69cf6b7 100644 | ||
index 81cf1a4b..c9b18041 100644 | ||
--- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java | ||
+++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java | ||
@@ -27,13 +27,11 @@ import com.velocitypowered.api.event.command.CommandExecuteEvent.CommandResult; | ||
|
@@ -634,10 +634,10 @@ index db97ab23..f69cf6b7 100644 | |
|
||
@Override | ||
diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java | ||
index 68ac3abb..78e5bc63 100644 | ||
index 59bd0fab..2f537859 100644 | ||
--- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java | ||
+++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java | ||
@@ -498,20 +498,22 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
@@ -514,20 +514,22 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
Component friendlyError; | ||
if (connectedServer != null && connectedServer.getServerInfo().equals(server.getServerInfo())) { | ||
friendlyError = LegacyComponentSerializer | ||
|
@@ -670,7 +670,7 @@ index 68ac3abb..78e5bc63 100644 | |
} | ||
handleConnectionException(server, null, friendlyError, safe); | ||
} | ||
@@ -532,40 +534,46 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
@@ -548,40 +550,46 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
Component disconnectReason = GsonComponentSerializer.gson().deserialize(disconnect.getReason()); | ||
if (connectedServer != null && connectedServer.getServerInfo().equals(server.getServerInfo())) { | ||
logger.info("{}: kicked from server {}: {}", this, server.getServerInfo().getName(), | ||
|
@@ -744,40 +744,6 @@ index 68ac3abb..78e5bc63 100644 | |
} | ||
} | ||
|
||
@@ -654,18 +662,21 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { | ||
break; | ||
case SUCCESS: | ||
sendMessage(Identity.nil(), | ||
- LegacyComponentSerializer | ||
- .legacyAmpersand() | ||
- .deserialize(( | ||
- Settings.IMP.MESSAGES.VELOCITY.ERROR.MOVED_TO_NEW_SERVER) | ||
- .replace("%nl%","\n") | ||
- .replace("{0}", originalEvent.getServer() | ||
- .getServerInfo().getName()) | ||
- .replace("{1}", | ||
- LegacyComponentSerializer | ||
- .legacySection() | ||
- .serialize( | ||
- friendlyReason)))); | ||
+ LegacyComponentSerializer | ||
+ .legacyAmpersand() | ||
+ .deserialize(( | ||
+ Settings.IMP.MESSAGES.VELOCITY.ERROR.MOVED_TO_NEW_SERVER) | ||
+ .replace("%nl%","\n") | ||
+ .replace("{0}", originalEvent | ||
+ .getServer() | ||
+ .getServerInfo() | ||
+ .getName()) | ||
+ .replace("{1}", | ||
+ LegacyComponentSerializer | ||
+ .legacySection() | ||
+ .serialize( | ||
+ friendlyReason)) | ||
+ )); | ||
break; | ||
default: | ||
// The only remaining value is successful (no need to do anything!) | ||
diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java | ||
index ed8765e1..5914c277 100644 | ||
--- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java | ||
|
Oops, something went wrong.