Skip to content

Commit

Permalink
Add support for 1.18 and 1.19, update version to 1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MinusKube committed Oct 12, 2022
1 parent b05f927 commit ed9db8d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ repositories {
}
dependencies {
compile 'fr.minuskube:netherboard-bukkit:1.2.2'
compile 'fr.minuskube:netherboard-bukkit:1.2.3'
// Or if you use Sponge:
// compile 'fr.minuskube:netherboard-sponge:1.2.2'
// compile 'fr.minuskube:netherboard-sponge:1.2.3'
}
```

Expand All @@ -102,7 +102,7 @@ dependencies {
<artifactId>netherboard-sponge</artifactId>
-->

<version>1.2.2</version>
<version>1.2.3</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ subprojects {
sourceCompatibility = '1.8'

group 'fr.minuskube'
version '1.2.2'
version '1.2.3'

repositories {
mavenCentral()
Expand Down
21 changes: 13 additions & 8 deletions bukkit/src/main/java/fr/minuskube/netherboard/bukkit/util/NMS.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ public class NMS {
Class<?> playerConnectionClass = getClass("net.minecraft.server.network", "PlayerConnection");
Class<?> packetClass = getClass("net.minecraft.network.protocol", "Packet");


sbScore = scoreClass.getConstructor(sbClass, objClass, String.class);
sbScoreSet = scoreClass.getMethod("setScore", int.class);

packetObj = packetObjClass.getConstructor(objClass, int.class);

packetDisplay = packetDisplayClass.getConstructor(int.class, objClass);

sendPacket = playerConnectionClass.getMethod("sendPacket", packetClass);
if (VERSION.isBelow1_18()) {
sbScoreSet = scoreClass.getMethod("setScore", int.class);
sendPacket = playerConnectionClass.getMethod("sendPacket", packetClass);
}
else {
sbScoreSet = scoreClass.getMethod("a", int.class);
sendPacket = playerConnectionClass.getMethod("a", packetClass);
}

if (VERSION.isBelow1_17()) {
playerScores = sbClass.getDeclaredField("playerScores");
Expand Down Expand Up @@ -158,9 +161,7 @@ public static Object getHandle(Object obj) throws NoSuchMethodException,

if(!HANDLES.containsKey(clazz)) {
Method method = clazz.getDeclaredMethod("getHandle");

if(!method.isAccessible())
method.setAccessible(true);
method.setAccessible(true);

HANDLES.put(clazz, method);
}
Expand Down Expand Up @@ -213,6 +214,10 @@ public boolean isBelow1_17() {
major.equals("1.16");
}

public boolean isBelow1_18() {
return major.equals("1.17") || isBelow1_17();
}

}

}
2 changes: 1 addition & 1 deletion bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Netherboard
version: 1.2.2
version: 1.2.3
description: Scoreboard API for your Bukkit Plugins.
author: MinusKube
website: https://github.com/MinusKube/netherboard
Expand Down

0 comments on commit ed9db8d

Please sign in to comment.