Skip to content

Commit 95bbed2

Browse files
authored
Fix build (#147)
* Update versions * Fix build errors * Update BlockBehaviorOverride.java
1 parent 0117226 commit 95bbed2

7 files changed

Lines changed: 32 additions & 22 deletions

File tree

build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
22
`java-library`
33
`maven-publish`
4-
id("io.github.0ffz.github-packages") version "1.2.1"
5-
id("io.papermc.hangar-publish-plugin") version "0.1.2"
4+
id("io.github.apdevteam.github-packages") version "1.2.2"
5+
id("io.papermc.hangar-publish-plugin") version "0.1.3"
66
}
77

88
repositories {
@@ -15,9 +15,9 @@ repositories {
1515

1616
dependencies {
1717
api("org.jetbrains:annotations-java5:24.1.0")
18-
compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
18+
compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
1919
compileOnly("net.countercraft:movecraft:+")
20-
compileOnly("it.unimi.dsi:fastutil:8.5.11")
20+
compileOnly("it.unimi.dsi:fastutil:8.5.13")
2121
}
2222

2323
group = "net.countercraft.movecraft.combat"
@@ -69,7 +69,7 @@ hangarPublish {
6969
platforms {
7070
register(io.papermc.hangarpublishplugin.model.Platforms.PAPER) {
7171
jar.set(tasks.jar.flatMap { it.archiveFile })
72-
platformVersions.set(listOf("1.18.2-1.21.1"))
72+
platformVersions.set(listOf("1.20.6-1.21.5"))
7373
dependencies {
7474
hangar("Movecraft") {
7575
required.set(true)

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/net/countercraft/movecraft/combat/features/BlockBehaviorOverride.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import it.unimi.dsi.fastutil.objects.Object2IntMap;
55
import net.countercraft.movecraft.combat.MovecraftCombat;
66
import net.countercraft.movecraft.util.Tags;
7-
import org.apache.commons.lang.reflect.FieldUtils;
87
import org.bukkit.Bukkit;
98
import org.bukkit.Material;
109
import org.bukkit.configuration.file.FileConfiguration;
1110
import org.jetbrains.annotations.NotNull;
1211
import org.jetbrains.annotations.Nullable;
1312

1413
import java.lang.reflect.Field;
14+
import java.lang.reflect.InaccessibleObjectException;
1515
import java.lang.reflect.InvocationTargetException;
1616
import java.lang.reflect.Method;
1717
import java.util.*;
@@ -340,36 +340,46 @@ protected boolean setIgniteOdds(Material m, int value, Object fireBlock) {
340340
abstract Class<?> getCraftMagicNumbersClass() throws ClassNotFoundException;
341341

342342
protected Object getBlockClass(Material m)
343-
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
343+
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
344+
ClassNotFoundException {
344345
if (this.magicNumbers == null) {
345346
this.magicNumbers = this.getCraftMagicNumbersClass();
346347
}
347348
Method method = magicNumbers.getMethod("getBlock", Material.class);
348349
return method.invoke(null, m);
349350
}
350351

351-
protected static <T> void writeField(@NotNull Object block, @NotNull Consumer<T> whatToDoWithField, String fieldName) throws IllegalAccessException, NoSuchFieldException, ClassCastException {
352-
Field field = FieldUtils.getField(block.getClass(), fieldName, true);
353-
T obj = (T)field.get(block);
352+
protected static <T> void writeField(@NotNull Object block, @NotNull Consumer<T> whatToDoWithField,
353+
String fieldName) throws IllegalAccessException, NoSuchFieldException, ClassCastException,
354+
InaccessibleObjectException, SecurityException {
355+
Field field = block.getClass().getField(fieldName);
356+
field.setAccessible(true);
357+
T obj = (T) field.get(block);
354358
whatToDoWithField.accept(obj);
355359
}
356360

357-
protected static <T> void writeField(@NotNull Object block, T value, String fieldName) throws IllegalAccessException, NoSuchFieldException, ClassCastException {
358-
Field field = FieldUtils.getField(block.getClass(), fieldName, true);
359-
T obj = (T)field.get(block);
361+
protected static <T> void writeField(@NotNull Object block, T value, String fieldName)
362+
throws IllegalAccessException, NoSuchFieldException, ClassCastException, InaccessibleObjectException,
363+
SecurityException {
364+
Field field = block.getClass().getField(fieldName);
365+
field.setAccessible(true);
360366
field.set(block, value);
361367
}
362368

363369
protected static <T> Optional<T> getFieldValueSafe(@NotNull Object instance, String fieldName) {
364370
try {
365371
return Optional.ofNullable(getFieldValue(instance, fieldName));
366-
} catch(Exception ex) {
372+
} catch (Exception ex) {
367373
return Optional.empty();
368374
}
369375
}
370-
protected static <T> T getFieldValue(@NotNull Object instance, String fieldName) throws IllegalAccessException, NoSuchFieldException, ClassCastException {
371-
Field field = FieldUtils.getField(instance.getClass(), fieldName, true);
372-
T obj = (T)field.get(instance);
376+
377+
protected static <T> T getFieldValue(@NotNull Object instance, String fieldName)
378+
throws IllegalAccessException, NoSuchFieldException, ClassCastException, InaccessibleObjectException,
379+
SecurityException {
380+
Field field = instance.getClass().getField(fieldName);
381+
field.setAccessible(true);
382+
T obj = (T) field.get(instance);
373383
return obj;
374384
}
375385
}

src/main/java/net/countercraft/movecraft/combat/features/DurabilityOverride.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private boolean nextToAir(@NotNull Block b) {
4949
public void onEntityExplode(@NotNull EntityExplodeEvent e) {
5050
if (DurabilityOverride == null)
5151
return;
52-
if (e.getEntityType() != EntityType.PRIMED_TNT)
52+
if (e.getEntityType() != EntityType.TNT)
5353
return;
5454

5555
Set<Block> removeList = new HashSet<>();

src/main/java/net/countercraft/movecraft/combat/features/ReImplementTNTTranslocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private Location getCenterLocation(@NotNull Block block) {
5959
private Set<SearchEntry> getTNT(@NotNull Block piston, @Nullable Block pistonHead, @NotNull BlockFace direction) {
6060
Set<SearchEntry> searchResults = new HashSet<>();
6161
for (Entity e : piston.getWorld().getEntities()) {
62-
if (!e.isValid() || e.getType() != EntityType.PRIMED_TNT)
62+
if (!e.isValid() || e.getType() != EntityType.TNT)
6363
continue;
6464

6565
TNTPrimed tnt = (TNTPrimed) e;

src/main/java/net/countercraft/movecraft/combat/features/tracers/TNTTracers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public void run() {
146146
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
147147
public void entityExplodeEvent(@NotNull EntityExplodeEvent e) {
148148
Entity tnt = e.getEntity();
149-
if (e.getEntityType() != EntityType.PRIMED_TNT)
149+
if (e.getEntityType() != EntityType.TNT)
150150
return;
151151
if (TracerRateTicks == 0)
152152
return;

src/main/java/net/countercraft/movecraft/combat/features/tracking/TNTTracking.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private Vector getTNTVector() {
8585
public void onEntitySpawn(@NotNull EntitySpawnEvent e) {
8686
if (!DamageTracking.EnableTNTTracking)
8787
return;
88-
if (!e.getEntityType().equals(EntityType.PRIMED_TNT))
88+
if (!e.getEntityType().equals(EntityType.TNT))
8989
return;
9090
TNTPrimed tnt = (TNTPrimed) e.getEntity();
9191

0 commit comments

Comments
 (0)