Skip to content

Commit

Permalink
Update to 1.20.2 & package name
Browse files Browse the repository at this point in the history
  • Loading branch information
max1mde committed Nov 1, 2023
1 parent 56e815d commit 5c48817
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Project exclude paths
/.gradle/
/build/
/build/classes/java/main/
/build/classes/java/main/
/.idea/
spigot-nms.jar
1 change: 1 addition & 0 deletions .idea/modules/LabyModAPI.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
Binary file added spigot-nms.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package com.maximfiedler.labymodapi;

package com.maximde.labymodapi;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
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;

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) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5c48817

Please sign in to comment.