diff --git a/.gitignore b/.gitignore index 8a0a60d..c7c2298 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ # Project exclude paths /.gradle/ /build/ -/build/classes/java/main/ \ No newline at end of file +/build/classes/java/main/ +/.idea/ +spigot-nms.jar \ No newline at end of file diff --git a/.idea/modules/LabyModAPI.main.iml b/.idea/modules/LabyModAPI.main.iml index 643c5a9..99220f9 100644 --- a/.idea/modules/LabyModAPI.main.iml +++ b/.idea/modules/LabyModAPI.main.iml @@ -6,6 +6,7 @@ SPIGOT BUNGEECORD + MCP diff --git a/build.gradle b/build.gradle index 8bb6f90..505cfd4 100644 --- a/build.gradle +++ b/build.gradle @@ -8,8 +8,11 @@ version = '1.0' repositories { mavenCentral() maven { - name = "spigotmc-repo" - url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + content { + includeGroup 'org.bukkit' + includeGroup 'org.spigotmc' + } } maven { name = "sonatype" @@ -19,13 +22,15 @@ repositories { name = 'minecraft-repo' url = 'https://libraries.minecraft.net/' } + maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' } + maven { url = 'https://oss.sonatype.org/content/repositories/central' } } dependencies { - compileOnly "org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT" - implementation files("C:\\Workspace\\NextFight\\NextFightHub\\lib\\spigot-1.20-R0.1-SNAPSHOT-remapped.jar") - compileOnly 'com.mojang:authlib:1.5.21' + compileOnly 'org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT' + compileOnly 'com.mojang:authlib:4.0.43' compileOnly 'net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT' + implementation files('spigot-nms.jar') } def targetJavaVersion = 17 diff --git a/spigot-nms.jar b/spigot-nms.jar new file mode 100644 index 0000000..8550e3b Binary files /dev/null and b/spigot-nms.jar differ diff --git a/src/main/java/com/maximfiedler/labymodapi/LabyModAPI.java b/src/main/java/com/maximde/labymodapi/LabyModAPI.java similarity index 99% rename from src/main/java/com/maximfiedler/labymodapi/LabyModAPI.java rename to src/main/java/com/maximde/labymodapi/LabyModAPI.java index 644596f..0bb815c 100644 --- a/src/main/java/com/maximfiedler/labymodapi/LabyModAPI.java +++ b/src/main/java/com/maximde/labymodapi/LabyModAPI.java @@ -1,5 +1,4 @@ -package com.maximfiedler.labymodapi; - +package com.maximde.labymodapi; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/src/main/java/com/maximfiedler/labymodapi/LabyModProtocol.java b/src/main/java/com/maximde/labymodapi/LabyModProtocol.java similarity index 80% rename from src/main/java/com/maximfiedler/labymodapi/LabyModProtocol.java rename to src/main/java/com/maximde/labymodapi/LabyModProtocol.java index bbde1bb..25f0b32 100644 --- a/src/main/java/com/maximfiedler/labymodapi/LabyModProtocol.java +++ b/src/main/java/com/maximde/labymodapi/LabyModProtocol.java @@ -1,15 +1,15 @@ -package com.maximfiedler.labymodapi; +package com.maximde.labymodapi; import com.google.gson.JsonElement; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.DecoderException; import io.netty.handler.codec.EncoderException; - import net.minecraft.network.PacketDataSerializer; -import net.minecraft.network.protocol.game.PacketPlayOutCustomPayload; +import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.MinecraftKey; -import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer; import org.bukkit.entity.Player; import java.nio.charset.Charset; @@ -17,9 +17,15 @@ public class LabyModProtocol { public void sendLabyModMessage(Player player, String key, JsonElement messageContent) { byte[] bytes = getBytesToSend(key, messageContent.toString()); - PacketDataSerializer pds = new PacketDataSerializer(Unpooled.wrappedBuffer(bytes)); - PacketPlayOutCustomPayload payloadPacket = new PacketPlayOutCustomPayload(new MinecraftKey("labymod3:main"), pds); - (((CraftPlayer)player).getHandle()).c.a(payloadPacket); + ClientboundCustomPayloadPacket packet = new ClientboundCustomPayloadPacket(new CustomPacketPayload() { + public void a(PacketDataSerializer pds) { + pds.c(bytes); + } + public MinecraftKey a() { + return new MinecraftKey("labymod3:main"); + } + }); + (((CraftPlayer)player).getHandle()).c.a(packet); } public byte[] getBytesToSend(String messageKey, String messageContents) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 08a905c..ce283e2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: LabyModAPI version: '${version}' -main: com.maximfiedler.labymodapi.LabyModAPI +main: com.maximde.labymodapi.LabyModAPI api-version: '1.20' -author: MaximFiedler, IbizaGamer +author: MaximDe, IbizaGamer