SteamWar/BungeeCore
Archiviert
13
2

english #354

Zusammengeführt
Lixfel hat 21 Commits von english nach master 2022-05-24 10:15:41 +02:00 zusammengeführt
4 geänderte Dateien mit 60 neuen und 1 gelöschten Zeilen
Nur Änderungen aus Commit 8aed828f82 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -158,6 +158,7 @@ public class BungeeCore extends Plugin {
new SessionManager();
new SpigotReceiver();
new TablistManager();
new SettingsChangedListener();
getProxy().getScheduler().schedule(this, () -> {
SteamwarUser.clearCache();

Datei anzeigen

@ -61,6 +61,14 @@ public class ConnectionListener extends BasicListener {
ProxiedPlayer player = event.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if (!user.isManualLocale()) {
Locale locale = player.getLocale();
YoyoNow markierte diese Unterhaltung als gelöst Veraltet
Veraltet
Review

Hier hast du definitiv noch keine Locale vorliegen, es reicht vollkommen auf das SettingsChangedEvent zu warten

Hier hast du definitiv noch keine Locale vorliegen, es reicht vollkommen auf das SettingsChangedEvent zu warten
if (locale == null) {
locale = Locale.getDefault();
}
user.setLocale(locale, false);
}
player.removeGroups("Admin", "team");
if(user.getUserGroup().isAdminGroup())

Datei anzeigen

@ -0,0 +1,46 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.SettingsChangedEvent;
import net.md_5.bungee.event.EventHandler;
import java.util.Locale;
public class SettingsChangedListener extends BasicListener {
@EventHandler
public void onSettingsChanged(SettingsChangedEvent event) {
ProxiedPlayer player = event.getPlayer();
SteamwarUser steamwarUser = SteamwarUser.get(player);
if (steamwarUser.isManualLocale())
return;
Locale locale = player.getLocale();
if (locale == null) {
locale = Locale.getDefault();
}
steamwarUser.setLocale(locale, false);
}
}

Datei anzeigen

@ -389,9 +389,13 @@ public class SteamwarUser {
}
public void setLocale(Locale locale, boolean manualLocale) {
if (this.locale.equals(locale) && this.manualLocale == manualLocale)
return;
boolean needsUpdate = !this.locale.equals(locale);
this.locale = locale;
this.manualLocale = manualLocale;
updateLocale.update(locale.getLanguage(), manualLocale, id);
new LocaleInvalidationPacket(id).send(getPlayer());
if (needsUpdate)
new LocaleInvalidationPacket(id).send(getPlayer());
}
}