SteamWar/SpigotCore
Archiviert
13
0

Merge pull request 'Fix player join 1.8 to 1.10' (#222) from fix-player-join into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #222
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2023-01-15 16:47:32 +01:00
Commit cd78778511
6 geänderte Dateien mit 88 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -43,6 +43,7 @@ sourceSets {
} }
dependencies { dependencies {
compileOnly project(':CommonCore')
compileOnly project(":SpigotCore_Main") compileOnly project(":SpigotCore_Main")
compileOnly swdep("Spigot-1.12") compileOnly swdep("Spigot-1.12")

Datei anzeigen

@ -0,0 +1,34 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 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.core;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerLocaleChangeEvent;
import java.util.Locale;
public class LocaleChangeWrapper12 implements LocaleChangeWrapper {
@EventHandler
private void onLocale(PlayerLocaleChangeEvent event) {
SteamwarUser.get(event.getPlayer().getUniqueId()).setLocale(Locale.forLanguageTag(event.getLocale()), false);
}
}

Datei anzeigen

@ -0,0 +1,24 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 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.core;
public class LocaleChangeWrapper8 implements LocaleChangeWrapper {
// Event not available in 1.8-1.10
}

Datei anzeigen

@ -110,6 +110,9 @@ public class Core extends JavaPlugin{
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this); Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this); Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this);
Bukkit.getPluginManager().registerEvents(new WorldLoadEvent(), this); Bukkit.getPluginManager().registerEvents(new WorldLoadEvent(), this);
if(!Statement.productionDatabase()) {
Bukkit.getPluginManager().registerEvents(LocaleChangeWrapper.impl, this);
}
getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new NetworkReceiver()); getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new NetworkReceiver());
getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge"); getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge");
if(Core.getVersion() < 19) if(Core.getVersion() < 19)

Datei anzeigen

@ -0,0 +1,26 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 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.core;
import org.bukkit.event.Listener;
public interface LocaleChangeWrapper extends Listener {
LocaleChangeWrapper impl = VersionDependent.getVersionImpl(Core.getInstance());
}

Datei anzeigen

@ -27,11 +27,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLocaleChangeEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import java.util.Locale;
public class PlayerJoinedEvent implements Listener{ public class PlayerJoinedEvent implements Listener{
@ -51,13 +48,6 @@ public class PlayerJoinedEvent implements Listener{
event.setJoinMessage("§a§l» §r" + player.getDisplayName()); event.setJoinMessage("§a§l» §r" + player.getDisplayName());
} }
@EventHandler
private void onLocale(PlayerLocaleChangeEvent event) {
if(!Statement.productionDatabase()) {
SteamwarUser.get(event.getPlayer().getUniqueId()).setLocale(Locale.forLanguageTag(event.getLocale()), false);
}
}
@EventHandler @EventHandler
private void onQuit(PlayerQuitEvent event) { private void onQuit(PlayerQuitEvent event) {