3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-03 08:21:06 +02:00

Geyser now requires 1.13.2+ on Spigot

Dieser Commit ist enthalten in:
Camotoy 2022-09-30 11:58:09 -04:00
Ursprung c3c2e18f50
Commit 47d14e12eb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -32,6 +32,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import me.lucko.commodore.CommodoreProvider; import me.lucko.commodore.CommodoreProvider;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.block.data.BlockData;
import org.bukkit.command.CommandMap; import org.bukkit.command.CommandMap;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -99,18 +100,22 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
@Override @Override
public void onLoad() { public void onLoad() {
GeyserLocale.init(this);
try { try {
// AvailableCommandsSerializer_v291 complains otherwise // AvailableCommandsSerializer_v291 complains otherwise - affects at least 1.8
ByteBuf.class.getMethod("writeShortLE", int.class); ByteBuf.class.getMethod("writeShortLE", int.class);
} catch (NoSuchMethodException e) { // Only available in 1.13.x
Class.forName("org.bukkit.event.server.ServerLoadEvent");
// We depend on this as a fallback in certain scenarios
BlockData.class.getMethod("getAsString");
} catch (ClassNotFoundException | NoSuchMethodException e) {
getLogger().severe("*********************************************"); getLogger().severe("*********************************************");
getLogger().severe(""); getLogger().severe("");
getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server.header")); getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server.header"));
getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server.message", "1.12.2")); getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server.message", "1.13.2"));
getLogger().severe(""); getLogger().severe("");
getLogger().severe("*********************************************"); getLogger().severe("*********************************************");
Bukkit.getPluginManager().disablePlugin(this);
return; return;
} }
@ -124,14 +129,10 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server_type.message", "Paper")); getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server_type.message", "Paper"));
getLogger().severe(""); getLogger().severe("");
getLogger().severe("*********************************************"); getLogger().severe("*********************************************");
Bukkit.getPluginManager().disablePlugin(this);
return; return;
} }
} }
GeyserLocale.init(this);
// This is manually done instead of using Bukkit methods to save the config because otherwise comments get removed // This is manually done instead of using Bukkit methods to save the config because otherwise comments get removed
try { try {
if (!getDataFolder().exists()) { if (!getDataFolder().exists()) {
@ -157,6 +158,12 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
@Override @Override
public void onEnable() { public void onEnable() {
if (this.geyserConfig == null) {
// We failed to initialize correctly
Bukkit.getPluginManager().disablePlugin(this);
return;
}
// Remove this in like a year // Remove this in like a year
if (Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) { if (Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) {
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION)); geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION));