Skip to content

Commit 4961bcf

Browse files
Cleanup VLTask
1 parent 7caa8be commit 4961bcf

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

src/main/java/net/raphimc/vialoader/util/ProtocolVersionList.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,4 @@ public static List<ProtocolVersion> getProtocolsNewToOld() {
3131
return Collections.unmodifiableList(protocolVersions);
3232
}
3333

34-
/**
35-
* Returns true if first is closer to version than second
36-
*
37-
* @param version The version to compare to
38-
* @param first The first version
39-
* @param second The second version
40-
* @return true if first is closer to version than second
41-
*/
42-
public static boolean isCloserTo(final ProtocolVersion version, final ProtocolVersion first, final ProtocolVersion second) {
43-
if (version.getVersionType() == first.getVersionType() || version.getVersionType() == second.getVersionType()) {
44-
return Math.abs(version.getVersion() - first.getVersion()) < Math.abs(version.getVersion() - second.getVersion());
45-
} else {
46-
final int ordinal = version.getVersionType().ordinal();
47-
return Math.abs(ordinal - first.getVersionType().ordinal()) < Math.abs(ordinal - second.getVersionType().ordinal());
48-
}
49-
}
50-
5134
}

src/main/java/net/raphimc/vialoader/util/VLTask.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,12 @@
1919

2020
import com.viaversion.viaversion.api.platform.PlatformTask;
2121
import com.viaversion.viaversion.api.scheduler.Task;
22-
import com.viaversion.viaversion.api.scheduler.TaskStatus;
2322

24-
public class VLTask implements PlatformTask<Task> {
25-
26-
private final Task task;
27-
28-
public VLTask(final Task task) {
29-
this.task = task;
30-
}
23+
public record VLTask(Task task) implements PlatformTask<Task> {
3124

3225
@Override
3326
public void cancel() {
3427
this.task.cancel();
3528
}
3629

37-
public TaskStatus getStatus() {
38-
return this.task.status();
39-
}
40-
4130
}

0 commit comments

Comments
 (0)