mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-05 07:57:59 +01:00
Add method for checking the global thread
This commit is contained in:
parent
4ff9286a79
commit
2d8cc827b9
@ -1239,6 +1239,11 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||||||
return schedulingProvider.isRegionThread(location);
|
return schedulingProvider.isRegionThread(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGlobalThread() {
|
||||||
|
return schedulingProvider.isGlobalThread();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PermissionsHandler getPermissionsHandler() {
|
public PermissionsHandler getPermissionsHandler() {
|
||||||
return permissionsHandler;
|
return permissionsHandler;
|
||||||
|
@ -129,6 +129,8 @@ public interface IEssentials extends Plugin {
|
|||||||
|
|
||||||
boolean isRegionThread(Location location);
|
boolean isRegionThread(Location location);
|
||||||
|
|
||||||
|
boolean isGlobalThread();
|
||||||
|
|
||||||
PermissionsHandler getPermissionsHandler();
|
PermissionsHandler getPermissionsHandler();
|
||||||
|
|
||||||
AlternativeCommandsHandler getAlternativeCommandsHandler();
|
AlternativeCommandsHandler getAlternativeCommandsHandler();
|
||||||
|
@ -10,6 +10,8 @@ public interface SchedulingProvider extends Provider {
|
|||||||
|
|
||||||
boolean isRegionThread(Location location);
|
boolean isRegionThread(Location location);
|
||||||
|
|
||||||
|
boolean isGlobalThread();
|
||||||
|
|
||||||
void runEntityTask(Entity entity, Runnable runnable);
|
void runEntityTask(Entity entity, Runnable runnable);
|
||||||
|
|
||||||
EssentialsTask runEntityTask(Entity entity, Runnable runnable, long delay);
|
EssentialsTask runEntityTask(Entity entity, Runnable runnable, long delay);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.ess3.provider.providers;
|
package net.ess3.provider.providers;
|
||||||
|
|
||||||
import net.ess3.provider.SchedulingProvider;
|
import net.ess3.provider.SchedulingProvider;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -28,6 +29,11 @@ public class BukkitSchedulingProvider implements SchedulingProvider {
|
|||||||
return plugin.getServer().isPrimaryThread();
|
return plugin.getServer().isPrimaryThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGlobalThread() {
|
||||||
|
return Bukkit.isPrimaryThread();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runEntityTask(Entity entity, Runnable runnable) {
|
public void runEntityTask(Entity entity, Runnable runnable) {
|
||||||
runEntityTask(entity, runnable, 1);
|
runEntityTask(entity, runnable, 1);
|
||||||
|
@ -48,6 +48,11 @@ public class FoliaSchedulingProvider implements SchedulingProvider, Listener {
|
|||||||
return plugin.getServer().isOwnedByCurrentRegion(location);
|
return plugin.getServer().isOwnedByCurrentRegion(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGlobalThread() {
|
||||||
|
return plugin.getServer().isGlobalTickThread();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runEntityTask(Entity entity, Runnable runnable) {
|
public void runEntityTask(Entity entity, Runnable runnable) {
|
||||||
runEntityTask(entity, runnable, 1);
|
runEntityTask(entity, runnable, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user