support for 21w19a

This commit is contained in:
Bixilon 2021-05-21 13:17:00 +02:00
parent 54209f0d97
commit a17c6474eb
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
7 changed files with 67 additions and 5 deletions

View File

@ -43,9 +43,9 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
}
public static ResourceLocation getResourceLocation(String resourceLocation) throws IllegalArgumentException {
if (!ProtocolDefinition.RESOURCE_LOCATION_PATTERN.matcher(resourceLocation).matches()) {
throw new IllegalArgumentException(String.format("%s in not a valid resource location!", resourceLocation));
}
// if (!ProtocolDefinition.RESOURCE_LOCATION_PATTERN.matcher(resourceLocation).matches()) {
// throw new IllegalArgumentException(String.format("%s in not a valid resource location!", resourceLocation));
// }
if (Util.doesStringContainsUppercaseLetters(resourceLocation)) {
// just a string but wrapped into a resourceLocation (like old plugin channels MC|BRAND or ...)

View File

@ -0,0 +1,31 @@
/*
* Minosoft
* Copyright (C) 2021 Moritz Zwerger
*
* 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 <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.protocol.packets.c2s.play
import de.bixilon.minosoft.protocol.packets.c2s.PlayC2SPacket
import de.bixilon.minosoft.protocol.protocol.PlayOutByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class PongC2SP(val id: Int) : PlayC2SPacket {
override fun write(buffer: PlayOutByteBuffer) {
buffer.writeInt(id)
}
override fun log() {
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Pong (id=$id)" }
}
}

View File

@ -0,0 +1,28 @@
/*
* Minosoft
* Copyright (C) 2021 Moritz Zwerger
*
* 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 <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.protocol.packets.s2c.play
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class PingS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val id = buffer.readInt()
override fun log() {
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Ping (id=$id)" }
}
}

View File

@ -109,6 +109,7 @@ class PacketTypes {
PLAY_PLAYER_GROUND_CHANGE,
PLAY_PREPARE_CRAFTING_GRID,
PLAY_QUERY_ENTITY_NBT,
PLAY_PONG(PongC2SP::class.java)
;
val state: ConnectionStates = ConnectionStates.valueOf(name.split("_".toRegex()).toTypedArray()[0])
@ -271,6 +272,7 @@ class PacketTypes {
PLAY_COMPRESSION_SET({ CompressionSetS2CP(it) }, isThreadSafe = false),
PLAY_ADVANCEMENT_PROGRESS({ TODO() }),
PLAY_VIBRATION_SIGNAL({ VibrationSignalS2CP(it) }),
PLAY_PING({ PingS2CP(it) }),
;
init {

View File

@ -16,6 +16,7 @@ package de.bixilon.minosoft.protocol.protocol;
@SuppressWarnings("unused")
public class ProtocolVersions {
public static final int
V_21W19A = 779,
V_21W18A = 778,
V_21W17A = 777,
V_21W16A = 776,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long