3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

Checkstyle and friends

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-06-27 21:18:52 -04:00
Ursprung 254e8f1a1e
Commit 1f7d14f6d1
4 geänderte Dateien mit 29 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -42,7 +42,7 @@
<property name="allowNonPrintableEscapes" value="true"/> <property name="allowNonPrintableEscapes" value="true"/>
</module> </module>
<module name="LineLength"> <module name="LineLength">
<property name="max" value="100"/> <property name="max" value="120"/>
<property name="ignorePattern" <property name="ignorePattern"
value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module> </module>

Datei anzeigen

@ -118,7 +118,6 @@ public class ServerCommand implements SimpleCommand {
playersTextComponent = Component.translatable("velocity.command.server-tooltip-players-online"); playersTextComponent = Component.translatable("velocity.command.server-tooltip-players-online");
} }
playersTextComponent = playersTextComponent.args(Component.text(connectedPlayers)); playersTextComponent = playersTextComponent.args(Component.text(connectedPlayers));
String playersText = server.getPlayersConnected().size() + " player(s) online";
if (serverInfo.getName().equals(currentPlayerServer)) { if (serverInfo.getName().equals(currentPlayerServer)) {
serverTextComponent = serverTextComponent.color(NamedTextColor.GREEN) serverTextComponent = serverTextComponent.color(NamedTextColor.GREEN)
.hoverEvent( .hoverEvent(

Datei anzeigen

@ -268,6 +268,12 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
return connection.getProtocolVersion(); return connection.getProtocolVersion();
} }
/**
* Translates the message in the user's locale.
*
* @param message the message to translate
* @return the translated message
*/
public Component translateMessage(Component message) { public Component translateMessage(Component message) {
Locale locale = ClosestLocaleMatcher.INSTANCE Locale locale = ClosestLocaleMatcher.INSTANCE
.lookupClosest(this.settings == null ? Locale.getDefault() : this.settings.getLocale()); .lookupClosest(this.settings == null ? Locale.getDefault() : this.settings.getLocale());

Datei anzeigen

@ -1,3 +1,20 @@
/*
* Copyright (C) 2018 Velocity Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.velocitypowered.proxy.util; package com.velocitypowered.proxy.util;
import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.Caffeine;
@ -21,6 +38,11 @@ public class ClosestLocaleMatcher {
}); });
} }
/**
* Registers a known locale.
*
* @param locale locale to register
*/
public void registerKnown(final Locale locale) { public void registerKnown(final Locale locale) {
if (locale.getLanguage().equals(new Locale("zh").getLanguage())) { if (locale.getLanguage().equals(new Locale("zh").getLanguage())) {
return; return;