3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01:00

The Great Refactor Part 2 - org.geysermc.connector -> org.geysermc.geyser

Dieser Commit ist enthalten in:
RednedEpic 2021-11-20 15:34:30 -06:00
Ursprung 0b5009b415
Commit 3f5cb29ee0
624 geänderte Dateien mit 5437 neuen und 5056 gelöschten Zeilen

2
Jenkinsfile vendored
Datei anzeigen

@ -40,7 +40,7 @@ pipeline {
) )
rtMavenRun( rtMavenRun(
pom: 'pom.xml', pom: 'pom.xml',
goals: 'javadoc:jar source:jar install -pl :connector -am -DskipTests', goals: 'javadoc:jar source:jar install -pl :core -am -DskipTests',
deployerId: "maven-deployer", deployerId: "maven-deployer",
resolverId: "maven-resolver" resolverId: "maven-resolver"
) )

Datei anzeigen

@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion;
@SupportedSourceVersion(SourceVersion.RELEASE_16) @SupportedSourceVersion(SourceVersion.RELEASE_16)
public class BlockEntityProcessor extends ClassProcessor { public class BlockEntityProcessor extends ClassProcessor {
public BlockEntityProcessor() { public BlockEntityProcessor() {
super("org.geysermc.connector.network.translators.world.block.entity.BlockEntity"); super("org.geysermc.geyser.network.translators.world.block.entity.BlockEntity");
} }
} }

Datei anzeigen

@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion;
@SupportedSourceVersion(SourceVersion.RELEASE_16) @SupportedSourceVersion(SourceVersion.RELEASE_16)
public class CollisionRemapperProcessor extends ClassProcessor { public class CollisionRemapperProcessor extends ClassProcessor {
public CollisionRemapperProcessor() { public CollisionRemapperProcessor() {
super("org.geysermc.connector.network.translators.collision.CollisionRemapper"); super("org.geysermc.geyser.network.translators.collision.CollisionRemapper");
} }
} }

Datei anzeigen

@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion;
@SupportedSourceVersion(SourceVersion.RELEASE_16) @SupportedSourceVersion(SourceVersion.RELEASE_16)
public class ItemRemapperProcessor extends ClassProcessor { public class ItemRemapperProcessor extends ClassProcessor {
public ItemRemapperProcessor() { public ItemRemapperProcessor() {
super("org.geysermc.connector.network.translators.ItemRemapper"); super("org.geysermc.geyser.network.translators.ItemRemapper");
} }
} }

Datei anzeigen

@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion;
@SupportedSourceVersion(SourceVersion.RELEASE_16) @SupportedSourceVersion(SourceVersion.RELEASE_16)
public class PacketTranslatorProcessor extends ClassProcessor { public class PacketTranslatorProcessor extends ClassProcessor {
public PacketTranslatorProcessor() { public PacketTranslatorProcessor() {
super("org.geysermc.connector.network.translators.Translator"); super("org.geysermc.geyser.network.translators.Translator");
} }
} }

Datei anzeigen

@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion;
@SupportedSourceVersion(SourceVersion.RELEASE_16) @SupportedSourceVersion(SourceVersion.RELEASE_16)
public class SoundHandlerProcessor extends ClassProcessor { public class SoundHandlerProcessor extends ClassProcessor {
public SoundHandlerProcessor() { public SoundHandlerProcessor() {
super("org.geysermc.connector.network.translators.sound.SoundHandler"); super("org.geysermc.geyser.network.translators.sound.SoundHandler");
} }
} }

19
api/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>geyser-parent</artifactId>
<groupId>org.geysermc</groupId>
<version>1.4.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api</artifactId>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
</project>

Datei anzeigen

@ -0,0 +1,59 @@
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.api;
import org.geysermc.geyser.api.logger.GeyserLogger;
/**
* General API class for Geyser.
*/
public abstract class Geyser {
private static Geyser instance;
/**
* Gets the logger used by Geyser.
*
* @return the logger used by Geyser
*/
public abstract GeyserLogger getLogger();
/**
* Returns the current {@link Geyser} instance.
*
* @return the current Geyser instance
*/
public static Geyser getInstance() {
return instance;
}
protected static void setInstance(Geyser instance) {
if (Geyser.instance != null) {
throw new RuntimeException("Cannot redefine singleton Geyser!");
}
Geyser.instance = instance;
}
}

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector; package org.geysermc.geyser.api.logger;
public interface GeyserLogger { public interface GeyserLogger {

Datei anzeigen

@ -41,7 +41,7 @@
<configuration> <configuration>
<archive> <archive>
<manifestEntries> <manifestEntries>
<Main-Class>org.geysermc.platform.bungeecord.GeyserBungeeMain</Main-Class> <Main-Class>org.geysermc.geyser.platform.bungeecord.GeyserBungeeMain</Main-Class>
</manifestEntries> </manifestEntries>
</archive> </archive>
</configuration> </configuration>
@ -60,21 +60,21 @@
<relocations> <relocations>
<relocation> <relocation>
<pattern>net.md_5.bungee.jni</pattern> <pattern>net.md_5.bungee.jni</pattern>
<shadedPattern>org.geysermc.platform.bungeecord.shaded.jni</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.bungeecord.shaded.jni</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.fasterxml.jackson</pattern> <pattern>com.fasterxml.jackson</pattern>
<shadedPattern>org.geysermc.platform.bungeecord.shaded.jackson</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.bungeecord.shaded.jackson</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<!-- This is not used because relocating breaks natives, but we must include it <!-- This is not used because relocating breaks natives, but we must include it
or else we get ClassDefNotFound --> or else we get ClassDefNotFound -->
<pattern>io.netty.channel.kqueue</pattern> <pattern>io.netty.channel.kqueue</pattern>
<shadedPattern>org.geysermc.platform.bungeecord.shaded.io.netty.channel.kqueue</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.bungeecord.shaded.io.netty.channel.kqueue</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>net.kyori</pattern> <pattern>net.kyori</pattern>
<shadedPattern>org.geysermc.platform.bungeecord.shaded.kyori</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.bungeecord.shaded.kyori</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

Datei anzeigen

@ -23,14 +23,14 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord; package org.geysermc.geyser.platform.bungeecord;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter; import lombok.Getter;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import org.geysermc.connector.FloodgateKeyLoader; import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import java.nio.file.Path; import java.nio.file.Path;

Datei anzeigen

@ -23,13 +23,13 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord; package org.geysermc.geyser.platform.bungeecord;
import lombok.Getter; import lombok.Getter;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.geyser.common.serializer.AsteriskSerializer;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord; package org.geysermc.geyser.platform.bungeecord;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
@ -39,11 +39,11 @@ import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.netty.PipelineUtils; import net.md_5.bungee.netty.PipelineUtils;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.common.connection.GeyserInjector; import org.geysermc.geyser.common.connection.GeyserInjector;
import org.geysermc.connector.common.connection.LocalServerChannelWrapper; import org.geysermc.geyser.common.connection.LocalServerChannelWrapper;
import org.geysermc.connector.common.connection.LocalSession; import org.geysermc.geyser.common.connection.LocalSession;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -185,7 +185,7 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener {
this.bungeeChannels = null; this.bungeeChannels = null;
if (this.localChannel != null) { if (this.localChannel != null) {
shutdown(); shutdown();
initializeLocalChannel(GeyserConnector.getInstance().getBootstrap()); initializeLocalChannel(GeyserImpl.getInstance().getBootstrap());
} }
} }
} }

Datei anzeigen

@ -23,11 +23,11 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord; package org.geysermc.geyser.platform.bungeecord;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.GeyserLogger; import org.geysermc.geyser.api.logger.GeyserLogger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;

Datei anzeigen

@ -23,9 +23,9 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord; package org.geysermc.geyser.platform.bungeecord;
import org.geysermc.connector.common.main.IGeyserMain; import org.geysermc.geyser.common.main.IGeyserMain;
public class GeyserBungeeMain extends IGeyserMain { public class GeyserBungeeMain extends IGeyserMain {

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord; package org.geysermc.geyser.platform.bungeecord;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
@ -34,8 +34,8 @@ import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.event.ProxyPingEvent; import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import org.geysermc.connector.common.ping.GeyserPingInfo; import org.geysermc.geyser.common.ping.GeyserPingInfo;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;

Datei anzeigen

@ -23,23 +23,23 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord; package org.geysermc.geyser.platform.bungeecord;
import net.md_5.bungee.api.config.ListenerInfo; import net.md_5.bungee.api.config.ListenerInfo;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
import org.geysermc.connector.common.AuthType; import org.geysermc.geyser.common.AuthType;
import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import org.geysermc.connector.utils.FileUtils; import org.geysermc.geyser.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandExecutor; import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandExecutor;
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandManager; import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandManager;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.io.File; import java.io.File;
@ -59,7 +59,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
private GeyserBungeeLogger geyserLogger; private GeyserBungeeLogger geyserLogger;
private IGeyserPingPassthrough geyserBungeePingPassthrough; private IGeyserPingPassthrough geyserBungeePingPassthrough;
private GeyserConnector connector; private GeyserImpl geyser;
@Override @Override
public void onEnable() { public void onEnable() {
@ -116,26 +116,26 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
geyserConfig.loadFloodgate(this); geyserConfig.loadFloodgate(this);
this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this); this.geyser = GeyserImpl.start(PlatformType.BUNGEECORD, this);
this.geyserInjector = new GeyserBungeeInjector(this); this.geyserInjector = new GeyserBungeeInjector(this);
this.geyserInjector.initializeLocalChannel(this); this.geyserInjector.initializeLocalChannel(this);
this.geyserCommandManager = new GeyserBungeeCommandManager(connector); this.geyserCommandManager = new GeyserBungeeCommandManager(geyser);
if (geyserConfig.isLegacyPingPassthrough()) { if (geyserConfig.isLegacyPingPassthrough()) {
this.geyserBungeePingPassthrough = GeyserLegacyPingPassthrough.init(connector); this.geyserBungeePingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else { } else {
this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy()); this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy());
} }
this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor(connector)); this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor(geyser));
} }
@Override @Override
public void onDisable() { public void onDisable() {
if (connector != null) { if (geyser != null) {
connector.shutdown(); geyser.shutdown();
} }
if (geyserInjector != null) { if (geyserInjector != null) {
geyserInjector.shutdown(); geyserInjector.shutdown();

Datei anzeigen

@ -23,12 +23,12 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord.command; package org.geysermc.geyser.platform.bungeecord.command;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
public class BungeeCommandSender implements CommandSender { public class BungeeCommandSender implements CommandSender {

Datei anzeigen

@ -23,17 +23,17 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord.command; package org.geysermc.geyser.platform.bungeecord.command;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command; import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.TabExecutor; import net.md_5.bungee.api.plugin.TabExecutor;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandExecutor; import org.geysermc.geyser.command.CommandExecutor;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -41,10 +41,10 @@ import java.util.Collections;
public class GeyserBungeeCommandExecutor extends Command implements TabExecutor { public class GeyserBungeeCommandExecutor extends Command implements TabExecutor {
private final CommandExecutor commandExecutor; private final CommandExecutor commandExecutor;
public GeyserBungeeCommandExecutor(GeyserConnector connector) { public GeyserBungeeCommandExecutor(GeyserImpl geyser) {
super("geyser"); super("geyser");
this.commandExecutor = new CommandExecutor(connector); this.commandExecutor = new CommandExecutor(geyser);
} }
@Override @Override

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.bungeecord.command; package org.geysermc.geyser.platform.bungeecord.command;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
public class GeyserBungeeCommandManager extends CommandManager { public class GeyserBungeeCommandManager extends CommandManager {
public GeyserBungeeCommandManager(GeyserConnector connector) { public GeyserBungeeCommandManager(GeyserImpl geyser) {
super(connector); super(geyser);
} }
@Override @Override

Datei anzeigen

@ -1,4 +1,4 @@
main: org.geysermc.platform.bungeecord.GeyserBungeePlugin main: org.geysermc.geyser.platform.bungeecord.GeyserBungeePlugin
name: ${outputName}-BungeeCord name: ${outputName}-BungeeCord
author: ${project.organization.name} author: ${project.organization.name}
website: ${project.organization.url} website: ${project.organization.url}

Datei anzeigen

@ -58,7 +58,7 @@
<configuration> <configuration>
<archive> <archive>
<manifestEntries> <manifestEntries>
<Main-Class>org.geysermc.platform.spigot.GeyserSpigotMain</Main-Class> <Main-Class>org.geysermc.geyser.platform.spigot.GeyserSpigotMain</Main-Class>
</manifestEntries> </manifestEntries>
</archive> </archive>
</configuration> </configuration>
@ -77,19 +77,19 @@
<relocations> <relocations>
<relocation> <relocation>
<pattern>it.unimi.dsi.fastutil</pattern> <pattern>it.unimi.dsi.fastutil</pattern>
<shadedPattern>org.geysermc.platform.spigot.shaded.fastutil</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.spigot.shaded.fastutil</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.fasterxml.jackson</pattern> <pattern>com.fasterxml.jackson</pattern>
<shadedPattern>org.geysermc.platform.spigot.shaded.jackson</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.spigot.shaded.jackson</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>net.kyori</pattern> <pattern>net.kyori</pattern>
<shadedPattern>org.geysermc.platform.spigot.shaded.kyori</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.spigot.shaded.kyori</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.objectweb.asm</pattern> <pattern>org.objectweb.asm</pattern>
<shadedPattern>org.geysermc.platform.spigot.shaded.asm</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.spigot.shaded.asm</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot; package org.geysermc.geyser.platform.spigot;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.geysermc.connector.FloodgateKeyLoader; import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import java.nio.file.Path; import java.nio.file.Path;

Datei anzeigen

@ -23,13 +23,13 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot; package org.geysermc.geyser.platform.spigot;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.geyser.common.serializer.AsteriskSerializer;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot; package org.geysermc.geyser.platform.spigot;
import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer; import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
@ -31,9 +31,9 @@ import io.netty.channel.*;
import io.netty.channel.local.LocalAddress; import io.netty.channel.local.LocalAddress;
import io.netty.util.concurrent.DefaultThreadFactory; import io.netty.util.concurrent.DefaultThreadFactory;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.common.connection.GeyserInjector; import org.geysermc.geyser.common.connection.GeyserInjector;
import org.geysermc.connector.common.connection.LocalServerChannelWrapper; import org.geysermc.geyser.common.connection.LocalServerChannelWrapper;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;

Datei anzeigen

@ -23,12 +23,12 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot; package org.geysermc.geyser.platform.spigot;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.GeyserLogger; import org.geysermc.geyser.api.logger.GeyserLogger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;

Datei anzeigen

@ -23,9 +23,9 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot; package org.geysermc.geyser.platform.spigot;
import org.geysermc.connector.common.main.IGeyserMain; import org.geysermc.geyser.common.main.IGeyserMain;
public class GeyserSpigotMain extends IGeyserMain { public class GeyserSpigotMain extends IGeyserMain {

Datei anzeigen

@ -23,16 +23,16 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot; package org.geysermc.geyser.platform.spigot;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.util.CachedServerIcon; import org.bukkit.util.CachedServerIcon;
import org.geysermc.connector.common.ping.GeyserPingInfo; import org.geysermc.geyser.common.ping.GeyserPingInfo;
import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.net.InetAddress; import java.net.InetAddress;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot; package org.geysermc.geyser.platform.spigot;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.MappingData; import com.viaversion.viaversion.api.data.MappingData;
@ -32,27 +32,27 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
import org.geysermc.connector.common.AuthType; import org.geysermc.geyser.common.AuthType;
import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.connector.network.translators.world.WorldManager; import org.geysermc.geyser.network.translators.world.WorldManager;
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import org.geysermc.connector.utils.Constants; import org.geysermc.geyser.utils.Constants;
import org.geysermc.connector.utils.FileUtils; import org.geysermc.geyser.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
import org.geysermc.platform.spigot.command.GeyserSpigotCommandExecutor; import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandExecutor;
import org.geysermc.platform.spigot.command.GeyserSpigotCommandManager; import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandManager;
import org.geysermc.platform.spigot.command.SpigotCommandSender; import org.geysermc.geyser.platform.spigot.command.SpigotCommandSender;
import org.geysermc.platform.spigot.world.GeyserPistonListener; import org.geysermc.geyser.platform.spigot.world.GeyserPistonListener;
import org.geysermc.platform.spigot.world.GeyserSpigot1_11CraftingListener; import org.geysermc.geyser.platform.spigot.world.GeyserSpigot1_11CraftingListener;
import org.geysermc.platform.spigot.world.GeyserSpigotBlockPlaceListener; import org.geysermc.geyser.platform.spigot.world.GeyserSpigotBlockPlaceListener;
import org.geysermc.platform.spigot.world.manager.*; import org.geysermc.geyser.platform.spigot.world.manager.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -70,7 +70,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
private IGeyserPingPassthrough geyserSpigotPingPassthrough; private IGeyserPingPassthrough geyserSpigotPingPassthrough;
private GeyserSpigotWorldManager geyserWorldManager; private GeyserSpigotWorldManager geyserWorldManager;
private GeyserConnector connector; private GeyserImpl geyser;
/** /**
* The Minecraft server version, formatted as <code>1.#.#</code> * The Minecraft server version, formatted as <code>1.#.#</code>
@ -147,15 +147,15 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
// Turn "(MC: 1.16.4)" into 1.16.4. // Turn "(MC: 1.16.4)" into 1.16.4.
this.minecraftVersion = Bukkit.getServer().getVersion().split("\\(MC: ")[1].split("\\)")[0]; this.minecraftVersion = Bukkit.getServer().getVersion().split("\\(MC: ")[1].split("\\)")[0];
this.connector = GeyserConnector.start(PlatformType.SPIGOT, this); this.geyser = GeyserImpl.start(PlatformType.SPIGOT, this);
if (geyserConfig.isLegacyPingPassthrough()) { if (geyserConfig.isLegacyPingPassthrough()) {
this.geyserSpigotPingPassthrough = GeyserLegacyPingPassthrough.init(connector); this.geyserSpigotPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else { } else {
this.geyserSpigotPingPassthrough = new GeyserSpigotPingPassthrough(geyserLogger); this.geyserSpigotPingPassthrough = new GeyserSpigotPingPassthrough(geyserLogger);
} }
this.geyserCommandManager = new GeyserSpigotCommandManager(connector); this.geyserCommandManager = new GeyserSpigotCommandManager(geyser);
boolean isViaVersion = Bukkit.getPluginManager().getPlugin("ViaVersion") != null; boolean isViaVersion = Bukkit.getPluginManager().getPlugin("ViaVersion") != null;
if (isViaVersion) { if (isViaVersion) {
@ -226,23 +226,23 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
} }
geyserLogger.debug("Using default world manager: " + this.geyserWorldManager.getClass()); geyserLogger.debug("Using default world manager: " + this.geyserWorldManager.getClass());
} }
GeyserSpigotBlockPlaceListener blockPlaceListener = new GeyserSpigotBlockPlaceListener(connector, this.geyserWorldManager); GeyserSpigotBlockPlaceListener blockPlaceListener = new GeyserSpigotBlockPlaceListener(geyser, this.geyserWorldManager);
Bukkit.getServer().getPluginManager().registerEvents(blockPlaceListener, this); Bukkit.getServer().getPluginManager().registerEvents(blockPlaceListener, this);
Bukkit.getServer().getPluginManager().registerEvents(new GeyserPistonListener(connector, this.geyserWorldManager), this); Bukkit.getServer().getPluginManager().registerEvents(new GeyserPistonListener(geyser, this.geyserWorldManager), this);
if (isPre1_12) { if (isPre1_12) {
// Register events needed to send all recipes to the client // Register events needed to send all recipes to the client
Bukkit.getServer().getPluginManager().registerEvents(new GeyserSpigot1_11CraftingListener(connector), this); Bukkit.getServer().getPluginManager().registerEvents(new GeyserSpigot1_11CraftingListener(geyser), this);
} }
this.getCommand("geyser").setExecutor(new GeyserSpigotCommandExecutor(connector)); this.getCommand("geyser").setExecutor(new GeyserSpigotCommandExecutor(geyser));
} }
@Override @Override
public void onDisable() { public void onDisable() {
if (connector != null) { if (geyser != null) {
connector.shutdown(); geyser.shutdown();
} }
if (geyserInjector != null) { if (geyserInjector != null) {
geyserInjector.shutdown(); geyserInjector.shutdown();

Datei anzeigen

@ -23,17 +23,17 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.command; package org.geysermc.geyser.platform.spigot.command;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandExecutor; import org.geysermc.geyser.command.CommandExecutor;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -41,8 +41,8 @@ import java.util.List;
public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabExecutor { public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabExecutor {
public GeyserSpigotCommandExecutor(GeyserConnector connector) { public GeyserSpigotCommandExecutor(GeyserImpl geyser) {
super(connector); super(geyser);
} }
@Override @Override

Datei anzeigen

@ -23,13 +23,13 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.command; package org.geysermc.geyser.platform.spigot.command;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandMap; import org.bukkit.command.CommandMap;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -47,8 +47,8 @@ public class GeyserSpigotCommandManager extends CommandManager {
} }
} }
public GeyserSpigotCommandManager(GeyserConnector connector) { public GeyserSpigotCommandManager(GeyserImpl geyser) {
super(connector); super(geyser);
} }
@Override @Override

Datei anzeigen

@ -23,13 +23,13 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.command; package org.geysermc.geyser.platform.spigot.command;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -91,7 +91,7 @@ public class SpigotCommandSender implements CommandSender {
//noinspection JavaReflectionMemberAccess - of course it doesn't exist; that's why we're doing it //noinspection JavaReflectionMemberAccess - of course it doesn't exist; that's why we're doing it
LOCALE_METHOD = Player.Spigot.class.getMethod("getLocale"); LOCALE_METHOD = Player.Spigot.class.getMethod("getLocale");
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
GeyserConnector.getInstance().getLogger().debug("Player.Spigot.getLocale() doesn't exist? Not a big deal but if you're seeing this please report it to the developers!"); GeyserImpl.getInstance().getLogger().debug("Player.Spigot.getLocale() doesn't exist? Not a big deal but if you're seeing this please report it to the developers!");
} }
} }
} }

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world; package org.geysermc.geyser.platform.spigot.world;
import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
@ -40,24 +40,24 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPistonEvent; import org.bukkit.event.block.BlockPistonEvent;
import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPistonRetractEvent;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.session.cache.PistonCache; import org.geysermc.geyser.network.session.cache.PistonCache;
import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.network.translators.world.block.BlockStateValues;
import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntity; import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntity;
import org.geysermc.connector.utils.Direction; import org.geysermc.geyser.utils.Direction;
import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
public class GeyserPistonListener implements Listener { public class GeyserPistonListener implements Listener {
private final GeyserConnector connector; private final GeyserImpl geyser;
private final GeyserSpigotWorldManager worldManager; private final GeyserSpigotWorldManager worldManager;
public GeyserPistonListener(GeyserConnector connector, GeyserSpigotWorldManager worldManager) { public GeyserPistonListener(GeyserImpl geyser, GeyserSpigotWorldManager worldManager) {
this.connector = connector; this.geyser = geyser;
this.worldManager = worldManager; this.worldManager = worldManager;
} }
@ -88,7 +88,7 @@ public class GeyserPistonListener implements Listener {
Object2IntMap<Vector3i> attachedBlocks = new Object2IntOpenHashMap<>(); Object2IntMap<Vector3i> attachedBlocks = new Object2IntOpenHashMap<>();
boolean blocksFilled = false; boolean blocksFilled = false;
for (Map.Entry<UUID, GeyserSession> entry : connector.getSessionManager().getSessions().entrySet()) { for (Map.Entry<UUID, GeyserSession> entry : geyser.getSessionManager().getSessions().entrySet()) {
Player player = Bukkit.getPlayer(entry.getKey()); Player player = Bukkit.getPlayer(entry.getKey());
if (player == null || !player.getWorld().equals(world)) { if (player == null || !player.getWorld().equals(world)) {
continue; continue;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world; package org.geysermc.geyser.platform.spigot.world;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
@ -46,11 +46,11 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.Recipe; import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.ShapelessRecipe;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.geyser.network.translators.item.ItemTranslator;
import org.geysermc.connector.utils.InventoryUtils; import org.geysermc.geyser.utils.InventoryUtils;
import java.util.*; import java.util.*;
@ -60,7 +60,7 @@ import java.util.*;
*/ */
public class GeyserSpigot1_11CraftingListener implements Listener { public class GeyserSpigot1_11CraftingListener implements Listener {
private final GeyserConnector connector; private final GeyserImpl geyser;
/** /**
* Specific mapping data for 1.12 to 1.13. Used to convert the 1.12 item into 1.13. * Specific mapping data for 1.12 to 1.13. Used to convert the 1.12 item into 1.13.
*/ */
@ -70,8 +70,8 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
*/ */
private final List<ProtocolPathEntry> protocolList; private final List<ProtocolPathEntry> protocolList;
public GeyserSpigot1_11CraftingListener(GeyserConnector connector) { public GeyserSpigot1_11CraftingListener(GeyserImpl geyser) {
this.connector = connector; this.geyser = geyser;
this.mappingData1_12to1_13 = Via.getManager().getProtocolManager().getProtocol(Protocol1_13To1_12_2.class).getMappingData(); this.mappingData1_12to1_13 = Via.getManager().getProtocolManager().getProtocol(Protocol1_13To1_12_2.class).getMappingData();
this.protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(), this.protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(),
ProtocolVersion.v1_13.getVersion()); ProtocolVersion.v1_13.getVersion());
@ -80,7 +80,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
GeyserSession session = null; GeyserSession session = null;
for (GeyserSession otherSession : connector.getSessionManager().getSessions().values()) { for (GeyserSession otherSession : geyser.getSessionManager().getSessions().values()) {
if (otherSession.getName().equals(event.getPlayer().getName())) { if (otherSession.getName().equals(event.getPlayer().getName())) {
session = otherSession; session = otherSession;
break; break;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world; package org.geysermc.geyser.platform.spigot.world;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.SoundEvent;
@ -32,20 +32,20 @@ import lombok.AllArgsConstructor;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.network.translators.world.block.BlockStateValues;
import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager;
@AllArgsConstructor @AllArgsConstructor
public class GeyserSpigotBlockPlaceListener implements Listener { public class GeyserSpigotBlockPlaceListener implements Listener {
private final GeyserConnector connector; private final GeyserImpl geyser;
private final GeyserSpigotWorldManager worldManager; private final GeyserSpigotWorldManager worldManager;
@EventHandler @EventHandler
public void place(final BlockPlaceEvent event) { public void place(final BlockPlaceEvent event) {
GeyserSession session = connector.getPlayerByUuid(event.getPlayer().getUniqueId()); GeyserSession session = geyser.getPlayerByUuid(event.getPlayer().getUniqueId());
if (session == null) { if (session == null) {
return; return;
} }

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world.manager; package org.geysermc.geyser.platform.spigot.world.manager;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.network.translators.world.block.BlockStateValues;
import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world.manager; package org.geysermc.geyser.platform.spigot.world.manager;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.MappingData; import com.viaversion.viaversion.api.data.MappingData;
@ -36,8 +36,8 @@ import org.bukkit.Bukkit;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.network.translators.world.block.BlockStateValues;
import java.util.List; import java.util.List;

Datei anzeigen

@ -23,11 +23,11 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world.manager; package org.geysermc.geyser.platform.spigot.world.manager;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.network.translators.world.block.BlockStateValues;
/** /**
* Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)} * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)}

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world.manager; package org.geysermc.geyser.platform.spigot.world.manager;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.MappingData; import com.viaversion.viaversion.api.data.MappingData;
@ -32,9 +32,9 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.platform.spigot.GeyserSpigotPlugin; import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin;
import java.util.List; import java.util.List;

Datei anzeigen

@ -23,13 +23,13 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world.manager; package org.geysermc.geyser.platform.spigot.world.manager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.network.translators.world.block.BlockStateValues;
import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.spigot.world.manager; package org.geysermc.geyser.platform.spigot.world.manager;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMap;
@ -38,14 +38,14 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator;
import org.geysermc.connector.network.translators.world.GeyserWorldManager; import org.geysermc.geyser.network.translators.world.GeyserWorldManager;
import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.network.translators.world.block.BlockStateValues;
import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.connector.utils.BlockEntityUtils; import org.geysermc.geyser.utils.BlockEntityUtils;
import org.geysermc.connector.utils.GameRule; import org.geysermc.geyser.utils.GameRule;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -100,7 +100,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
Block block = bukkitPlayer.getWorld().getBlockAt(x, y, z); Block block = bukkitPlayer.getWorld().getBlockAt(x, y, z);
if (!(block.getState() instanceof Lectern lectern)) { if (!(block.getState() instanceof Lectern lectern)) {
session.getConnector().getLogger().error("Lectern expected at: " + Vector3i.from(x, y, z).toString() + " but was not! " + block.toString()); session.getGeyser().getLogger().error("Lectern expected at: " + Vector3i.from(x, y, z).toString() + " but was not! " + block.toString());
return; return;
} }

Datei anzeigen

@ -1,4 +1,4 @@
main: org.geysermc.platform.spigot.GeyserSpigotPlugin main: org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin
name: ${outputName}-Spigot name: ${outputName}-Spigot
author: ${project.organization.name} author: ${project.organization.name}
website: ${project.organization.url} website: ${project.organization.url}

Datei anzeigen

@ -40,7 +40,7 @@
<configuration> <configuration>
<archive> <archive>
<manifestEntries> <manifestEntries>
<Main-Class>org.geysermc.platform.sponge.GeyserSpongeMain</Main-Class> <Main-Class>org.geysermc.geyser.platform.sponge.GeyserSpongeMain</Main-Class>
</manifestEntries> </manifestEntries>
</archive> </archive>
</configuration> </configuration>
@ -59,27 +59,27 @@
<relocations> <relocations>
<relocation> <relocation>
<pattern>com.fasterxml.jackson</pattern> <pattern>com.fasterxml.jackson</pattern>
<shadedPattern>org.geysermc.platform.sponge.shaded.jackson</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.sponge.shaded.jackson</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>io.netty</pattern> <pattern>io.netty</pattern>
<shadedPattern>org.geysermc.platform.sponge.shaded.netty</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.sponge.shaded.netty</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>it.unimi.dsi.fastutil</pattern> <pattern>it.unimi.dsi.fastutil</pattern>
<shadedPattern>org.geysermc.platform.sponge.shaded.fastutil</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.sponge.shaded.fastutil</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.google.common</pattern> <pattern>com.google.common</pattern>
<shadedPattern>org.geysermc.platform.sponge.shaded.google.common</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.sponge.shaded.google.common</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.google.guava</pattern> <pattern>com.google.guava</pattern>
<shadedPattern>org.geysermc.platform.sponge.shaded.google.guava</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.sponge.shaded.google.guava</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>net.kyori</pattern> <pattern>net.kyori</pattern>
<shadedPattern>org.geysermc.platform.sponge.shaded.kyori</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.sponge.shaded.kyori</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

Datei anzeigen

@ -23,9 +23,9 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge; package org.geysermc.geyser.platform.sponge;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import java.nio.file.Path; import java.nio.file.Path;

Datei anzeigen

@ -23,10 +23,10 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge; package org.geysermc.geyser.platform.sponge;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.spongepowered.api.Platform; import org.spongepowered.api.Platform;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.plugin.PluginContainer; import org.spongepowered.api.plugin.PluginContainer;

Datei anzeigen

@ -23,12 +23,12 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge; package org.geysermc.geyser.platform.sponge;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.GeyserLogger; import org.geysermc.geyser.api.logger.GeyserLogger;
import org.slf4j.Logger; import org.slf4j.Logger;
@AllArgsConstructor @AllArgsConstructor

Datei anzeigen

@ -23,9 +23,9 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge; package org.geysermc.geyser.platform.sponge;
import org.geysermc.connector.common.main.IGeyserMain; import org.geysermc.geyser.common.main.IGeyserMain;
public class GeyserSpongeMain extends IGeyserMain { public class GeyserSpongeMain extends IGeyserMain {

Datei anzeigen

@ -23,11 +23,11 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge; package org.geysermc.geyser.platform.sponge;
import org.geysermc.connector.common.ping.GeyserPingInfo; import org.geysermc.geyser.common.ping.GeyserPingInfo;
import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import org.spongepowered.api.MinecraftVersion; import org.spongepowered.api.MinecraftVersion;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.event.SpongeEventFactory; import org.spongepowered.api.event.SpongeEventFactory;

Datei anzeigen

@ -23,21 +23,21 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge; package org.geysermc.geyser.platform.sponge;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import org.geysermc.connector.utils.FileUtils; import org.geysermc.geyser.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.geysermc.platform.sponge.command.GeyserSpongeCommandExecutor; import org.geysermc.geyser.platform.sponge.command.GeyserSpongeCommandExecutor;
import org.geysermc.platform.sponge.command.GeyserSpongeCommandManager; import org.geysermc.geyser.platform.sponge.command.GeyserSpongeCommandManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.config.ConfigDir; import org.spongepowered.api.config.ConfigDir;
@ -52,7 +52,7 @@ import java.net.InetSocketAddress;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.UUID; import java.util.UUID;
@Plugin(id = "geyser", name = GeyserConnector.NAME + "-Sponge", version = GeyserConnector.VERSION, url = "https://geysermc.org", authors = "GeyserMC") @Plugin(id = "geyser", name = GeyserImpl.NAME + "-Sponge", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
public class GeyserSpongePlugin implements GeyserBootstrap { public class GeyserSpongePlugin implements GeyserBootstrap {
@Inject @Inject
@ -67,7 +67,7 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
private GeyserSpongeLogger geyserLogger; private GeyserSpongeLogger geyserLogger;
private IGeyserPingPassthrough geyserSpongePingPassthrough; private IGeyserPingPassthrough geyserSpongePingPassthrough;
private GeyserConnector connector; private GeyserImpl geyser;
@Override @Override
public void onEnable() { public void onEnable() {
@ -107,21 +107,21 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
this.geyserLogger = new GeyserSpongeLogger(logger, geyserConfig.isDebugMode()); this.geyserLogger = new GeyserSpongeLogger(logger, geyserConfig.isDebugMode());
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger); GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
this.connector = GeyserConnector.start(PlatformType.SPONGE, this); this.geyser = GeyserImpl.start(PlatformType.SPONGE, this);
if (geyserConfig.isLegacyPingPassthrough()) { if (geyserConfig.isLegacyPingPassthrough()) {
this.geyserSpongePingPassthrough = GeyserLegacyPingPassthrough.init(connector); this.geyserSpongePingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else { } else {
this.geyserSpongePingPassthrough = new GeyserSpongePingPassthrough(); this.geyserSpongePingPassthrough = new GeyserSpongePingPassthrough();
} }
this.geyserCommandManager = new GeyserSpongeCommandManager(Sponge.getCommandManager(), connector); this.geyserCommandManager = new GeyserSpongeCommandManager(Sponge.getCommandManager(), geyser);
Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(connector), "geyser"); Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(geyser), "geyser");
} }
@Override @Override
public void onDisable() { public void onDisable() {
connector.shutdown(); geyser.shutdown();
} }
@Override @Override

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge.command; package org.geysermc.geyser.platform.sponge.command;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandExecutor; import org.geysermc.geyser.command.CommandExecutor;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.common.ChatColor; import org.geysermc.geyser.common.ChatColor;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.command.CommandCallable;
import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.CommandSource;
@ -47,8 +47,8 @@ import java.util.Optional;
public class GeyserSpongeCommandExecutor extends CommandExecutor implements CommandCallable { public class GeyserSpongeCommandExecutor extends CommandExecutor implements CommandCallable {
public GeyserSpongeCommandExecutor(GeyserConnector connector) { public GeyserSpongeCommandExecutor(GeyserImpl geyser) {
super(connector); super(geyser);
} }
@Override @Override

Datei anzeigen

@ -23,10 +23,10 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge.command; package org.geysermc.geyser.platform.sponge.command;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandMapping; import org.spongepowered.api.command.CommandMapping;
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Text;
@ -34,8 +34,8 @@ import org.spongepowered.api.text.Text;
public class GeyserSpongeCommandManager extends CommandManager { public class GeyserSpongeCommandManager extends CommandManager {
private final org.spongepowered.api.command.CommandManager handle; private final org.spongepowered.api.command.CommandManager handle;
public GeyserSpongeCommandManager(org.spongepowered.api.command.CommandManager handle, GeyserConnector connector) { public GeyserSpongeCommandManager(org.spongepowered.api.command.CommandManager handle, GeyserImpl geyser) {
super(connector); super(geyser);
this.handle = handle; this.handle = handle;
} }

Datei anzeigen

@ -23,11 +23,11 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.sponge.command; package org.geysermc.geyser.platform.sponge.command;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.source.ConsoleSource; import org.spongepowered.api.command.source.ConsoleSource;
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Text;

Datei anzeigen

@ -81,7 +81,7 @@
<configuration> <configuration>
<archive> <archive>
<manifestEntries> <manifestEntries>
<Main-Class>org.geysermc.platform.standalone.GeyserStandaloneBootstrap</Main-Class> <Main-Class>org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap</Main-Class>
</manifestEntries> </manifestEntries>
</archive> </archive>
</configuration> </configuration>
@ -119,7 +119,7 @@
</filters> </filters>
<transformers> <transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.geysermc.platform.standalone.GeyserStandaloneBootstrap</mainClass> <mainClass>org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap</mainClass>
<manifestEntries> <manifestEntries>
<Multi-Release>true</Multi-Release> <Multi-Release>true</Multi-Release>
</manifestEntries> </manifestEntries>

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone; package org.geysermc.geyser.platform.standalone;
import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JavaType;
@ -39,18 +39,18 @@ import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.appender.ConsoleAppender; import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import org.geysermc.connector.utils.FileUtils; import org.geysermc.geyser.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.geysermc.platform.standalone.command.GeyserCommandManager; import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager;
import org.geysermc.platform.standalone.gui.GeyserStandaloneGUI; import org.geysermc.geyser.platform.standalone.gui.GeyserStandaloneGUI;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -74,7 +74,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
private boolean useGui = System.console() == null && !isHeadless(); private boolean useGui = System.console() == null && !isHeadless();
private String configFilename = "config.yml"; private String configFilename = "config.yml";
private GeyserConnector connector; private GeyserImpl geyser;
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@ -211,14 +211,14 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
// Allow libraries like Protocol to have their debug information passthrough // Allow libraries like Protocol to have their debug information passthrough
logger.get().setLevel(geyserConfig.isDebugMode() ? Level.DEBUG : Level.INFO); logger.get().setLevel(geyserConfig.isDebugMode() ? Level.DEBUG : Level.INFO);
connector = GeyserConnector.start(PlatformType.STANDALONE, this); geyser = GeyserImpl.start(PlatformType.STANDALONE, this);
geyserCommandManager = new GeyserCommandManager(connector); geyserCommandManager = new GeyserCommandManager(geyser);
if (gui != null) { if (gui != null) {
gui.setupInterface(geyserLogger, geyserCommandManager); gui.setupInterface(geyserLogger, geyserCommandManager);
} }
geyserPingPassthrough = GeyserLegacyPingPassthrough.init(connector); geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
if (!useGui) { if (!useGui) {
geyserLogger.start(); // Throws an error otherwise geyserLogger.start(); // Throws an error otherwise
@ -242,7 +242,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
@Override @Override
public void onDisable() { public void onDisable() {
connector.shutdown(); geyser.shutdown();
System.exit(0); System.exit(0);
} }

Datei anzeigen

@ -23,11 +23,11 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone; package org.geysermc.geyser.platform.standalone;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;

Datei anzeigen

@ -23,10 +23,10 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone; package org.geysermc.geyser.platform.standalone;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
@Getter @Getter
public class GeyserStandaloneDumpInfo extends BootstrapDumpInfo { public class GeyserStandaloneDumpInfo extends BootstrapDumpInfo {

Datei anzeigen

@ -23,33 +23,33 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone; package org.geysermc.geyser.platform.standalone;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import net.minecrell.terminalconsole.SimpleTerminalConsole; import net.minecrell.terminalconsole.SimpleTerminalConsole;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator; import org.apache.logging.log4j.core.config.Configurator;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.GeyserLogger; import org.geysermc.geyser.api.logger.GeyserLogger;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.common.ChatColor; import org.geysermc.geyser.common.ChatColor;
@Log4j2 @Log4j2
public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender { public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender {
@Override @Override
protected boolean isRunning() { protected boolean isRunning() {
return !GeyserConnector.getInstance().isShuttingDown(); return !GeyserImpl.getInstance().isShuttingDown();
} }
@Override @Override
protected void runCommand(String line) { protected void runCommand(String line) {
GeyserConnector.getInstance().getCommandManager().runCommand(this, line); GeyserImpl.getInstance().getCommandManager().runCommand(this, line);
} }
@Override @Override
protected void shutdown() { protected void shutdown() {
GeyserConnector.getInstance().getBootstrap().onDisable(); GeyserImpl.getInstance().getBootstrap().onDisable();
} }
@Override @Override

Datei anzeigen

@ -23,10 +23,10 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone; package org.geysermc.geyser.platform.standalone;
import org.geysermc.connector.common.ChatColor; import org.geysermc.geyser.common.ChatColor;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone.command; package org.geysermc.geyser.platform.standalone.command;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
public class GeyserCommandManager extends CommandManager { public class GeyserCommandManager extends CommandManager {
public GeyserCommandManager(GeyserConnector connector) { public GeyserCommandManager(GeyserImpl geyser) {
super(connector); super(geyser);
} }
@Override @Override

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone.gui; package org.geysermc.geyser.platform.standalone.gui;
import lombok.Getter; import lombok.Getter;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone.gui; package org.geysermc.geyser.platform.standalone.gui;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.*; import javax.swing.text.*;

Datei anzeigen

@ -23,14 +23,14 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone.gui; package org.geysermc.geyser.platform.standalone.gui;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.geysermc.platform.standalone.GeyserStandaloneLogger; import org.geysermc.geyser.platform.standalone.GeyserStandaloneLogger;
import org.geysermc.platform.standalone.command.GeyserCommandManager; import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager;
import javax.swing.*; import javax.swing.*;
import javax.swing.table.DefaultTableModel; import javax.swing.table.DefaultTableModel;
@ -302,11 +302,11 @@ public class GeyserStandaloneGUI {
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
Runnable periodicTask = () -> { Runnable periodicTask = () -> {
if (GeyserConnector.getInstance() != null) { if (GeyserImpl.getInstance() != null) {
// Update player table // Update player table
playerTableModel.getDataVector().removeAllElements(); playerTableModel.getDataVector().removeAllElements();
for (GeyserSession player : GeyserConnector.getInstance().getSessionManager().getSessions().values()) { for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) {
Vector<String> row = new Vector<>(); Vector<String> row = new Vector<>();
row.add(player.getSocketAddress().getHostName()); row.add(player.getSocketAddress().getHostName());
row.add(player.getPlayerEntity().getUsername()); row.add(player.getPlayerEntity().getUsername());

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.standalone.gui; package org.geysermc.geyser.platform.standalone.gui;
import lombok.Setter; import lombok.Setter;

Datei anzeigen

@ -40,7 +40,7 @@
<configuration> <configuration>
<archive> <archive>
<manifestEntries> <manifestEntries>
<Main-Class>org.geysermc.platform.velocity.GeyserVelocityMain</Main-Class> <Main-Class>org.geysermc.geyser.platform.velocity.GeyserVelocityMain</Main-Class>
</manifestEntries> </manifestEntries>
</archive> </archive>
</configuration> </configuration>
@ -59,15 +59,15 @@
<relocations> <relocations>
<relocation> <relocation>
<pattern>com.fasterxml.jackson</pattern> <pattern>com.fasterxml.jackson</pattern>
<shadedPattern>org.geysermc.platform.velocity.shaded.jackson</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.velocity.shaded.jackson</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>it.unimi.dsi.fastutil</pattern> <pattern>it.unimi.dsi.fastutil</pattern>
<shadedPattern>org.geysermc.platform.velocity.shaded.fastutil</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.velocity.shaded.fastutil</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>net.kyori.adventure.text.serializer.gson.legacyimpl</pattern> <pattern>net.kyori.adventure.text.serializer.gson.legacyimpl</pattern>
<shadedPattern>org.geysermc.platform.velocity.shaded.kyori.legacyimpl</shadedPattern> <shadedPattern>org.geysermc.geyser.platform.velocity.shaded.kyori.legacyimpl</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity; package org.geysermc.geyser.platform.velocity;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.FloodgateKeyLoader; import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import java.io.File; import java.io.File;
import java.nio.file.Path; import java.nio.file.Path;

Datei anzeigen

@ -23,13 +23,13 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity; package org.geysermc.geyser.platform.velocity;
import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.geyser.common.serializer.AsteriskSerializer;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity; package org.geysermc.geyser.platform.velocity;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*; import io.netty.channel.*;
import io.netty.channel.local.LocalAddress; import io.netty.channel.local.LocalAddress;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.common.connection.GeyserInjector; import org.geysermc.geyser.common.connection.GeyserInjector;
import org.geysermc.connector.common.connection.LocalServerChannelWrapper; import org.geysermc.geyser.common.connection.LocalServerChannelWrapper;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.function.Supplier; import java.util.function.Supplier;

Datei anzeigen

@ -23,12 +23,12 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity; package org.geysermc.geyser.platform.velocity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.GeyserLogger; import org.geysermc.geyser.api.logger.GeyserLogger;
import org.slf4j.Logger; import org.slf4j.Logger;
@AllArgsConstructor @AllArgsConstructor

Datei anzeigen

@ -23,9 +23,9 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity; package org.geysermc.geyser.platform.velocity;
import org.geysermc.connector.common.main.IGeyserMain; import org.geysermc.geyser.common.main.IGeyserMain;
public class GeyserVelocityMain extends IGeyserMain { public class GeyserVelocityMain extends IGeyserMain {

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity; package org.geysermc.geyser.platform.velocity;
import com.velocitypowered.api.event.proxy.ProxyPingEvent; import com.velocitypowered.api.event.proxy.ProxyPingEvent;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
@ -32,8 +32,8 @@ import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.geysermc.connector.common.ping.GeyserPingInfo; import org.geysermc.geyser.common.ping.GeyserPingInfo;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.Optional; import java.util.Optional;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity; package org.geysermc.geyser.platform.velocity;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.velocitypowered.api.command.CommandManager; import com.velocitypowered.api.command.CommandManager;
@ -36,17 +36,17 @@ import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import lombok.Getter; import lombok.Getter;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.connector.common.AuthType; import org.geysermc.geyser.common.AuthType;
import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import org.geysermc.connector.utils.FileUtils; import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandExecutor;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandManager;
import org.geysermc.platform.velocity.command.GeyserVelocityCommandExecutor; import org.geysermc.geyser.utils.FileUtils;
import org.geysermc.platform.velocity.command.GeyserVelocityCommandManager; import org.geysermc.geyser.utils.LanguageUtils;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -58,7 +58,7 @@ import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.UUID; import java.util.UUID;
@Plugin(id = "geyser", name = GeyserConnector.NAME + "-Velocity", version = GeyserConnector.VERSION, url = "https://geysermc.org", authors = "GeyserMC") @Plugin(id = "geyser", name = GeyserImpl.NAME + "-Velocity", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
public class GeyserVelocityPlugin implements GeyserBootstrap { public class GeyserVelocityPlugin implements GeyserBootstrap {
@Inject @Inject
@ -76,10 +76,10 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
private GeyserVelocityLogger geyserLogger; private GeyserVelocityLogger geyserLogger;
private IGeyserPingPassthrough geyserPingPassthrough; private IGeyserPingPassthrough geyserPingPassthrough;
private GeyserConnector connector; private GeyserImpl geyser;
@Getter @Getter
private final Path configFolder = Paths.get("plugins/" + GeyserConnector.NAME + "-Velocity/"); private final Path configFolder = Paths.get("plugins/" + GeyserImpl.NAME + "-Velocity/");
@Override @Override
public void onEnable() { public void onEnable() {
@ -136,15 +136,15 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile()); geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile());
this.connector = GeyserConnector.start(PlatformType.VELOCITY, this); this.geyser = GeyserImpl.start(PlatformType.VELOCITY, this);
this.geyserInjector = new GeyserVelocityInjector(proxyServer); this.geyserInjector = new GeyserVelocityInjector(proxyServer);
// Will be initialized after the proxy has been bound // Will be initialized after the proxy has been bound
this.geyserCommandManager = new GeyserVelocityCommandManager(connector); this.geyserCommandManager = new GeyserVelocityCommandManager(geyser);
this.commandManager.register("geyser", new GeyserVelocityCommandExecutor(connector)); this.commandManager.register("geyser", new GeyserVelocityCommandExecutor(geyser));
if (geyserConfig.isLegacyPingPassthrough()) { if (geyserConfig.isLegacyPingPassthrough()) {
this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(connector); this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
} else { } else {
this.geyserPingPassthrough = new GeyserVelocityPingPassthrough(proxyServer); this.geyserPingPassthrough = new GeyserVelocityPingPassthrough(proxyServer);
} }
@ -152,8 +152,8 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
@Override @Override
public void onDisable() { public void onDisable() {
if (connector != null) { if (geyser != null) {
connector.shutdown(); geyser.shutdown();
} }
if (geyserInjector != null) { if (geyserInjector != null) {
geyserInjector.shutdown(); geyserInjector.shutdown();
@ -171,7 +171,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
} }
@Override @Override
public org.geysermc.connector.command.CommandManager getGeyserCommandManager() { public org.geysermc.geyser.command.CommandManager getGeyserCommandManager() {
return this.geyserCommandManager; return this.geyserCommandManager;
} }

Datei anzeigen

@ -23,16 +23,16 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity.command; package org.geysermc.geyser.platform.velocity.command;
import com.velocitypowered.api.command.SimpleCommand; import com.velocitypowered.api.command.SimpleCommand;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandExecutor; import org.geysermc.geyser.command.CommandExecutor;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.common.ChatColor; import org.geysermc.geyser.common.ChatColor;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -40,8 +40,8 @@ import java.util.List;
public class GeyserVelocityCommandExecutor extends CommandExecutor implements SimpleCommand { public class GeyserVelocityCommandExecutor extends CommandExecutor implements SimpleCommand {
public GeyserVelocityCommandExecutor(GeyserConnector connector) { public GeyserVelocityCommandExecutor(GeyserImpl geyser) {
super(connector); super(geyser);
} }
@Override @Override

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity.command; package org.geysermc.geyser.platform.velocity.command;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.command.CommandManager;
public class GeyserVelocityCommandManager extends CommandManager { public class GeyserVelocityCommandManager extends CommandManager {
public GeyserVelocityCommandManager(GeyserConnector connector) { public GeyserVelocityCommandManager(GeyserImpl geyser) {
super(connector); super(geyser);
} }
@Override @Override

Datei anzeigen

@ -23,14 +23,14 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.platform.velocity.command; package org.geysermc.geyser.platform.velocity.command;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.ConsoleCommandSource; import com.velocitypowered.api.proxy.ConsoleCommandSource;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.Locale; import java.util.Locale;

Datei anzeigen

@ -24,6 +24,12 @@
<version>1.4.3-SNAPSHOT</version> <version>1.4.3-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.geysermc</groupId>
<artifactId>api</artifactId>
<version>1.4.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.geysermc</groupId> <groupId>org.geysermc</groupId>
<artifactId>common</artifactId> <artifactId>common</artifactId>
@ -308,7 +314,7 @@
</goals> </goals>
<configuration> <configuration>
<includes> <includes>
<include>${project.basedir}/src/main/java/org/geysermc/connector/GeyserConnector.java</include> <include>${project.basedir}/src/main/java/org/geysermc/geyser/GeyserConnector.java</include>
</includes> </includes>
<replacements> <replacements>
<replacement> <replacement>
@ -332,7 +338,7 @@
</goals> </goals>
<configuration> <configuration>
<includes> <includes>
<include>${project.basedir}/src/main/java/org/geysermc/connector/GeyserConnector.java</include> <include>${project.basedir}/src/main/java/org/geysermc/geyser/GeyserConnector.java</include>
</includes> </includes>
<replacements> <replacements>
<replacement> <replacement>

Datei anzeigen

@ -25,487 +25,62 @@
package org.geysermc.connector; package org.geysermc.connector;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.steveice10.packetlib.tcp.TcpSession;
import com.nukkitx.network.raknet.RakNetConstants;
import com.nukkitx.network.util.EventLoops;
import com.nukkitx.protocol.bedrock.BedrockServer; import com.nukkitx.protocol.bedrock.BedrockServer;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.kqueue.KQueue;
import io.netty.util.NettyRuntime;
import io.netty.util.concurrent.DefaultThreadFactory;
import io.netty.util.internal.SystemPropertyUtil;
import lombok.Getter;
import lombok.Setter;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.bootstrap.GeyserBootstrap;
import org.geysermc.connector.command.CommandManager;
import org.geysermc.connector.common.AuthType;
import org.geysermc.connector.configuration.GeyserConfiguration;
import org.geysermc.connector.entity.EntityDefinitions;
import org.geysermc.connector.metrics.Metrics;
import org.geysermc.connector.network.ConnectorServerEventHandler;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslatorRegistry; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.geyser.api.Geyser;
import org.geysermc.connector.network.translators.item.ItemTranslator;
import org.geysermc.connector.network.translators.world.WorldManager;
import org.geysermc.connector.registry.BlockRegistries;
import org.geysermc.connector.registry.Registries;
import org.geysermc.connector.scoreboard.ScoreboardUpdater;
import org.geysermc.connector.skin.FloodgateSkinUploader;
import org.geysermc.connector.utils.*;
import org.geysermc.floodgate.crypto.AesCipher;
import org.geysermc.floodgate.crypto.AesKeyProducer;
import org.geysermc.floodgate.crypto.Base64Topping;
import org.geysermc.floodgate.crypto.FloodgateCipher;
import org.geysermc.floodgate.news.NewsItemAction;
import org.geysermc.floodgate.time.TimeSyncer;
import org.jetbrains.annotations.Contract;
import javax.naming.directory.Attribute;
import javax.naming.directory.InitialDirContext;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.security.Key;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Getter /**
* Deprecated, please use {@link Geyser} or {@link GeyserImpl}.
*
* @deprecated legacy code
*/
@Deprecated
public class GeyserConnector { public class GeyserConnector {
public static final ObjectMapper JSON_MAPPER = new ObjectMapper() public static final String NAME = GeyserImpl.NAME;
.enable(JsonParser.Feature.IGNORE_UNDEFINED) public static final String GIT_VERSION = GeyserImpl.GIT_VERSION; // A fallback for running in IDEs
.enable(JsonParser.Feature.ALLOW_COMMENTS) public static final String VERSION = GeyserImpl.VERSION; // A fallback for running in IDEs
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)
.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
public static final String NAME = "Geyser"; public static final String OAUTH_CLIENT_ID = GeyserImpl.OAUTH_CLIENT_ID;
public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs
public static final String VERSION = "DEV"; // A fallback for running in IDEs
/** private static final GeyserConnector INSTANCE = new GeyserConnector();
* Oauth client ID for Microsoft authentication
*/
public static final String OAUTH_CLIENT_ID = "204cefd1-4818-4de1-b98d-513fae875d88";
private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"; public static GeyserConnector getInstance() {
return INSTANCE;
private final SessionManager sessionManager = new SessionManager();
private static GeyserConnector instance;
/**
* This is used in GeyserConnect to stop the bedrock server binding to a port
*/
@Setter
private static boolean shouldStartListener = true;
private final TimeSyncer timeSyncer;
private FloodgateCipher cipher;
private FloodgateSkinUploader skinUploader;
private final NewsHandler newsHandler;
private volatile boolean shuttingDown = false;
private final ScheduledExecutorService scheduledThread;
private final BedrockServer bedrockServer;
private final PlatformType platformType;
private final GeyserBootstrap bootstrap;
private final Metrics metrics;
private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) {
long startupTime = System.currentTimeMillis();
instance = this;
this.bootstrap = bootstrap;
GeyserLogger logger = bootstrap.getGeyserLogger();
GeyserConfiguration config = bootstrap.getGeyserConfig();
this.platformType = platformType;
logger.info("******************************************");
logger.info("");
logger.info(LanguageUtils.getLocaleStringLog("geyser.core.load", NAME, VERSION));
logger.info("");
logger.info("******************************************");
this.scheduledThread = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("Geyser Scheduled Thread"));
logger.setDebug(config.isDebugMode());
PacketTranslatorRegistry.init();
/* Initialize translators and registries */
BlockRegistries.init();
Registries.init();
EntityDefinitions.init();
ItemTranslator.init();
MessageTranslator.init();
LocaleUtils.init();
ScoreboardUpdater.init();
ResourcePack.loadPacks();
if (platformType != PlatformType.STANDALONE && config.getRemote().getAddress().equals("auto")) {
// Set the remote address to localhost since that is where we are always connecting
try {
config.getRemote().setAddress(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
logger.debug("Unknown host when trying to find localhost.");
if (config.isDebugMode()) {
ex.printStackTrace();
}
config.getRemote().setAddress(InetAddress.getLoopbackAddress().getHostAddress());
}
}
String remoteAddress = config.getRemote().getAddress();
// Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry.
if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) {
int remotePort;
try {
// Searches for a server address and a port from a SRV record of the specified host name
InitialDirContext ctx = new InitialDirContext();
Attribute attr = ctx.getAttributes("dns:///_minecraft._tcp." + remoteAddress, new String[]{"SRV"}).get("SRV");
// size > 0 = SRV entry found
if (attr != null && attr.size() > 0) {
String[] record = ((String) attr.get(0)).split(" ");
// Overwrites the existing address and port with that from the SRV record.
config.getRemote().setAddress(remoteAddress = record[3]);
config.getRemote().setPort(remotePort = Integer.parseInt(record[2]));
logger.debug("Found SRV record \"" + remoteAddress + ":" + remotePort + "\"");
}
} catch (Exception | NoClassDefFoundError ex) { // Check for a NoClassDefFoundError to prevent Android crashes
logger.debug("Exception while trying to find an SRV record for the remote host.");
if (config.isDebugMode())
ex.printStackTrace(); // Otherwise we can get a stack trace for any domain that doesn't have an SRV record
}
} }
// Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves public BedrockServer getBedrockServer() {
TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false; return GeyserImpl.getInstance().getBedrockServer();
TimeSyncer timeSyncer = null;
if (config.getRemote().getAuthType() == AuthType.FLOODGATE) {
timeSyncer = new TimeSyncer(Constants.NTP_SERVER);
try {
Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath());
cipher = new AesCipher(new Base64Topping());
cipher.init(key);
logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key"));
skinUploader = new FloodgateSkinUploader(this).start();
} catch (Exception exception) {
logger.severe(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception);
}
}
this.timeSyncer = timeSyncer;
String branch = "unknown";
int buildNumber = -1;
if (this.isProductionEnvironment()) {
try {
Properties gitProperties = new Properties();
gitProperties.load(FileUtils.getResource("git.properties"));
branch = gitProperties.getProperty("git.branch");
String build = gitProperties.getProperty("git.build.number");
if (build != null) {
buildNumber = Integer.parseInt(build);
}
} catch (Throwable e) {
logger.error("Failed to read git.properties", e);
}
} else {
logger.debug("Not getting git properties for the news handler as we are in a development environment.");
}
newsHandler = new NewsHandler(branch, buildNumber);
CooldownUtils.setDefaultShowCooldown(config.getShowCooldown());
DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether
// https://github.com/GeyserMC/Geyser/issues/957
RakNetConstants.MAXIMUM_MTU_SIZE = (short) config.getMtu();
logger.debug("Setting MTU to " + config.getMtu());
Integer bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads");
if (bedrockThreadCount == null) {
// Copy the code from Netty's default thread count fallback
bedrockThreadCount = Math.max(1, SystemPropertyUtil.getInt("io.netty.eventLoopThreads", NettyRuntime.availableProcessors() * 2));
} }
boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol(); public boolean isShuttingDown() {
bedrockServer = new BedrockServer( return GeyserImpl.getInstance().isShuttingDown();
new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()),
bedrockThreadCount,
EventLoops.commonGroup(),
enableProxyProtocol
);
if (config.isDebugMode()) {
logger.debug("EventLoop type: " + EventLoops.getChannelType());
if (EventLoops.getChannelType() == EventLoops.ChannelType.NIO) {
if (System.getProperties().contains("disableNativeEventLoop")) {
logger.debug("EventLoop type is NIO because native event loops are disabled.");
} else {
logger.debug("Reason for no Epoll: " + Epoll.unavailabilityCause().toString());
logger.debug("Reason for no KQueue: " + KQueue.unavailabilityCause().toString());
}
}
} }
bedrockServer.setHandler(new ConnectorServerEventHandler(this)); public PlatformType getPlatformType() {
return GeyserImpl.getInstance().getPlatformType();
if (shouldStartListener) {
bedrockServer.bind().whenComplete((avoid, throwable) -> {
if (throwable == null) {
logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
} else {
logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
throwable.printStackTrace();
}
}).join();
}
if (config.getMetrics().isEnabled()) {
metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger(""));
metrics.addCustomChart(new Metrics.SingleLineChart("players", sessionManager::size));
// Prevent unwanted words best we can
metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().getAuthType().toString().toLowerCase()));
metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName));
metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", LanguageUtils::getDefaultLocale));
metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserConnector.VERSION));
metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> {
Map<String, Integer> valueMap = new HashMap<>();
for (GeyserSession session : sessionManager.getAllSessions()) {
if (session == null) continue;
if (session.getClientData() == null) continue;
String os = session.getClientData().getDeviceOs().toString();
if (!valueMap.containsKey(os)) {
valueMap.put(os, 1);
} else {
valueMap.put(os, valueMap.get(os) + 1);
}
}
return valueMap;
}));
metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> {
Map<String, Integer> valueMap = new HashMap<>();
for (GeyserSession session : sessionManager.getAllSessions()) {
if (session == null) continue;
if (session.getClientData() == null) continue;
String version = session.getClientData().getGameVersion();
if (!valueMap.containsKey(version)) {
valueMap.put(version, 1);
} else {
valueMap.put(version, valueMap.get(version) + 1);
}
}
return valueMap;
}));
String minecraftVersion = bootstrap.getMinecraftServerVersion();
if (minecraftVersion != null) {
Map<String, Map<String, Integer>> versionMap = new HashMap<>();
Map<String, Integer> platformMap = new HashMap<>();
platformMap.put(platformType.getPlatformName(), 1);
versionMap.put(minecraftVersion, platformMap);
metrics.addCustomChart(new Metrics.DrilldownPie("minecraftServerVersion", () -> {
// By the end, we should return, for example:
// 1.16.5 => (Spigot, 1)
return versionMap;
}));
}
// The following code can be attributed to the PaperMC project
// https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0005-Paper-Metrics.patch#L614
metrics.addCustomChart(new Metrics.DrilldownPie("javaVersion", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
String javaVersion = System.getProperty("java.version");
Map<String, Integer> entry = new HashMap<>();
entry.put(javaVersion, 1);
// http://openjdk.java.net/jeps/223
// Java decided to change their versioning scheme and in doing so modified the
// java.version system property to return $major[.$minor][.$security][-ea], as opposed to
// 1.$major.0_$identifier we can handle pre-9 by checking if the "major" is equal to "1",
// otherwise, 9+
String majorVersion = javaVersion.split("\\.")[0];
String release;
int indexOf = javaVersion.lastIndexOf('.');
if (majorVersion.equals("1")) {
release = "Java " + javaVersion.substring(0, indexOf);
} else {
// of course, it really wouldn't be all that simple if they didn't add a quirk, now
// would it valid strings for the major may potentially include values such as -ea to
// denote a pre release
Matcher versionMatcher = Pattern.compile("\\d+").matcher(majorVersion);
if (versionMatcher.find()) {
majorVersion = versionMatcher.group(0);
}
release = "Java " + majorVersion;
}
map.put(release, entry);
return map;
}));
} else {
metrics = null;
}
boolean isGui = false;
// This will check if we are in standalone and get the 'useGui' variable from there
if (platformType == PlatformType.STANDALONE) {
try {
Class<?> cls = Class.forName("org.geysermc.platform.standalone.GeyserStandaloneBootstrap");
isGui = (boolean) cls.getMethod("isUseGui").invoke(cls.cast(bootstrap));
} catch (Exception e) {
logger.debug("Failed detecting if standalone is using a GUI; if this is a GeyserConnect instance this can be safely ignored.");
}
}
double completeTime = (System.currentTimeMillis() - startupTime) / 1000D;
String message = LanguageUtils.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " ";
if (isGui) {
message += LanguageUtils.getLocaleStringLog("geyser.core.finish.gui");
} else {
message += LanguageUtils.getLocaleStringLog("geyser.core.finish.console");
}
logger.info(message);
if (platformType == PlatformType.STANDALONE) {
logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn"));
}
newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED);
} }
public void shutdown() { public void shutdown() {
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown")); GeyserImpl.getInstance().shutdown();
shuttingDown = true;
if (sessionManager.size() >= 1) {
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", sessionManager.size()));
sessionManager.disconnectAll("geyser.core.shutdown.kick.message");
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done"));
}
scheduledThread.shutdown();
bedrockServer.close();
if (timeSyncer != null) {
timeSyncer.shutdown();
}
if (skinUploader != null) {
skinUploader.close();
}
newsHandler.shutdown();
this.getCommandManager().getCommands().clear();
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.done"));
}
/**
* Gets a player by their current UUID
*
* @param uuid the uuid
* @return the player or <code>null</code> if there is no player online with this UUID
*/
@Contract("null -> null")
public GeyserSession getPlayerByUuid(UUID uuid) {
if (uuid == null) {
return null;
}
return sessionManager.getSessions().get(uuid);
}
/**
* Gets a player by their Xbox user identifier
*
* @param xuid the Xbox user identifier
* @return the player or <code>null</code> if there is no player online with this xuid
*/
@SuppressWarnings("unused") // API usage
public GeyserSession getPlayerByXuid(String xuid) {
for (GeyserSession session : sessionManager.getPendingSessions()) {
if (session.getAuthData().getXboxUUID().equals(xuid)) {
return session;
}
}
for (GeyserSession session : sessionManager.getSessions().values()) {
if (session.getAuthData().getXboxUUID().equals(xuid)) {
return session;
}
}
return null;
}
public static GeyserConnector start(PlatformType platformType, GeyserBootstrap bootstrap) {
return new GeyserConnector(platformType, bootstrap);
} }
public void reload() { public void reload() {
shutdown(); GeyserImpl.getInstance().reload();
bootstrap.onEnable();
} }
public GeyserLogger getLogger() { public GeyserSession getPlayerByXuid(String xuid) {
return bootstrap.getGeyserLogger(); return new GeyserSession(GeyserImpl.getInstance().getPlayerByXuid(xuid));
} }
public GeyserConfiguration getConfig() { public GeyserSession getPlayerByUuid(UUID uuid) {
return bootstrap.getGeyserConfig(); return new GeyserSession(GeyserImpl.getInstance().getPlayerByUuid(uuid));
} }
public CommandManager getCommandManager() {
return bootstrap.getGeyserCommandManager();
}
public WorldManager getWorldManager() {
return bootstrap.getWorldManager();
}
public TimeSyncer getTimeSyncer() {
return timeSyncer;
}
/**
* Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files
* expected to be in a jarfile are not present.
*
* @return true if the version number is not 'DEV'.
*/
public boolean isProductionEnvironment() { public boolean isProductionEnvironment() {
//noinspection ConstantConditions - changes in production return GeyserImpl.getInstance().isProductionEnvironment();
return !"DEV".equals(GeyserConnector.VERSION);
}
/**
* Deprecated. Get the AuthType from the GeyserConfiguration through {@link GeyserConnector#getConfig()}
* @return The
*/
@Deprecated
public AuthType getDefaultAuthType() {
return getConfig().getRemote().getAuthType();
}
public static GeyserConnector getInstance() {
return instance;
} }
} }

Datei anzeigen

@ -25,26 +25,30 @@
package org.geysermc.connector.network.session.auth; package org.geysermc.connector.network.session.auth;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.geysermc.connector.GeyserConnector;
import java.util.UUID; import java.util.UUID;
@RequiredArgsConstructor /**
* Deprecated, legacy code. Serves as a wrapper around
* the class used now.
*
* @deprecated legacy code
*/
public class AuthData { public class AuthData {
@Getter private final String name; private final org.geysermc.geyser.network.session.auth.AuthData handle;
@Getter private final UUID UUID;
@Getter private final String xboxUUID;
private final JsonNode certChainData; public AuthData(org.geysermc.geyser.network.session.auth.AuthData handle) {
private final String clientData; this.handle = handle;
}
public void upload(GeyserConnector connector) { public String getName() {
// we can't upload the skin in LoginEncryptionUtil since the global server would return return this.handle.getName();
// the skin too fast, that's why we upload it after we know for sure that the target server }
// is ready to handle the result of the global server
connector.getSkinUploader().uploadSkin(certChainData, clientData); public UUID getUUID() {
return this.handle.getUuid();
}
public String getXboxUUID() {
return this.handle.getXuid();
} }
} }

Datei anzeigen

@ -23,11 +23,12 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector; package org.geysermc.geyser;
import org.geysermc.connector.common.AuthType; import org.geysermc.geyser.api.logger.GeyserLogger;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.common.AuthType;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import org.geysermc.geyser.utils.LanguageUtils;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;

Datei anzeigen

@ -0,0 +1,502 @@
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.steveice10.packetlib.tcp.TcpSession;
import com.nukkitx.network.raknet.RakNetConstants;
import com.nukkitx.network.util.EventLoops;
import com.nukkitx.protocol.bedrock.BedrockServer;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.kqueue.KQueue;
import io.netty.util.NettyRuntime;
import io.netty.util.concurrent.DefaultThreadFactory;
import io.netty.util.internal.SystemPropertyUtil;
import lombok.Getter;
import lombok.Setter;
import org.geysermc.common.PlatformType;
import org.geysermc.geyser.api.Geyser;
import org.geysermc.geyser.api.logger.GeyserLogger;
import org.geysermc.geyser.bootstrap.GeyserBootstrap;
import org.geysermc.geyser.command.CommandManager;
import org.geysermc.geyser.common.AuthType;
import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.metrics.Metrics;
import org.geysermc.geyser.network.ConnectorServerEventHandler;
import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.geyser.network.translators.PacketTranslatorRegistry;
import org.geysermc.geyser.network.translators.chat.MessageTranslator;
import org.geysermc.geyser.network.translators.item.ItemTranslator;
import org.geysermc.geyser.network.translators.world.WorldManager;
import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.scoreboard.ScoreboardUpdater;
import org.geysermc.geyser.skin.FloodgateSkinUploader;
import org.geysermc.geyser.utils.*;
import org.geysermc.floodgate.crypto.AesCipher;
import org.geysermc.floodgate.crypto.AesKeyProducer;
import org.geysermc.floodgate.crypto.Base64Topping;
import org.geysermc.floodgate.crypto.FloodgateCipher;
import org.geysermc.floodgate.news.NewsItemAction;
import org.geysermc.floodgate.time.TimeSyncer;
import org.jetbrains.annotations.Contract;
import javax.naming.directory.Attribute;
import javax.naming.directory.InitialDirContext;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.security.Key;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Getter
public class GeyserImpl extends Geyser {
public static final ObjectMapper JSON_MAPPER = new ObjectMapper()
.enable(JsonParser.Feature.IGNORE_UNDEFINED)
.enable(JsonParser.Feature.ALLOW_COMMENTS)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)
.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
public static final String NAME = "Geyser";
public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs
public static final String VERSION = "DEV"; // A fallback for running in IDEs
/**
* Oauth client ID for Microsoft authentication
*/
public static final String OAUTH_CLIENT_ID = "204cefd1-4818-4de1-b98d-513fae875d88";
private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b";
private final SessionManager sessionManager = new SessionManager();
/**
* This is used in GeyserConnect to stop the bedrock server binding to a port
*/
@Setter
private static boolean shouldStartListener = true;
private final TimeSyncer timeSyncer;
private FloodgateCipher cipher;
private FloodgateSkinUploader skinUploader;
private final NewsHandler newsHandler;
private volatile boolean shuttingDown = false;
private final ScheduledExecutorService scheduledThread;
private final BedrockServer bedrockServer;
private final PlatformType platformType;
private final GeyserBootstrap bootstrap;
private final Metrics metrics;
private GeyserImpl(PlatformType platformType, GeyserBootstrap bootstrap) {
long startupTime = System.currentTimeMillis();
Geyser.setInstance(this);
this.bootstrap = bootstrap;
GeyserLogger logger = bootstrap.getGeyserLogger();
GeyserConfiguration config = bootstrap.getGeyserConfig();
this.platformType = platformType;
logger.info("******************************************");
logger.info("");
logger.info(LanguageUtils.getLocaleStringLog("geyser.core.load", NAME, VERSION));
logger.info("");
logger.info("******************************************");
this.scheduledThread = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("Geyser Scheduled Thread"));
logger.setDebug(config.isDebugMode());
PacketTranslatorRegistry.init();
/* Initialize translators and registries */
BlockRegistries.init();
Registries.init();
EntityDefinitions.init();
ItemTranslator.init();
MessageTranslator.init();
LocaleUtils.init();
ScoreboardUpdater.init();
ResourcePack.loadPacks();
if (platformType != PlatformType.STANDALONE && config.getRemote().getAddress().equals("auto")) {
// Set the remote address to localhost since that is where we are always connecting
try {
config.getRemote().setAddress(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
logger.debug("Unknown host when trying to find localhost.");
if (config.isDebugMode()) {
ex.printStackTrace();
}
config.getRemote().setAddress(InetAddress.getLoopbackAddress().getHostAddress());
}
}
String remoteAddress = config.getRemote().getAddress();
// Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry.
if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) {
int remotePort;
try {
// Searches for a server address and a port from a SRV record of the specified host name
InitialDirContext ctx = new InitialDirContext();
Attribute attr = ctx.getAttributes("dns:///_minecraft._tcp." + remoteAddress, new String[]{"SRV"}).get("SRV");
// size > 0 = SRV entry found
if (attr != null && attr.size() > 0) {
String[] record = ((String) attr.get(0)).split(" ");
// Overwrites the existing address and port with that from the SRV record.
config.getRemote().setAddress(remoteAddress = record[3]);
config.getRemote().setPort(remotePort = Integer.parseInt(record[2]));
logger.debug("Found SRV record \"" + remoteAddress + ":" + remotePort + "\"");
}
} catch (Exception | NoClassDefFoundError ex) { // Check for a NoClassDefFoundError to prevent Android crashes
logger.debug("Exception while trying to find an SRV record for the remote host.");
if (config.isDebugMode())
ex.printStackTrace(); // Otherwise we can get a stack trace for any domain that doesn't have an SRV record
}
}
// Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves
TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false;
TimeSyncer timeSyncer = null;
if (config.getRemote().getAuthType() == AuthType.FLOODGATE) {
timeSyncer = new TimeSyncer(Constants.NTP_SERVER);
try {
Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath());
cipher = new AesCipher(new Base64Topping());
cipher.init(key);
logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key"));
skinUploader = new FloodgateSkinUploader(this).start();
} catch (Exception exception) {
logger.severe(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception);
}
}
this.timeSyncer = timeSyncer;
String branch = "unknown";
int buildNumber = -1;
if (this.isProductionEnvironment()) {
try {
Properties gitProperties = new Properties();
gitProperties.load(FileUtils.getResource("git.properties"));
branch = gitProperties.getProperty("git.branch");
String build = gitProperties.getProperty("git.build.number");
if (build != null) {
buildNumber = Integer.parseInt(build);
}
} catch (Throwable e) {
logger.error("Failed to read git.properties", e);
}
} else {
logger.debug("Not getting git properties for the news handler as we are in a development environment.");
}
newsHandler = new NewsHandler(branch, buildNumber);
CooldownUtils.setDefaultShowCooldown(config.getShowCooldown());
DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether
// https://github.com/GeyserMC/Geyser/issues/957
RakNetConstants.MAXIMUM_MTU_SIZE = (short) config.getMtu();
logger.debug("Setting MTU to " + config.getMtu());
Integer bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads");
if (bedrockThreadCount == null) {
// Copy the code from Netty's default thread count fallback
bedrockThreadCount = Math.max(1, SystemPropertyUtil.getInt("io.netty.eventLoopThreads", NettyRuntime.availableProcessors() * 2));
}
boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol();
bedrockServer = new BedrockServer(
new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()),
bedrockThreadCount,
EventLoops.commonGroup(),
enableProxyProtocol
);
if (config.isDebugMode()) {
logger.debug("EventLoop type: " + EventLoops.getChannelType());
if (EventLoops.getChannelType() == EventLoops.ChannelType.NIO) {
if (System.getProperties().contains("disableNativeEventLoop")) {
logger.debug("EventLoop type is NIO because native event loops are disabled.");
} else {
logger.debug("Reason for no Epoll: " + Epoll.unavailabilityCause().toString());
logger.debug("Reason for no KQueue: " + KQueue.unavailabilityCause().toString());
}
}
}
bedrockServer.setHandler(new ConnectorServerEventHandler(this));
if (shouldStartListener) {
bedrockServer.bind().whenComplete((avoid, throwable) -> {
if (throwable == null) {
logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
} else {
logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
throwable.printStackTrace();
}
}).join();
}
if (config.getMetrics().isEnabled()) {
metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger(""));
metrics.addCustomChart(new Metrics.SingleLineChart("players", sessionManager::size));
// Prevent unwanted words best we can
metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().getAuthType().toString().toLowerCase()));
metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName));
metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", LanguageUtils::getDefaultLocale));
metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserImpl.VERSION));
metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> {
Map<String, Integer> valueMap = new HashMap<>();
for (GeyserSession session : sessionManager.getAllSessions()) {
if (session == null) continue;
if (session.getClientData() == null) continue;
String os = session.getClientData().getDeviceOs().toString();
if (!valueMap.containsKey(os)) {
valueMap.put(os, 1);
} else {
valueMap.put(os, valueMap.get(os) + 1);
}
}
return valueMap;
}));
metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> {
Map<String, Integer> valueMap = new HashMap<>();
for (GeyserSession session : sessionManager.getAllSessions()) {
if (session == null) continue;
if (session.getClientData() == null) continue;
String version = session.getClientData().getGameVersion();
if (!valueMap.containsKey(version)) {
valueMap.put(version, 1);
} else {
valueMap.put(version, valueMap.get(version) + 1);
}
}
return valueMap;
}));
String minecraftVersion = bootstrap.getMinecraftServerVersion();
if (minecraftVersion != null) {
Map<String, Map<String, Integer>> versionMap = new HashMap<>();
Map<String, Integer> platformMap = new HashMap<>();
platformMap.put(platformType.getPlatformName(), 1);
versionMap.put(minecraftVersion, platformMap);
metrics.addCustomChart(new Metrics.DrilldownPie("minecraftServerVersion", () -> {
// By the end, we should return, for example:
// 1.16.5 => (Spigot, 1)
return versionMap;
}));
}
// The following code can be attributed to the PaperMC project
// https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0005-Paper-Metrics.patch#L614
metrics.addCustomChart(new Metrics.DrilldownPie("javaVersion", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
String javaVersion = System.getProperty("java.version");
Map<String, Integer> entry = new HashMap<>();
entry.put(javaVersion, 1);
// http://openjdk.java.net/jeps/223
// Java decided to change their versioning scheme and in doing so modified the
// java.version system property to return $major[.$minor][.$security][-ea], as opposed to
// 1.$major.0_$identifier we can handle pre-9 by checking if the "major" is equal to "1",
// otherwise, 9+
String majorVersion = javaVersion.split("\\.")[0];
String release;
int indexOf = javaVersion.lastIndexOf('.');
if (majorVersion.equals("1")) {
release = "Java " + javaVersion.substring(0, indexOf);
} else {
// of course, it really wouldn't be all that simple if they didn't add a quirk, now
// would it valid strings for the major may potentially include values such as -ea to
// denote a pre release
Matcher versionMatcher = Pattern.compile("\\d+").matcher(majorVersion);
if (versionMatcher.find()) {
majorVersion = versionMatcher.group(0);
}
release = "Java " + majorVersion;
}
map.put(release, entry);
return map;
}));
} else {
metrics = null;
}
boolean isGui = false;
// This will check if we are in standalone and get the 'useGui' variable from there
if (platformType == PlatformType.STANDALONE) {
try {
Class<?> cls = Class.forName("org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap");
isGui = (boolean) cls.getMethod("isUseGui").invoke(cls.cast(bootstrap));
} catch (Exception e) {
logger.debug("Failed detecting if standalone is using a GUI; if this is a GeyserConnect instance this can be safely ignored.");
}
}
double completeTime = (System.currentTimeMillis() - startupTime) / 1000D;
String message = LanguageUtils.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " ";
if (isGui) {
message += LanguageUtils.getLocaleStringLog("geyser.core.finish.gui");
} else {
message += LanguageUtils.getLocaleStringLog("geyser.core.finish.console");
}
logger.info(message);
if (platformType == PlatformType.STANDALONE) {
logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn"));
}
newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED);
}
public void shutdown() {
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown"));
shuttingDown = true;
if (sessionManager.size() >= 1) {
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", sessionManager.size()));
sessionManager.disconnectAll("geyser.core.shutdown.kick.message");
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done"));
}
scheduledThread.shutdown();
bedrockServer.close();
if (timeSyncer != null) {
timeSyncer.shutdown();
}
if (skinUploader != null) {
skinUploader.close();
}
newsHandler.shutdown();
this.getCommandManager().getCommands().clear();
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.done"));
}
/**
* Gets a player by their current UUID
*
* @param uuid the uuid
* @return the player or <code>null</code> if there is no player online with this UUID
*/
@Contract("null -> null")
public GeyserSession getPlayerByUuid(UUID uuid) {
if (uuid == null) {
return null;
}
return sessionManager.getSessions().get(uuid);
}
/**
* Gets a player by their Xbox user identifier
*
* @param xuid the Xbox user identifier
* @return the player or <code>null</code> if there is no player online with this xuid
*/
@SuppressWarnings("unused") // API usage
public GeyserSession getPlayerByXuid(String xuid) {
for (GeyserSession session : sessionManager.getPendingSessions()) {
if (session.getAuthData().getXuid().equals(xuid)) {
return session;
}
}
for (GeyserSession session : sessionManager.getSessions().values()) {
if (session.getAuthData().getXuid().equals(xuid)) {
return session;
}
}
return null;
}
public static GeyserImpl start(PlatformType platformType, GeyserBootstrap bootstrap) {
return new GeyserImpl(platformType, bootstrap);
}
public void reload() {
shutdown();
bootstrap.onEnable();
}
public GeyserLogger getLogger() {
return bootstrap.getGeyserLogger();
}
public GeyserConfiguration getConfig() {
return bootstrap.getGeyserConfig();
}
public CommandManager getCommandManager() {
return bootstrap.getGeyserCommandManager();
}
public WorldManager getWorldManager() {
return bootstrap.getWorldManager();
}
public TimeSyncer getTimeSyncer() {
return timeSyncer;
}
/**
* Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files
* expected to be in a jarfile are not present.
*
* @return true if the version number is not 'DEV'.
*/
public boolean isProductionEnvironment() {
//noinspection ConstantConditions - changes in production
return !"DEV".equals(GeyserImpl.VERSION);
}
public static GeyserImpl getInstance() {
return (GeyserImpl) Geyser.getInstance();
}
}

Datei anzeigen

@ -23,13 +23,13 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector; package org.geysermc.geyser;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;

Datei anzeigen

@ -23,15 +23,17 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.bootstrap; package org.geysermc.geyser.bootstrap;
import org.geysermc.connector.GeyserLogger; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandManager; import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.geyser.api.logger.GeyserLogger;
import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.geyser.command.CommandManager;
import org.geysermc.connector.network.translators.world.GeyserWorldManager; import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.connector.network.translators.world.WorldManager; import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.geyser.network.translators.world.GeyserWorldManager;
import org.geysermc.geyser.network.translators.world.WorldManager;
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -108,7 +110,7 @@ public interface GeyserBootstrap {
* that have direct server access - platforms such as proxies always have to be on their latest version to support * that have direct server access - platforms such as proxies always have to be on their latest version to support
* the newest Minecraft version, but older servers can use ViaVersion to enable newer versions to join. * the newest Minecraft version, but older servers can use ViaVersion to enable newer versions to join.
* <br> * <br>
* If used, this should not be null before {@link org.geysermc.connector.GeyserConnector} initialization. * If used, this should not be null before {@link GeyserImpl} initialization.
* *
* @return the Minecraft version being used on the server, or <code>null</code> if not applicable * @return the Minecraft version being used on the server, or <code>null</code> if not applicable
*/ */

Datei anzeigen

@ -23,11 +23,11 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command; package org.geysermc.geyser.command;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,10 +41,10 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
public class CommandExecutor { public class CommandExecutor {
protected final GeyserConnector connector; protected final GeyserImpl geyser;
public GeyserCommand getCommand(String label) { public GeyserCommand getCommand(String label) {
return connector.getCommandManager().getCommands().get(label); return geyser.getCommandManager().getCommands().get(label);
} }
@Nullable @Nullable
@ -53,7 +53,7 @@ public class CommandExecutor {
return null; return null;
} }
for (GeyserSession session : connector.getSessionManager().getSessions().values()) { for (GeyserSession session : geyser.getSessionManager().getSessions().values()) {
if (sender.getName().equals(session.getPlayerEntity().getUsername())) { if (sender.getName().equals(session.getPlayerEntity().getUsername())) {
return session; return session;
} }
@ -77,7 +77,7 @@ public class CommandExecutor {
} }
List<String> availableCommands = new ArrayList<>(); List<String> availableCommands = new ArrayList<>();
Map<String, GeyserCommand> commands = connector.getCommandManager().getCommands(); Map<String, GeyserCommand> commands = geyser.getCommandManager().getCommands();
// Only show commands they have permission to use // Only show commands they have permission to use
for (String name : commands.keySet()) { for (String name : commands.keySet()) {

Datei anzeigen

@ -23,15 +23,15 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command; package org.geysermc.geyser.command;
import lombok.Getter; import lombok.Getter;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.defaults.*; import org.geysermc.geyser.command.defaults.*;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.*; import java.util.*;
@ -40,28 +40,28 @@ public abstract class CommandManager {
@Getter @Getter
private final Map<String, GeyserCommand> commands = Collections.synchronizedMap(new HashMap<>()); private final Map<String, GeyserCommand> commands = Collections.synchronizedMap(new HashMap<>());
private final GeyserConnector connector; private final GeyserImpl geyser;
public CommandManager(GeyserConnector connector) { public CommandManager(GeyserImpl geyser) {
this.connector = connector; this.geyser = geyser;
registerCommand(new HelpCommand(connector, "help", "geyser.commands.help.desc", "geyser.command.help")); registerCommand(new HelpCommand(geyser, "help", "geyser.commands.help.desc", "geyser.command.help"));
registerCommand(new ListCommand(connector, "list", "geyser.commands.list.desc", "geyser.command.list")); registerCommand(new ListCommand(geyser, "list", "geyser.commands.list.desc", "geyser.command.list"));
registerCommand(new ReloadCommand(connector, "reload", "geyser.commands.reload.desc", "geyser.command.reload")); registerCommand(new ReloadCommand(geyser, "reload", "geyser.commands.reload.desc", "geyser.command.reload"));
registerCommand(new OffhandCommand(connector, "offhand", "geyser.commands.offhand.desc", "geyser.command.offhand")); registerCommand(new OffhandCommand(geyser, "offhand", "geyser.commands.offhand.desc", "geyser.command.offhand"));
registerCommand(new DumpCommand(connector, "dump", "geyser.commands.dump.desc", "geyser.command.dump")); registerCommand(new DumpCommand(geyser, "dump", "geyser.commands.dump.desc", "geyser.command.dump"));
registerCommand(new VersionCommand(connector, "version", "geyser.commands.version.desc", "geyser.command.version")); registerCommand(new VersionCommand(geyser, "version", "geyser.commands.version.desc", "geyser.command.version"));
registerCommand(new SettingsCommand(connector, "settings", "geyser.commands.settings.desc", "geyser.command.settings")); registerCommand(new SettingsCommand(geyser, "settings", "geyser.commands.settings.desc", "geyser.command.settings"));
registerCommand(new StatisticsCommand(connector, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics")); registerCommand(new StatisticsCommand(geyser, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics"));
registerCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements")); registerCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements"));
if (GeyserConnector.getInstance().getPlatformType() == PlatformType.STANDALONE) { if (GeyserImpl.getInstance().getPlatformType() == PlatformType.STANDALONE) {
registerCommand(new StopCommand(connector, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); registerCommand(new StopCommand(geyser, "stop", "geyser.commands.stop.desc", "geyser.command.stop"));
} }
} }
public void registerCommand(GeyserCommand command) { public void registerCommand(GeyserCommand command) {
commands.put(command.getName(), command); commands.put(command.getName(), command);
connector.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.commands.registered", command.getName())); geyser.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.commands.registered", command.getName()));
if (command.getAliases().isEmpty()) if (command.getAliases().isEmpty())
return; return;
@ -89,7 +89,7 @@ public abstract class CommandManager {
GeyserCommand cmd = commands.get(label); GeyserCommand cmd = commands.get(label);
if (cmd == null) { if (cmd == null) {
connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.invalid")); geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.invalid"));
return; return;
} }
@ -99,7 +99,7 @@ public abstract class CommandManager {
if (!cmd.isBedrockOnly()) { if (!cmd.isBedrockOnly()) {
cmd.execute(null, sender, args); cmd.execute(null, sender, args);
} else { } else {
connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only")); geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only"));
} }
} }
} }
@ -108,7 +108,7 @@ public abstract class CommandManager {
* @return a list of all subcommands under {@code /geyser}. * @return a list of all subcommands under {@code /geyser}.
*/ */
public List<String> getCommandNames() { public List<String> getCommandNames() {
return Arrays.asList(connector.getCommandManager().getCommands().keySet().toArray(new String[0])); return Arrays.asList(geyser.getCommandManager().getCommands().keySet().toArray(new String[0]));
} }
/** /**

Datei anzeigen

@ -23,9 +23,9 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command; package org.geysermc.geyser.command;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
/** /**
* Implemented on top of any class that can send a command. * Implemented on top of any class that can send a command.

Datei anzeigen

@ -23,12 +23,12 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command; package org.geysermc.geyser.command;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;

Datei anzeigen

@ -23,11 +23,11 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
public class AdvancementsCommand extends GeyserCommand { public class AdvancementsCommand extends GeyserCommand {
public AdvancementsCommand(String name, String description, String permission) { public AdvancementsCommand(String name, String description, String permission) {

Datei anzeigen

@ -23,22 +23,22 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import com.fasterxml.jackson.core.util.DefaultIndenter; import com.fasterxml.jackson.core.util.DefaultIndenter;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.common.ChatColor; import org.geysermc.geyser.common.ChatColor;
import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.geyser.common.serializer.AsteriskSerializer;
import org.geysermc.connector.dump.DumpInfo; import org.geysermc.geyser.dump.DumpInfo;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.geysermc.connector.utils.WebUtils; import org.geysermc.geyser.utils.WebUtils;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -47,20 +47,20 @@ import java.util.List;
public class DumpCommand extends GeyserCommand { public class DumpCommand extends GeyserCommand {
private final GeyserConnector connector; private final GeyserImpl geyser;
private static final ObjectMapper MAPPER = new ObjectMapper(); private static final ObjectMapper MAPPER = new ObjectMapper();
private static final String DUMP_URL = "https://dump.geysermc.org/"; private static final String DUMP_URL = "https://dump.geysermc.org/";
public DumpCommand(GeyserConnector connector, String name, String description, String permission) { public DumpCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
this.connector = connector; this.geyser = geyser;
} }
@Override @Override
public void execute(GeyserSession session, CommandSender sender, String[] args) { public void execute(GeyserSession session, CommandSender sender, String[] args) {
// Only allow the console to create dumps on Geyser Standalone // Only allow the console to create dumps on Geyser Standalone
if (!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) {
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale()));
return; return;
} }
@ -93,7 +93,7 @@ public class DumpCommand extends GeyserCommand {
} }
} catch (IOException e) { } catch (IOException e) {
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collect_error", sender.getLocale())); sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collect_error", sender.getLocale()));
connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.collect_error_short"), e); geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.collect_error_short"), e);
return; return;
} }
@ -103,12 +103,12 @@ public class DumpCommand extends GeyserCommand {
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.writing", sender.getLocale())); sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.writing", sender.getLocale()));
try { try {
FileOutputStream outputStream = new FileOutputStream(GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("dump.json").toFile()); FileOutputStream outputStream = new FileOutputStream(GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("dump.json").toFile());
outputStream.write(dumpData.getBytes()); outputStream.write(dumpData.getBytes());
outputStream.close(); outputStream.close();
} catch (IOException e) { } catch (IOException e) {
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.write_error", sender.getLocale())); sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.write_error", sender.getLocale()));
connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.write_error_short"), e); geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.write_error_short"), e);
return; return;
} }
@ -123,7 +123,7 @@ public class DumpCommand extends GeyserCommand {
responseNode = MAPPER.readTree(response); responseNode = MAPPER.readTree(response);
} catch (IOException e) { } catch (IOException e) {
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.upload_error", sender.getLocale())); sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.upload_error", sender.getLocale()));
connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.upload_error_short"), e); geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.upload_error_short"), e);
return; return;
} }
@ -137,7 +137,7 @@ public class DumpCommand extends GeyserCommand {
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.message", sender.getLocale()) + " " + ChatColor.DARK_AQUA + uploadedDumpUrl); sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.message", sender.getLocale()) + " " + ChatColor.DARK_AQUA + uploadedDumpUrl);
if (!sender.isConsole()) { if (!sender.isConsole()) {
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl)); geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl));
} }
} }

Datei anzeigen

@ -23,24 +23,24 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.common.ChatColor; import org.geysermc.geyser.common.ChatColor;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
public class HelpCommand extends GeyserCommand { public class HelpCommand extends GeyserCommand {
private final GeyserConnector connector; private final GeyserImpl geyser;
public HelpCommand(GeyserConnector connector, String name, String description, String permission) { public HelpCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
this.connector = connector; this.geyser = geyser;
this.setAliases(Collections.singletonList("?")); this.setAliases(Collections.singletonList("?"));
} }
@ -59,7 +59,7 @@ public class HelpCommand extends GeyserCommand {
String header = LanguageUtils.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage); String header = LanguageUtils.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage);
sender.sendMessage(header); sender.sendMessage(header);
Map<String, GeyserCommand> cmds = connector.getCommandManager().getCommands(); Map<String, GeyserCommand> cmds = geyser.getCommandManager().getCommands();
for (String cmdName : cmds.keySet()) { for (String cmdName : cmds.keySet()) {
GeyserCommand cmd = cmds.get(cmdName); GeyserCommand cmd = cmds.get(cmdName);

Datei anzeigen

@ -23,31 +23,31 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ListCommand extends GeyserCommand { public class ListCommand extends GeyserCommand {
private final GeyserConnector connector; private final GeyserImpl geyser;
public ListCommand(GeyserConnector connector, String name, String description, String permission) { public ListCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
this.connector = connector; this.geyser = geyser;
} }
@Override @Override
public void execute(GeyserSession session, CommandSender sender, String[] args) { public void execute(GeyserSession session, CommandSender sender, String[] args) {
String message = LanguageUtils.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(), String message = LanguageUtils.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(),
connector.getSessionManager().size(), geyser.getSessionManager().size(),
connector.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" "))); geyser.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" ")));
sender.sendMessage(message); sender.sendMessage(message);
} }

Datei anzeigen

@ -23,20 +23,20 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.BlockUtils; import org.geysermc.geyser.utils.BlockUtils;
public class OffhandCommand extends GeyserCommand { public class OffhandCommand extends GeyserCommand {
public OffhandCommand(GeyserConnector connector, String name, String description, String permission) { public OffhandCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
} }

Datei anzeigen

@ -23,27 +23,27 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
public class ReloadCommand extends GeyserCommand { public class ReloadCommand extends GeyserCommand {
private final GeyserConnector connector; private final GeyserImpl geyser;
public ReloadCommand(GeyserConnector connector, String name, String description, String permission) { public ReloadCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
this.connector = connector; this.geyser = geyser;
} }
@Override @Override
public void execute(GeyserSession session, CommandSender sender, String[] args) { public void execute(GeyserSession session, CommandSender sender, String[] args) {
if (!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) {
return; return;
} }
@ -51,7 +51,7 @@ public class ReloadCommand extends GeyserCommand {
sender.sendMessage(message); sender.sendMessage(message);
connector.getSessionManager().disconnectAll("geyser.commands.reload.kick"); geyser.getSessionManager().disconnectAll("geyser.commands.reload.kick");
connector.reload(); geyser.reload();
} }
} }

Datei anzeigen

@ -23,16 +23,16 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.SettingsUtils; import org.geysermc.geyser.utils.SettingsUtils;
public class SettingsCommand extends GeyserCommand { public class SettingsCommand extends GeyserCommand {
public SettingsCommand(GeyserConnector connector, String name, String description, String permission) { public SettingsCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
} }

Datei anzeigen

@ -23,18 +23,18 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.data.game.ClientCommand;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
public class StatisticsCommand extends GeyserCommand { public class StatisticsCommand extends GeyserCommand {
public StatisticsCommand(GeyserConnector connector, String name, String description, String permission) { public StatisticsCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
} }

Datei anzeigen

@ -23,35 +23,35 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import java.util.Collections; import java.util.Collections;
public class StopCommand extends GeyserCommand { public class StopCommand extends GeyserCommand {
private final GeyserConnector connector; private final GeyserImpl geyser;
public StopCommand(GeyserConnector connector, String name, String description, String permission) { public StopCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
this.connector = connector; this.geyser = geyser;
this.setAliases(Collections.singletonList("shutdown")); this.setAliases(Collections.singletonList("shutdown"));
} }
@Override @Override
public void execute(GeyserSession session, CommandSender sender, String[] args) { public void execute(GeyserSession session, CommandSender sender, String[] args) {
if (!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) {
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale()));
return; return;
} }
connector.getBootstrap().onDisable(); geyser.getBootstrap().onDisable();
} }
} }

Datei anzeigen

@ -23,19 +23,19 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.command.defaults; package org.geysermc.geyser.command.defaults;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.connector.command.CommandSender; import org.geysermc.geyser.command.CommandSender;
import org.geysermc.connector.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.connector.common.ChatColor; import org.geysermc.geyser.common.ChatColor;
import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.network.session.GeyserSession;
import org.geysermc.connector.utils.FileUtils; import org.geysermc.geyser.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.utils.LanguageUtils;
import org.geysermc.connector.utils.WebUtils; import org.geysermc.geyser.utils.WebUtils;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -45,12 +45,12 @@ import java.util.Properties;
public class VersionCommand extends GeyserCommand { public class VersionCommand extends GeyserCommand {
private final GeyserConnector connector; private final GeyserImpl geyser;
public VersionCommand(GeyserConnector connector, String name, String description, String permission) { public VersionCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission); super(name, description, permission);
this.connector = connector; this.geyser = geyser;
} }
@Override @Override
@ -64,10 +64,10 @@ public class VersionCommand extends GeyserCommand {
} }
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(),
GeyserConnector.NAME, GeyserConnector.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions)); GeyserImpl.NAME, GeyserImpl.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions));
// Disable update checking in dev mode and for players in Geyser Standalone // Disable update checking in dev mode and for players in Geyser Standalone
if (GeyserConnector.getInstance().isProductionEnvironment() && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) { if (GeyserImpl.getInstance().isProductionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) {
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale())); sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale()));
try { try {
Properties gitProp = new Properties(); Properties gitProp = new Properties();
@ -88,7 +88,7 @@ public class VersionCommand extends GeyserCommand {
throw new AssertionError("buildNumber missing"); throw new AssertionError("buildNumber missing");
} }
} catch (IOException | AssertionError | NumberFormatException e) { } catch (IOException | AssertionError | NumberFormatException e) {
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.version.failed"), e); GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.version.failed"), e);
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.version.failed", sender.getLocale())); sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.version.failed", sender.getLocale()));
} }
} }

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.common; package org.geysermc.geyser.common;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationContext;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.common; package org.geysermc.geyser.common;
public class ChatColor { public class ChatColor {

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.common.connection; package org.geysermc.geyser.common.connection;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.*; import io.netty.channel.*;

Datei anzeigen

@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Geyser * @link https://github.com/GeyserMC/Geyser
*/ */
package org.geysermc.connector.common.connection; package org.geysermc.geyser.common.connection;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.DefaultChannelPipeline; import io.netty.channel.DefaultChannelPipeline;

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen