english #354
@ -158,6 +158,7 @@ public class BungeeCore extends Plugin {
|
||||
new SessionManager();
|
||||
new SpigotReceiver();
|
||||
new TablistManager();
|
||||
new SettingsChangedListener();
|
||||
|
||||
getProxy().getScheduler().schedule(this, () -> {
|
||||
SteamwarUser.clearCache();
|
||||
|
@ -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
|
||||
if (locale == null) {
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
user.setLocale(locale, false);
|
||||
}
|
||||
|
||||
player.removeGroups("Admin", "team");
|
||||
|
||||
if(user.getUserGroup().isAdminGroup())
|
||||
|
46
src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java
Normale Datei
46
src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java
Normale Datei
@ -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);
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Hier hast du definitiv noch keine Locale vorliegen, es reicht vollkommen auf das SettingsChangedEvent zu warten