Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
15c48d4
Add Folia providers
JRoy Mar 28, 2023
0e4bab2
Get like 70% of the plugin to work
JRoy Mar 28, 2023
07fbf93
Ensure nuke commands runs on correct threads
JRoy Mar 29, 2023
2088294
Actually fire init tasks in Folia
JRoy Mar 29, 2023
a649f97
Add some thread checking helper methods
JRoy Mar 29, 2023
04683ee
Fix async entity dismounts
JRoy Mar 29, 2023
1d93ebf
Fix moo
JRoy Mar 29, 2023
05a8aa8
Switch to Paper repo
JRoy Mar 30, 2023
9a5ac3c
Fix tests
JRoy Mar 30, 2023
4ff9286
Move over some discord things
JRoy Mar 30, 2023
2d8cc82
Add method for checking the global thread
JRoy Mar 30, 2023
7216fdd
Add helper methods for ensuring thread contexts
JRoy Mar 30, 2023
2ba1eb0
fix "Fix moo"
JRoy Apr 1, 2023
7279be7
allow DiscordMessageEvent calls from any context
JRoy Apr 3, 2023
4cb861b
Run interaction commands async for now (hopefully okay)
JRoy Apr 3, 2023
ec5007c
fix wrong period/timeunit for folia scheduling
JRoy Apr 12, 2023
9133dce
Merge branch '2.x' into refactor/folia
JRoy Apr 16, 2023
4256909
Fix folia init tasks never getting called LOLW
JRoy Apr 27, 2023
10fc005
Merge remote-tracking branch 'upstream/2.x' into refactor/folia
JRoy Jul 27, 2023
1a108b5
Bump folia version
JRoy Jul 27, 2023
d4ebaf6
Fix weather command
JRoy Jul 27, 2023
0c8bc16
Fix time command
JRoy Jul 27, 2023
d0493cc
Merge remote-tracking branch 'upstream/2.x' into refactor/folia
JRoy Aug 22, 2023
d73ed13
Fix time/weather commands
JRoy Aug 22, 2023
25685a8
Merge branch '2.x' into feat/folia/merge-2.x-changes
Warriorrrr Feb 13, 2026
00e3509
Update scheduling providers to work with new provider system
Warriorrrr Feb 13, 2026
b300213
Move economy layers initialization to after providers
Warriorrrr Feb 13, 2026
4423bc8
Merge branch '2.x' into fork/Warriorrrr/feat/folia/merge-2.x-changes
JRoy Feb 28, 2026
63dcfa2
sure
JRoy Feb 28, 2026
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
2 changes: 2 additions & 0 deletions Essentials/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {
api(project(path: ':providers:PaperProvider', configuration: 'shadow')){
exclude(module: 'paper-api')
}
api project(':providers:FoliaProvider')
api(project(':providers:NMSReflectionProvider')) {
exclude(module: 'bukkit')
}
Expand Down Expand Up @@ -73,6 +74,7 @@ shadowJar {
include (dependency('net.kyori:adventure-text-minimessage'))
include (project(':providers:BaseProviders'))
include (project(path: ':providers:PaperProvider', configuration: 'shadow'))
include (project(':providers:FoliaProvider'))
include (project(':providers:NMSReflectionProvider'))
include (project(':providers:1_8Provider'))
include (project(':providers:1_12Provider'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,6 @@ public void nowUnsafe(Location loc, TeleportCause cause, CompletableFuture<Boole
paperFuture.exceptionally(future::completeExceptionally);
}

private void runOnMain(final Runnable runnable) throws ExecutionException, InterruptedException {
if (Bukkit.isPrimaryThread()) {
runnable.run();
return;
}
final CompletableFuture<Object> taskLock = new CompletableFuture<>();
Bukkit.getScheduler().runTask(ess, () -> {
runnable.run();
taskLock.complete(new Object());
});
taskLock.get();
}

protected void nowAsync(final IUser teleportee, final ITarget target, final TeleportCause cause, final CompletableFuture<Boolean> future) {
cancel(false);

Expand All @@ -169,8 +156,8 @@ protected void nowAsync(final IUser teleportee, final ITarget target, final Tele
}

try {
runOnMain(() -> teleportee.getBase().eject()); //EntityDismountEvent requires a sync context.
} catch (final ExecutionException | InterruptedException e) {
ess.ensureEntity(teleportee.getBase(), () -> teleportee.getBase().eject()); //EntityDismountEvent requires a sync context.
} catch (final RuntimeException e) {
future.completeExceptionally(e);
return;
}
Expand All @@ -190,8 +177,7 @@ protected void nowAsync(final IUser teleportee, final ITarget target, final Tele
if (LocationUtil.isBlockUnsafeForUser(ess, teleportee, chunk.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) {
if (ess.getSettings().isTeleportSafetyEnabled()) {
if (ess.getSettings().isForceDisableTeleportSafety()) {
//The chunk we're teleporting to is 100% going to be loaded here, no need to teleport async.
teleportee.getBase().teleport(loc, cause);
PaperLib.teleportAsync(teleportee.getBase(), loc, cause);
} else {
try {
//There's a chance the safer location is outside the loaded chunk so still teleport async here.
Expand All @@ -207,8 +193,7 @@ protected void nowAsync(final IUser teleportee, final ITarget target, final Tele
}
} else {
if (ess.getSettings().isForceDisableTeleportSafety()) {
//The chunk we're teleporting to is 100% going to be loaded here, no need to teleport async.
teleportee.getBase().teleport(loc, cause);
PaperLib.teleportAsync(teleportee.getBase(), loc, cause);
} else {
if (ess.getSettings().isTeleportToCenterLocation()) {
loc = LocationUtil.getRoundedDestination(loc);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.earth2me.essentials;

import java.util.UUID;
import java.util.concurrent.CompletableFuture;

import net.ess3.api.IEssentials;
import net.ess3.api.IUser;
import net.ess3.provider.SchedulingProvider;
import org.bukkit.Location;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;

import net.ess3.api.IEssentials;
import net.ess3.api.IUser;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;

import net.essentialsx.api.v2.events.TeleportWarmupCancelledEvent;
import net.essentialsx.api.v2.events.TeleportWarmupCancelledEvent.CancelReason;

Expand All @@ -31,7 +32,7 @@ public class AsyncTimedTeleport implements Runnable {
private final boolean timer_canMove;
private final Trade timer_chargeFor;
private final TeleportCause timer_cause;
private int timer_task;
private SchedulingProvider.EssentialsTask timer_task;
private double timer_health;

AsyncTimedTeleport(final IUser user, final IEssentials ess, final AsyncTeleport teleport, final long delay, final IUser teleportUser, final ITarget target, final Trade chargeFor, final TeleportCause cause, final boolean respawn) {
Expand All @@ -55,7 +56,7 @@ public class AsyncTimedTeleport implements Runnable {
this.timer_respawn = respawn;
this.timer_canMove = user.isAuthorized("essentials.teleport.timer.move");

timer_task = ess.runTaskTimerAsynchronously(this, 20, 20).getTaskId();
timer_task = ess.runTaskTimerAsynchronously(this, 20, 20);

if (future != null) {
this.parentFuture = future;
Expand Down Expand Up @@ -142,16 +143,16 @@ public void run() {
}
}

ess.scheduleSyncDelayedTask(new DelayedTeleportTask());
ess.scheduleEntityDelayedTask(teleportOwner.getBase(), new DelayedTeleportTask());
}

//If we need to cancelTimer a pending teleportPlayer call this method
void cancelTimer(final boolean notifyUser) {
if (timer_task == -1) {
if (timer_task == null) {
return;
}
try {
ess.getServer().getScheduler().cancelTask(timer_task);
timer_task.cancel();

final IUser teleportUser = ess.getUser(this.timer_teleportee);
if (teleportUser != null && teleportUser.getBase() != null) {
Expand All @@ -167,7 +168,7 @@ void cancelTimer(final boolean notifyUser) {
}
}
} finally {
timer_task = -1;
timer_task = null;
}
}
}
13 changes: 7 additions & 6 deletions Essentials/src/main/java/com/earth2me/essentials/Backup.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.earth2me.essentials;

import net.ess3.api.IEssentials;
import net.ess3.provider.SchedulingProvider;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;

Expand All @@ -18,7 +19,7 @@ public class Backup implements Runnable {
private transient final IEssentials ess;
private final AtomicBoolean pendingShutdown = new AtomicBoolean(false);
private transient boolean running = false;
private transient int taskId = -1;
private transient SchedulingProvider.EssentialsTask task = null;
private transient boolean active = false;
private transient CompletableFuture<Object> taskLock = null;

Expand All @@ -36,10 +37,10 @@ public void onPlayerJoin() {

public synchronized void stopTask() {
running = false;
if (taskId != -1) {
server.getScheduler().cancelTask(taskId);
if (task != null) {
task.cancel();
}
taskId = -1;
task = null;
}

private synchronized void startTask() {
Expand All @@ -48,7 +49,7 @@ private synchronized void startTask() {
if (interval < 1200) {
return;
}
taskId = ess.scheduleSyncRepeatingTask(this, interval, interval);
task = ess.scheduleGlobalRepeatingTask(this, interval, interval);
running = true;
}
}
Expand Down Expand Up @@ -123,7 +124,7 @@ public void run() {
}

if (!pendingShutdown.get()) {
ess.scheduleSyncDelayedTask(new BackupEnableSaveTask());
ess.scheduleGlobalDelayedTask(new BackupEnableSaveTask());
}
}
});
Expand Down
Loading
Loading