mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Scoreboard fix
This commit is contained in:
commit
4cacd226f4
17 changed files with 847 additions and 223 deletions
|
|
@ -61,4 +61,11 @@ public interface Logger {
|
||||||
* @param message the message to log
|
* @param message the message to log
|
||||||
*/
|
*/
|
||||||
void debug(String message);
|
void debug(String message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the logger should print debug messages
|
||||||
|
*
|
||||||
|
* @param debug if the logger should print debug messages
|
||||||
|
*/
|
||||||
|
void setDebug(boolean debug);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,14 @@ import org.geysermc.connector.network.remote.RemoteJavaServer;
|
||||||
import org.geysermc.connector.network.translators.TranslatorsInit;
|
import org.geysermc.connector.network.translators.TranslatorsInit;
|
||||||
import org.geysermc.connector.plugin.GeyserPluginLoader;
|
import org.geysermc.connector.plugin.GeyserPluginLoader;
|
||||||
import org.geysermc.connector.plugin.GeyserPluginManager;
|
import org.geysermc.connector.plugin.GeyserPluginManager;
|
||||||
|
import org.geysermc.connector.thread.PingPassthroughThread;
|
||||||
import org.geysermc.connector.utils.Toolbox;
|
import org.geysermc.connector.utils.Toolbox;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class GeyserConnector implements Connector {
|
public class GeyserConnector implements Connector {
|
||||||
|
|
||||||
|
|
@ -84,6 +85,9 @@ public class GeyserConnector implements Connector {
|
||||||
@Getter
|
@Getter
|
||||||
private final ScheduledExecutorService generalThreadPool;
|
private final ScheduledExecutorService generalThreadPool;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private PingPassthroughThread passthroughThread;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
instance = new GeyserConnector();
|
instance = new GeyserConnector();
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +99,6 @@ public class GeyserConnector implements Connector {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
this.generalThreadPool = Executors.newScheduledThreadPool(32); //TODO: Make configurable value
|
this.generalThreadPool = Executors.newScheduledThreadPool(32); //TODO: Make configurable value
|
||||||
|
|
||||||
this.logger = GeyserLogger.DEFAULT;
|
this.logger = GeyserLogger.DEFAULT;
|
||||||
|
|
||||||
ConsoleCommandReader consoleReader = new ConsoleCommandReader(this);
|
ConsoleCommandReader consoleReader = new ConsoleCommandReader(this);
|
||||||
|
|
@ -126,6 +129,8 @@ public class GeyserConnector implements Connector {
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.setDebug(config.isDebugMode());
|
||||||
|
|
||||||
Toolbox.CACHED_PALLETE.array();
|
Toolbox.CACHED_PALLETE.array();
|
||||||
|
|
||||||
TranslatorsInit.start();
|
TranslatorsInit.start();
|
||||||
|
|
@ -138,6 +143,10 @@ public class GeyserConnector implements Connector {
|
||||||
pluginManager = new GeyserPluginManager(new GeyserPluginLoader(this));
|
pluginManager = new GeyserPluginManager(new GeyserPluginLoader(this));
|
||||||
pluginManager.getLoader().loadPlugins();
|
pluginManager.getLoader().loadPlugins();
|
||||||
|
|
||||||
|
passthroughThread = new PingPassthroughThread(this);
|
||||||
|
if (config.isPingPassthrough())
|
||||||
|
generalThreadPool.scheduleAtFixedRate(passthroughThread, 1, 1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
BedrockServer bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()));
|
BedrockServer bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()));
|
||||||
bedrockServer.setHandler(new ConnectorServerEventHandler(this));
|
bedrockServer.setHandler(new ConnectorServerEventHandler(this));
|
||||||
bedrockServer.bind().whenComplete((avoid, throwable) -> {
|
bedrockServer.bind().whenComplete((avoid, throwable) -> {
|
||||||
|
|
|
||||||
|
|
@ -39,4 +39,7 @@ public class GeyserConfiguration {
|
||||||
|
|
||||||
@JsonProperty("max-players")
|
@JsonProperty("max-players")
|
||||||
private int maxPlayers;
|
private int maxPlayers;
|
||||||
|
|
||||||
|
@JsonProperty("debug-mode")
|
||||||
|
private boolean debugMode;
|
||||||
}
|
}
|
||||||
|
|
@ -37,12 +37,11 @@ import java.util.logging.*;
|
||||||
public class GeyserLogger implements org.geysermc.api.logger.Logger {
|
public class GeyserLogger implements org.geysermc.api.logger.Logger {
|
||||||
|
|
||||||
private boolean colored = true;
|
private boolean colored = true;
|
||||||
private boolean debug = true;
|
private boolean debug = false;
|
||||||
|
|
||||||
public static final GeyserLogger DEFAULT = new GeyserLogger();
|
public static final GeyserLogger DEFAULT = new GeyserLogger();
|
||||||
|
|
||||||
private GeyserLogger() {
|
private GeyserLogger() {
|
||||||
|
|
||||||
ConsoleHandler consoleHandler = new ConsoleHandler();
|
ConsoleHandler consoleHandler = new ConsoleHandler();
|
||||||
consoleHandler.setLevel(Level.INFO);
|
consoleHandler.setLevel(Level.INFO);
|
||||||
consoleHandler.setFormatter(new SimpleFormatter() {
|
consoleHandler.setFormatter(new SimpleFormatter() {
|
||||||
|
|
@ -117,7 +116,9 @@ public class GeyserLogger implements org.geysermc.api.logger.Logger {
|
||||||
@Override
|
@Override
|
||||||
public void debug(String message) {
|
public void debug(String message) {
|
||||||
waitFor();
|
waitFor();
|
||||||
System.out.println(printConsole(ChatColor.GRAY + message, colored));
|
|
||||||
|
if (debug)
|
||||||
|
System.out.println(printConsole(ChatColor.GRAY + message, colored));
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void waitFor() {
|
private synchronized void waitFor() {
|
||||||
|
|
@ -130,4 +131,9 @@ public class GeyserLogger implements org.geysermc.api.logger.Logger {
|
||||||
public static String printConsole(String message, boolean colors) {
|
public static String printConsole(String message, boolean colors) {
|
||||||
return colors ? ChatColor.toANSI(message + ChatColor.RESET) : ChatColor.stripColors(message + ChatColor.RESET);
|
return colors ? ChatColor.toANSI(message + ChatColor.RESET) : ChatColor.stripColors(message + ChatColor.RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDebug(boolean debug) {
|
||||||
|
this.debug = debug;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,16 @@
|
||||||
|
|
||||||
package org.geysermc.connector.network;
|
package org.geysermc.connector.network;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockPong;
|
import com.nukkitx.protocol.bedrock.BedrockPong;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockServerEventHandler;
|
import com.nukkitx.protocol.bedrock.BedrockServerEventHandler;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
||||||
import com.nukkitx.protocol.bedrock.v361.Bedrock_v361;
|
import com.nukkitx.protocol.bedrock.v361.Bedrock_v361;
|
||||||
import org.geysermc.api.Geyser;
|
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.configuration.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.console.GeyserLogger;
|
import org.geysermc.connector.console.GeyserLogger;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
import org.geysermc.connector.utils.MessageUtils;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
|
|
@ -53,20 +54,31 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BedrockPong onQuery(InetSocketAddress inetSocketAddress) {
|
public BedrockPong onQuery(InetSocketAddress inetSocketAddress) {
|
||||||
GeyserLogger.DEFAULT.info(inetSocketAddress + " has pinged you!");
|
GeyserLogger.DEFAULT.debug(inetSocketAddress + " has pinged you!");
|
||||||
GeyserConfiguration config = connector.getConfig();
|
GeyserConfiguration config = connector.getConfig();
|
||||||
BedrockPong pong = new BedrockPong();
|
BedrockPong pong = new BedrockPong();
|
||||||
pong.setEdition("MCPE");
|
pong.setEdition("MCPE");
|
||||||
pong.setMotd(config.getBedrock().getMotd1());
|
|
||||||
pong.setSubMotd(config.getBedrock().getMotd2());
|
|
||||||
pong.setPlayerCount(2);
|
|
||||||
pong.setMaximumPlayerCount(config.getMaxPlayers());
|
|
||||||
pong.setGameType("Default");
|
pong.setGameType("Default");
|
||||||
pong.setNintendoLimited(false);
|
pong.setNintendoLimited(false);
|
||||||
pong.setProtocolVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion());
|
pong.setProtocolVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion());
|
||||||
pong.setVersion("1.12.0");
|
pong.setVersion("1.12.0");
|
||||||
pong.setIpv4Port(19132);
|
pong.setIpv4Port(19132);
|
||||||
|
|
||||||
|
if (connector.getConfig().isPingPassthrough()) {
|
||||||
|
ServerStatusInfo serverInfo = connector.getPassthroughThread().getInfo();
|
||||||
|
|
||||||
|
if (serverInfo != null) {
|
||||||
|
pong.setMotd(MessageUtils.getBedrockMessage(serverInfo.getDescription()));
|
||||||
|
pong.setSubMotd(config.getBedrock().getMotd2());
|
||||||
|
pong.setPlayerCount(serverInfo.getPlayerInfo().getOnlinePlayers());
|
||||||
|
pong.setMaximumPlayerCount(serverInfo.getPlayerInfo().getMaxPlayers());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pong.setPlayerCount(1);
|
||||||
|
pong.setMaximumPlayerCount(config.getMaxPlayers());
|
||||||
|
pong.setMotd(config.getBedrock().getMotd1());
|
||||||
|
pong.setSubMotd(config.getBedrock().getMotd2());
|
||||||
|
}
|
||||||
return pong;
|
return pong;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +89,4 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
||||||
bedrockServerSession.addDisconnectHandler((x) -> GeyserLogger.DEFAULT.warning("Bedrock user with ip: " + bedrockServerSession.getAddress().getAddress() + " has disconnected for reason " + x));
|
bedrockServerSession.addDisconnectHandler((x) -> GeyserLogger.DEFAULT.warning("Bedrock user with ip: " + bedrockServerSession.getAddress().getAddress() + " has disconnected for reason " + x));
|
||||||
bedrockServerSession.setPacketCodec(Bedrock_v361.V361_CODEC);
|
bedrockServerSession.setPacketCodec(Bedrock_v361.V361_CODEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,9 @@
|
||||||
|
|
||||||
package org.geysermc.connector.network;
|
package org.geysermc.connector.network;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket;
|
||||||
import com.nimbusds.jose.JWSObject;
|
import com.nimbusds.jose.JWSObject;
|
||||||
import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler;
|
import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
|
|
@ -49,10 +51,9 @@ public class UpstreamPacketHandler implements BedrockPacketHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LoginPacket loginPacket) {
|
public boolean handle(LoginPacket loginPacket) {
|
||||||
System.err.println("Handled " + loginPacket.getClass().getSimpleName());
|
|
||||||
// TODO: Implement support for multiple protocols
|
// TODO: Implement support for multiple protocols
|
||||||
if (loginPacket.getProtocolVersion() != GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
|
if (loginPacket.getProtocolVersion() != GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
|
||||||
System.out.println("unsupported");
|
connector.getLogger().debug("unsupported");
|
||||||
session.getUpstream().disconnect("Unsupported Bedrock version. Are you running an outdated version?");
|
session.getUpstream().disconnect("Unsupported Bedrock version. Are you running an outdated version?");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +86,7 @@ public class UpstreamPacketHandler implements BedrockPacketHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ResourcePackClientResponsePacket textPacket) {
|
public boolean handle(ResourcePackClientResponsePacket textPacket) {
|
||||||
System.err.println("Handled " + textPacket.getClass().getSimpleName());
|
connector.getLogger().debug("Handled " + textPacket.getClass().getSimpleName());
|
||||||
switch (textPacket.getStatus()) {
|
switch (textPacket.getStatus()) {
|
||||||
case COMPLETED:
|
case COMPLETED:
|
||||||
session.connect(connector.getRemoteServer());
|
session.connect(connector.getRemoteServer());
|
||||||
|
|
@ -107,299 +108,315 @@ public class UpstreamPacketHandler implements BedrockPacketHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AdventureSettingsPacket packet) {
|
public boolean handle(AdventureSettingsPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AnimatePacket packet) {
|
public boolean handle(AnimatePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
switch (packet.getAction()) {
|
||||||
|
case SWING_ARM:
|
||||||
|
ClientPlayerSwingArmPacket swingArmPacket = new ClientPlayerSwingArmPacket(Hand.MAIN_HAND);
|
||||||
|
session.getDownstream().getSession().send(swingArmPacket);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(BlockEntityDataPacket packet) {
|
public boolean handle(BlockEntityDataPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(BlockPickRequestPacket packet) {
|
public boolean handle(BlockPickRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(BookEditPacket packet) {
|
public boolean handle(BookEditPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ClientCacheBlobStatusPacket packet) {
|
public boolean handle(ClientCacheBlobStatusPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ClientCacheMissResponsePacket packet) {
|
public boolean handle(ClientCacheMissResponsePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ClientCacheStatusPacket packet) {
|
public boolean handle(ClientCacheStatusPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ClientToServerHandshakePacket packet) {
|
public boolean handle(ClientToServerHandshakePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(CommandBlockUpdatePacket packet) {
|
public boolean handle(CommandBlockUpdatePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(CommandRequestPacket packet) {
|
public boolean handle(CommandRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
|
|
||||||
ClientChatPacket chatPacket = new ClientChatPacket(packet.getCommand());
|
String command = packet.getCommand().replace("/", "");
|
||||||
session.getDownstream().getSession().send(chatPacket);
|
if (connector.getCommandMap().getCommands().containsKey(command)) {
|
||||||
|
connector.getCommandMap().runCommand(session, command);
|
||||||
|
} else {
|
||||||
|
ClientChatPacket chatPacket = new ClientChatPacket(packet.getCommand());
|
||||||
|
session.getDownstream().getSession().send(chatPacket);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ContainerClosePacket packet) {
|
public boolean handle(ContainerClosePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(CraftingEventPacket packet) {
|
public boolean handle(CraftingEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(EntityEventPacket packet) {
|
public boolean handle(EntityEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(EntityFallPacket packet) {
|
public boolean handle(EntityFallPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(EntityPickRequestPacket packet) {
|
public boolean handle(EntityPickRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(EventPacket packet) {
|
public boolean handle(EventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(InteractPacket packet) {
|
public boolean handle(InteractPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(InventoryContentPacket packet) {
|
public boolean handle(InventoryContentPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(InventorySlotPacket packet) {
|
public boolean handle(InventorySlotPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(InventoryTransactionPacket packet) {
|
public boolean handle(InventoryTransactionPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ItemFrameDropItemPacket packet) {
|
public boolean handle(ItemFrameDropItemPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LabTablePacket packet) {
|
public boolean handle(LabTablePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LecternUpdatePacket packet) {
|
public boolean handle(LecternUpdatePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LevelEventGenericPacket packet) {
|
public boolean handle(LevelEventGenericPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LevelSoundEventPacket packet) {
|
public boolean handle(LevelSoundEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LevelSoundEvent3Packet packet) {
|
public boolean handle(LevelSoundEvent3Packet packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MapInfoRequestPacket packet) {
|
public boolean handle(MapInfoRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MobArmorEquipmentPacket packet) {
|
public boolean handle(MobArmorEquipmentPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MobEquipmentPacket packet) {
|
public boolean handle(MobEquipmentPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ModalFormResponsePacket packet) {
|
public boolean handle(ModalFormResponsePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MoveEntityAbsolutePacket packet) {
|
public boolean handle(MoveEntityAbsolutePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MovePlayerPacket packet) {
|
public boolean handle(MovePlayerPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(NetworkStackLatencyPacket packet) {
|
public boolean handle(NetworkStackLatencyPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PhotoTransferPacket packet) {
|
public boolean handle(PhotoTransferPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlayerActionPacket packet) {
|
public boolean handle(PlayerActionPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlayerHotbarPacket packet) {
|
public boolean handle(PlayerHotbarPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlayerInputPacket packet) {
|
public boolean handle(PlayerInputPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlayerSkinPacket packet) {
|
public boolean handle(PlayerSkinPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PurchaseReceiptPacket packet) {
|
public boolean handle(PurchaseReceiptPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(RequestChunkRadiusPacket packet) {
|
public boolean handle(RequestChunkRadiusPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ResourcePackChunkRequestPacket packet) {
|
public boolean handle(ResourcePackChunkRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(RiderJumpPacket packet) {
|
public boolean handle(RiderJumpPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ServerSettingsRequestPacket packet) {
|
public boolean handle(ServerSettingsRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetDefaultGameTypePacket packet) {
|
public boolean handle(SetDefaultGameTypePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetLocalPlayerAsInitializedPacket packet) {
|
public boolean handle(SetLocalPlayerAsInitializedPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetPlayerGameTypePacket packet) {
|
public boolean handle(SetPlayerGameTypePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SubClientLoginPacket packet) {
|
public boolean handle(SubClientLoginPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(TextPacket packet) {
|
public boolean handle(TextPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
|
|
||||||
|
if (packet.getMessage().charAt(0) == '.') {
|
||||||
|
ClientChatPacket chatPacket = new ClientChatPacket(packet.getMessage().replace(".", "/"));
|
||||||
|
session.getDownstream().getSession().send(chatPacket);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ClientChatPacket chatPacket = new ClientChatPacket(packet.getMessage());
|
ClientChatPacket chatPacket = new ClientChatPacket(packet.getMessage());
|
||||||
session.getDownstream().getSession().send(chatPacket);
|
session.getDownstream().getSession().send(chatPacket);
|
||||||
|
|
@ -409,493 +426,493 @@ public class UpstreamPacketHandler implements BedrockPacketHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AddBehaviorTreePacket packet) {
|
public boolean handle(AddBehaviorTreePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AddEntityPacket packet) {
|
public boolean handle(AddEntityPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AddHangingEntityPacket packet) {
|
public boolean handle(AddHangingEntityPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AddItemEntityPacket packet) {
|
public boolean handle(AddItemEntityPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AddPaintingPacket packet) {
|
public boolean handle(AddPaintingPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AddPlayerPacket packet) {
|
public boolean handle(AddPlayerPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AvailableCommandsPacket packet) {
|
public boolean handle(AvailableCommandsPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(BlockEventPacket packet) {
|
public boolean handle(BlockEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(BossEventPacket packet) {
|
public boolean handle(BossEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(CameraPacket packet) {
|
public boolean handle(CameraPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ChangeDimensionPacket packet) {
|
public boolean handle(ChangeDimensionPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ChunkRadiusUpdatedPacket packet) {
|
public boolean handle(ChunkRadiusUpdatedPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ClientboundMapItemDataPacket packet) {
|
public boolean handle(ClientboundMapItemDataPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(CommandOutputPacket packet) {
|
public boolean handle(CommandOutputPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ContainerOpenPacket packet) {
|
public boolean handle(ContainerOpenPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ContainerSetDataPacket packet) {
|
public boolean handle(ContainerSetDataPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(CraftingDataPacket packet) {
|
public boolean handle(CraftingDataPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(DisconnectPacket packet) {
|
public boolean handle(DisconnectPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ExplodePacket packet) {
|
public boolean handle(ExplodePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LevelChunkPacket packet) {
|
public boolean handle(LevelChunkPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameRulesChangedPacket packet) {
|
public boolean handle(GameRulesChangedPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GuiDataPickItemPacket packet) {
|
public boolean handle(GuiDataPickItemPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(HurtArmorPacket packet) {
|
public boolean handle(HurtArmorPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AutomationClientConnectPacket packet) {
|
public boolean handle(AutomationClientConnectPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LevelEventPacket packet) {
|
public boolean handle(LevelEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MapCreateLockedCopyPacket packet) {
|
public boolean handle(MapCreateLockedCopyPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MobEffectPacket packet) {
|
public boolean handle(MobEffectPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ModalFormRequestPacket packet) {
|
public boolean handle(ModalFormRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MoveEntityDeltaPacket packet) {
|
public boolean handle(MoveEntityDeltaPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(NpcRequestPacket packet) {
|
public boolean handle(NpcRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(OnScreenTextureAnimationPacket packet) {
|
public boolean handle(OnScreenTextureAnimationPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlayerListPacket packet) {
|
public boolean handle(PlayerListPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlaySoundPacket packet) {
|
public boolean handle(PlaySoundPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlayStatusPacket packet) {
|
public boolean handle(PlayStatusPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(RemoveEntityPacket packet) {
|
public boolean handle(RemoveEntityPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(RemoveObjectivePacket packet) {
|
public boolean handle(RemoveObjectivePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ResourcePackChunkDataPacket packet) {
|
public boolean handle(ResourcePackChunkDataPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ResourcePackDataInfoPacket packet) {
|
public boolean handle(ResourcePackDataInfoPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ResourcePacksInfoPacket packet) {
|
public boolean handle(ResourcePacksInfoPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ResourcePackStackPacket packet) {
|
public boolean handle(ResourcePackStackPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(RespawnPacket packet) {
|
public boolean handle(RespawnPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ScriptCustomEventPacket packet) {
|
public boolean handle(ScriptCustomEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ServerSettingsResponsePacket packet) {
|
public boolean handle(ServerSettingsResponsePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ServerToClientHandshakePacket packet) {
|
public boolean handle(ServerToClientHandshakePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetCommandsEnabledPacket packet) {
|
public boolean handle(SetCommandsEnabledPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetDifficultyPacket packet) {
|
public boolean handle(SetDifficultyPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetDisplayObjectivePacket packet) {
|
public boolean handle(SetDisplayObjectivePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetEntityDataPacket packet) {
|
public boolean handle(SetEntityDataPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetEntityLinkPacket packet) {
|
public boolean handle(SetEntityLinkPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetEntityMotionPacket packet) {
|
public boolean handle(SetEntityMotionPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetHealthPacket packet) {
|
public boolean handle(SetHealthPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetLastHurtByPacket packet) {
|
public boolean handle(SetLastHurtByPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetScoreboardIdentityPacket packet) {
|
public boolean handle(SetScoreboardIdentityPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetScorePacket packet) {
|
public boolean handle(SetScorePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetSpawnPositionPacket packet) {
|
public boolean handle(SetSpawnPositionPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetTimePacket packet) {
|
public boolean handle(SetTimePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SetTitlePacket packet) {
|
public boolean handle(SetTitlePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ShowCreditsPacket packet) {
|
public boolean handle(ShowCreditsPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ShowProfilePacket packet) {
|
public boolean handle(ShowProfilePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(ShowStoreOfferPacket packet) {
|
public boolean handle(ShowStoreOfferPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SimpleEventPacket packet) {
|
public boolean handle(SimpleEventPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SpawnExperienceOrbPacket packet) {
|
public boolean handle(SpawnExperienceOrbPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(StartGamePacket packet) {
|
public boolean handle(StartGamePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(StopSoundPacket packet) {
|
public boolean handle(StopSoundPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(StructureBlockUpdatePacket packet) {
|
public boolean handle(StructureBlockUpdatePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(StructureTemplateDataExportRequestPacket packet) {
|
public boolean handle(StructureTemplateDataExportRequestPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(StructureTemplateDataExportResponsePacket packet) {
|
public boolean handle(StructureTemplateDataExportResponsePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(TakeItemEntityPacket packet) {
|
public boolean handle(TakeItemEntityPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(TransferPacket packet) {
|
public boolean handle(TransferPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(UpdateAttributesPacket packet) {
|
public boolean handle(UpdateAttributesPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(UpdateBlockPacket packet) {
|
public boolean handle(UpdateBlockPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(UpdateBlockPropertiesPacket packet) {
|
public boolean handle(UpdateBlockPropertiesPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(UpdateBlockSyncedPacket packet) {
|
public boolean handle(UpdateBlockSyncedPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(UpdateEquipPacket packet) {
|
public boolean handle(UpdateEquipPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(UpdateSoftEnumPacket packet) {
|
public boolean handle(UpdateSoftEnumPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(UpdateTradePacket packet) {
|
public boolean handle(UpdateTradePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(AvailableEntityIdentifiersPacket packet) {
|
public boolean handle(AvailableEntityIdentifiersPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(BiomeDefinitionListPacket packet) {
|
public boolean handle(BiomeDefinitionListPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LevelSoundEvent2Packet packet) {
|
public boolean handle(LevelSoundEvent2Packet packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(NetworkChunkPublisherUpdatePacket packet) {
|
public boolean handle(NetworkChunkPublisherUpdatePacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(SpawnParticleEffectPacket packet) {
|
public boolean handle(SpawnParticleEffectPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(VideoStreamConnectPacket packet) {
|
public boolean handle(VideoStreamConnectPacket packet) {
|
||||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -27,26 +27,26 @@ package org.geysermc.connector.network.session;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||||
import com.github.steveice10.packetlib.Client;
|
import com.github.steveice10.packetlib.Client;
|
||||||
import com.github.steveice10.mc.auth.exception.request.RequestException;
|
|
||||||
import com.github.steveice10.packetlib.event.session.ConnectedEvent;
|
import com.github.steveice10.packetlib.event.session.ConnectedEvent;
|
||||||
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
||||||
import com.github.steveice10.packetlib.event.session.PacketReceivedEvent;
|
import com.github.steveice10.packetlib.event.session.PacketReceivedEvent;
|
||||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||||
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
|
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
|
||||||
import com.nukkitx.network.util.DisconnectReason;
|
import com.nukkitx.network.util.DisconnectReason;
|
||||||
import com.nukkitx.protocol.MinecraftSession;
|
|
||||||
import com.nukkitx.protocol.PlayerSession;
|
import com.nukkitx.protocol.PlayerSession;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
||||||
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
|
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.api.command.CommandSender;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.network.remote.RemoteJavaServer;
|
import org.geysermc.connector.network.remote.RemoteJavaServer;
|
||||||
|
import org.geysermc.connector.network.session.cache.ScoreboardCache;
|
||||||
import org.geysermc.connector.network.translators.Registry;
|
import org.geysermc.connector.network.translators.Registry;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class GeyserSession implements PlayerSession {
|
public class GeyserSession implements PlayerSession, CommandSender {
|
||||||
|
|
||||||
private GeyserConnector connector;
|
private GeyserConnector connector;
|
||||||
|
|
||||||
|
|
@ -59,23 +59,25 @@ public class GeyserSession implements PlayerSession {
|
||||||
@Getter
|
@Getter
|
||||||
private Client downstream;
|
private Client downstream;
|
||||||
|
|
||||||
|
private final GeyserSession THIS = this;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private AuthenticationData authenticationData;
|
private AuthenticationData authenticationData;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private ScoreboardCache scoreboardCache;
|
||||||
|
|
||||||
private boolean closed;
|
private boolean closed;
|
||||||
|
|
||||||
public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession) {
|
public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession) {
|
||||||
this.connector = connector;
|
this.connector = connector;
|
||||||
this.upstream = bedrockServerSession;
|
this.upstream = bedrockServerSession;
|
||||||
|
|
||||||
|
this.scoreboardCache = new ScoreboardCache(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect(RemoteJavaServer remoteServer) {
|
public void connect(RemoteJavaServer remoteServer) {
|
||||||
MinecraftProtocol protocol = null;
|
MinecraftProtocol protocol = new MinecraftProtocol(authenticationData.getName());
|
||||||
try {
|
|
||||||
protocol = new MinecraftProtocol(connector.getConfig().getRemote().getEmail(), connector.getConfig().getRemote().getPassword());
|
|
||||||
} catch (RequestException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
downstream = new Client(remoteServer.getAddress(), remoteServer.getPort(), protocol, new TcpSessionFactory());
|
downstream = new Client(remoteServer.getAddress(), remoteServer.getPort(), protocol, new TcpSessionFactory());
|
||||||
downstream.getSession().addListener(new SessionAdapter() {
|
downstream.getSession().addListener(new SessionAdapter() {
|
||||||
|
|
||||||
|
|
@ -92,7 +94,7 @@ public class GeyserSession implements PlayerSession {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void packetReceived(PacketReceivedEvent event) {
|
public void packetReceived(PacketReceivedEvent event) {
|
||||||
Registry.JAVA.translate(event.getPacket().getClass(), event.getPacket(), GeyserSession.this);
|
Registry.JAVA.translate(event.getPacket().getClass(), event.getPacket(), THIS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -131,8 +133,29 @@ public class GeyserSession implements PlayerSession {
|
||||||
authenticationData = new AuthenticationData(name, uuid, xboxUUID);
|
authenticationData = new AuthenticationData(name, uuid, xboxUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BedrockServerSession getUpstream() {
|
@Override
|
||||||
return upstream;
|
public String getName() {
|
||||||
|
return authenticationData.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMessage(String message) {
|
||||||
|
TextPacket textPacket = new TextPacket();
|
||||||
|
textPacket.setPlatformChatId("");
|
||||||
|
textPacket.setSourceName("");
|
||||||
|
textPacket.setXuid("");
|
||||||
|
textPacket.setType(TextPacket.Type.CHAT);
|
||||||
|
textPacket.setNeedsTranslation(false);
|
||||||
|
textPacket.setMessage(message);
|
||||||
|
|
||||||
|
upstream.sendPacket(textPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMessage(String[] messages) {
|
||||||
|
for (String message : messages) {
|
||||||
|
sendMessage(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|
|
||||||
51
connector/src/main/java/org/geysermc/connector/network/session/cache/ScoreboardCache.java
vendored
Normal file
51
connector/src/main/java/org/geysermc/connector/network/session/cache/ScoreboardCache.java
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 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.connector.network.session.cache;
|
||||||
|
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.RemoveObjectivePacket;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
import org.geysermc.connector.network.translators.scoreboard.Scoreboard;
|
||||||
|
|
||||||
|
public class ScoreboardCache {
|
||||||
|
|
||||||
|
private GeyserSession session;
|
||||||
|
|
||||||
|
public ScoreboardCache(GeyserSession session) {
|
||||||
|
this.session = session;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Scoreboard scoreboard;
|
||||||
|
|
||||||
|
public void removeScoreboard() {
|
||||||
|
RemoveObjectivePacket removeObjectivePacket = new RemoveObjectivePacket();
|
||||||
|
removeObjectivePacket.setObjectiveId(scoreboard.getObjective().getObjectiveName());
|
||||||
|
session.getUpstream().sendPacket(removeObjectivePacket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -26,16 +26,15 @@
|
||||||
package org.geysermc.connector.network.translators;
|
package org.geysermc.connector.network.translators;
|
||||||
|
|
||||||
import com.github.steveice10.packetlib.packet.Packet;
|
import com.github.steveice10.packetlib.packet.Packet;
|
||||||
import org.geysermc.api.Geyser;
|
|
||||||
import org.geysermc.connector.console.GeyserLogger;
|
import org.geysermc.connector.console.GeyserLogger;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class Registry<T> {
|
public class Registry<T> {
|
||||||
|
|
||||||
private final Map<Class<? extends T>, BiConsumer<? extends T, GeyserSession>> MAP = new HashMap<>();
|
private final Map<Class<? extends T>, BiConsumer<? extends T, GeyserSession>> MAP = new HashMap<>();
|
||||||
|
|
||||||
public static final Registry<Packet> JAVA = new Registry<>();
|
public static final Registry<Packet> JAVA = new Registry<>();
|
||||||
|
|
@ -48,7 +47,7 @@ public class Registry<T> {
|
||||||
try {
|
try {
|
||||||
((BiConsumer<P, GeyserSession>) JAVA.MAP.get(clazz)).accept(p, s);
|
((BiConsumer<P, GeyserSession>) JAVA.MAP.get(clazz)).accept(p, s);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
GeyserLogger.DEFAULT.warning("could not translate packet " + p.getClass().getSimpleName());
|
GeyserLogger.DEFAULT.debug("could not translate packet " + p.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,32 +26,39 @@
|
||||||
package org.geysermc.connector.network.translators;
|
package org.geysermc.connector.network.translators;
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector2f;
|
import com.flowpowered.math.vector.Vector2f;
|
||||||
import com.flowpowered.math.vector.Vector2i;
|
|
||||||
import com.flowpowered.math.vector.Vector3f;
|
import com.flowpowered.math.vector.Vector3f;
|
||||||
import com.flowpowered.math.vector.Vector3i;
|
import com.flowpowered.math.vector.Vector3i;
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction;
|
||||||
import com.github.steveice10.mc.protocol.data.message.TranslationMessage;
|
import com.github.steveice10.mc.protocol.data.message.TranslationMessage;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTitlePacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionRotationPacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
|
||||||
import com.nukkitx.nbt.CompoundTagBuilder;
|
import com.nukkitx.nbt.CompoundTagBuilder;
|
||||||
import com.nukkitx.nbt.NbtUtils;
|
import com.nukkitx.nbt.NbtUtils;
|
||||||
import com.nukkitx.nbt.stream.NBTOutputStream;
|
import com.nukkitx.nbt.stream.NBTOutputStream;
|
||||||
import com.nukkitx.nbt.tag.CompoundTag;
|
import com.nukkitx.nbt.tag.CompoundTag;
|
||||||
import com.nukkitx.network.VarInts;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
|
import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
|
||||||
import com.nukkitx.protocol.bedrock.data.GameRule;
|
import com.nukkitx.protocol.bedrock.data.GameRule;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
import io.netty.buffer.ByteBuf;
|
import org.geysermc.connector.network.session.cache.ScoreboardCache;
|
||||||
import io.netty.buffer.ByteBufOutputStream;
|
import org.geysermc.connector.network.translators.scoreboard.Scoreboard;
|
||||||
import io.netty.buffer.Unpooled;
|
import org.geysermc.connector.network.translators.scoreboard.ScoreboardObjective;
|
||||||
import org.geysermc.connector.utils.GeyserUtils;
|
|
||||||
import org.geysermc.connector.utils.MessageUtils;
|
import org.geysermc.connector.utils.MessageUtils;
|
||||||
import org.geysermc.connector.utils.Toolbox;
|
import org.geysermc.connector.utils.Toolbox;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class TranslatorsInit {
|
public class TranslatorsInit {
|
||||||
|
|
||||||
private static final CompoundTag EMPTY_TAG = CompoundTagBuilder.builder().buildRootTag();
|
private static final CompoundTag EMPTY_TAG = CompoundTagBuilder.builder().buildRootTag();
|
||||||
private static final byte[] EMPTY_LEVEL_CHUNK_DATA;
|
private static final byte[] EMPTY_LEVEL_CHUNK_DATA;
|
||||||
|
|
||||||
|
|
@ -72,6 +79,10 @@ public class TranslatorsInit {
|
||||||
public static void start() {
|
public static void start() {
|
||||||
addLoginPackets();
|
addLoginPackets();
|
||||||
addChatPackets();
|
addChatPackets();
|
||||||
|
addTitlePackets();
|
||||||
|
addTimePackets();
|
||||||
|
addEntityPackets();
|
||||||
|
addScoreboardPackets();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addLoginPackets() {
|
private static void addLoginPackets() {
|
||||||
|
|
@ -132,15 +143,10 @@ public class TranslatorsInit {
|
||||||
session.getUpstream().sendPacket(startGamePacket);
|
session.getUpstream().sendPacket(startGamePacket);
|
||||||
|
|
||||||
Vector3f pos = new Vector3f(0, 0, 0);
|
Vector3f pos = new Vector3f(0, 0, 0);
|
||||||
|
|
||||||
int chunkX = pos.getFloorX() >> 4;
|
int chunkX = pos.getFloorX() >> 4;
|
||||||
|
|
||||||
int chunkZ = pos.getFloorZ() >> 4;
|
int chunkZ = pos.getFloorZ() >> 4;
|
||||||
|
|
||||||
for (int x = -3; x < 3; x++) {
|
for (int x = -3; x < 3; x++) {
|
||||||
|
|
||||||
for (int z = -3; z < 3; z++) {
|
for (int z = -3; z < 3; z++) {
|
||||||
|
|
||||||
LevelChunkPacket data = new LevelChunkPacket();
|
LevelChunkPacket data = new LevelChunkPacket();
|
||||||
data.setChunkX(chunkX + x);
|
data.setChunkX(chunkX + x);
|
||||||
data.setChunkZ(chunkZ + z);
|
data.setChunkZ(chunkZ + z);
|
||||||
|
|
@ -151,14 +157,11 @@ public class TranslatorsInit {
|
||||||
session.getUpstream().sendPacketImmediately(data);
|
session.getUpstream().sendPacketImmediately(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayStatusPacket packet1 = new PlayStatusPacket();
|
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
|
||||||
|
playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
|
||||||
packet1.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
|
session.getUpstream().sendPacket(playStatusPacket);
|
||||||
|
|
||||||
session.getUpstream().sendPacket(packet1);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,22 +196,215 @@ public class TranslatorsInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] empty(byte[] b, Vector2i pos) {
|
public static void addTitlePackets() {
|
||||||
ByteBuf by = Unpooled.buffer();
|
Registry.add(ServerTitlePacket.class, (packet, session) -> {
|
||||||
|
SetTitlePacket titlePacket = new SetTitlePacket();
|
||||||
|
|
||||||
GeyserUtils.writePEChunkCoord(by, pos);
|
switch (packet.getAction()) {
|
||||||
|
case TITLE:
|
||||||
|
titlePacket.setType(SetTitlePacket.Type.SET_TITLE);
|
||||||
|
titlePacket.setText(packet.getTitle().getFullText());
|
||||||
|
break;
|
||||||
|
case SUBTITLE:
|
||||||
|
titlePacket.setType(SetTitlePacket.Type.SET_SUBTITLE);
|
||||||
|
titlePacket.setText(packet.getSubtitle().getFullText());
|
||||||
|
break;
|
||||||
|
case CLEAR:
|
||||||
|
case RESET:
|
||||||
|
titlePacket.setType(SetTitlePacket.Type.RESET_TITLE);
|
||||||
|
titlePacket.setText("");
|
||||||
|
break;
|
||||||
|
case ACTION_BAR:
|
||||||
|
titlePacket.setType(SetTitlePacket.Type.SET_ACTIONBAR_MESSAGE);
|
||||||
|
titlePacket.setText(packet.getActionBar().getFullText());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return by.array();
|
titlePacket.setFadeInTime(packet.getFadeIn());
|
||||||
|
titlePacket.setFadeOutTime(packet.getFadeOut());
|
||||||
|
titlePacket.setStayTime(packet.getStay());
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(titlePacket);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CanWriteToBB extends ByteArrayOutputStream {
|
public static void addTimePackets() {
|
||||||
|
Registry.add(ServerUpdateTimePacket.class, (packet, session) -> {
|
||||||
|
SetTimePacket setTimePacket = new SetTimePacket();
|
||||||
|
setTimePacket.setTime((int) Math.abs(packet.getTime()));
|
||||||
|
|
||||||
CanWriteToBB() {
|
session.getUpstream().sendPacket(setTimePacket);
|
||||||
super(8192);
|
});
|
||||||
}
|
|
||||||
|
|
||||||
void writeTo(ByteBuf buf) {
|
|
||||||
buf.writeBytes(super.buf, 0, super.count);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addEntityPackets() {
|
||||||
|
Registry.add(ServerEntityPositionPacket.class, (packet, session) -> {
|
||||||
|
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();
|
||||||
|
moveEntityPacket.setRuntimeEntityId(packet.getEntityId());
|
||||||
|
moveEntityPacket.setPosition(new Vector3f(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ()));
|
||||||
|
moveEntityPacket.setRotation(new Vector3f(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ()));
|
||||||
|
moveEntityPacket.setOnGround(packet.isOnGround());
|
||||||
|
moveEntityPacket.setTeleported(false);
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(moveEntityPacket);
|
||||||
|
});
|
||||||
|
|
||||||
|
Registry.add(ServerEntityPositionRotationPacket.class, (packet, session) -> {
|
||||||
|
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();
|
||||||
|
moveEntityPacket.setRuntimeEntityId(packet.getEntityId());
|
||||||
|
moveEntityPacket.setPosition(new Vector3f(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ()));
|
||||||
|
moveEntityPacket.setRotation(new Vector3f(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ()));
|
||||||
|
moveEntityPacket.setOnGround(true);
|
||||||
|
moveEntityPacket.setTeleported(false);
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(moveEntityPacket);
|
||||||
|
});
|
||||||
|
|
||||||
|
Registry.add(ServerEntityTeleportPacket.class, (packet, session) -> {
|
||||||
|
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();
|
||||||
|
moveEntityPacket.setRuntimeEntityId(packet.getEntityId());
|
||||||
|
moveEntityPacket.setPosition(new Vector3f(packet.getX(), packet.getY(), packet.getZ()));
|
||||||
|
moveEntityPacket.setRotation(new Vector3f(packet.getX(), packet.getY(), packet.getZ()));
|
||||||
|
moveEntityPacket.setOnGround(packet.isOnGround());
|
||||||
|
moveEntityPacket.setTeleported(true);
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(moveEntityPacket);
|
||||||
|
});
|
||||||
|
|
||||||
|
Registry.add(ServerEntityVelocityPacket.class, (packet, session) -> {
|
||||||
|
SetEntityMotionPacket entityMotionPacket = new SetEntityMotionPacket();
|
||||||
|
entityMotionPacket.setRuntimeEntityId(packet.getEntityId());
|
||||||
|
entityMotionPacket.setMotion(new Vector3f(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()));
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(entityMotionPacket);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addScoreboardPackets() {
|
||||||
|
Registry.add(ServerDisplayScoreboardPacket.class, (packet, session) -> {
|
||||||
|
try {
|
||||||
|
ScoreboardCache cache = session.getScoreboardCache();
|
||||||
|
Scoreboard scoreboard = new Scoreboard(session);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (cache.getScoreboard() != null)
|
||||||
|
cache.setScoreboard(scoreboard);
|
||||||
|
*/
|
||||||
|
System.out.println("added scoreboard " + packet.getScoreboardName());
|
||||||
|
// scoreboard.onUpdate();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Registry.add(ServerScoreboardObjectivePacket.class, (packet, session) -> {
|
||||||
|
try {
|
||||||
|
ScoreboardCache cache = session.getScoreboardCache();
|
||||||
|
Scoreboard scoreboard = new Scoreboard(session);
|
||||||
|
if (cache.getScoreboard() != null)
|
||||||
|
scoreboard = cache.getScoreboard();
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("new objective registered with " + packet.getName());
|
||||||
|
if (packet.getAction() == ObjectiveAction.ADD || packet.getAction() == ObjectiveAction.UPDATE) {
|
||||||
|
ScoreboardObjective objective = scoreboard.registerNewObjective(packet.getName());
|
||||||
|
objective.setDisplaySlot(ScoreboardObjective.DisplaySlot.SIDEBAR);
|
||||||
|
objective.setDisplayName(packet.getDisplayName().getFullText());
|
||||||
|
} else {
|
||||||
|
scoreboard.unregisterObjective(packet.getDisplayName().getFullText());
|
||||||
|
}
|
||||||
|
|
||||||
|
scoreboard.onUpdate();
|
||||||
|
cache.setScoreboard(scoreboard);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Registry.add(ServerUpdateScorePacket.class, (packet, session) -> {
|
||||||
|
try {
|
||||||
|
ScoreboardCache cache = session.getScoreboardCache();
|
||||||
|
Scoreboard scoreboard = new Scoreboard(session);
|
||||||
|
if (cache.getScoreboard() != null)
|
||||||
|
scoreboard = cache.getScoreboard();
|
||||||
|
|
||||||
|
ScoreboardObjective objective = scoreboard.getObjective(packet.getObjective());
|
||||||
|
if (objective == null) {
|
||||||
|
objective = scoreboard.registerNewObjective(packet.getObjective());
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(packet.getEntry() + " <-> objective = " + packet.getObjective() + " val " + packet.getValue());
|
||||||
|
switch (packet.getAction()) {
|
||||||
|
case REMOVE:
|
||||||
|
objective.registerScore(packet.getObjective(), packet.getEntry(), packet.getValue(), SetScorePacket.Action.REMOVE);
|
||||||
|
break;
|
||||||
|
case ADD_OR_UPDATE:
|
||||||
|
objective.registerScore(packet.getObjective(), packet.getEntry(), packet.getValue(), SetScorePacket.Action.SET);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cache.setScoreboard(scoreboard);
|
||||||
|
scoreboard.onUpdate();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public static void addScoreboardPackets() {
|
||||||
|
Registry.add(ServerDisplayScoreboardPacket.class, (packet, session) -> {
|
||||||
|
SetDisplayObjectivePacket objectivePacket = new SetDisplayObjectivePacket();
|
||||||
|
objectivePacket.setCriteria("dummy");
|
||||||
|
objectivePacket.setDisplaySlot("sidebar");
|
||||||
|
objectivePacket.setDisplayName(packet.getScoreboardName());
|
||||||
|
objectivePacket.setSortOrder(1);
|
||||||
|
objectivePacket.setObjectiveId(UUID.randomUUID().toString()); // uhh
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(objectivePacket);
|
||||||
|
|
||||||
|
System.out.println("added scoreboard " + packet.getScoreboardName());
|
||||||
|
});
|
||||||
|
|
||||||
|
Registry.add(ServerScoreboardObjectivePacket.class, (packet, session) -> {
|
||||||
|
if (packet.getAction() == ObjectiveAction.REMOVE) {
|
||||||
|
RemoveObjectivePacket objectivePacket = new RemoveObjectivePacket();
|
||||||
|
objectivePacket.setObjectiveId(packet.getDisplayName().getFullText());
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(objectivePacket);
|
||||||
|
} else {
|
||||||
|
SetDisplayObjectivePacket objectivePacket = new SetDisplayObjectivePacket();
|
||||||
|
objectivePacket.setCriteria("dummy");
|
||||||
|
objectivePacket.setDisplaySlot("sidebar");
|
||||||
|
objectivePacket.setDisplayName(packet.getDisplayName().getFullText());
|
||||||
|
objectivePacket.setSortOrder(1);
|
||||||
|
objectivePacket.setObjectiveId(packet.getName()); // uhh
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(objectivePacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("new objective registered with " + packet.getName());
|
||||||
|
});
|
||||||
|
|
||||||
|
Registry.add(ServerUpdateScorePacket.class, (packet, session) -> {
|
||||||
|
if (packet.getAction() == ScoreboardAction.ADD_OR_UPDATE) {
|
||||||
|
SetDisplayObjectivePacket objectivePacket = new SetDisplayObjectivePacket();
|
||||||
|
objectivePacket.setObjectiveId(packet.getObjective());
|
||||||
|
objectivePacket.setDisplaySlot("sidebar");
|
||||||
|
objectivePacket.setCriteria("dummy");
|
||||||
|
objectivePacket.setDisplayName(packet.getEntry());
|
||||||
|
objectivePacket.setSortOrder(1);
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(objectivePacket);
|
||||||
|
} else {
|
||||||
|
RemoveObjectivePacket objectivePacket = new RemoveObjectivePacket();
|
||||||
|
objectivePacket.setObjectiveId(packet.getObjective());
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(objectivePacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(packet.getEntry() + " <-> objective = " + packet.getObjective() + " val " + packet.getValue());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 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.connector.network.translators.scoreboard;
|
||||||
|
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.SetScorePacket;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapted from: https://github.com/Ragnok123/GTScoreboard
|
||||||
|
*/
|
||||||
|
public class Score {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private int score;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private long scoreboardId;
|
||||||
|
|
||||||
|
private ScoreboardObjective objective;
|
||||||
|
private String fakePlayer;
|
||||||
|
private long id;
|
||||||
|
private boolean isFake;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private SetScorePacket.Action action = SetScorePacket.Action.SET;
|
||||||
|
|
||||||
|
private boolean modified = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String fakeId;
|
||||||
|
|
||||||
|
public Score(ScoreboardObjective objective, String fakePlayer) {
|
||||||
|
scoreboardId = -new Random().nextLong();
|
||||||
|
objective = objective;
|
||||||
|
fakePlayer = fakePlayer;
|
||||||
|
isFake = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 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.connector.network.translators.scoreboard;
|
||||||
|
|
||||||
|
import com.nukkitx.protocol.bedrock.data.ScoreInfo;
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.RemoveObjectivePacket;
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.SetDisplayObjectivePacket;
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.SetScorePacket;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapted from: https://github.com/Ragnok123/GTScoreboard
|
||||||
|
*/
|
||||||
|
public class Scoreboard {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private ScoreboardObjective objective;
|
||||||
|
|
||||||
|
private GeyserSession session;
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private Map<String, ScoreboardObjective> objectiveMap = new HashMap<String, ScoreboardObjective>();
|
||||||
|
|
||||||
|
public Scoreboard(GeyserSession session) {
|
||||||
|
this.session = session;
|
||||||
|
|
||||||
|
id = new Random().nextLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoreboardObjective registerNewObjective(String objectiveName) {
|
||||||
|
ScoreboardObjective objective = new ScoreboardObjective();
|
||||||
|
objective.setObjectiveName(objectiveName);
|
||||||
|
this.objective = objective;
|
||||||
|
if (!objectiveMap.containsKey(objectiveName)) {
|
||||||
|
objectiveMap.put(objectiveName, objective);
|
||||||
|
}
|
||||||
|
|
||||||
|
return objective;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoreboardObjective getObjective(String objectiveName) {
|
||||||
|
ScoreboardObjective objective = null;
|
||||||
|
if (objectiveMap.containsKey(objectiveName) && this.objective.getObjectiveName().contains(objectiveName)) {
|
||||||
|
objective = this.objective;
|
||||||
|
}
|
||||||
|
|
||||||
|
return objective;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjective(String objectiveName) {
|
||||||
|
if (objectiveMap.containsKey(objectiveName))
|
||||||
|
objective = objectiveMap.get(objectiveName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unregisterObjective(String objectiveName) {
|
||||||
|
if (!objectiveMap.containsKey(objectiveName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (objective.getObjectiveName().equals(objective)) {
|
||||||
|
objective = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectiveMap.remove(objectiveName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onUpdate() {
|
||||||
|
RemoveObjectivePacket removeObjectivePacket = new RemoveObjectivePacket();
|
||||||
|
removeObjectivePacket.setObjectiveId(objective.getObjectiveName());
|
||||||
|
session.getUpstream().sendPacket(removeObjectivePacket);
|
||||||
|
|
||||||
|
SetDisplayObjectivePacket displayObjectivePacket = new SetDisplayObjectivePacket();
|
||||||
|
displayObjectivePacket.setObjectiveId(objective.getObjectiveName());
|
||||||
|
displayObjectivePacket.setDisplayName(objective.getDisplayName());
|
||||||
|
displayObjectivePacket.setCriteria("dummy");
|
||||||
|
displayObjectivePacket.setDisplaySlot(ScoreboardObjective.DisplaySlot.SIDEBAR.name());
|
||||||
|
displayObjectivePacket.setSortOrder(1);
|
||||||
|
session.getUpstream().sendPacket(displayObjectivePacket);
|
||||||
|
|
||||||
|
Map<String, Score> fakeMap = new HashMap<String, Score>();
|
||||||
|
for (Map.Entry<String, Score> entry : objective.getScores().entrySet()) {
|
||||||
|
fakeMap.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Score score : fakeMap.values()) {
|
||||||
|
ScoreInfo scoreInfo = new ScoreInfo(score.getScoreboardId(), objective.getObjectiveName(), score.getScore(), score.getFakeId());
|
||||||
|
|
||||||
|
SetScorePacket setScorePacket = new SetScorePacket();
|
||||||
|
setScorePacket.setAction(score.getAction());
|
||||||
|
setScorePacket.setInfos(Arrays.asList(scoreInfo));
|
||||||
|
session.getUpstream().sendPacket(setScorePacket);
|
||||||
|
|
||||||
|
if (score.getAction() == SetScorePacket.Action.REMOVE) {
|
||||||
|
String id = score.getFakeId();
|
||||||
|
objective.getScores().remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 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.connector.network.translators.scoreboard;
|
||||||
|
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.SetScorePacket;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.geysermc.connector.console.GeyserLogger;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapted from: https://github.com/Ragnok123/GTScoreboard
|
||||||
|
*/
|
||||||
|
public class ScoreboardObjective {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private int scoreboardTick = 0;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String objectiveName;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private DisplaySlot displaySlot;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String displayName;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private Map<String, Score> scores = new HashMap<String, Score>();
|
||||||
|
|
||||||
|
public void registerScore(String id, String fake, int value) {
|
||||||
|
registerScore(id, fake, value, SetScorePacket.Action.SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerScore(String id, String fake, int value, SetScorePacket.Action action) {
|
||||||
|
Score score = new Score(this, fake);
|
||||||
|
score.setScore(value);
|
||||||
|
score.setFakeId(id);
|
||||||
|
score.setAction(action);
|
||||||
|
if (!scores.containsKey(id)) {
|
||||||
|
scores.put(id, score);
|
||||||
|
} else {
|
||||||
|
setScore(id, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScore(String id, int value) {
|
||||||
|
if (scores.containsKey(id)) {
|
||||||
|
Score modifiedScore = scores.get(id);
|
||||||
|
modifiedScore.setScore(value);
|
||||||
|
scores.remove(id);
|
||||||
|
scores.put(id, modifiedScore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScoreText(String id, String text) {
|
||||||
|
if (scores.containsKey(id)) {
|
||||||
|
Score oldScore = scores.get(id);
|
||||||
|
oldScore.setAction(SetScorePacket.Action.REMOVE);
|
||||||
|
oldScore.setFakeId(id + "_old_changed");
|
||||||
|
|
||||||
|
Score newScore = new Score(this, text);
|
||||||
|
newScore.setScore(oldScore.getScore());
|
||||||
|
newScore.setFakeId(id);
|
||||||
|
scores.remove(id);
|
||||||
|
scores.put(id, newScore);
|
||||||
|
scores.put(id + "_old_changed", oldScore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScore(String id) {
|
||||||
|
int i = 0;
|
||||||
|
if (scores.containsKey(id)) {
|
||||||
|
Score score = scores.get(id);
|
||||||
|
i = score.getScore();
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetScore(String id) {
|
||||||
|
if (scores.containsKey(id)) {
|
||||||
|
Score modifiedScore = scores.get(id);
|
||||||
|
modifiedScore.setAction(SetScorePacket.Action.REMOVE);
|
||||||
|
scores.remove(id);
|
||||||
|
scores.put(id, modifiedScore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DisplaySlot {
|
||||||
|
|
||||||
|
SIDEBAR,
|
||||||
|
LIST,
|
||||||
|
BELOWNAME;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -28,6 +28,7 @@ package org.geysermc.connector.plugin;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
public class PluginYML {
|
public class PluginYML {
|
||||||
|
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ public class MessageUtils {
|
||||||
strings.add("");
|
strings.add("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (translation.getTranslationKey().equals("command.context.here")) {
|
||||||
|
strings.add(" - no permission or invalid command!");
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < getTranslationParams(translation.getTranslationParams()).size(); j++) {
|
for (int j = 0; j < getTranslationParams(translation.getTranslationParams()).size(); j++) {
|
||||||
strings.add(getTranslationParams(translation.getTranslationParams()).get(j));
|
strings.add(getTranslationParams(translation.getTranslationParams()).get(j));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,10 @@ import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class Toolbox {
|
public class Toolbox {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
InputStream stream = Toolbox.class.getClassLoader().getResourceAsStream("cached_pallete.json");
|
InputStream stream = Toolbox.class.getClassLoader().getResourceAsStream("cached_pallete.json");
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
ArrayList<LinkedHashMap<String, Object>> entries = new ArrayList<>();
|
ArrayList<LinkedHashMap<String, Object>> entries = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -26,9 +24,7 @@ public class Toolbox {
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuf b = Unpooled.buffer();
|
ByteBuf b = Unpooled.buffer();
|
||||||
|
|
||||||
VarInts.writeUnsignedInt(b, entries.size());
|
VarInts.writeUnsignedInt(b, entries.size());
|
||||||
|
|
||||||
for (Map<String, Object> e : entries) {
|
for (Map<String, Object> e : entries) {
|
||||||
BedrockUtils.writeString(b, (String) e.get("name"));
|
BedrockUtils.writeString(b, (String) e.get("name"));
|
||||||
b.writeShortLE((int) e.get("data"));
|
b.writeShortLE((int) e.get("data"));
|
||||||
|
|
@ -37,16 +33,12 @@ public class Toolbox {
|
||||||
|
|
||||||
CACHED_PALLETE = b;
|
CACHED_PALLETE = b;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
InputStream stream2 = Toolbox.class.getClassLoader().getResourceAsStream("items.json");
|
InputStream stream2 = Toolbox.class.getClassLoader().getResourceAsStream("items.json");
|
||||||
if (stream2 == null) {
|
if (stream2 == null) {
|
||||||
throw new AssertionError("Items Table not found");
|
throw new AssertionError("Items Table not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectMapper mapper2 = new ObjectMapper();
|
ObjectMapper mapper2 = new ObjectMapper();
|
||||||
|
|
||||||
ArrayList<HashMap> s = new ArrayList<>();
|
ArrayList<HashMap> s = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
s = mapper2.readValue(stream2, ArrayList.class);
|
s = mapper2.readValue(stream2, ArrayList.class);
|
||||||
|
|
@ -55,26 +47,11 @@ public class Toolbox {
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<StartGamePacket.ItemEntry> l = new ArrayList<>();
|
ArrayList<StartGamePacket.ItemEntry> l = new ArrayList<>();
|
||||||
|
for (HashMap e : s) {
|
||||||
for(HashMap e : s) {
|
|
||||||
l.add(new StartGamePacket.ItemEntry((String) e.get("name"), (short) ((int) e.get("id"))));
|
l.add(new StartGamePacket.ItemEntry((String) e.get("name"), (short) ((int) e.get("id"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
ITEMS = l;
|
ITEMS = l;
|
||||||
|
|
||||||
/*ByteBuf serializer;
|
|
||||||
|
|
||||||
serializer = Unpooled.buffer();
|
|
||||||
serializer.writeShortLE(1);
|
|
||||||
GeyserUtils.writeVarIntByteArray(serializer, (chunkdata) -> {
|
|
||||||
GeyserUtils.writeEmptySubChunk(chunkdata);
|
|
||||||
chunkdata.writeZero(512);
|
|
||||||
chunkdata.writeZero(256);
|
|
||||||
chunkdata.writeByte(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
EMPTY_CHUNK = GeyserUtils.readAllBytes(serializer);*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Collection<StartGamePacket.ItemEntry> ITEMS;
|
public static final Collection<StartGamePacket.ItemEntry> ITEMS;
|
||||||
|
|
@ -82,5 +59,4 @@ public class Toolbox {
|
||||||
public static final ByteBuf CACHED_PALLETE;
|
public static final ByteBuf CACHED_PALLETE;
|
||||||
|
|
||||||
//public static final byte[] EMPTY_CHUNK;
|
//public static final byte[] EMPTY_CHUNK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -30,6 +30,9 @@ ping-passthrough: false
|
||||||
# Maximum amount of players that can connect
|
# Maximum amount of players that can connect
|
||||||
max-players: 100
|
max-players: 100
|
||||||
|
|
||||||
|
# If debug messages should be sent through console
|
||||||
|
debug-mode: false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue