From 927542ff2eff9dd1675cd8465f1fe310dcc764c6 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 11 Apr 2020 00:20:34 +0100 Subject: [PATCH 01/31] Added base command completion --- .../JavaServerDeclareCommandsTranslator.java | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java new file mode 100644 index 00000000..d921bd79 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2019-2020 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.java; + +import com.github.steveice10.mc.protocol.data.game.command.CommandNode; +import com.github.steveice10.mc.protocol.data.game.command.CommandType; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket; +import com.nukkitx.protocol.bedrock.data.CommandData; +import com.nukkitx.protocol.bedrock.data.CommandEnumData; +import com.nukkitx.protocol.bedrock.data.CommandParamData; +import com.nukkitx.protocol.bedrock.packet.AvailableCommandsPacket; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +import java.util.*; + +@Translator(packet = ServerDeclareCommandsPacket.class) +public class JavaServerDeclareCommandsTranslator extends PacketTranslator { + @Override + public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) { + GeyserConnector.getInstance().getLogger().info("ServerDeclareCommandsPacket"); + + List rootNodes = new ArrayList<>(); + List commandData = new ArrayList<>(); + Map commands = new HashMap<>(); + + for (CommandNode node : packet.getNodes()) { + if (node.getType() == CommandType.ROOT) { + rootNodes.add(node); + } + } + + for (CommandNode rootNode : rootNodes) { + for (int nodeIndex : rootNode.getChildIndices()) { + CommandNode node = packet.getNodes()[nodeIndex]; + + commands.put(nodeIndex, node.getName()); + } + } + + List flags = new ArrayList<>(); + for (int commandID : commands.keySet()) { + String commandName = commands.get(commandID); + + CommandEnumData aliases = new CommandEnumData( commandName + "Aliases", new String[]{commandName.toLowerCase()}, false); + + CommandData data = new CommandData(commandName, "A Java server command", flags, (byte) 0, aliases, new CommandParamData[0][0]); + commandData.add(data); + } + + + AvailableCommandsPacket availableCommandsPacket = new AvailableCommandsPacket(); + for (CommandData data : commandData) { + availableCommandsPacket.getCommands().add(data); + } + + session.getUpstream().sendPacket(availableCommandsPacket); + } +} From c0500862211c24912b0e710daf5f6ec4ec7f6986 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 11 Apr 2020 01:24:22 +0100 Subject: [PATCH 02/31] Basic param parsing --- .../JavaServerDeclareCommandsTranslator.java | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java index d921bd79..9ae5bb48 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -25,6 +25,8 @@ package org.geysermc.connector.network.translators.java; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandType; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket; @@ -36,7 +38,9 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.utils.FileUtils; +import java.io.IOException; import java.util.*; @Translator(packet = ServerDeclareCommandsPacket.class) @@ -48,6 +52,8 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator rootNodes = new ArrayList<>(); List commandData = new ArrayList<>(); Map commands = new HashMap<>(); + Map> commandArgs = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); for (CommandNode node : packet.getNodes()) { if (node.getType() == CommandType.ROOT) { @@ -59,21 +65,47 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator= 1) { + for (int childIndex : node.getChildIndices()) { + commandArgs.putIfAbsent(nodeIndex, new ArrayList<>()); + commandArgs.get(nodeIndex).add(packet.getNodes()[childIndex]); + } + } + commands.put(nodeIndex, node.getName()); } } + + + /* try { + GeyserConnector.getInstance().getLogger().debug(mapper.writeValueAsString(params)); + } catch (JsonProcessingException e) { } */ + List flags = new ArrayList<>(); for (int commandID : commands.keySet()) { String commandName = commands.get(commandID); - CommandEnumData aliases = new CommandEnumData( commandName + "Aliases", new String[]{commandName.toLowerCase()}, false); + CommandEnumData aliases = new CommandEnumData( commandName + "Aliases", new String[] { commandName.toLowerCase() }, false); + CommandParamData[][] params = new CommandParamData[0][0]; - CommandData data = new CommandData(commandName, "A Java server command", flags, (byte) 0, aliases, new CommandParamData[0][0]); + if (commandArgs.containsKey(commandID)) { + params = new CommandParamData[1][]; + CommandParamData[] param1 = new CommandParamData[commandArgs.get(commandID).size()]; + + int i = 0; + for (CommandNode paramNode : commandArgs.get(commandID)) { + param1[i] = new CommandParamData(paramNode.getName(), false, null, CommandParamData.Type.MESSAGE, null, Collections.emptyList()); + i++; + } + + params[0] = param1; + } + + CommandData data = new CommandData(commandName, "A Java server command", flags, (byte) 0, aliases, params); commandData.add(data); } - AvailableCommandsPacket availableCommandsPacket = new AvailableCommandsPacket(); for (CommandData data : commandData) { availableCommandsPacket.getCommands().add(data); From 010840bebe4125632e053211d0c7450c5a14a30f Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 11 Apr 2020 02:25:58 +0100 Subject: [PATCH 03/31] Better parameter handling --- .../JavaServerDeclareCommandsTranslator.java | 116 +++++++++++++++--- 1 file changed, 96 insertions(+), 20 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java index 9ae5bb48..7ada88cb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -28,6 +28,7 @@ package org.geysermc.connector.network.translators.java; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; +import com.github.steveice10.mc.protocol.data.game.command.CommandParser; import com.github.steveice10.mc.protocol.data.game.command.CommandType; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket; import com.nukkitx.protocol.bedrock.data.CommandData; @@ -65,6 +66,8 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator= 1) { for (int childIndex : node.getChildIndices()) { commandArgs.putIfAbsent(nodeIndex, new ArrayList<>()); @@ -76,31 +79,12 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator flags = new ArrayList<>(); for (int commandID : commands.keySet()) { String commandName = commands.get(commandID); CommandEnumData aliases = new CommandEnumData( commandName + "Aliases", new String[] { commandName.toLowerCase() }, false); - CommandParamData[][] params = new CommandParamData[0][0]; - - if (commandArgs.containsKey(commandID)) { - params = new CommandParamData[1][]; - CommandParamData[] param1 = new CommandParamData[commandArgs.get(commandID).size()]; - - int i = 0; - for (CommandNode paramNode : commandArgs.get(commandID)) { - param1[i] = new CommandParamData(paramNode.getName(), false, null, CommandParamData.Type.MESSAGE, null, Collections.emptyList()); - i++; - } - - params[0] = param1; - } + CommandParamData[][] params = getParams(commandID, packet.getNodes()[commandID], commandArgs); CommandData data = new CommandData(commandName, "A Java server command", flags, (byte) 0, aliases, params); commandData.add(data); @@ -113,4 +97,96 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator> commandArgs) { + if (commandArgs.containsKey(commandID)) { + CommandParamData[][] params = new CommandParamData[commandArgs.get(commandID).size()][]; + + if (commandNode.getName().equals("ban")) { + GeyserConnector.getInstance().getLogger().debug("ban : " + commandArgs.get(commandID)); + } + + int i = 0; + for (CommandNode paramNode : commandArgs.get(commandID)) { + CommandParamData[] param1 = new CommandParamData[1]; + param1[0] = new CommandParamData(paramNode.getName(), false, null, mapCommandType(paramNode.getParser()), null, Collections.emptyList()); + params[i] = param1; + i++; + } + + return params; + } + + return new CommandParamData[0][0]; + } + + private CommandParamData.Type mapCommandType(CommandParser parser) { + if (parser == null) { return CommandParamData.Type.STRING; } + + switch (parser) { + case FLOAT: + return CommandParamData.Type.FLOAT; + + case INTEGER: + return CommandParamData.Type.INT; + + case ENTITY: + case GAME_PROFILE: + return CommandParamData.Type.TARGET; + + case BLOCK_POS: + return CommandParamData.Type.BLOCK_POSITION; + + case COLUMN_POS: + case VEC3: + return CommandParamData.Type.POSITION; + + case MESSAGE: + return CommandParamData.Type.MESSAGE; + + case NBT: + case NBT_COMPOUND_TAG: + case NBT_TAG: + case NBT_PATH: + return CommandParamData.Type.JSON; + + case RESOURCE_LOCATION: + return CommandParamData.Type.FILE_PATH; + + case INT_RANGE: + return CommandParamData.Type.INT_RANGE; + + case BOOL: + case DOUBLE: + case STRING: + case VEC2: + case BLOCK_STATE: + case BLOCK_PREDICATE: + case ITEM_STACK: + case ITEM_PREDICATE: + case COLOR: + case COMPONENT: + case OBJECTIVE: + case OBJECTIVE_CRITERIA: + case OPERATION: // Possibly OPERATOR + case PARTICLE: + case ROTATION: + case SCOREBOARD_SLOT: + case SCORE_HOLDER: + case SWIZZLE: + case TEAM: + case ITEM_SLOT: + case MOB_EFFECT: + case FUNCTION: + case ENTITY_ANCHOR: + case RANGE: + case FLOAT_RANGE: + case ITEM_ENCHANTMENT: + case ENTITY_SUMMON: + case DIMENSION: + case TIME: + default: + return CommandParamData.Type.STRING; + } + } } From 74d3254bf074ee79ead6eaeddc2eee6645978f73 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 11 Apr 2020 02:58:07 +0100 Subject: [PATCH 04/31] Automatic enum creation and comments --- .../JavaServerDeclareCommandsTranslator.java | 58 ++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java index 7ada88cb..bd164a34 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -25,8 +25,6 @@ package org.geysermc.connector.network.translators.java; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandParser; import com.github.steveice10.mc.protocol.data.game.command.CommandType; @@ -35,39 +33,37 @@ import com.nukkitx.protocol.bedrock.data.CommandData; import com.nukkitx.protocol.bedrock.data.CommandEnumData; import com.nukkitx.protocol.bedrock.data.CommandParamData; import com.nukkitx.protocol.bedrock.packet.AvailableCommandsPacket; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.FileUtils; -import java.io.IOException; import java.util.*; @Translator(packet = ServerDeclareCommandsPacket.class) public class JavaServerDeclareCommandsTranslator extends PacketTranslator { @Override public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) { - GeyserConnector.getInstance().getLogger().info("ServerDeclareCommandsPacket"); - List rootNodes = new ArrayList<>(); List commandData = new ArrayList<>(); Map commands = new HashMap<>(); Map> commandArgs = new HashMap<>(); - ObjectMapper mapper = new ObjectMapper(); + // Find the root nodes for (CommandNode node : packet.getNodes()) { if (node.getType() == CommandType.ROOT) { rootNodes.add(node); } } + // Loop through the root nodes to get all commands for (CommandNode rootNode : rootNodes) { for (int nodeIndex : rootNode.getChildIndices()) { CommandNode node = packet.getNodes()[nodeIndex]; + // Make sure we dont have duplicated commands (happens if there is more than 1 root node) if (commands.containsKey(nodeIndex)) { continue; } + // Get and update the commandArgs list with the found arguments if (node.getChildIndices().length >= 1) { for (int childIndex : node.getChildIndices()) { commandArgs.putIfAbsent(nodeIndex, new ArrayList<>()); @@ -75,41 +71,77 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator flags = new ArrayList<>(); + + // Loop through all the found commands for (int commandID : commands.keySet()) { String commandName = commands.get(commandID); + // Create a basic alias CommandEnumData aliases = new CommandEnumData( commandName + "Aliases", new String[] { commandName.toLowerCase() }, false); + + // Get and parse all params CommandParamData[][] params = getParams(commandID, packet.getNodes()[commandID], commandArgs); + // Build the completed command and add it to the final list CommandData data = new CommandData(commandName, "A Java server command", flags, (byte) 0, aliases, params); commandData.add(data); } + // Add our commands to the AvailableCommandsPacket for the bedrock client AvailableCommandsPacket availableCommandsPacket = new AvailableCommandsPacket(); for (CommandData data : commandData) { availableCommandsPacket.getCommands().add(data); } + // Finally, send the commands to the client session.getUpstream().sendPacket(availableCommandsPacket); } private CommandParamData[][] getParams(int commandID, CommandNode commandNode, Map> commandArgs) { if (commandArgs.containsKey(commandID)) { - CommandParamData[][] params = new CommandParamData[commandArgs.get(commandID).size()][]; + List parsedParams = new ArrayList<>(); + int enumIndex = -1; - if (commandNode.getName().equals("ban")) { - GeyserConnector.getInstance().getLogger().debug("ban : " + commandArgs.get(commandID)); + for (CommandNode paramNode : commandArgs.get(commandID)) { + if (paramNode.getParser() == null) { + if (enumIndex == -1) { + enumIndex = parsedParams.size(); + + // Create the new enum command + CommandEnumData enumData = new CommandEnumData(paramNode.getName(), new String[] { paramNode.getName() }, false); + parsedParams.add(new CommandParamData(paramNode.getName(), false, enumData, mapCommandType(paramNode.getParser()), null, Collections.emptyList())); + }else { + // Get the existing enum + CommandParamData enumParam = parsedParams.get(enumIndex); + + // Extend the current list of enum values + String[] enumOptions = Arrays.copyOf(enumParam.getEnumData().getValues(), enumParam.getEnumData().getValues().length + 1); + enumOptions[enumOptions.length - 1] = paramNode.getName(); + + // Re-create the command using the updated values + CommandEnumData enumData = new CommandEnumData(enumParam.getEnumData().getName(), enumOptions, false); + parsedParams.set(enumIndex, new CommandParamData(enumParam.getName(), false, enumData, enumParam.getType(), null, Collections.emptyList())); + } + }else{ + // Put the non-enum param into the list + parsedParams.add(new CommandParamData(paramNode.getName(), false, null, mapCommandType(paramNode.getParser()), null, Collections.emptyList())); + } } + CommandParamData[][] params = new CommandParamData[parsedParams.size()][]; + + // Fill the nested params array int i = 0; - for (CommandNode paramNode : commandArgs.get(commandID)) { + for (CommandParamData parsedParam : parsedParams) { CommandParamData[] param1 = new CommandParamData[1]; - param1[0] = new CommandParamData(paramNode.getName(), false, null, mapCommandType(paramNode.getParser()), null, Collections.emptyList()); + param1[0] = parsedParam; params[i] = param1; i++; } From c95d2d2f477079d6160360acf2b26989eb6e96fc Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 11 Apr 2020 14:57:29 +0100 Subject: [PATCH 05/31] New parameter parsing ready for multiple params --- .../JavaServerDeclareCommandsTranslator.java | 102 ++++++++++++------ 1 file changed, 68 insertions(+), 34 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java index bd164a34..22d6e7a6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -25,6 +25,8 @@ package org.geysermc.connector.network.translators.java; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandParser; import com.github.steveice10.mc.protocol.data.game.command.CommandType; @@ -33,6 +35,8 @@ import com.nukkitx.protocol.bedrock.data.CommandData; import com.nukkitx.protocol.bedrock.data.CommandEnumData; import com.nukkitx.protocol.bedrock.data.CommandParamData; import com.nukkitx.protocol.bedrock.packet.AvailableCommandsPacket; +import lombok.Getter; +import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -87,7 +91,7 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator> commandArgs) { - if (commandArgs.containsKey(commandID)) { - List parsedParams = new ArrayList<>(); - int enumIndex = -1; + private CommandParamData[][] getParams(int commandID, CommandNode commandNode, CommandNode[] allNodes) { + // Check if the command is an alias and redirect it + if (commandNode.getRedirectIndex() != -1) { + GeyserConnector.getInstance().getLogger().debug("Redirecting command " + commandNode.getName() + " to " + allNodes[commandNode.getRedirectIndex()].getName()); + commandNode = allNodes[commandNode.getRedirectIndex()]; + } - for (CommandNode paramNode : commandArgs.get(commandID)) { - if (paramNode.getParser() == null) { - if (enumIndex == -1) { - enumIndex = parsedParams.size(); + if (commandNode.getChildIndices().length >= 1) { + // Create the root param node and build all the children + ParamInfo rootParam = new ParamInfo(commandNode, null); + rootParam.buildChildren(allNodes); - // Create the new enum command - CommandEnumData enumData = new CommandEnumData(paramNode.getName(), new String[] { paramNode.getName() }, false); - parsedParams.add(new CommandParamData(paramNode.getName(), false, enumData, mapCommandType(paramNode.getParser()), null, Collections.emptyList())); - }else { - // Get the existing enum - CommandParamData enumParam = parsedParams.get(enumIndex); + try { + new ObjectMapper().writeValueAsString(rootParam.getChildren()); + } catch (JsonProcessingException e) { } - // Extend the current list of enum values - String[] enumOptions = Arrays.copyOf(enumParam.getEnumData().getValues(), enumParam.getEnumData().getValues().length + 1); - enumOptions[enumOptions.length - 1] = paramNode.getName(); - - // Re-create the command using the updated values - CommandEnumData enumData = new CommandEnumData(enumParam.getEnumData().getName(), enumOptions, false); - parsedParams.set(enumIndex, new CommandParamData(enumParam.getName(), false, enumData, enumParam.getType(), null, Collections.emptyList())); - } - }else{ - // Put the non-enum param into the list - parsedParams.add(new CommandParamData(paramNode.getName(), false, null, mapCommandType(paramNode.getParser()), null, Collections.emptyList())); - } - } - - CommandParamData[][] params = new CommandParamData[parsedParams.size()][]; + CommandParamData[][] params = new CommandParamData[rootParam.getChildren().size()][]; // Fill the nested params array int i = 0; - for (CommandParamData parsedParam : parsedParams) { - CommandParamData[] param1 = new CommandParamData[1]; - param1[0] = parsedParam; - params[i] = param1; + for (ParamInfo parmInfo : rootParam.getChildren()) { + CommandParamData[] paramParts = new CommandParamData[1]; + paramParts[0] = parmInfo.getParamData(); + params[i] = paramParts; i++; } @@ -221,4 +210,49 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator children; + + public ParamInfo(CommandNode paramNode, CommandParamData paramData) { + this.paramNode = paramNode; + this.paramData = paramData; + this.children = new ArrayList<>(); + } + + public void buildChildren(CommandNode[] allNodes) { + int enumIndex = -1; + + for (int paramID : paramNode.getChildIndices()) { + CommandNode paramNode = allNodes[paramID]; + + if (paramNode.getParser() == null) { + if (enumIndex == -1) { + enumIndex = children.size(); + + // Create the new enum command + CommandEnumData enumData = new CommandEnumData(paramNode.getName(), new String[] { paramNode.getName() }, false); + children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), false, enumData, mapCommandType(paramNode.getParser()), null, Collections.emptyList()))); + } else { + // Get the existing enum + ParamInfo enumParamInfo = children.get(enumIndex); + + // Extend the current list of enum values + String[] enumOptions = Arrays.copyOf(enumParamInfo.getParamData().getEnumData().getValues(), enumParamInfo.getParamData().getEnumData().getValues().length + 1); + enumOptions[enumOptions.length - 1] = paramNode.getName(); + + // Re-create the command using the updated values + CommandEnumData enumData = new CommandEnumData(enumParamInfo.getParamData().getEnumData().getName(), enumOptions, false); + children.set(enumIndex, new ParamInfo(enumParamInfo.getParamNode(), new CommandParamData(enumParamInfo.getParamData().getName(), false, enumData, enumParamInfo.getParamData().getType(), null, Collections.emptyList()))); + } + }else{ + // Put the non-enum param into the list + children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), false, null, mapCommandType(paramNode.getParser()), null, Collections.emptyList()))); + } + } + } + } } From 00099b53323ad7dfbcaacd1ffb91610a3d9fdb1c Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 11 Apr 2020 15:53:53 +0100 Subject: [PATCH 06/31] Multi arguments handling --- .../JavaServerDeclareCommandsTranslator.java | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java index 22d6e7a6..f8d31be9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -120,18 +120,17 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator treeData = rootParam.getTree(); + CommandParamData[][] params = new CommandParamData[treeData.size()][]; // Fill the nested params array int i = 0; - for (ParamInfo parmInfo : rootParam.getChildren()) { - CommandParamData[] paramParts = new CommandParamData[1]; - paramParts[0] = parmInfo.getParamData(); - params[i] = paramParts; + for (CommandParamData[] tree : treeData) { + params[i] = tree; i++; } @@ -253,6 +252,35 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator getTree() { + List treeParamData = new ArrayList<>(); + + for (ParamInfo child : children) { + List childTree = child.getTree(); + for (CommandParamData[] subchild : childTree) { + CommandParamData[] tmpTree = new ArrayList() { + { + add(child.getParamData()); + addAll(Arrays.asList(subchild)); + } + }.toArray(new CommandParamData[0]); + + treeParamData.add(tmpTree); + } + + if (childTree.size() == 0) { + treeParamData.add(new CommandParamData[] { child.getParamData() }); + } + } + + return treeParamData; } } } From b0d39c587f51b8bd218d9ab19b5dde14883f63c1 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 11 Apr 2020 19:31:06 +0100 Subject: [PATCH 07/31] Removed debugging code --- .../java/JavaServerDeclareCommandsTranslator.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java index f8d31be9..614966a5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -120,10 +120,6 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator treeData = rootParam.getTree(); CommandParamData[][] params = new CommandParamData[treeData.size()][]; @@ -263,7 +259,10 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator treeParamData = new ArrayList<>(); for (ParamInfo child : children) { + // Get the tree from the child List childTree = child.getTree(); + + // Un-pack the tree append the child node to it and push into the list for (CommandParamData[] subchild : childTree) { CommandParamData[] tmpTree = new ArrayList() { { @@ -275,6 +274,7 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator Date: Mon, 13 Apr 2020 11:10:53 +0100 Subject: [PATCH 08/31] Added warning message if chat message is longer than 256 characters. --- .../BedrockCommandRequestTranslator.java | 9 ++++++++- .../bedrock/BedrockTextTranslator.java | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java index 28cbf4c4..47895666 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java @@ -45,7 +45,14 @@ public class BedrockCommandRequestTranslator extends PacketTranslator 256) { + session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); + return; + } + + ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java index 1c841631..89766be3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java @@ -38,12 +38,26 @@ public class BedrockTextTranslator extends PacketTranslator { @Override public void translate(TextPacket packet, GeyserSession session) { if (packet.getMessage().charAt(0) == '.') { - ClientChatPacket chatPacket = new ClientChatPacket(packet.getMessage().replace(".", "/")); + String message = packet.getMessage().replace(".", "/").trim(); + + if (message.length() > 256) { + session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); + return; + } + + ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); return; } - ClientChatPacket chatPacket = new ClientChatPacket(packet.getMessage()); + String message = packet.getMessage().trim(); + + if (message.length() > 256) { + session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); + return; + } + + ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); } } From 549fe1d479d5c115d2ba30295be83cbbd0c49aad Mon Sep 17 00:00:00 2001 From: rtm516 Date: Mon, 13 Apr 2020 17:27:30 +0100 Subject: [PATCH 09/31] Fixed crashing bug when using more than 1 root node --- .../JavaServerDeclareCommandsTranslator.java | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java index 614966a5..391f0a61 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaServerDeclareCommandsTranslator.java @@ -25,11 +25,8 @@ package org.geysermc.connector.network.translators.java; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandParser; -import com.github.steveice10.mc.protocol.data.game.command.CommandType; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket; import com.nukkitx.protocol.bedrock.data.CommandData; import com.nukkitx.protocol.bedrock.data.CommandEnumData; @@ -47,37 +44,30 @@ import java.util.*; public class JavaServerDeclareCommandsTranslator extends PacketTranslator { @Override public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) { - List rootNodes = new ArrayList<>(); List commandData = new ArrayList<>(); Map commands = new HashMap<>(); Map> commandArgs = new HashMap<>(); - // Find the root nodes - for (CommandNode node : packet.getNodes()) { - if (node.getType() == CommandType.ROOT) { - rootNodes.add(node); - } - } + // Get the first node, it should be a root node + CommandNode rootNode = packet.getNodes()[packet.getFirstNodeIndex()]; // Loop through the root nodes to get all commands - for (CommandNode rootNode : rootNodes) { - for (int nodeIndex : rootNode.getChildIndices()) { - CommandNode node = packet.getNodes()[nodeIndex]; + for (int nodeIndex : rootNode.getChildIndices()) { + CommandNode node = packet.getNodes()[nodeIndex]; - // Make sure we dont have duplicated commands (happens if there is more than 1 root node) - if (commands.containsKey(nodeIndex)) { continue; } + // Make sure we dont have duplicated commands (happens if there is more than 1 root node) + if (commands.containsKey(nodeIndex)) { continue; } - // Get and update the commandArgs list with the found arguments - if (node.getChildIndices().length >= 1) { - for (int childIndex : node.getChildIndices()) { - commandArgs.putIfAbsent(nodeIndex, new ArrayList<>()); - commandArgs.get(nodeIndex).add(packet.getNodes()[childIndex]); - } + // Get and update the commandArgs list with the found arguments + if (node.getChildIndices().length >= 1) { + for (int childIndex : node.getChildIndices()) { + commandArgs.putIfAbsent(nodeIndex, new ArrayList<>()); + commandArgs.get(nodeIndex).add(packet.getNodes()[childIndex]); } - - // Insert the command name into the list - commands.put(nodeIndex, node.getName()); } + + // Insert the command name into the list + commands.put(nodeIndex, node.getName()); } // The command flags, not sure what these do apart from break things @@ -104,6 +94,8 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator Date: Mon, 13 Apr 2020 17:49:29 +0100 Subject: [PATCH 10/31] Centeralised message length checking and added TODO for localization --- .../bedrock/BedrockCommandRequestTranslator.java | 6 ++---- .../translators/bedrock/BedrockTextTranslator.java | 11 +++-------- .../org/geysermc/connector/utils/MessageUtils.java | 11 +++++++++++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java index 47895666..c8d8c323 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java @@ -34,6 +34,7 @@ import org.geysermc.connector.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; import com.nukkitx.protocol.bedrock.packet.CommandRequestPacket; +import org.geysermc.connector.utils.MessageUtils; @Translator(packet = CommandRequestPacket.class) public class BedrockCommandRequestTranslator extends PacketTranslator { @@ -47,10 +48,7 @@ public class BedrockCommandRequestTranslator extends PacketTranslator 256) { - session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); - return; - } + if (MessageUtils.isTooLong(message, session)) { return; } ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java index 89766be3..b8800faa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java @@ -31,6 +31,7 @@ import org.geysermc.connector.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; +import org.geysermc.connector.utils.MessageUtils; @Translator(packet = TextPacket.class) public class BedrockTextTranslator extends PacketTranslator { @@ -40,10 +41,7 @@ public class BedrockTextTranslator extends PacketTranslator { if (packet.getMessage().charAt(0) == '.') { String message = packet.getMessage().replace(".", "/").trim(); - if (message.length() > 256) { - session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); - return; - } + if (MessageUtils.isTooLong(message, session)) { return; } ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); @@ -52,10 +50,7 @@ public class BedrockTextTranslator extends PacketTranslator { String message = packet.getMessage().trim(); - if (message.length() > 256) { - session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); - return; - } + if (MessageUtils.isTooLong(message, session)) { return; } ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); diff --git a/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java index a28d6a7a..5b5ce7df 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java @@ -32,6 +32,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; +import org.geysermc.connector.network.session.GeyserSession; import java.util.*; import java.util.regex.Matcher; @@ -290,4 +291,14 @@ public class MessageUtils { } return ""; } + + public static boolean isTooLong(String message, GeyserSession session) { + if (message.length() > 256) { + // TODO: Add Geyser localization and translate this based on language + session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); + return false; + } + + return true; + } } From f7c5fea87e140d822392e473e86360678d746e98 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Mon, 13 Apr 2020 22:52:38 +0100 Subject: [PATCH 11/31] Prevents animations from being sent to the server before the player has spawned --- .../network/translators/bedrock/BedrockAnimateTranslator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java index 7ccb2426..e64c161b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java @@ -25,6 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; +import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -40,6 +41,9 @@ public class BedrockAnimateTranslator extends PacketTranslator { @Override public void translate(AnimatePacket packet, GeyserSession session) { + // Stop the player sending animations before they have fully spawned into the server + if (!session.isSpawned()) { return; } + switch (packet.getAction()) { case SWING_ARM: // Delay so entity damage can be processed first From 522dc864de072970846164de5ad6332db0aa6784 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Tue, 14 Apr 2020 10:55:12 +0100 Subject: [PATCH 12/31] Removed unneeded import --- .../network/translators/bedrock/BedrockAnimateTranslator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java index e64c161b..8fecfb86 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java @@ -25,7 +25,6 @@ package org.geysermc.connector.network.translators.bedrock; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; From fe7edd2fde85a038e346e9308804f24da90ee4f9 Mon Sep 17 00:00:00 2001 From: Redned Date: Wed, 15 Apr 2020 02:50:55 -0500 Subject: [PATCH 13/31] Don't allow blank issues --- .github/ISSUE_TEMPLATE/config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..3ba13e0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false From 34a8a6d55fc9fa2298a9d5fe3a0d917ee4043ba1 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Wed, 15 Apr 2020 10:51:56 +0100 Subject: [PATCH 14/31] Fixed single line if statements --- .../bedrock/BedrockCommandRequestTranslator.java | 4 +++- .../translators/bedrock/BedrockTextTranslator.java | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java index c8d8c323..e7d4c748 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java @@ -48,7 +48,9 @@ public class BedrockCommandRequestTranslator extends PacketTranslator { if (packet.getMessage().charAt(0) == '.') { String message = packet.getMessage().replace(".", "/").trim(); - if (MessageUtils.isTooLong(message, session)) { return; } + if (MessageUtils.isTooLong(message, session)) { + return; + } ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); @@ -50,7 +52,9 @@ public class BedrockTextTranslator extends PacketTranslator { String message = packet.getMessage().trim(); - if (MessageUtils.isTooLong(message, session)) { return; } + if (MessageUtils.isTooLong(message, session)) { + return; + } ClientChatPacket chatPacket = new ClientChatPacket(message); session.getDownstream().getSession().send(chatPacket); From 8fd4632d075d701b54591160304c897c4ff1d75b Mon Sep 17 00:00:00 2001 From: rtm516 Date: Wed, 15 Apr 2020 10:55:10 +0100 Subject: [PATCH 15/31] Fixed single line if statements --- .../network/translators/bedrock/BedrockAnimateTranslator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java index 8fecfb86..af41c9e0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java @@ -41,7 +41,9 @@ public class BedrockAnimateTranslator extends PacketTranslator { @Override public void translate(AnimatePacket packet, GeyserSession session) { // Stop the player sending animations before they have fully spawned into the server - if (!session.isSpawned()) { return; } + if (!session.isSpawned()) { + return; + } switch (packet.getAction()) { case SWING_ARM: From 9cdb172755f9ac09563d71b67ac63cc960e8c92d Mon Sep 17 00:00:00 2001 From: rtm516 Date: Wed, 15 Apr 2020 11:50:47 +0100 Subject: [PATCH 16/31] Adds the discord link to the issues list --- .github/ISSUE_TEMPLATE/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 3ba13e0c..1b0f1a97 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1 +1,5 @@ blank_issues_enabled: false +contact_links: + - name: GeyserMC Discord + url: http://discord.geysermc.org/ + about: If your issue seems like it possibly an easy fix due to configuration, please hop on our discord. From bfb3fb42589e2a6f2d2bfa2552290cd73a3444e5 Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Wed, 15 Apr 2020 15:39:21 -0400 Subject: [PATCH 17/31] Update various copyright dates --- .../org/geysermc/platform/bukkit/GeyserBukkitConfiguration.java | 2 +- .../java/org/geysermc/platform/bukkit/GeyserBukkitLogger.java | 2 +- .../java/org/geysermc/platform/bukkit/GeyserBukkitPlugin.java | 2 +- .../geysermc/platform/bungeecord/GeyserBungeeConfiguration.java | 2 +- .../org/geysermc/platform/bungeecord/GeyserBungeeLogger.java | 2 +- .../org/geysermc/platform/bungeecord/GeyserBungeePlugin.java | 2 +- .../org/geysermc/platform/sponge/GeyserSpongeConfiguration.java | 2 +- .../java/org/geysermc/platform/sponge/GeyserSpongeLogger.java | 2 +- .../java/org/geysermc/platform/sponge/GeyserSpongePlugin.java | 2 +- .../java/org/geysermc/platform/standalone/GeyserBootstrap.java | 2 +- .../org/geysermc/platform/standalone/GeyserConfiguration.java | 2 +- common/src/main/java/org/geysermc/common/ChatColor.java | 2 +- .../src/main/java/org/geysermc/common/IGeyserConfiguration.java | 2 +- .../java/org/geysermc/common/bootstrap/IGeyserBootstrap.java | 2 +- .../src/main/java/org/geysermc/common/logger/IGeyserLogger.java | 2 +- .../main/java/org/geysermc/common/window/CustomFormBuilder.java | 2 +- .../main/java/org/geysermc/common/window/CustomFormWindow.java | 2 +- common/src/main/java/org/geysermc/common/window/FormWindow.java | 2 +- .../main/java/org/geysermc/common/window/ModalFormWindow.java | 2 +- .../main/java/org/geysermc/common/window/SimpleFormWindow.java | 2 +- .../main/java/org/geysermc/common/window/button/FormButton.java | 2 +- .../main/java/org/geysermc/common/window/button/FormImage.java | 2 +- .../org/geysermc/common/window/component/DropdownComponent.java | 2 +- .../org/geysermc/common/window/component/FormComponent.java | 2 +- .../org/geysermc/common/window/component/InputComponent.java | 2 +- .../org/geysermc/common/window/component/LabelComponent.java | 2 +- .../org/geysermc/common/window/component/SliderComponent.java | 2 +- .../geysermc/common/window/component/StepSliderComponent.java | 2 +- .../org/geysermc/common/window/component/ToggleComponent.java | 2 +- .../org/geysermc/common/window/response/CustomFormResponse.java | 2 +- .../java/org/geysermc/common/window/response/FormResponse.java | 2 +- .../org/geysermc/common/window/response/FormResponseData.java | 2 +- .../org/geysermc/common/window/response/ModalFormResponse.java | 2 +- .../org/geysermc/common/window/response/SimpleFormResponse.java | 2 +- .../main/java/org/geysermc/connector/inventory/Inventory.java | 2 +- .../java/org/geysermc/connector/inventory/PlayerInventory.java | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitConfiguration.java b/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitConfiguration.java index 1ddda652..5b8842b4 100644 --- a/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitConfiguration.java +++ b/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitLogger.java b/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitLogger.java index 05fd2c6c..454ec9f6 100644 --- a/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitLogger.java +++ b/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitPlugin.java b/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitPlugin.java index 3c7ae839..8b0883ef 100644 --- a/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitPlugin.java +++ b/bootstrap/bukkit/src/main/java/org/geysermc/platform/bukkit/GeyserBukkitPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java index 420f8347..e0f6a6ef 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeLogger.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeLogger.java index 2ebc069b..7aba88bc 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeLogger.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index d6974daf..959c78d9 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeConfiguration.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeConfiguration.java index 7b6a89f1..be4923e2 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeConfiguration.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeLogger.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeLogger.java index 1df7fbf9..758ac98d 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeLogger.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java index a2074b15..bc264589 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserBootstrap.java index 284d9407..1bdce0bd 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserBootstrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserConfiguration.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserConfiguration.java index a1362c7a..afd6179e 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserConfiguration.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/ChatColor.java b/common/src/main/java/org/geysermc/common/ChatColor.java index 20632770..e60012e7 100644 --- a/common/src/main/java/org/geysermc/common/ChatColor.java +++ b/common/src/main/java/org/geysermc/common/ChatColor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/IGeyserConfiguration.java b/common/src/main/java/org/geysermc/common/IGeyserConfiguration.java index 41534457..774e3394 100644 --- a/common/src/main/java/org/geysermc/common/IGeyserConfiguration.java +++ b/common/src/main/java/org/geysermc/common/IGeyserConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/bootstrap/IGeyserBootstrap.java b/common/src/main/java/org/geysermc/common/bootstrap/IGeyserBootstrap.java index cf4b3991..9a9d9c2b 100644 --- a/common/src/main/java/org/geysermc/common/bootstrap/IGeyserBootstrap.java +++ b/common/src/main/java/org/geysermc/common/bootstrap/IGeyserBootstrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/logger/IGeyserLogger.java b/common/src/main/java/org/geysermc/common/logger/IGeyserLogger.java index b4d143e4..ad571ebb 100644 --- a/common/src/main/java/org/geysermc/common/logger/IGeyserLogger.java +++ b/common/src/main/java/org/geysermc/common/logger/IGeyserLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java b/common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java index fb679412..004b00a9 100644 --- a/common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java +++ b/common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java b/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java index a6bc7278..8d48fcfa 100644 --- a/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java +++ b/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/FormWindow.java b/common/src/main/java/org/geysermc/common/window/FormWindow.java index 968d9349..3cfaee43 100644 --- a/common/src/main/java/org/geysermc/common/window/FormWindow.java +++ b/common/src/main/java/org/geysermc/common/window/FormWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/ModalFormWindow.java b/common/src/main/java/org/geysermc/common/window/ModalFormWindow.java index 93466039..66dda0b5 100644 --- a/common/src/main/java/org/geysermc/common/window/ModalFormWindow.java +++ b/common/src/main/java/org/geysermc/common/window/ModalFormWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java b/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java index cc31f061..381cef39 100644 --- a/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java +++ b/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/button/FormButton.java b/common/src/main/java/org/geysermc/common/window/button/FormButton.java index 4f710d48..cf912c81 100644 --- a/common/src/main/java/org/geysermc/common/window/button/FormButton.java +++ b/common/src/main/java/org/geysermc/common/window/button/FormButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/button/FormImage.java b/common/src/main/java/org/geysermc/common/window/button/FormImage.java index a3f83a0c..b700b046 100644 --- a/common/src/main/java/org/geysermc/common/window/button/FormImage.java +++ b/common/src/main/java/org/geysermc/common/window/button/FormImage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java b/common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java index 8abe72ff..4dac6b04 100644 --- a/common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java +++ b/common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/component/FormComponent.java b/common/src/main/java/org/geysermc/common/window/component/FormComponent.java index fb5b9d18..5a56ae0c 100644 --- a/common/src/main/java/org/geysermc/common/window/component/FormComponent.java +++ b/common/src/main/java/org/geysermc/common/window/component/FormComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/component/InputComponent.java b/common/src/main/java/org/geysermc/common/window/component/InputComponent.java index 53ec2b5e..fad6a0fe 100644 --- a/common/src/main/java/org/geysermc/common/window/component/InputComponent.java +++ b/common/src/main/java/org/geysermc/common/window/component/InputComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/component/LabelComponent.java b/common/src/main/java/org/geysermc/common/window/component/LabelComponent.java index 7d2aaa42..a76b313f 100644 --- a/common/src/main/java/org/geysermc/common/window/component/LabelComponent.java +++ b/common/src/main/java/org/geysermc/common/window/component/LabelComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/component/SliderComponent.java b/common/src/main/java/org/geysermc/common/window/component/SliderComponent.java index fd82b3e2..a7a78362 100644 --- a/common/src/main/java/org/geysermc/common/window/component/SliderComponent.java +++ b/common/src/main/java/org/geysermc/common/window/component/SliderComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/component/StepSliderComponent.java b/common/src/main/java/org/geysermc/common/window/component/StepSliderComponent.java index b61e416d..8f128d1a 100644 --- a/common/src/main/java/org/geysermc/common/window/component/StepSliderComponent.java +++ b/common/src/main/java/org/geysermc/common/window/component/StepSliderComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/component/ToggleComponent.java b/common/src/main/java/org/geysermc/common/window/component/ToggleComponent.java index 614ecf8f..50a5c631 100644 --- a/common/src/main/java/org/geysermc/common/window/component/ToggleComponent.java +++ b/common/src/main/java/org/geysermc/common/window/component/ToggleComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java b/common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java index 36b2922f..6cdd7097 100644 --- a/common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java +++ b/common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/response/FormResponse.java b/common/src/main/java/org/geysermc/common/window/response/FormResponse.java index 58c8c8e8..2be64683 100644 --- a/common/src/main/java/org/geysermc/common/window/response/FormResponse.java +++ b/common/src/main/java/org/geysermc/common/window/response/FormResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/response/FormResponseData.java b/common/src/main/java/org/geysermc/common/window/response/FormResponseData.java index 826aba20..fd40be0f 100644 --- a/common/src/main/java/org/geysermc/common/window/response/FormResponseData.java +++ b/common/src/main/java/org/geysermc/common/window/response/FormResponseData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java b/common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java index 844c9a5b..e1a14039 100644 --- a/common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java +++ b/common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java b/common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java index 5a53d042..e80d58e7 100644 --- a/common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java +++ b/common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java index 801f670c..d969f970 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 diff --git a/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java b/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java index 424570b9..a1db2fcd 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 GeyserMC. http://geysermc.org + * Copyright (c) 2019-2020 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 From 89d19ba6125fcd7c04b6e4a9c40af6168f574fa6 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Wed, 15 Apr 2020 21:32:27 +0100 Subject: [PATCH 18/31] Update config.yml --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 1b0f1a97..92085a35 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,4 +2,4 @@ blank_issues_enabled: false contact_links: - name: GeyserMC Discord url: http://discord.geysermc.org/ - about: If your issue seems like it possibly an easy fix due to configuration, please hop on our discord. + about: If your issue seems like it could possibly be an easy fix due to configuration, please hop on our Discord. From 1c255e4d737cee132fabc934252dd8d22f9718b5 Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Wed, 15 Apr 2020 18:33:16 -0400 Subject: [PATCH 19/31] Fishing bobber shows --- .../connector/entity/FishingHookEntity.java | 30 +++++++++++++++++++ .../connector/entity/type/EntityType.java | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java new file mode 100644 index 00000000..c831e586 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -0,0 +1,30 @@ +package org.geysermc.connector.entity; + +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.packet.AddEntityPacket; +import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +public class FishingHookEntity extends Entity { + public FishingHookEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { + super(entityId, geyserId, entityType, position, motion, rotation); + } + + @Override + public void spawnEntity(GeyserSession session) { + AddEntityPacket addEntityPacket = new AddEntityPacket(); + addEntityPacket.setIdentifier("minecraft:fishing_hook"); + addEntityPacket.setRuntimeEntityId(geyserId); + addEntityPacket.setUniqueEntityId(geyserId); + addEntityPacket.setPosition(position); + addEntityPacket.setMotion(motion); + addEntityPacket.setRotation(getBedrockRotation()); + addEntityPacket.setEntityType(entityType.getType()); + addEntityPacket.getMetadata().putAll(metadata); + + valid = true; + session.getUpstream().sendPacket(addEntityPacket); + + session.getConnector().getLogger().debug("Spawned entity " + entityType + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index c50f05db..f2da80bf 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -110,7 +110,7 @@ public enum EntityType { TURTLE(AnimalEntity.class, 74, 0.4f, 1.2f), CAT(CatEntity.class, 75, 0.35f, 0.3f), SHULKER_BULLET(Entity.class, 76, 0f), - FISHING_BOBBER(Entity.class, 77, 0f), + FISHING_BOBBER(FishingHookEntity.class, 77, 0f), CHALKBOARD(Entity.class, 78, 0f), DRAGON_FIREBALL(ItemedFireballEntity.class, 79, 0f), ARROW(ArrowEntity.class, 80, 0.25f, 0.25f), From 406f76201d5ccf5c1e316beb821a4140e6259372 Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Wed, 15 Apr 2020 18:35:14 -0400 Subject: [PATCH 20/31] Add license; add comment --- .../connector/entity/FishingHookEntity.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java index c831e586..3a77292f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -1,3 +1,28 @@ +/* + * Copyright (c) 2019-2020 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.entity; import com.nukkitx.math.vector.Vector3f; @@ -13,6 +38,7 @@ public class FishingHookEntity extends Entity { @Override public void spawnEntity(GeyserSession session) { AddEntityPacket addEntityPacket = new AddEntityPacket(); + // Different ID in Bedrock addEntityPacket.setIdentifier("minecraft:fishing_hook"); addEntityPacket.setRuntimeEntityId(geyserId); addEntityPacket.setUniqueEntityId(geyserId); From 508d56ffc8d1a3b23befc2fa553950aed27fc762 Mon Sep 17 00:00:00 2001 From: Artuto Date: Wed, 15 Apr 2020 22:50:02 -0500 Subject: [PATCH 21/31] Fix inverted booleans in MessageUtils.isTooLong --- .../main/java/org/geysermc/connector/utils/MessageUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java index f0228309..5be8eab1 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java @@ -300,9 +300,9 @@ public class MessageUtils { if (message.length() > 256) { // TODO: Add Geyser localization and translate this based on language session.sendMessage("Your message is bigger than 256 characters (" + message.length() + ") so it has not been sent."); - return false; + return true; } - return true; + return false; } } From ca8b19c0d01a95841011b8543b543e10280af299 Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 16 Apr 2020 14:36:03 +0200 Subject: [PATCH 22/31] Implement ShulkerEntity --- .../entity/living/monster/ShulkerEntity.java | 40 +++++++++++++++++++ .../connector/entity/type/EntityType.java | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java new file mode 100644 index 00000000..551a0125 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java @@ -0,0 +1,40 @@ +package org.geysermc.connector.entity.living.monster; + +import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.protocol.bedrock.data.EntityData; +import org.geysermc.connector.entity.living.GolemEntity; +import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +public class ShulkerEntity extends GolemEntity { + + public ShulkerEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { + super(entityId, geyserId, entityType, position, motion, rotation); + } + + @Override + public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { + if (entityMetadata.getId() == 15) { + BlockFace blockFace = (BlockFace) entityMetadata.getValue(); + metadata.put(EntityData.SHULKER_ATTACH_FACE, (byte) blockFace.ordinal()); + } + if (entityMetadata.getId() == 16) { + Position position = (Position) entityMetadata.getValue(); + metadata.put(EntityData.SHULKER_ATTACH_POS, Vector3i.from(position.getX(), position.getY(), position.getZ())); + } + //TODO Outdated metadata flag SHULKER_PEAK_HEIGHT +// if (entityMetadata.getId() == 17) { +// int height = (byte) entityMetadata.getValue(); +// metadata.put(EntityData.SHULKER_PEAK_HEIGHT, height); +// } + if (entityMetadata.getId() == 18) { + int color = Math.abs((byte) entityMetadata.getValue() - 15); + metadata.put(EntityData.VARIANT, color); + } + super.updateBedrockMetadata(entityMetadata, session); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index c50f05db..69d418f7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -85,7 +85,7 @@ public enum EntityType { NPC(PlayerEntity.class, 51, 1.8f, 0.6f, 0.6f, 1.62f), WITHER(MonsterEntity.class, 52, 3.5f, 0.9f), ENDER_DRAGON(EnderDragonEntity.class, 53, 4f, 13f), - SHULKER(GolemEntity.class, 54, 1f, 1f), + SHULKER(ShulkerEntity.class, 54, 1f, 1f), ENDERMITE(MonsterEntity.class, 55, 0.3f, 0.4f), AGENT(Entity.class, 56, 0f), VINDICATOR(AbstractIllagerEntity.class, 57, 1.8f, 0.6f, 0.6f, 1.62f), From ec9f692418b0b5b56e4c5b222dd1fc855b40fe0d Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 17 Apr 2020 00:03:01 +0200 Subject: [PATCH 23/31] Reset rain during respawning Fixes #358 --- .../translators/java/JavaRespawnTranslator.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java index 185aab54..b28e9010 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java @@ -25,6 +25,9 @@ package org.geysermc.connector.network.translators.java; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.data.LevelEventType; +import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.attribute.AttributeType; import org.geysermc.connector.network.session.GeyserSession; @@ -35,6 +38,8 @@ import org.geysermc.connector.utils.DimensionUtils; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; +import java.util.concurrent.ThreadLocalRandom; + @Translator(packet = ServerRespawnPacket.class) public class JavaRespawnTranslator extends PacketTranslator { @@ -53,6 +58,12 @@ public class JavaRespawnTranslator extends PacketTranslator session.getUpstream().sendPacket(playerGameTypePacket); session.setGameMode(packet.getGamemode()); + LevelEventPacket stopRainPacket = new LevelEventPacket(); + stopRainPacket.setType(LevelEventType.STOP_RAIN); + stopRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000); + stopRainPacket.setPosition(Vector3f.ZERO); + session.getUpstream().sendPacket(stopRainPacket); + if (entity.getDimension() != DimensionUtils.javaToBedrock(packet.getDimension())) { DimensionUtils.switchDimension(session, packet.getDimension()); } else { From c246a32844a78ceaddd1319af36534c066667c1e Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 17 Apr 2020 13:29:35 +0200 Subject: [PATCH 24/31] Fix brand --- .../java/JavaPluginMessageTranslator.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java index 60227aa4..e6af7eb3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -25,6 +25,8 @@ package org.geysermc.connector.network.translators.java; +import com.github.steveice10.packetlib.io.NetOutput; +import com.github.steveice10.packetlib.io.buffer.ByteBufferNetOutput; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -33,14 +35,37 @@ import org.geysermc.connector.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; + @Translator(packet = ServerPluginMessagePacket.class) public class JavaPluginMessageTranslator extends PacketTranslator { + + private static final int MAX_VAR_INT_LENGTH = 5; + @Override public void translate(ServerPluginMessagePacket packet, GeyserSession session) { if (packet.getChannel().equals("minecraft:brand")) { + byte[] data; + try { + data = writeString(GeyserConnector.NAME); + } catch (IOException e) { + e.printStackTrace(); + return; + } session.getDownstream().getSession().send( - new ClientPluginMessagePacket(packet.getChannel(), GeyserConnector.NAME.getBytes()) + new ClientPluginMessagePacket(packet.getChannel(), data) ); } } + + private byte[] writeString(String string) throws IOException { + byte[] data = string.getBytes(StandardCharsets.UTF_8); + ByteBuffer byteBuffer = ByteBuffer.allocate(MAX_VAR_INT_LENGTH + data.length); + NetOutput output = new ByteBufferNetOutput(byteBuffer); + output.writeVarInt(data.length); + output.writeBytes(data); + return byteBuffer.array(); + } } From 1a06fe331eb50ba702eb94686854c7433e9c85aa Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 17 Apr 2020 14:54:04 +0200 Subject: [PATCH 25/31] Improve login screen --- .../common/window/button/FormButton.java | 4 ++ .../network/UpstreamPacketHandler.java | 2 +- .../connector/utils/LoginEncryptionUtils.java | 62 ++++++++++++------- 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/common/src/main/java/org/geysermc/common/window/button/FormButton.java b/common/src/main/java/org/geysermc/common/window/button/FormButton.java index cf912c81..6daa2fea 100644 --- a/common/src/main/java/org/geysermc/common/window/button/FormButton.java +++ b/common/src/main/java/org/geysermc/common/window/button/FormButton.java @@ -37,6 +37,10 @@ public class FormButton { @Getter private FormImage image; + public FormButton(String text) { + this.text = text; + } + public FormButton(String text, FormImage image) { this.text = text; diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index cf6c2ee2..2ccb3723 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -86,7 +86,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { @Override public boolean handle(ModalFormResponsePacket packet) { - return LoginEncryptionUtils.authenticateFromForm(session, connector, packet.getFormData()); + return LoginEncryptionUtils.authenticateFromForm(session, connector, packet.getFormId(), packet.getFormData()); } private boolean couldLoginUserByName(String bedrockUsername) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index 7f6c8eda..781a2c7d 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -40,9 +40,12 @@ import net.minidev.json.JSONObject; import org.geysermc.common.window.CustomFormBuilder; import org.geysermc.common.window.CustomFormWindow; import org.geysermc.common.window.FormWindow; +import org.geysermc.common.window.SimpleFormWindow; +import org.geysermc.common.window.button.FormButton; import org.geysermc.common.window.component.InputComponent; import org.geysermc.common.window.component.LabelComponent; import org.geysermc.common.window.response.CustomFormResponse; +import org.geysermc.common.window.response.SimpleFormResponse; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.auth.AuthData; @@ -152,43 +155,60 @@ public class LoginEncryptionUtils { session.getUpstream().sendPacketImmediately(packet); } - private static int AUTH_FORM_ID = 1337; + private static int AUTH_FORM_ID = 1336; + private static int AUTH_DETAILS_FORM_ID = 1337; public static void showLoginWindow(GeyserSession session) { - CustomFormWindow window = new CustomFormBuilder("Login") - .addComponent(new LabelComponent("Minecraft: Java Edition account authentication.")) + SimpleFormWindow window = new SimpleFormWindow("Login", "Minecraft: Java Edition account authentication. You need a Java Edition account to play on this server."); + window.getButtons().add(new FormButton("Login with Minecraft")); + window.getButtons().add(new FormButton("Disconnect")); + + session.sendForm(window, AUTH_FORM_ID); + } + + public static void showLoginDetailsWindow(GeyserSession session) { + CustomFormWindow window = new CustomFormBuilder("Login Details") .addComponent(new LabelComponent("Enter the credentials for your Minecraft: Java Edition account below.")) .addComponent(new InputComponent("Email/Username", "account@geysermc.org", "")) .addComponent(new InputComponent("Password", "123456", "")) .build(); - session.sendForm(window, AUTH_FORM_ID); + session.sendForm(window, AUTH_DETAILS_FORM_ID); } - public static boolean authenticateFromForm(GeyserSession session, GeyserConnector connector, String formData) { + public static boolean authenticateFromForm(GeyserSession session, GeyserConnector connector, int formId, String formData) { WindowCache windowCache = session.getWindowCache(); - if (!windowCache.getWindows().containsKey(AUTH_FORM_ID)) + if (!windowCache.getWindows().containsKey(formId)) return false; - FormWindow window = windowCache.getWindows().remove(AUTH_FORM_ID); - window.setResponse(formData.trim()); + if(formId == AUTH_FORM_ID || formId == AUTH_DETAILS_FORM_ID) { + FormWindow window = windowCache.getWindows().remove(formId); + window.setResponse(formData.trim()); - if (!session.isLoggedIn()) { - if (window instanceof CustomFormWindow) { - CustomFormWindow customFormWindow = (CustomFormWindow) window; - if (!customFormWindow.getTitle().equals("Login")) - return false; + if (!session.isLoggedIn()) { + if (formId == AUTH_DETAILS_FORM_ID && window instanceof CustomFormWindow) { + CustomFormWindow customFormWindow = (CustomFormWindow) window; - CustomFormResponse response = (CustomFormResponse) customFormWindow.getResponse(); - if (response != null) { - String email = response.getInputResponses().get(2); - String password = response.getInputResponses().get(3); + CustomFormResponse response = (CustomFormResponse) customFormWindow.getResponse(); + if (response != null) { + String email = response.getInputResponses().get(1); + String password = response.getInputResponses().get(2); - session.authenticate(email, password); + session.authenticate(email, password); + } + + // Clear windows so authentication data isn't accidentally cached + windowCache.getWindows().clear(); + } else if (formId == AUTH_FORM_ID && window instanceof SimpleFormWindow) { + SimpleFormResponse response = (SimpleFormResponse) window.getResponse(); + if(response != null) { + if(response.getClickedButtonId() == 0) { + showLoginDetailsWindow(session); + } else if(response.getClickedButtonId() == 1) { + session.disconnect("Login is required"); + } + } } - - // Clear windows so authentication data isn't accidentally cached - windowCache.getWindows().clear(); } } return true; From dc59be39017a40287897bd83499fd1135f247802 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Fri, 17 Apr 2020 14:34:44 +0100 Subject: [PATCH 26/31] Fix blank login causing error --- .../org/geysermc/connector/network/session/GeyserSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index af7c4e58..83a94529 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -300,7 +300,7 @@ public class GeyserSession implements CommandSender { downstream.getSession().connect(); connector.addPlayer(this); - } catch (InvalidCredentialsException e) { + } catch (InvalidCredentialsException | IllegalArgumentException e) { connector.getLogger().info("User '" + username + "' entered invalid login info, kicking."); disconnect("Invalid/incorrect login info"); } catch (RequestException ex) { From 5e9e17e47d9e4f801740e6017bba0205d186dd95 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 17 Apr 2020 15:52:46 +0200 Subject: [PATCH 27/31] clean up text --- .../java/org/geysermc/connector/utils/LoginEncryptionUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index 781a2c7d..300294a2 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -159,7 +159,7 @@ public class LoginEncryptionUtils { private static int AUTH_DETAILS_FORM_ID = 1337; public static void showLoginWindow(GeyserSession session) { - SimpleFormWindow window = new SimpleFormWindow("Login", "Minecraft: Java Edition account authentication. You need a Java Edition account to play on this server."); + SimpleFormWindow window = new SimpleFormWindow("Login", "You need a Java Edition account to play on this server."); window.getButtons().add(new FormButton("Login with Minecraft")); window.getButtons().add(new FormButton("Disconnect")); From 1beea43a1ec69ec13443dae487c2c6916720294c Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 17 Apr 2020 16:35:48 +0200 Subject: [PATCH 28/31] remove bytebuffer --- .../java/JavaPluginMessageTranslator.java | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java index e6af7eb3..cd0161db 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -25,8 +25,6 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.packetlib.io.NetOutput; -import com.github.steveice10.packetlib.io.buffer.ByteBufferNetOutput; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -35,37 +33,56 @@ import org.geysermc.connector.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; -import java.io.IOException; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @Translator(packet = ServerPluginMessagePacket.class) public class JavaPluginMessageTranslator extends PacketTranslator { - - private static final int MAX_VAR_INT_LENGTH = 5; + + private static byte[] brandData; + + static { + byte[] data = GeyserConnector.NAME.getBytes(StandardCharsets.UTF_8); + byte[] varInt = writeVarInt(data.length); + brandData = new byte[varInt.length + data.length]; + System.arraycopy(varInt, 0, brandData, 0, varInt.length); + System.arraycopy(data, 0, brandData, varInt.length, data.length); + } + @Override public void translate(ServerPluginMessagePacket packet, GeyserSession session) { if (packet.getChannel().equals("minecraft:brand")) { - byte[] data; - try { - data = writeString(GeyserConnector.NAME); - } catch (IOException e) { - e.printStackTrace(); - return; - } session.getDownstream().getSession().send( - new ClientPluginMessagePacket(packet.getChannel(), data) + new ClientPluginMessagePacket(packet.getChannel(), brandData) ); } } - private byte[] writeString(String string) throws IOException { - byte[] data = string.getBytes(StandardCharsets.UTF_8); - ByteBuffer byteBuffer = ByteBuffer.allocate(MAX_VAR_INT_LENGTH + data.length); - NetOutput output = new ByteBufferNetOutput(byteBuffer); - output.writeVarInt(data.length); - output.writeBytes(data); - return byteBuffer.array(); + private static byte[] writeVarInt(int value) { + byte[] data = new byte[getVarIntLength(value)]; + int index = 0; + do { + byte temp = (byte)(value & 0b01111111); + value >>>= 7; + if (value != 0) { + temp |= 0b10000000; + } + data[index] = temp; + index++; + } while (value != 0); + return data; + } + + private static int getVarIntLength(int number) { + if ((number & 0xFFFFFF80) == 0) { + return 1; + } else if ((number & 0xFFFFC000) == 0) { + return 2; + } else if ((number & 0xFFE00000) == 0) { + return 3; + } else if ((number & 0xF0000000) == 0) { + return 4; + } + return 5; } } From 7c580ba4a02f5072c5763c266e24334a883c6244 Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Fri, 17 Apr 2020 12:23:24 -0400 Subject: [PATCH 29/31] Update Protocol to 2.5.5-SNAPSHOT --- connector/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/pom.xml b/connector/pom.xml index 25ef5073..6dd7836a 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -39,7 +39,7 @@ com.nukkitx.protocol bedrock-v389 - 2.5.4 + 2.5.5-SNAPSHOT compile From 204035323b030e75220b1af9251e957045cca1e8 Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Fri, 17 Apr 2020 12:34:09 -0400 Subject: [PATCH 30/31] Update everything else --- connector/pom.xml | 2 +- .../src/main/java/org/geysermc/connector/GeyserConnector.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 6dd7836a..76e895b2 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -38,7 +38,7 @@ com.nukkitx.protocol - bedrock-v389 + bedrock-v390 2.5.5-SNAPSHOT compile diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 35f9085d..9cea6257 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -27,7 +27,7 @@ package org.geysermc.connector; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.BedrockServer; -import com.nukkitx.protocol.bedrock.v389.Bedrock_v389; +import com.nukkitx.protocol.bedrock.v390.Bedrock_v390; import lombok.Getter; @@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit; @Getter public class GeyserConnector { - public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v389.V389_CODEC; + public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v390.V390_CODEC; public static final String NAME = "Geyser"; public static final String VERSION = "1.0-SNAPSHOT"; From 2386b415a504f085493ec125ab22b8f1ecd2f153 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 17 Apr 2020 20:19:14 +0200 Subject: [PATCH 31/31] add licence header --- .../entity/living/monster/ShulkerEntity.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java index 551a0125..a3a175b8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java @@ -1,3 +1,28 @@ +/* + * Copyright (c) 2019-2020 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.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;