Dieser Commit ist enthalten in:
Ursprung
1204a5ccda
Commit
8aed828f82
@ -158,6 +158,7 @@ public class BungeeCore extends Plugin {
|
|||||||
new SessionManager();
|
new SessionManager();
|
||||||
new SpigotReceiver();
|
new SpigotReceiver();
|
||||||
new TablistManager();
|
new TablistManager();
|
||||||
|
new SettingsChangedListener();
|
||||||
|
|
||||||
getProxy().getScheduler().schedule(this, () -> {
|
getProxy().getScheduler().schedule(this, () -> {
|
||||||
SteamwarUser.clearCache();
|
SteamwarUser.clearCache();
|
||||||
|
@ -61,6 +61,14 @@ public class ConnectionListener extends BasicListener {
|
|||||||
ProxiedPlayer player = event.getPlayer();
|
ProxiedPlayer player = event.getPlayer();
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
|
||||||
|
if (!user.isManualLocale()) {
|
||||||
|
Locale locale = player.getLocale();
|
||||||
|
if (locale == null) {
|
||||||
|
locale = Locale.getDefault();
|
||||||
|
}
|
||||||
|
user.setLocale(locale, false);
|
||||||
|
}
|
||||||
|
|
||||||
player.removeGroups("Admin", "team");
|
player.removeGroups("Admin", "team");
|
||||||
|
|
||||||
if(user.getUserGroup().isAdminGroup())
|
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) {
|
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.locale = locale;
|
||||||
this.manualLocale = manualLocale;
|
this.manualLocale = manualLocale;
|
||||||
updateLocale.update(locale.getLanguage(), manualLocale, id);
|
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