Fix player join 1.8 to 1.10 #222
@ -43,6 +43,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(':CommonCore')
|
||||
compileOnly project(":SpigotCore_Main")
|
||||
|
||||
compileOnly swdep("Spigot-1.12")
|
||||
|
34
SpigotCore_12/src/de/steamwar/core/LocaleChangeWrapper12.java
Normale Datei
34
SpigotCore_12/src/de/steamwar/core/LocaleChangeWrapper12.java
Normale Datei
@ -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);
|
||||
}
|
||||
}
|
24
SpigotCore_8/src/de/steamwar/core/LocaleChangeWrapper8.java
Normale Datei
24
SpigotCore_8/src/de/steamwar/core/LocaleChangeWrapper8.java
Normale Datei
@ -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
|
||||
}
|
@ -110,6 +110,9 @@ public class Core extends JavaPlugin{
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ChattingEvent(), 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().registerOutgoingPluginChannel(this, "sw:bridge");
|
||||
if(Core.getVersion() < 19)
|
||||
|
26
SpigotCore_Main/src/de/steamwar/core/LocaleChangeWrapper.java
Normale Datei
26
SpigotCore_Main/src/de/steamwar/core/LocaleChangeWrapper.java
Normale Datei
@ -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());
|
||||
}
|
@ -27,11 +27,8 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLocaleChangeEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class PlayerJoinedEvent implements Listener{
|
||||
|
||||
@ -51,13 +48,6 @@ public class PlayerJoinedEvent implements Listener{
|
||||
|
||||
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
|
||||
private void onQuit(PlayerQuitEvent event) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren