From 645e5c07aca125c332a098b11cb1bee5c113482e Mon Sep 17 00:00:00 2001 From: Nanit Date: Sun, 23 Jan 2022 13:30:10 +0200 Subject: [PATCH 1/8] Added GPL copyright messages to files --- .../java/ru/nanit/limbo/LimboConstants.java | 17 +++++++++++++++++ src/main/java/ru/nanit/limbo/NanoLimbo.java | 17 +++++++++++++++++ .../nanit/limbo/configuration/LimboConfig.java | 17 +++++++++++++++++ .../configuration/SocketAddressSerializer.java | 17 +++++++++++++++++ .../connection/ClientChannelInitializer.java | 17 +++++++++++++++++ .../limbo/connection/ClientConnection.java | 17 +++++++++++++++++ .../ru/nanit/limbo/connection/GameProfile.java | 17 +++++++++++++++++ .../connection/pipeline/PacketDecoder.java | 17 +++++++++++++++++ .../connection/pipeline/PacketEncoder.java | 17 +++++++++++++++++ .../connection/pipeline/VarIntByteDecoder.java | 17 +++++++++++++++++ .../connection/pipeline/VarIntFrameDecoder.java | 17 +++++++++++++++++ .../pipeline/VarIntLengthEncoder.java | 17 +++++++++++++++++ .../ru/nanit/limbo/protocol/ByteMessage.java | 17 +++++++++++++++++ .../java/ru/nanit/limbo/protocol/Packet.java | 17 +++++++++++++++++ .../java/ru/nanit/limbo/protocol/PacketIn.java | 17 +++++++++++++++++ .../java/ru/nanit/limbo/protocol/PacketOut.java | 17 +++++++++++++++++ .../ru/nanit/limbo/protocol/PacketSnapshot.java | 17 +++++++++++++++++ .../limbo/protocol/packets/PacketHandshake.java | 17 +++++++++++++++++ .../packets/login/PacketDisconnect.java | 17 +++++++++++++++++ .../packets/login/PacketLoginPluginRequest.java | 17 +++++++++++++++++ .../login/PacketLoginPluginResponse.java | 17 +++++++++++++++++ .../packets/login/PacketLoginStart.java | 17 +++++++++++++++++ .../packets/login/PacketLoginSuccess.java | 17 +++++++++++++++++ .../protocol/packets/play/PacketBossBar.java | 17 +++++++++++++++++ .../packets/play/PacketChatMessage.java | 17 +++++++++++++++++ .../packets/play/PacketDeclareCommands.java | 17 +++++++++++++++++ .../protocol/packets/play/PacketJoinGame.java | 17 +++++++++++++++++ .../protocol/packets/play/PacketKeepAlive.java | 17 +++++++++++++++++ .../packets/play/PacketPlayerAbilities.java | 17 +++++++++++++++++ .../protocol/packets/play/PacketPlayerInfo.java | 17 +++++++++++++++++ .../play/PacketPlayerPositionAndLook.java | 17 +++++++++++++++++ .../packets/play/PacketPluginMessage.java | 17 +++++++++++++++++ .../packets/play/PacketTitleLegacy.java | 17 +++++++++++++++++ .../packets/play/PacketTitleSetSubTitle.java | 17 +++++++++++++++++ .../packets/play/PacketTitleSetTitle.java | 17 +++++++++++++++++ .../protocol/packets/play/PacketTitleTimes.java | 17 +++++++++++++++++ .../packets/status/PacketStatusPing.java | 17 +++++++++++++++++ .../packets/status/PacketStatusRequest.java | 17 +++++++++++++++++ .../packets/status/PacketStatusResponse.java | 17 +++++++++++++++++ .../ru/nanit/limbo/protocol/registry/State.java | 17 +++++++++++++++++ .../nanit/limbo/protocol/registry/Version.java | 17 +++++++++++++++++ .../java/ru/nanit/limbo/server/Connections.java | 17 +++++++++++++++++ .../java/ru/nanit/limbo/server/LimboServer.java | 17 +++++++++++++++++ .../ru/nanit/limbo/server/data/BossBar.java | 17 +++++++++++++++++ .../nanit/limbo/server/data/InfoForwarding.java | 17 +++++++++++++++++ .../ru/nanit/limbo/server/data/PingData.java | 17 +++++++++++++++++ .../ru/nanit/limbo/server/data/Position.java | 17 +++++++++++++++++ .../java/ru/nanit/limbo/server/data/Title.java | 17 +++++++++++++++++ src/main/java/ru/nanit/limbo/util/Colors.java | 17 +++++++++++++++++ src/main/java/ru/nanit/limbo/util/Logger.java | 17 +++++++++++++++++ src/main/java/ru/nanit/limbo/util/UuidUtil.java | 17 +++++++++++++++++ .../java/ru/nanit/limbo/world/Dimension.java | 17 +++++++++++++++++ .../ru/nanit/limbo/world/DimensionRegistry.java | 17 +++++++++++++++++ 53 files changed, 901 insertions(+) diff --git a/src/main/java/ru/nanit/limbo/LimboConstants.java b/src/main/java/ru/nanit/limbo/LimboConstants.java index a4f7929..f5fddf5 100644 --- a/src/main/java/ru/nanit/limbo/LimboConstants.java +++ b/src/main/java/ru/nanit/limbo/LimboConstants.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo; public final class LimboConstants { diff --git a/src/main/java/ru/nanit/limbo/NanoLimbo.java b/src/main/java/ru/nanit/limbo/NanoLimbo.java index 313ae36..0ea15d4 100644 --- a/src/main/java/ru/nanit/limbo/NanoLimbo.java +++ b/src/main/java/ru/nanit/limbo/NanoLimbo.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo; import ru.nanit.limbo.server.LimboServer; diff --git a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java index 17cef9f..fc71827 100644 --- a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java +++ b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.configuration; import org.spongepowered.configurate.ConfigurationNode; diff --git a/src/main/java/ru/nanit/limbo/configuration/SocketAddressSerializer.java b/src/main/java/ru/nanit/limbo/configuration/SocketAddressSerializer.java index f5ff626..18e737e 100644 --- a/src/main/java/ru/nanit/limbo/configuration/SocketAddressSerializer.java +++ b/src/main/java/ru/nanit/limbo/configuration/SocketAddressSerializer.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.configuration; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/src/main/java/ru/nanit/limbo/connection/ClientChannelInitializer.java b/src/main/java/ru/nanit/limbo/connection/ClientChannelInitializer.java index 879eca1..f564760 100644 --- a/src/main/java/ru/nanit/limbo/connection/ClientChannelInitializer.java +++ b/src/main/java/ru/nanit/limbo/connection/ClientChannelInitializer.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection; import io.netty.channel.Channel; diff --git a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java index 45f4156..8da4a32 100644 --- a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java +++ b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection; import com.grack.nanojson.JsonArray; diff --git a/src/main/java/ru/nanit/limbo/connection/GameProfile.java b/src/main/java/ru/nanit/limbo/connection/GameProfile.java index 754eebd..7d3dde7 100644 --- a/src/main/java/ru/nanit/limbo/connection/GameProfile.java +++ b/src/main/java/ru/nanit/limbo/connection/GameProfile.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection; import java.util.UUID; diff --git a/src/main/java/ru/nanit/limbo/connection/pipeline/PacketDecoder.java b/src/main/java/ru/nanit/limbo/connection/pipeline/PacketDecoder.java index f4510bd..cdc0702 100644 --- a/src/main/java/ru/nanit/limbo/connection/pipeline/PacketDecoder.java +++ b/src/main/java/ru/nanit/limbo/connection/pipeline/PacketDecoder.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection.pipeline; import io.netty.buffer.ByteBuf; diff --git a/src/main/java/ru/nanit/limbo/connection/pipeline/PacketEncoder.java b/src/main/java/ru/nanit/limbo/connection/pipeline/PacketEncoder.java index 65f6803..78e5f4c 100644 --- a/src/main/java/ru/nanit/limbo/connection/pipeline/PacketEncoder.java +++ b/src/main/java/ru/nanit/limbo/connection/pipeline/PacketEncoder.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection.pipeline; import io.netty.buffer.ByteBuf; diff --git a/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntByteDecoder.java b/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntByteDecoder.java index 624c8f6..2f9a611 100644 --- a/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntByteDecoder.java +++ b/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntByteDecoder.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection.pipeline; import io.netty.util.ByteProcessor; diff --git a/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntFrameDecoder.java b/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntFrameDecoder.java index 4ea28c7..861fb64 100644 --- a/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntFrameDecoder.java +++ b/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntFrameDecoder.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection.pipeline; import io.netty.buffer.ByteBuf; diff --git a/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntLengthEncoder.java b/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntLengthEncoder.java index 0a07fd3..940c42f 100644 --- a/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntLengthEncoder.java +++ b/src/main/java/ru/nanit/limbo/connection/pipeline/VarIntLengthEncoder.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.connection.pipeline; import io.netty.buffer.ByteBuf; diff --git a/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java b/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java index 54c3c00..e3550c3 100644 --- a/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java +++ b/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol; import io.netty.buffer.*; diff --git a/src/main/java/ru/nanit/limbo/protocol/Packet.java b/src/main/java/ru/nanit/limbo/protocol/Packet.java index 6ec59a7..3df6dcf 100644 --- a/src/main/java/ru/nanit/limbo/protocol/Packet.java +++ b/src/main/java/ru/nanit/limbo/protocol/Packet.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol; import ru.nanit.limbo.protocol.registry.Version; diff --git a/src/main/java/ru/nanit/limbo/protocol/PacketIn.java b/src/main/java/ru/nanit/limbo/protocol/PacketIn.java index 639d0c2..ed45197 100644 --- a/src/main/java/ru/nanit/limbo/protocol/PacketIn.java +++ b/src/main/java/ru/nanit/limbo/protocol/PacketIn.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol; import ru.nanit.limbo.protocol.registry.Version; diff --git a/src/main/java/ru/nanit/limbo/protocol/PacketOut.java b/src/main/java/ru/nanit/limbo/protocol/PacketOut.java index 78a4a4d..9d7d9c4 100644 --- a/src/main/java/ru/nanit/limbo/protocol/PacketOut.java +++ b/src/main/java/ru/nanit/limbo/protocol/PacketOut.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol; import ru.nanit.limbo.protocol.registry.Version; diff --git a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java index b6e0cbc..8034c16 100644 --- a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java +++ b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol; import ru.nanit.limbo.protocol.registry.Version; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/PacketHandshake.java b/src/main/java/ru/nanit/limbo/protocol/packets/PacketHandshake.java index c98b986..31c475b 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/PacketHandshake.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/PacketHandshake.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketDisconnect.java b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketDisconnect.java index 2981326..2ba8b85 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketDisconnect.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketDisconnect.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.login; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginRequest.java b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginRequest.java index 8a45c99..68b80c4 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginRequest.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginRequest.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.login; import io.netty.buffer.ByteBuf; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginResponse.java b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginResponse.java index 1059a4b..126ca29 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginResponse.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginPluginResponse.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.login; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginStart.java b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginStart.java index 3f768fa..4c8ea4c 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginStart.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginStart.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.login; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginSuccess.java b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginSuccess.java index 9acd9a4..61999ba 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginSuccess.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/login/PacketLoginSuccess.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.login; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketBossBar.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketBossBar.java index 6addcfe..8361ad2 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketBossBar.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketBossBar.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketChatMessage.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketChatMessage.java index c7b1f1e..ce1756e 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketChatMessage.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketChatMessage.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketDeclareCommands.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketDeclareCommands.java index c804b51..fa4cf6f 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketDeclareCommands.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketDeclareCommands.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java index 3417575..0043bc2 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketKeepAlive.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketKeepAlive.java index 5c5b79a..a92d63a 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketKeepAlive.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketKeepAlive.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerAbilities.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerAbilities.java index 5d7fe1d..49e8068 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerAbilities.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerAbilities.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerInfo.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerInfo.java index 45f5709..9b211bd 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerInfo.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerInfo.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerPositionAndLook.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerPositionAndLook.java index 4775b7c..c195f49 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerPositionAndLook.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPlayerPositionAndLook.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPluginMessage.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPluginMessage.java index 84cf640..e11c452 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPluginMessage.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketPluginMessage.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleLegacy.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleLegacy.java index cb7458f..87a9fe8 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleLegacy.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleLegacy.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetSubTitle.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetSubTitle.java index 6c7a708..845412a 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetSubTitle.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetSubTitle.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetTitle.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetTitle.java index 764fa5a..8c32716 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetTitle.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleSetTitle.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleTimes.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleTimes.java index e9f0c63..5e46dff 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleTimes.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketTitleTimes.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusPing.java b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusPing.java index 7ac1d8c..3bc39ee 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusPing.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusPing.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.status; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusRequest.java b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusRequest.java index ff3b92e..ce9759c 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusRequest.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusRequest.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.status; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java index df08142..706f986 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/status/PacketStatusResponse.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.packets.status; import ru.nanit.limbo.protocol.ByteMessage; diff --git a/src/main/java/ru/nanit/limbo/protocol/registry/State.java b/src/main/java/ru/nanit/limbo/protocol/registry/State.java index 24aec91..65ab464 100644 --- a/src/main/java/ru/nanit/limbo/protocol/registry/State.java +++ b/src/main/java/ru/nanit/limbo/protocol/registry/State.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.registry; import ru.nanit.limbo.protocol.Packet; diff --git a/src/main/java/ru/nanit/limbo/protocol/registry/Version.java b/src/main/java/ru/nanit/limbo/protocol/registry/Version.java index bb4d19c..68b5e26 100644 --- a/src/main/java/ru/nanit/limbo/protocol/registry/Version.java +++ b/src/main/java/ru/nanit/limbo/protocol/registry/Version.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.protocol.registry; import java.util.HashMap; diff --git a/src/main/java/ru/nanit/limbo/server/Connections.java b/src/main/java/ru/nanit/limbo/server/Connections.java index b4bf16b..246fb4a 100644 --- a/src/main/java/ru/nanit/limbo/server/Connections.java +++ b/src/main/java/ru/nanit/limbo/server/Connections.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.server; import ru.nanit.limbo.connection.ClientConnection; diff --git a/src/main/java/ru/nanit/limbo/server/LimboServer.java b/src/main/java/ru/nanit/limbo/server/LimboServer.java index 12dcb34..554a923 100644 --- a/src/main/java/ru/nanit/limbo/server/LimboServer.java +++ b/src/main/java/ru/nanit/limbo/server/LimboServer.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.server; import io.netty.bootstrap.ServerBootstrap; diff --git a/src/main/java/ru/nanit/limbo/server/data/BossBar.java b/src/main/java/ru/nanit/limbo/server/data/BossBar.java index b42795b..d77e89d 100644 --- a/src/main/java/ru/nanit/limbo/server/data/BossBar.java +++ b/src/main/java/ru/nanit/limbo/server/data/BossBar.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.server.data; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/src/main/java/ru/nanit/limbo/server/data/InfoForwarding.java b/src/main/java/ru/nanit/limbo/server/data/InfoForwarding.java index 711788a..f96869f 100644 --- a/src/main/java/ru/nanit/limbo/server/data/InfoForwarding.java +++ b/src/main/java/ru/nanit/limbo/server/data/InfoForwarding.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.server.data; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/src/main/java/ru/nanit/limbo/server/data/PingData.java b/src/main/java/ru/nanit/limbo/server/data/PingData.java index 477deea..435f13e 100644 --- a/src/main/java/ru/nanit/limbo/server/data/PingData.java +++ b/src/main/java/ru/nanit/limbo/server/data/PingData.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.server.data; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/src/main/java/ru/nanit/limbo/server/data/Position.java b/src/main/java/ru/nanit/limbo/server/data/Position.java index d28902b..9b6144a 100644 --- a/src/main/java/ru/nanit/limbo/server/data/Position.java +++ b/src/main/java/ru/nanit/limbo/server/data/Position.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.server.data; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/src/main/java/ru/nanit/limbo/server/data/Title.java b/src/main/java/ru/nanit/limbo/server/data/Title.java index 3519a25..28f94cd 100644 --- a/src/main/java/ru/nanit/limbo/server/data/Title.java +++ b/src/main/java/ru/nanit/limbo/server/data/Title.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.server.data; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/src/main/java/ru/nanit/limbo/util/Colors.java b/src/main/java/ru/nanit/limbo/util/Colors.java index 5dda255..41562e7 100644 --- a/src/main/java/ru/nanit/limbo/util/Colors.java +++ b/src/main/java/ru/nanit/limbo/util/Colors.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.util; public final class Colors { diff --git a/src/main/java/ru/nanit/limbo/util/Logger.java b/src/main/java/ru/nanit/limbo/util/Logger.java index a7427d3..947aacb 100644 --- a/src/main/java/ru/nanit/limbo/util/Logger.java +++ b/src/main/java/ru/nanit/limbo/util/Logger.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.util; import java.time.LocalTime; diff --git a/src/main/java/ru/nanit/limbo/util/UuidUtil.java b/src/main/java/ru/nanit/limbo/util/UuidUtil.java index a3868a8..54019a7 100644 --- a/src/main/java/ru/nanit/limbo/util/UuidUtil.java +++ b/src/main/java/ru/nanit/limbo/util/UuidUtil.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.util; import java.nio.charset.StandardCharsets; diff --git a/src/main/java/ru/nanit/limbo/world/Dimension.java b/src/main/java/ru/nanit/limbo/world/Dimension.java index 15d8750..5b3c815 100644 --- a/src/main/java/ru/nanit/limbo/world/Dimension.java +++ b/src/main/java/ru/nanit/limbo/world/Dimension.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.world; import net.kyori.adventure.nbt.CompoundBinaryTag; diff --git a/src/main/java/ru/nanit/limbo/world/DimensionRegistry.java b/src/main/java/ru/nanit/limbo/world/DimensionRegistry.java index 8c34880..3479eee 100644 --- a/src/main/java/ru/nanit/limbo/world/DimensionRegistry.java +++ b/src/main/java/ru/nanit/limbo/world/DimensionRegistry.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package ru.nanit.limbo.world; import net.kyori.adventure.nbt.CompoundBinaryTag; From 26c8dbba20e0871d2aeb762febe6a9933bab81cb Mon Sep 17 00:00:00 2001 From: Nanit Date: Sun, 23 Jan 2022 15:19:53 +0200 Subject: [PATCH 2/8] Added licenses to jar --- README.md | 2 +- build.gradle | 10 +- src/main/resources/LICENSE-configurate-yaml | 202 ++++++++++++++++++++ src/main/resources/LICENSE-netty | 202 ++++++++++++++++++++ 4 files changed, 410 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/LICENSE-configurate-yaml create mode 100644 src/main/resources/LICENSE-netty diff --git a/README.md b/README.md index ac19436..08c93a6 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ which will not significantly load the server. Required software: -* JDK 1.8 +* JDK 1.8+ * Gradle 7+ To build minimized .jar, go to project root and write in terminal: diff --git a/build.gradle b/build.gradle index 2e3a355..fa4b6d1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,10 @@ plugins { - id 'com.github.johnrengelman.shadow' version '7.0.0' id 'java' + id 'com.github.johnrengelman.shadow' version '7.0.0' } group 'ru.nanit' -version '1.3.2' +version '1.4' repositories { mavenCentral() @@ -20,13 +20,13 @@ dependencies { implementation 'com.grack:nanojson:1.7' } -jar { +shadowJar { + from 'LICENSE' + manifest { attributes('Main-Class': 'ru.nanit.limbo.NanoLimbo') } -} -shadowJar { minimize() } diff --git a/src/main/resources/LICENSE-configurate-yaml b/src/main/resources/LICENSE-configurate-yaml new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/src/main/resources/LICENSE-configurate-yaml @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/src/main/resources/LICENSE-netty b/src/main/resources/LICENSE-netty new file mode 100644 index 0000000..e25e752 --- /dev/null +++ b/src/main/resources/LICENSE-netty @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file From 9f3fa80eefccaa488344fd0bb4852c70537129ce Mon Sep 17 00:00:00 2001 From: Nanit Date: Mon, 24 Jan 2022 17:14:12 +0200 Subject: [PATCH 3/8] Added settings --- .../limbo/configuration/LimboConfig.java | 24 +++++++++++++++---- src/main/resources/settings.yml | 8 +++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java index fc71827..f563c78 100644 --- a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java +++ b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java @@ -23,6 +23,7 @@ import org.spongepowered.configurate.serialize.TypeSerializerCollection; import org.spongepowered.configurate.yaml.YamlConfigurationLoader; import ru.nanit.limbo.server.data.*; import ru.nanit.limbo.util.Colors; +import ru.nanit.limbo.world.Location; import java.io.BufferedReader; import java.io.FileNotFoundException; @@ -41,8 +42,11 @@ public final class LimboConfig { private int maxPlayers; private PingData pingData; + private boolean useSchematic; + private Path schematicPath; + private String dimensionType; - private Position spawnPosition; + private Location spawnPosition; private int gameMode; private boolean useBrandName; @@ -78,14 +82,18 @@ public final class LimboConfig { address = conf.node("bind").get(SocketAddress.class); maxPlayers = conf.node("maxPlayers").getInt(); pingData = conf.node("ping").get(PingData.class); + useSchematic = conf.node("world", "enable").getBoolean(false); dimensionType = conf.node("dimension").getString(); - spawnPosition = conf.node("spawnPosition").get(Position.class); + spawnPosition = conf.node("spawnPosition").get(Location.class); gameMode = conf.node("gameMode").getInt(); useBrandName = conf.node("brandName", "enable").getBoolean(); useJoinMessage = conf.node("joinMessage", "enable").getBoolean(); useBossBar = conf.node("bossBar", "enable").getBoolean(); useTitle = conf.node("title", "enable").getBoolean(); + if (useSchematic) + schematicPath = Paths.get(conf.node("world", "path").getString("./spawn.schem")); + if(useBrandName) brandName = conf.node("brandName", "content").getString(); @@ -130,7 +138,7 @@ public final class LimboConfig { .register(PingData.class, new PingData.Serializer()) .register(BossBar.class, new BossBar.Serializer()) .register(Title.class, new Title.Serializer()) - .register(Position.class, new Position.Serializer()) + .register(Location.class, new Location.Serializer()) .build(); } @@ -146,11 +154,19 @@ public final class LimboConfig { return pingData; } + public boolean isUseSchematic() { + return useSchematic; + } + + public Path getSchematicPath() { + return schematicPath; + } + public String getDimensionType() { return dimensionType; } - public Position getSpawnPosition() { + public Location getSpawnPosition() { return spawnPosition; } diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml index e47477d..c5360ce 100644 --- a/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -16,6 +16,14 @@ ping: description: '{"text": "&9NanoLimbo"}' version: 'NanoLimbo' +# World settings +world: + # Enable schematic loading. + # If false, then player will be spawned in the void + enable: false + # Relative path to schematic file + path: "./spawn.schem" + # Available dimensions: OVERWORLD, NETHER, THE_END dimension: THE_END From 864a84b9b69b36eb85869a3c627e50d9d26ae065 Mon Sep 17 00:00:00 2001 From: Nanit Date: Mon, 24 Jan 2022 17:15:58 +0200 Subject: [PATCH 4/8] Added schematic containers and loader. Added world-related classes --- .../java/ru/nanit/limbo/LimboConstants.java | 1 + .../limbo/connection/ClientConnection.java | 2 +- .../protocol/packets/play/PacketJoinGame.java | 2 +- .../ru/nanit/limbo/server/LimboServer.java | 2 +- .../ru/nanit/limbo/server/data/Position.java | 92 ------------ .../java/ru/nanit/limbo/world/BlockData.java | 51 +++++++ .../ru/nanit/limbo/world/BlockEntity.java | 45 ++++++ .../java/ru/nanit/limbo/world/BlockMap.java | 34 +++++ .../java/ru/nanit/limbo/world/Location.java | 106 ++++++++++++++ .../world/{ => dimension}/Dimension.java | 2 +- .../{ => dimension}/DimensionRegistry.java | 2 +- .../limbo/world/schematic/Schematic.java | 40 ++++++ .../world/schematic/SchematicLoader.java | 132 +++++++++++++++++ .../schematic/versions/LegacySchematic.java | 133 ++++++++++++++++++ .../schematic/versions/SpongeSchematic.java | 103 ++++++++++++++ src/test/java/SchematicTest.java | 34 +++++ src/test/resources/test.schematic | Bin 0 -> 6981 bytes 17 files changed, 684 insertions(+), 97 deletions(-) delete mode 100644 src/main/java/ru/nanit/limbo/server/data/Position.java create mode 100644 src/main/java/ru/nanit/limbo/world/BlockData.java create mode 100644 src/main/java/ru/nanit/limbo/world/BlockEntity.java create mode 100644 src/main/java/ru/nanit/limbo/world/BlockMap.java create mode 100644 src/main/java/ru/nanit/limbo/world/Location.java rename src/main/java/ru/nanit/limbo/world/{ => dimension}/Dimension.java (96%) rename src/main/java/ru/nanit/limbo/world/{ => dimension}/DimensionRegistry.java (98%) create mode 100644 src/main/java/ru/nanit/limbo/world/schematic/Schematic.java create mode 100644 src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java create mode 100644 src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java create mode 100644 src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java create mode 100644 src/test/java/SchematicTest.java create mode 100644 src/test/resources/test.schematic diff --git a/src/main/java/ru/nanit/limbo/LimboConstants.java b/src/main/java/ru/nanit/limbo/LimboConstants.java index f5fddf5..0c3d5b2 100644 --- a/src/main/java/ru/nanit/limbo/LimboConstants.java +++ b/src/main/java/ru/nanit/limbo/LimboConstants.java @@ -20,6 +20,7 @@ package ru.nanit.limbo; public final class LimboConstants { public static final String VELOCITY_INFO_CHANNEL = "velocity:player_info"; + public static final String BRAND_CHANNEL = "minecraft:brand"; private LimboConstants() {} diff --git a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java index 8da4a32..96a5c00 100644 --- a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java +++ b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java @@ -434,7 +434,7 @@ public class ClientConnection extends ChannelInboundHandlerAdapter { if (server.getConfig().isUseBrandName()){ PacketPluginMessage pluginMessage = new PacketPluginMessage(); - pluginMessage.setChannel("minecraft:brand"); + pluginMessage.setChannel(LimboConstants.BRAND_CHANNEL); pluginMessage.setMessage(server.getConfig().getBrandName()); PACKET_PLUGIN_MESSAGE = PacketSnapshot.of(pluginMessage); } diff --git a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java index 0043bc2..fdc3398 100644 --- a/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java +++ b/src/main/java/ru/nanit/limbo/protocol/packets/play/PacketJoinGame.java @@ -20,7 +20,7 @@ package ru.nanit.limbo.protocol.packets.play; import ru.nanit.limbo.protocol.ByteMessage; import ru.nanit.limbo.protocol.PacketOut; import ru.nanit.limbo.protocol.registry.Version; -import ru.nanit.limbo.world.DimensionRegistry; +import ru.nanit.limbo.world.dimension.DimensionRegistry; public class PacketJoinGame implements PacketOut { diff --git a/src/main/java/ru/nanit/limbo/server/LimboServer.java b/src/main/java/ru/nanit/limbo/server/LimboServer.java index 554a923..bacbdae 100644 --- a/src/main/java/ru/nanit/limbo/server/LimboServer.java +++ b/src/main/java/ru/nanit/limbo/server/LimboServer.java @@ -31,7 +31,7 @@ import ru.nanit.limbo.configuration.LimboConfig; import ru.nanit.limbo.connection.ClientChannelInitializer; import ru.nanit.limbo.connection.ClientConnection; import ru.nanit.limbo.util.Logger; -import ru.nanit.limbo.world.DimensionRegistry; +import ru.nanit.limbo.world.dimension.DimensionRegistry; import java.nio.file.Paths; import java.util.concurrent.ScheduledFuture; diff --git a/src/main/java/ru/nanit/limbo/server/data/Position.java b/src/main/java/ru/nanit/limbo/server/data/Position.java deleted file mode 100644 index 9b6144a..0000000 --- a/src/main/java/ru/nanit/limbo/server/data/Position.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2020 Nan1t - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package ru.nanit.limbo.server.data; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.spongepowered.configurate.ConfigurationNode; -import org.spongepowered.configurate.serialize.TypeSerializer; - -import java.lang.reflect.Type; - -public class Position { - - private double x; - private double y; - private double z; - private float yaw; - private float pitch; - - public double getX() { - return x; - } - - public double getY() { - return y; - } - - public double getZ() { - return z; - } - - public float getYaw() { - return yaw; - } - - public float getPitch() { - return pitch; - } - - public void setX(double x) { - this.x = x; - } - - public void setY(double y) { - this.y = y; - } - - public void setZ(double z) { - this.z = z; - } - - public void setYaw(float yaw) { - this.yaw = yaw; - } - - public void setPitch(float pitch) { - this.pitch = pitch; - } - - public static class Serializer implements TypeSerializer { - - @Override - public Position deserialize(Type type, ConfigurationNode node) { - Position position = new Position(); - position.setX(node.node("x").getDouble()); - position.setY(node.node("y").getDouble()); - position.setZ(node.node("z").getDouble()); - position.setYaw(node.node("yaw").getFloat()); - position.setPitch(node.node("pitch").getFloat()); - return position; - } - - @Override - public void serialize(Type type, @Nullable Position obj, ConfigurationNode node) { - - } - } -} diff --git a/src/main/java/ru/nanit/limbo/world/BlockData.java b/src/main/java/ru/nanit/limbo/world/BlockData.java new file mode 100644 index 0000000..9e8e03b --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/BlockData.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world; + +public class BlockData { + + private final String state; + private final int id; + private final byte data; + + public BlockData(String state, int id, byte data) { + this.state = state; + this.id = id; + this.data = data; + } + + public BlockData(String state) { + this(state, 0, (byte) 0); + } + + public BlockData(int id, byte data) { + this(null, id, data); + } + + public String getState() { + return state; + } + + public int getId() { + return id; + } + + public byte getData() { + return data; + } +} diff --git a/src/main/java/ru/nanit/limbo/world/BlockEntity.java b/src/main/java/ru/nanit/limbo/world/BlockEntity.java new file mode 100644 index 0000000..01eeb4d --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/BlockEntity.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world; + +import net.kyori.adventure.nbt.CompoundBinaryTag; + +public class BlockEntity { + + private final Location pos; + private final String id; + private final CompoundBinaryTag data; + + public BlockEntity(Location pos, String id, CompoundBinaryTag data) { + this.pos = pos; + this.id = id; + this.data = data; + } + + public Location getPos() { + return pos; + } + + public String getId() { + return id; + } + + public CompoundBinaryTag getData() { + return data; + } +} diff --git a/src/main/java/ru/nanit/limbo/world/BlockMap.java b/src/main/java/ru/nanit/limbo/world/BlockMap.java new file mode 100644 index 0000000..e69a981 --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/BlockMap.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world; + +import ru.nanit.limbo.protocol.registry.Version; + +public final class BlockMap { + + public BlockData convert(int id, byte data, Version version) { + // TODO + return null; + } + + public BlockData convert(String state, Version version) { + // TODO + return null; + } + +} diff --git a/src/main/java/ru/nanit/limbo/world/Location.java b/src/main/java/ru/nanit/limbo/world/Location.java new file mode 100644 index 0000000..5315609 --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/Location.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.spongepowered.configurate.ConfigurationNode; +import org.spongepowered.configurate.serialize.TypeSerializer; + +import java.lang.reflect.Type; + +public class Location { + + private final double x; + private final double y; + private final double z; + private final float yaw; + private final float pitch; + + Location(double x, double y, double z, float yaw, float pitch) { + this.x = x; + this.y = y; + this.z = z; + this.yaw = yaw; + this.pitch = pitch; + } + + Location(double x, double y, double z) { + this(x, y, z, 0.0F, 0.0F); + } + + public double getX() { + return x; + } + + public int getBlockX() { + return (int) x; + } + + public double getY() { + return y; + } + + public int getBlockY() { + return (int) y; + } + + public double getZ() { + return z; + } + + public int getBlockZ() { + return (int) z; + } + + public float getYaw() { + return yaw; + } + + public float getPitch() { + return pitch; + } + + public static Location of(double x, double y, double z) { + return new Location(x, y, z); + } + + public static Location of(double x, double y, double z, float yaw, float pitch) { + return new Location(x, y, z, yaw, pitch); + } + + public static Location pos(int x, int y, int z) { + return new Location(x, y, z); + } + + public static class Serializer implements TypeSerializer { + + @Override + public Location deserialize(Type type, ConfigurationNode node) { + double x = node.node("x").getDouble(0); + double y = node.node("y").getDouble(0); + double z = node.node("z").getDouble(0); + float yaw = node.node("yaw").getFloat(0.0F); + float pitch = node.node("pitch").getFloat(0.0F); + + return new Location(x, y, z, yaw, pitch); + } + + @Override + public void serialize(Type type, @Nullable Location obj, ConfigurationNode node) { } + } +} diff --git a/src/main/java/ru/nanit/limbo/world/Dimension.java b/src/main/java/ru/nanit/limbo/world/dimension/Dimension.java similarity index 96% rename from src/main/java/ru/nanit/limbo/world/Dimension.java rename to src/main/java/ru/nanit/limbo/world/dimension/Dimension.java index 5b3c815..4198688 100644 --- a/src/main/java/ru/nanit/limbo/world/Dimension.java +++ b/src/main/java/ru/nanit/limbo/world/dimension/Dimension.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package ru.nanit.limbo.world; +package ru.nanit.limbo.world.dimension; import net.kyori.adventure.nbt.CompoundBinaryTag; diff --git a/src/main/java/ru/nanit/limbo/world/DimensionRegistry.java b/src/main/java/ru/nanit/limbo/world/dimension/DimensionRegistry.java similarity index 98% rename from src/main/java/ru/nanit/limbo/world/DimensionRegistry.java rename to src/main/java/ru/nanit/limbo/world/dimension/DimensionRegistry.java index 3479eee..e428032 100644 --- a/src/main/java/ru/nanit/limbo/world/DimensionRegistry.java +++ b/src/main/java/ru/nanit/limbo/world/dimension/DimensionRegistry.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package ru.nanit.limbo.world; +package ru.nanit.limbo.world.dimension; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.nbt.ListBinaryTag; diff --git a/src/main/java/ru/nanit/limbo/world/schematic/Schematic.java b/src/main/java/ru/nanit/limbo/world/schematic/Schematic.java new file mode 100644 index 0000000..548bbdf --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/schematic/Schematic.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world.schematic; + +import ru.nanit.limbo.protocol.registry.Version; +import ru.nanit.limbo.world.BlockData; +import ru.nanit.limbo.world.BlockEntity; +import ru.nanit.limbo.world.BlockMap; +import ru.nanit.limbo.world.Location; + +import java.util.List; + +public interface Schematic { + + int getWidth(); + + int getHeight(); + + int getLength(); + + List getBlockEntities(); + + BlockData getBlock(Location loc, Version version, BlockMap mappings); + +} diff --git a/src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java b/src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java new file mode 100644 index 0000000..591f58f --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world.schematic; + +import net.kyori.adventure.nbt.BinaryTag; +import net.kyori.adventure.nbt.BinaryTagIO; +import net.kyori.adventure.nbt.CompoundBinaryTag; +import ru.nanit.limbo.world.BlockEntity; +import ru.nanit.limbo.world.Location; +import ru.nanit.limbo.world.schematic.versions.LegacySchematic; +import ru.nanit.limbo.world.schematic.versions.SpongeSchematic; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +public class SchematicLoader { + + public Schematic load(Path file) throws IOException { + return load(Files.newInputStream(file)); + } + + public Schematic load(InputStream stream) throws IOException { + CompoundBinaryTag nbt = BinaryTagIO.unlimitedReader().read(stream, BinaryTagIO.Compression.GZIP); + + if (nbt.getCompound("BlockData") == CompoundBinaryTag.empty()) { + return loadLegacy(nbt); + } else { + return loadSponge(nbt); + } + } + + // Specification: https://github.com/SpongePowered/Schematic-Specification/blob/master/versions/schematic-2.md + private Schematic loadSponge(CompoundBinaryTag nbt) { + SpongeSchematic schematic = new SpongeSchematic(); + + schematic.setDataVersion(nbt.getInt("DataVersion")); + + schematic.setWidth(nbt.getShort("Width")); + schematic.setHeight(nbt.getShort("Height")); + schematic.setLength(nbt.getShort("Length")); + + schematic.setPaletteMax(nbt.getInt("PaletteMax")); + + Map palette = new HashMap<>(); + CompoundBinaryTag paletteNbt = nbt.getCompound("Palette"); + + for (String key : paletteNbt.keySet()) { + palette.put(paletteNbt.getInt(key), key); + } + + schematic.setPalette(palette); + schematic.setBlockData(nbt.getByteArray("BlockData")); + + List blockEntities = new LinkedList<>(); + + for (BinaryTag tag : nbt.getList("BlockEntities")) { + if (tag instanceof CompoundBinaryTag) { + CompoundBinaryTag data = (CompoundBinaryTag) tag; + + int[] posArr = data.getIntArray("Pos"); + Location pos = Location.pos(posArr[0], posArr[1], posArr[2]); + String id = data.getString("Id"); + CompoundBinaryTag extra = data.getCompound("Extra"); + + blockEntities.add(new BlockEntity(pos, id, extra)); + } + } + + schematic.setBlockEntities(blockEntities); + + return schematic; + } + + private Schematic loadLegacy(CompoundBinaryTag nbt) { + LegacySchematic schematic = new LegacySchematic(); + + schematic.setWidth(nbt.getShort("Width")); + schematic.setHeight(nbt.getShort("Height")); + schematic.setLength(nbt.getShort("Length")); + + schematic.setMaterials(LegacySchematic.Materials.from(nbt.getString("Materials"))); + + schematic.setBlocks(nbt.getByteArray("Blocks")); + schematic.setAddBlocks(nbt.getByteArray("AddBlocks")); + schematic.setData(nbt.getByteArray("Data")); + + List blockEntities = new LinkedList<>(); + + for (BinaryTag tag : nbt.getList("TileEntities")) { + if (tag instanceof CompoundBinaryTag) { + CompoundBinaryTag data = (CompoundBinaryTag) tag; + + String id = data.getString("id"); + int x = data.getInt("x"); + int y = data.getInt("y"); + int z = data.getInt("z"); + + data.remove("id"); + data.remove("x"); + data.remove("y"); + data.remove("z"); + + blockEntities.add(new BlockEntity(Location.pos(x, y, z), id, data)); + } + } + + schematic.setBlockEntities(blockEntities); + + return schematic; + } +} diff --git a/src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java b/src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java new file mode 100644 index 0000000..9a35a8e --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world.schematic.versions; + +import ru.nanit.limbo.protocol.registry.Version; +import ru.nanit.limbo.world.BlockData; +import ru.nanit.limbo.world.BlockEntity; +import ru.nanit.limbo.world.BlockMap; +import ru.nanit.limbo.world.Location; +import ru.nanit.limbo.world.schematic.Schematic; + +import java.util.List; + +/** + * Legacy schematic format (1.12-) + */ +public class LegacySchematic implements Schematic { + + private short width; + private short height; + private short length; + private Materials materials; + private byte[] blocks; + private byte[] addBlocks; + private byte[] data; + private List blockEntities; + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public int getLength() { + return length; + } + + @Override + public List getBlockEntities() { + return blockEntities; + } + + @Override + public BlockData getBlock(Location loc, Version version, BlockMap mappings) { + int index = (loc.getBlockY() * length + loc.getBlockZ()) * width + loc.getBlockX(); + byte id = this.blocks[index]; + byte data = this.data[index]; + + return mappings.convert(id, data, version); + } + + public void setWidth(short width) { + this.width = width; + } + + public void setHeight(short height) { + this.height = height; + } + + public void setLength(short length) { + this.length = length; + } + + public void setMaterials(Materials materials) { + this.materials = materials; + } + + public void setBlocks(byte[] blocks) { + this.blocks = blocks; + } + + public void setAddBlocks(byte[] addBlocks) { + this.addBlocks = addBlocks; + } + + public void setData(byte[] data) { + this.data = data; + } + + public void setBlockEntities(List blockEntities) { + this.blockEntities = blockEntities; + } + + @Override + public String toString() { + return "Schematic{" + + "width=" + width + + ", height=" + height + + ", length=" + length + + ", materials=" + materials + + ", blocks length=" + blocks.length + + ", addBlocks length=" + addBlocks.length + + ", data length=" + data.length + + ", blockEntities=" + blockEntities + + '}'; + } + + public enum Materials { + + CLASSIC, + ALPHA, + POCKET; + + public static Materials from(String value) { + switch (value.toLowerCase()) { + case "classic": return CLASSIC; + case "alpha": return ALPHA; + case "pocket": return POCKET; + default: throw new IllegalArgumentException("Invalid materials type"); + } + } + } +} diff --git a/src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java b/src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java new file mode 100644 index 0000000..5fc7b89 --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world.schematic.versions; + +import ru.nanit.limbo.protocol.registry.Version; +import ru.nanit.limbo.world.BlockData; +import ru.nanit.limbo.world.BlockEntity; +import ru.nanit.limbo.world.BlockMap; +import ru.nanit.limbo.world.Location; +import ru.nanit.limbo.world.schematic.Schematic; + +import java.util.List; +import java.util.Map; + +/** + * Modern schematic format (Sponge second specification) + */ +public class SpongeSchematic implements Schematic { + + private int dataVersion; + private int width; + private int height; + private int length; + private int paletteMax; + private Map palette; + private byte[] blockData; + private List blockEntities; + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public int getLength() { + return length; + } + + @Override + public List getBlockEntities() { + return blockEntities; + } + + @Override + public BlockData getBlock(Location loc, Version version, BlockMap mappings) { + int index = loc.getBlockX() + loc.getBlockZ() * width + loc.getBlockY() * width * length; + int id = blockData[index]; + String state = palette.get(id); + return mappings.convert(state, version); + } + + public void setDataVersion(int dataVersion) { + this.dataVersion = dataVersion; + } + + public void setWidth(int width) { + this.width = width; + } + + public void setHeight(int height) { + this.height = height; + } + + public void setLength(int length) { + this.length = length; + } + + public void setPaletteMax(int paletteMax) { + this.paletteMax = paletteMax; + } + + public void setPalette(Map palette) { + this.palette = palette; + } + + public void setBlockData(byte[] blockData) { + this.blockData = blockData; + } + + public void setBlockEntities(List blockEntities) { + this.blockEntities = blockEntities; + } +} diff --git a/src/test/java/SchematicTest.java b/src/test/java/SchematicTest.java new file mode 100644 index 0000000..a23a054 --- /dev/null +++ b/src/test/java/SchematicTest.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import org.junit.jupiter.api.Test; +import ru.nanit.limbo.world.schematic.SchematicLoader; + +import java.io.IOException; +import java.io.InputStream; + +public class SchematicTest { + + @Test + public void testLoading() throws IOException { + SchematicLoader loader = new SchematicLoader(); + InputStream stream = getClass().getResourceAsStream("test.schematic"); + + System.out.println(loader.load(stream)); + } + +} diff --git a/src/test/resources/test.schematic b/src/test/resources/test.schematic new file mode 100644 index 0000000000000000000000000000000000000000..4119765f9bc9470c60feaa85ba08e6dff8b8df1d GIT binary patch literal 6981 zcma)=`gG#O)*IOCxq=@Q?J{YWQ&cmZ_X0fT_P3<37!0&vEpA+6hc*E=?-iA&m%L5A_N=!a5a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ic classes --- .../ru/nanit/limbo/protocol/ByteMessage.java | 12 ++- .../nanit/limbo/protocol/PacketSnapshot.java | 32 ++++++-- .../java/ru/nanit/limbo/world/BlockMap.java | 34 -------- .../ru/nanit/limbo/world/BlockMappings.java | 68 ++++++++++++++++ .../world/dimension/DimensionRegistry.java | 12 ++- .../world/schematic/AbstractSchematic.java | 73 ++++++++++++++++++ .../limbo/world/schematic/Schematic.java | 3 +- .../world/schematic/SchematicLoader.java | 17 ++-- .../schematic/versions/LegacySchematic.java | 61 +++------------ .../schematic/versions/SpongeSchematic.java | 62 +++++---------- src/test/java/SchematicTest.java | 7 +- src/test/resources/spawn.schem | Bin 0 -> 6609 bytes 12 files changed, 227 insertions(+), 154 deletions(-) delete mode 100644 src/main/java/ru/nanit/limbo/world/BlockMap.java create mode 100644 src/main/java/ru/nanit/limbo/world/BlockMappings.java create mode 100644 src/main/java/ru/nanit/limbo/world/schematic/AbstractSchematic.java create mode 100644 src/test/resources/spawn.schem diff --git a/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java b/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java index e3550c3..49facd1 100644 --- a/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java +++ b/src/main/java/ru/nanit/limbo/protocol/ByteMessage.java @@ -160,9 +160,7 @@ public class ByteMessage extends ByteBuf { } public void writeCompoundTagArray(CompoundBinaryTag[] compoundTags) { - try { - ByteBufOutputStream stream = new ByteBufOutputStream(buf); - + try (ByteBufOutputStream stream = new ByteBufOutputStream(buf)) { writeVarInt(compoundTags.length); for (CompoundBinaryTag tag : compoundTags) { @@ -174,16 +172,16 @@ public class ByteMessage extends ByteBuf { } public CompoundBinaryTag readCompoundTag() { - try { - return BinaryTagIO.reader().read((InputStream) new ByteBufInputStream(buf)); + try (ByteBufInputStream stream = new ByteBufInputStream(buf)) { + return BinaryTagIO.reader().read((InputStream) stream); } catch (IOException thrown) { throw new DecoderException("Cannot read NBT CompoundTag"); } } public void writeCompoundTag(CompoundBinaryTag compoundTag) { - try { - BinaryTagIO.writer().write(compoundTag, (OutputStream) new ByteBufOutputStream(buf)); + try (ByteBufOutputStream stream = new ByteBufOutputStream(buf)) { + BinaryTagIO.writer().write(compoundTag, (OutputStream) stream); } catch (IOException e) { throw new EncoderException("Cannot write NBT CompoundTag"); } diff --git a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java index 8034c16..602e908 100644 --- a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java +++ b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java @@ -22,14 +22,19 @@ import ru.nanit.limbo.protocol.registry.Version; import java.util.HashMap; import java.util.Map; +/** + * PacketSnapshot encodes packet to byt array for each MC version. + * Some versions have same bytes snapshot, so there are mappings + * to avoid storing same byte array for different versions + */ public class PacketSnapshot implements PacketOut { private final PacketOut packet; - private final Map versionMessages; + private final Map versionMessages = new HashMap<>(); + private final Map mappings = new HashMap<>(); public PacketSnapshot(PacketOut packet) { this.packet = packet; - this.versionMessages = new HashMap<>(); } public PacketOut getWrappedPacket() { @@ -37,11 +42,24 @@ public class PacketSnapshot implements PacketOut { } public PacketSnapshot encodePacket() { + Map hashes = new HashMap<>(); + for (Version version : Version.values()) { + if (version.equals(Version.UNDEFINED)) continue; + ByteMessage encodedMessage = ByteMessage.create(); packet.encode(encodedMessage, version); - byte[] message = encodedMessage.toByteArray(); - versionMessages.put(version, message); + + int hash = encodedMessage.hashCode(); + Version hashed = hashes.get(hash); + + if (hashed != null) { + mappings.put(version, hashed); + continue; + } + + hashes.put(hash, version); + versionMessages.put(version, encodedMessage.toByteArray()); encodedMessage.release(); } @@ -50,11 +68,11 @@ public class PacketSnapshot implements PacketOut { @Override public void encode(ByteMessage msg, Version version) { - byte[] message = versionMessages.get(version); + Version mapped = mappings.get(version); + byte[] message = versionMessages.get(mapped); - if (message != null) { + if (message != null) msg.writeBytes(message); - } } @Override diff --git a/src/main/java/ru/nanit/limbo/world/BlockMap.java b/src/main/java/ru/nanit/limbo/world/BlockMap.java deleted file mode 100644 index e69a981..0000000 --- a/src/main/java/ru/nanit/limbo/world/BlockMap.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2020 Nan1t - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package ru.nanit.limbo.world; - -import ru.nanit.limbo.protocol.registry.Version; - -public final class BlockMap { - - public BlockData convert(int id, byte data, Version version) { - // TODO - return null; - } - - public BlockData convert(String state, Version version) { - // TODO - return null; - } - -} diff --git a/src/main/java/ru/nanit/limbo/world/BlockMappings.java b/src/main/java/ru/nanit/limbo/world/BlockMappings.java new file mode 100644 index 0000000..0f5360e --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/BlockMappings.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world; + +import ru.nanit.limbo.protocol.registry.Version; + +import java.util.HashMap; +import java.util.Map; + +public final class BlockMappings { + + private final Map idToState = new HashMap<>(); + private final Map stateToId = new HashMap<>(); + + public BlockData convert(int id, byte data, Version version) { + if (version.less(Version.V1_13)) + return new BlockData(id, data); + + String state = idToState.get(toId(id, data)); + + return state != null ? new BlockData(state) : null; + } + + public BlockData convert(String state, Version version) { + if (state == null) return null; + + if (version.moreOrEqual(Version.V1_13)) { + return new BlockData(state); + } + + String id = stateToId.get(state); + + if (id != null) { + String[] arr = id.split(":"); + int blockId = Integer.parseInt(arr[0]); + byte data = Byte.parseByte(arr[1]); + + return new BlockData(blockId, data); + } + + return null; + } + + public void register(int id, byte data, String state) { + String strId = toId(id, data); + idToState.put(strId, state); + stateToId.put(state, strId); + } + + private String toId(int id, byte data) { + return id + ":" + data; + } +} diff --git a/src/main/java/ru/nanit/limbo/world/dimension/DimensionRegistry.java b/src/main/java/ru/nanit/limbo/world/dimension/DimensionRegistry.java index e428032..60c07b3 100644 --- a/src/main/java/ru/nanit/limbo/world/dimension/DimensionRegistry.java +++ b/src/main/java/ru/nanit/limbo/world/dimension/DimensionRegistry.java @@ -89,9 +89,15 @@ public final class DimensionRegistry { return TagStringIO.get().asCompound(streamToString(in)); } - private String streamToString(InputStream in) { - return new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)) - .lines() + private String streamToString(InputStream in) throws IOException { + InputStreamReader isReader = new InputStreamReader(in, StandardCharsets.UTF_8); + BufferedReader bufReader = new BufferedReader(isReader); + String content = bufReader.lines() .collect(Collectors.joining("\n")); + + isReader.close(); + bufReader.close(); + + return content; } } diff --git a/src/main/java/ru/nanit/limbo/world/schematic/AbstractSchematic.java b/src/main/java/ru/nanit/limbo/world/schematic/AbstractSchematic.java new file mode 100644 index 0000000..24ccf1e --- /dev/null +++ b/src/main/java/ru/nanit/limbo/world/schematic/AbstractSchematic.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2020 Nan1t + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.nanit.limbo.world.schematic; + +import ru.nanit.limbo.world.BlockEntity; +import ru.nanit.limbo.world.BlockMappings; + +import java.util.List; + +public abstract class AbstractSchematic implements Schematic { + + protected final BlockMappings mappings; + + private int width; + private int height; + private int length; + private List blockEntities; + + public AbstractSchematic(BlockMappings mappings) { + this.mappings = mappings; + } + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public int getLength() { + return length; + } + + @Override + public List getBlockEntities() { + return blockEntities; + } + + public void setWidth(int width) { + this.width = width; + } + + public void setHeight(int height) { + this.height = height; + } + + public void setLength(int length) { + this.length = length; + } + + public void setBlockEntities(List blockEntities) { + this.blockEntities = blockEntities; + } +} diff --git a/src/main/java/ru/nanit/limbo/world/schematic/Schematic.java b/src/main/java/ru/nanit/limbo/world/schematic/Schematic.java index 548bbdf..24d0102 100644 --- a/src/main/java/ru/nanit/limbo/world/schematic/Schematic.java +++ b/src/main/java/ru/nanit/limbo/world/schematic/Schematic.java @@ -20,7 +20,6 @@ package ru.nanit.limbo.world.schematic; import ru.nanit.limbo.protocol.registry.Version; import ru.nanit.limbo.world.BlockData; import ru.nanit.limbo.world.BlockEntity; -import ru.nanit.limbo.world.BlockMap; import ru.nanit.limbo.world.Location; import java.util.List; @@ -35,6 +34,6 @@ public interface Schematic { List getBlockEntities(); - BlockData getBlock(Location loc, Version version, BlockMap mappings); + BlockData getBlock(Location loc, Version version); } diff --git a/src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java b/src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java index 591f58f..70596a0 100644 --- a/src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java +++ b/src/main/java/ru/nanit/limbo/world/schematic/SchematicLoader.java @@ -21,6 +21,7 @@ import net.kyori.adventure.nbt.BinaryTag; import net.kyori.adventure.nbt.BinaryTagIO; import net.kyori.adventure.nbt.CompoundBinaryTag; import ru.nanit.limbo.world.BlockEntity; +import ru.nanit.limbo.world.BlockMappings; import ru.nanit.limbo.world.Location; import ru.nanit.limbo.world.schematic.versions.LegacySchematic; import ru.nanit.limbo.world.schematic.versions.SpongeSchematic; @@ -36,6 +37,12 @@ import java.util.Map; public class SchematicLoader { + private final BlockMappings mappings; + + public SchematicLoader(BlockMappings mappings) { + this.mappings = mappings; + } + public Schematic load(Path file) throws IOException { return load(Files.newInputStream(file)); } @@ -43,16 +50,16 @@ public class SchematicLoader { public Schematic load(InputStream stream) throws IOException { CompoundBinaryTag nbt = BinaryTagIO.unlimitedReader().read(stream, BinaryTagIO.Compression.GZIP); - if (nbt.getCompound("BlockData") == CompoundBinaryTag.empty()) { - return loadLegacy(nbt); - } else { + if (nbt.keySet().contains("BlockData")) { return loadSponge(nbt); + } else { + return loadLegacy(nbt); } } // Specification: https://github.com/SpongePowered/Schematic-Specification/blob/master/versions/schematic-2.md private Schematic loadSponge(CompoundBinaryTag nbt) { - SpongeSchematic schematic = new SpongeSchematic(); + SpongeSchematic schematic = new SpongeSchematic(mappings); schematic.setDataVersion(nbt.getInt("DataVersion")); @@ -93,7 +100,7 @@ public class SchematicLoader { } private Schematic loadLegacy(CompoundBinaryTag nbt) { - LegacySchematic schematic = new LegacySchematic(); + LegacySchematic schematic = new LegacySchematic(mappings); schematic.setWidth(nbt.getShort("Width")); schematic.setHeight(nbt.getShort("Height")); diff --git a/src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java b/src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java index 9a35a8e..70614b6 100644 --- a/src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java +++ b/src/main/java/ru/nanit/limbo/world/schematic/versions/LegacySchematic.java @@ -19,68 +19,33 @@ package ru.nanit.limbo.world.schematic.versions; import ru.nanit.limbo.protocol.registry.Version; import ru.nanit.limbo.world.BlockData; -import ru.nanit.limbo.world.BlockEntity; -import ru.nanit.limbo.world.BlockMap; +import ru.nanit.limbo.world.BlockMappings; import ru.nanit.limbo.world.Location; -import ru.nanit.limbo.world.schematic.Schematic; - -import java.util.List; +import ru.nanit.limbo.world.schematic.AbstractSchematic; /** * Legacy schematic format (1.12-) */ -public class LegacySchematic implements Schematic { +public class LegacySchematic extends AbstractSchematic { - private short width; - private short height; - private short length; private Materials materials; private byte[] blocks; private byte[] addBlocks; private byte[] data; - private List blockEntities; - @Override - public int getWidth() { - return width; + public LegacySchematic(BlockMappings mappings) { + super(mappings); } @Override - public int getHeight() { - return height; - } - - @Override - public int getLength() { - return length; - } - - @Override - public List getBlockEntities() { - return blockEntities; - } - - @Override - public BlockData getBlock(Location loc, Version version, BlockMap mappings) { - int index = (loc.getBlockY() * length + loc.getBlockZ()) * width + loc.getBlockX(); + public BlockData getBlock(Location loc, Version version) { + int index = (loc.getBlockY() * getLength() + loc.getBlockZ()) * getWidth() + loc.getBlockX(); byte id = this.blocks[index]; byte data = this.data[index]; return mappings.convert(id, data, version); } - public void setWidth(short width) { - this.width = width; - } - - public void setHeight(short height) { - this.height = height; - } - - public void setLength(short length) { - this.length = length; - } - public void setMaterials(Materials materials) { this.materials = materials; } @@ -97,21 +62,17 @@ public class LegacySchematic implements Schematic { this.data = data; } - public void setBlockEntities(List blockEntities) { - this.blockEntities = blockEntities; - } - @Override public String toString() { return "Schematic{" + - "width=" + width + - ", height=" + height + - ", length=" + length + + "width=" + getWidth() + + ", height=" + getHeight() + + ", length=" + getLength() + ", materials=" + materials + ", blocks length=" + blocks.length + ", addBlocks length=" + addBlocks.length + ", data length=" + data.length + - ", blockEntities=" + blockEntities + + ", blockEntities=" + getBlockEntities() + '}'; } diff --git a/src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java b/src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java index 5fc7b89..bc6010c 100644 --- a/src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java +++ b/src/main/java/ru/nanit/limbo/world/schematic/versions/SpongeSchematic.java @@ -19,51 +19,29 @@ package ru.nanit.limbo.world.schematic.versions; import ru.nanit.limbo.protocol.registry.Version; import ru.nanit.limbo.world.BlockData; -import ru.nanit.limbo.world.BlockEntity; -import ru.nanit.limbo.world.BlockMap; +import ru.nanit.limbo.world.BlockMappings; import ru.nanit.limbo.world.Location; -import ru.nanit.limbo.world.schematic.Schematic; +import ru.nanit.limbo.world.schematic.AbstractSchematic; -import java.util.List; import java.util.Map; /** * Modern schematic format (Sponge second specification) */ -public class SpongeSchematic implements Schematic { +public class SpongeSchematic extends AbstractSchematic { private int dataVersion; - private int width; - private int height; - private int length; private int paletteMax; private Map palette; private byte[] blockData; - private List blockEntities; - @Override - public int getWidth() { - return width; + public SpongeSchematic(BlockMappings mappings) { + super(mappings); } @Override - public int getHeight() { - return height; - } - - @Override - public int getLength() { - return length; - } - - @Override - public List getBlockEntities() { - return blockEntities; - } - - @Override - public BlockData getBlock(Location loc, Version version, BlockMap mappings) { - int index = loc.getBlockX() + loc.getBlockZ() * width + loc.getBlockY() * width * length; + public BlockData getBlock(Location loc, Version version) { + int index = loc.getBlockX() + loc.getBlockZ() * getWidth() + loc.getBlockY() * getWidth() * getLength(); int id = blockData[index]; String state = palette.get(id); return mappings.convert(state, version); @@ -73,18 +51,6 @@ public class SpongeSchematic implements Schematic { this.dataVersion = dataVersion; } - public void setWidth(int width) { - this.width = width; - } - - public void setHeight(int height) { - this.height = height; - } - - public void setLength(int length) { - this.length = length; - } - public void setPaletteMax(int paletteMax) { this.paletteMax = paletteMax; } @@ -97,7 +63,17 @@ public class SpongeSchematic implements Schematic { this.blockData = blockData; } - public void setBlockEntities(List blockEntities) { - this.blockEntities = blockEntities; + @Override + public String toString() { + return "SpongeSchematic{" + + "dataVersion=" + dataVersion + + ", width=" + getWidth() + + ", height=" + getHeight() + + ", length=" + getLength() + + ", paletteMax=" + paletteMax + + ", palette=" + palette + + ", blockData bytes=" + blockData.length + + ", blockEntities=" + getBlockEntities() + + '}'; } } diff --git a/src/test/java/SchematicTest.java b/src/test/java/SchematicTest.java index a23a054..157e434 100644 --- a/src/test/java/SchematicTest.java +++ b/src/test/java/SchematicTest.java @@ -16,6 +16,7 @@ */ import org.junit.jupiter.api.Test; +import ru.nanit.limbo.world.BlockMappings; import ru.nanit.limbo.world.schematic.SchematicLoader; import java.io.IOException; @@ -25,10 +26,10 @@ public class SchematicTest { @Test public void testLoading() throws IOException { - SchematicLoader loader = new SchematicLoader(); - InputStream stream = getClass().getResourceAsStream("test.schematic"); + BlockMappings mappings = new BlockMappings(); + SchematicLoader loader = new SchematicLoader(mappings); + InputStream stream = getClass().getResourceAsStream("spawn.schem"); System.out.println(loader.load(stream)); } - } diff --git a/src/test/resources/spawn.schem b/src/test/resources/spawn.schem new file mode 100644 index 0000000000000000000000000000000000000000..0a800b50ce1b8fed7f9291330f03d7d4f3c24c9a GIT binary patch literal 6609 zcmb`H^-~m%(|{2W=}hH=!m$DuzF-B8 zkSJSRct)@cGLW-K3l``b0FdZLAEzdX#(^CiL~=mqU2bgg(e=r0^PMop=FLF`@6+fY zNT7Hsj|jfL={Ld5(IbhmkDc#5A?5SYMZ%+8-=y8j) zQy!rQFEZ?*<2$o*H0bk#5C9HoqC55FJj`VXNG{mxZo9oaI(z-V5BX{fFo(W#doNaH)IhY~3 z3-Id}PGg_Bp3Vn8pnIo(Jt?-90a-EJ)B5l zXimt2Y_4#bG}r7MR5YloNrJfZ{_s&lKwyLI>WR&<4~<7vMO-iuwbOfj%!%157tkxU zcZ<>by4&o;8VO%MRy&y(7la1w^)}R+FQ^moV?~oJ7@hYbfW6Zemqm5Npx?}$aPIUy zV~OnxV5tA2=B8Js5)N_-TLNPQwL7iVv~bj=u@U zsYP$+i^(yP4+2TGna8%U(z;}K*Z);+`)~c0BmNL8Uv*!<*GAeWj>~ks0=>heI{v2qm?Hmptq}_X zCdW4M=6lwui2Yfb@mKJ;^cWA3L*m?{Wcg@tQfc$TKv|kSgUv*Dj_@nADH#*n$6J`I0vt!Wn+U)@+h{ z&Pjdt7U>AtPNF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[PATCH 6/8] Release byte buf if hash not found --- src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java index 602e908..5daffae 100644 --- a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java +++ b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java @@ -55,11 +55,11 @@ public class PacketSnapshot implements PacketOut { if (hashed != null) { mappings.put(version, hashed); - continue; + } else { + hashes.put(hash, version); + versionMessages.put(version, encodedMessage.toByteArray()); } - hashes.put(hash, version); - versionMessages.put(version, encodedMessage.toByteArray()); encodedMessage.release(); } From aac321e182c0e777c8dba2c533a0cac24c590eb3 Mon Sep 17 00:00:00 2001 From: Nanit Date: Wed, 26 Jan 2022 17:20:54 +0200 Subject: [PATCH 7/8] Optimized packet snapshot --- src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java index 5daffae..d61c0ed 100644 --- a/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java +++ b/src/main/java/ru/nanit/limbo/protocol/PacketSnapshot.java @@ -24,8 +24,8 @@ import java.util.Map; /** * PacketSnapshot encodes packet to byt array for each MC version. - * Some versions have same bytes snapshot, so there are mappings - * to avoid storing same byte array for different versions + * Some versions have same snapshot, so there are mappings + * to avoid storing same bytes array for different versions */ public class PacketSnapshot implements PacketOut { From 297c1fa722e6f18c9adff70c70b1ec0c8408277c Mon Sep 17 00:00:00 2001 From: Nanit Date: Wed, 26 Jan 2022 18:50:07 +0200 Subject: [PATCH 8/8] Temporaly commentet world-related code --- .../java/ru/nanit/limbo/configuration/LimboConfig.java | 6 +++--- src/main/resources/settings.yml | 8 -------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java index f563c78..76d717e 100644 --- a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java +++ b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java @@ -82,7 +82,7 @@ public final class LimboConfig { address = conf.node("bind").get(SocketAddress.class); maxPlayers = conf.node("maxPlayers").getInt(); pingData = conf.node("ping").get(PingData.class); - useSchematic = conf.node("world", "enable").getBoolean(false); + //useSchematic = conf.node("world", "enable").getBoolean(false); dimensionType = conf.node("dimension").getString(); spawnPosition = conf.node("spawnPosition").get(Location.class); gameMode = conf.node("gameMode").getInt(); @@ -91,8 +91,8 @@ public final class LimboConfig { useBossBar = conf.node("bossBar", "enable").getBoolean(); useTitle = conf.node("title", "enable").getBoolean(); - if (useSchematic) - schematicPath = Paths.get(conf.node("world", "path").getString("./spawn.schem")); + /*if (useSchematic) + schematicPath = Paths.get(conf.node("world", "path").getString("./spawn.schem"));*/ if(useBrandName) brandName = conf.node("brandName", "content").getString(); diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml index c5360ce..e47477d 100644 --- a/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -16,14 +16,6 @@ ping: description: '{"text": "&9NanoLimbo"}' version: 'NanoLimbo' -# World settings -world: - # Enable schematic loading. - # If false, then player will be spawned in the void - enable: false - # Relative path to schematic file - path: "./spawn.schem" - # Available dimensions: OVERWORLD, NETHER, THE_END dimension: THE_END