Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ repositories {
}
}

dependencies {
compile 'com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

dependencies {
compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
}

test {
useJUnitPlatform()
}
}
13 changes: 3 additions & 10 deletions src/main/java/io/egg/tickspeed/TickTimeJob.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.egg.tickspeed;


import org.bukkit.Bukkit;

import java.lang.reflect.Field;
Expand All @@ -18,9 +17,9 @@ public TickTimeJob() {
try {
utils = getNmsClass("SystemUtils");
getMillis = utils.getDeclaredMethod("getMonotonicMillis");
server = getNmsClass("MinecraftServer");
server = getNmsClass("server.MinecraftServer");
getServer = server.getMethod("getServer");
f = server.getDeclaredField("nextTick");
f = server.getDeclaredField("ao");
} catch (ClassNotFoundException | NoSuchMethodException | NoSuchFieldException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -51,14 +50,8 @@ public void run() {
}
}
public Class<?> getNmsClass(String name) throws ClassNotFoundException {
// explode the Server interface implementation's package name into its components
String[] array = Bukkit.getServer().getClass().getPackage().getName().split("\\.");

// pick out the component representing the package version if it's present
String packageVersion = array.length == 4 ? array[3] + "." : "";

// construct the qualified class name from the obtained package version
String qualName = "net.minecraft.server." + packageVersion + name;
String qualName = "net.minecraft." + name;

// simple call to get the Class object
return Class.forName(qualName);
Expand Down