Folia Support(dev)
This commit is contained in:
parent
68ab92dd7a
commit
885db23fc6
19
pom.xml
19
pom.xml
@ -324,8 +324,18 @@
|
|||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<!-- <artifactSet>-->
|
||||||
|
<!-- <includes>-->
|
||||||
|
<!-- <include>com.github.Anon8281:UniversalScheduler</include>-->
|
||||||
|
<!-- </includes>-->
|
||||||
|
<!-- </artifactSet>-->
|
||||||
<finalName>${project.finalNameBase}-Spigot-Universal</finalName>
|
<finalName>${project.finalNameBase}-Spigot-Universal</finalName>
|
||||||
<relocations>
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>com.github.Anon8281.universalScheduler</pattern>
|
||||||
|
<shadedPattern>fr.xephi.authme.libs.com.github.Anon8281.universalScheduler
|
||||||
|
</shadedPattern>
|
||||||
|
</relocation>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>com.google.common</pattern>
|
<pattern>com.google.common</pattern>
|
||||||
<shadedPattern>fr.xephi.authme.libs.com.google.common</shadedPattern>
|
<shadedPattern>fr.xephi.authme.libs.com.google.common</shadedPattern>
|
||||||
@ -1049,6 +1059,15 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Universal Scheduler used by Folia -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.Anon8281</groupId>
|
||||||
|
<artifactId>UniversalScheduler</artifactId>
|
||||||
|
<version>0.1.6</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- XAuth, another authentication plugin, required by the database converter -->
|
<!-- XAuth, another authentication plugin, required by the database converter -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.luricos.bukkit</groupId>
|
<groupId>de.luricos.bukkit</groupId>
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package fr.xephi.authme;
|
|||||||
|
|
||||||
import ch.jalu.injector.Injector;
|
import ch.jalu.injector.Injector;
|
||||||
import ch.jalu.injector.InjectorBuilder;
|
import ch.jalu.injector.InjectorBuilder;
|
||||||
|
import com.github.Anon8281.universalScheduler.UniversalScheduler;
|
||||||
|
import com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskScheduler;
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
import fr.xephi.authme.command.CommandHandler;
|
import fr.xephi.authme.command.CommandHandler;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
@ -77,6 +79,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
private static final String pluginBuild = "b";
|
private static final String pluginBuild = "b";
|
||||||
private static String pluginBuildNumber = "40";
|
private static String pluginBuildNumber = "40";
|
||||||
// Private instances
|
// Private instances
|
||||||
|
private static TaskScheduler scheduler;
|
||||||
private EmailService emailService;
|
private EmailService emailService;
|
||||||
private CommandHandler commandHandler;
|
private CommandHandler commandHandler;
|
||||||
@Inject
|
@Inject
|
||||||
@ -102,6 +105,14 @@ public class AuthMe extends JavaPlugin {
|
|||||||
return pluginBuild;
|
return pluginBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Universal Scheduler
|
||||||
|
*
|
||||||
|
* @return TaskScheduler
|
||||||
|
*/
|
||||||
|
public static TaskScheduler getScheduler() {
|
||||||
|
return scheduler;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plugin's name.
|
* Get the plugin's name.
|
||||||
@ -139,7 +150,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Load the plugin version data from the plugin description file
|
// Load the plugin version data from the plugin description file
|
||||||
loadPluginInfo(getDescription().getVersion());
|
loadPluginInfo(getDescription().getVersion());
|
||||||
|
scheduler = UniversalScheduler.getScheduler(this);
|
||||||
// Set the Logger instance and log file path
|
// Set the Logger instance and log file path
|
||||||
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
||||||
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
||||||
@ -189,6 +200,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
backupService.doBackup(BackupService.BackupCause.START);
|
backupService.doBackup(BackupService.BackupCause.START);
|
||||||
// Set up Metrics
|
// Set up Metrics
|
||||||
OnStartupTasks.sendMetrics(this, settings);
|
OnStartupTasks.sendMetrics(this, settings);
|
||||||
|
|
||||||
if (settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
|
if (settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
|
||||||
logger.info("\n" + " ___ __ __ __ ___ \n" +
|
logger.info("\n" + " ___ __ __ __ ___ \n" +
|
||||||
" / | __ __/ /_/ /_ / |/ /__ \n" +
|
" / | __ __/ /_/ /_ / |/ /__ \n" +
|
||||||
@ -453,7 +465,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
|
|
||||||
private void checkServerType() {
|
private void checkServerType() {
|
||||||
if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
if (isClassLoaded("io.papermc.paper.threadedregions.RegionizedServerInitEvent")) {
|
||||||
|
logger.info("AuthMeReReloaded is running on Folia");
|
||||||
|
} else if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
||||||
logger.info("AuthMeReReloaded is running on Paper");
|
logger.info("AuthMeReReloaded is running on Paper");
|
||||||
} else if (isClassLoaded("catserver.server.CatServerConfig")) {
|
} else if (isClassLoaded("catserver.server.CatServerConfig")) {
|
||||||
logger.info("AuthMeReReloaded is running on CatServer");
|
logger.info("AuthMeReReloaded is running on CatServer");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme.service;
|
package fr.xephi.authme.service;
|
||||||
|
|
||||||
|
import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask;
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.initialization.SettingsDependent;
|
import fr.xephi.authme.initialization.SettingsDependent;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
@ -48,10 +49,10 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* This task will be executed by the main server thread.
|
* This task will be executed by the main server thread.
|
||||||
*
|
*
|
||||||
* @param task Task to be executed
|
* @param task Task to be executed
|
||||||
* @return Task id number (-1 if scheduling failed)
|
* Task id number (-1 if scheduling failed)
|
||||||
*/
|
*/
|
||||||
public int scheduleSyncDelayedTask(Runnable task) {
|
public void scheduleSyncDelayedTask(Runnable task) {
|
||||||
return Bukkit.getScheduler().scheduleSyncDelayedTask(authMe, task);
|
MyScheduledTask tsk = AuthMe.getScheduler().runTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,12 +60,12 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* <p>
|
* <p>
|
||||||
* This task will be executed by the main server thread.
|
* This task will be executed by the main server thread.
|
||||||
*
|
*
|
||||||
* @param task Task to be executed
|
* @param task Task to be executed
|
||||||
* @param delay Delay in server ticks before executing task
|
* @param delay Delay in server ticks before executing task
|
||||||
* @return Task id number (-1 if scheduling failed)
|
* Task id number (-1 if scheduling failed)
|
||||||
*/
|
*/
|
||||||
public int scheduleSyncDelayedTask(Runnable task, long delay) {
|
public void scheduleSyncDelayedTask(Runnable task, long delay) {
|
||||||
return Bukkit.getScheduler().scheduleSyncDelayedTask(authMe, task, delay);
|
MyScheduledTask tsk = AuthMe.getScheduler().runTaskLater(task, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,7 +77,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
*/
|
*/
|
||||||
public void scheduleSyncTaskFromOptionallyAsyncTask(Runnable task) {
|
public void scheduleSyncTaskFromOptionallyAsyncTask(Runnable task) {
|
||||||
if (Bukkit.isPrimaryThread()) {
|
if (Bukkit.isPrimaryThread()) {
|
||||||
task.run();
|
AuthMe.getScheduler().runTask(task);
|
||||||
} else {
|
} else {
|
||||||
scheduleSyncDelayedTask(task);
|
scheduleSyncDelayedTask(task);
|
||||||
}
|
}
|
||||||
@ -86,12 +87,12 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* Returns a task that will run on the next server tick.
|
* Returns a task that will run on the next server tick.
|
||||||
*
|
*
|
||||||
* @param task the task to be run
|
* @param task the task to be run
|
||||||
* @return a BukkitTask that contains the id number
|
* a BukkitTask that contains the id number
|
||||||
* @throws IllegalArgumentException if plugin is null
|
* @throws IllegalArgumentException if plugin is null
|
||||||
* @throws IllegalArgumentException if task is null
|
* @throws IllegalArgumentException if task is null
|
||||||
*/
|
*/
|
||||||
public BukkitTask runTask(Runnable task) {
|
public void runTask(Runnable task) {
|
||||||
return Bukkit.getScheduler().runTask(authMe, task);
|
AuthMe.getScheduler().runTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,7 +106,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @throws IllegalArgumentException if task is null
|
* @throws IllegalArgumentException if task is null
|
||||||
*/
|
*/
|
||||||
public BukkitTask runTaskLater(Runnable task, long delay) {
|
public BukkitTask runTaskLater(Runnable task, long delay) {
|
||||||
return Bukkit.getScheduler().runTaskLater(authMe, task, delay);
|
return (BukkitTask) AuthMe.getScheduler().runTaskLater(task, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,9 +117,9 @@ public class BukkitService implements SettingsDependent {
|
|||||||
*/
|
*/
|
||||||
public void runTaskOptionallyAsync(Runnable task) {
|
public void runTaskOptionallyAsync(Runnable task) {
|
||||||
if (useAsyncTasks) {
|
if (useAsyncTasks) {
|
||||||
runTaskAsynchronously(task);
|
AuthMe.getScheduler().runTaskAsynchronously(task);
|
||||||
} else {
|
} else {
|
||||||
task.run();
|
AuthMe.getScheduler().runTask(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,12 +130,12 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* Returns a task that will run asynchronously.
|
* Returns a task that will run asynchronously.
|
||||||
*
|
*
|
||||||
* @param task the task to be run
|
* @param task the task to be run
|
||||||
* @return a BukkitTask that contains the id number
|
* a BukkitTask that contains the id number
|
||||||
* @throws IllegalArgumentException if plugin is null
|
* @throws IllegalArgumentException if plugin is null
|
||||||
* @throws IllegalArgumentException if task is null
|
* @throws IllegalArgumentException if task is null
|
||||||
*/
|
*/
|
||||||
public BukkitTask runTaskAsynchronously(Runnable task) {
|
public void runTaskAsynchronously(Runnable task) {
|
||||||
return Bukkit.getScheduler().runTaskAsynchronously(authMe, task);
|
AuthMe.getScheduler().runTaskAsynchronously(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,27 +149,27 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @param delay the ticks to wait before running the task for the first
|
* @param delay the ticks to wait before running the task for the first
|
||||||
* time
|
* time
|
||||||
* @param period the ticks to wait between runs
|
* @param period the ticks to wait between runs
|
||||||
* @return a BukkitTask that contains the id number
|
* a BukkitTask that contains the id number
|
||||||
* @throws IllegalArgumentException if task is null
|
* @throws IllegalArgumentException if task is null
|
||||||
* @throws IllegalStateException if this was already scheduled
|
* @throws IllegalStateException if this was already scheduled
|
||||||
*/
|
*/
|
||||||
public BukkitTask runTaskTimerAsynchronously(BukkitRunnable task, long delay, long period) {
|
public void runTaskTimerAsynchronously(BukkitRunnable task, long delay, long period) {
|
||||||
return task.runTaskTimerAsynchronously(authMe, delay, period);
|
AuthMe.getScheduler().runTaskTimerAsynchronously(task, delay, period);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules the given task to repeatedly run until cancelled, starting after the
|
* Schedules the given task to repeatedly run until cancelled, starting after the
|
||||||
* specified number of server ticks.
|
* specified number of server ticks.
|
||||||
*
|
*
|
||||||
* @param task the task to schedule
|
* @param task the task to schedule
|
||||||
* @param delay the ticks to wait before running the task
|
* @param delay the ticks to wait before running the task
|
||||||
* @param period the ticks to wait between runs
|
* @param period the ticks to wait between runs
|
||||||
* @return a BukkitTask that contains the id number
|
* a BukkitTask that contains the id number
|
||||||
* @throws IllegalArgumentException if plugin is null
|
* @throws IllegalArgumentException if plugin is null
|
||||||
* @throws IllegalStateException if this was already scheduled
|
* @throws IllegalStateException if this was already scheduled
|
||||||
*/
|
*/
|
||||||
public BukkitTask runTaskTimer(BukkitRunnable task, long delay, long period) {
|
public void runTaskTimer(BukkitRunnable task, long delay, long period) {
|
||||||
return task.runTaskTimer(authMe, delay, period);
|
AuthMe.getScheduler().runTaskTimer(task, delay, period);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -16,6 +16,7 @@ softdepend:
|
|||||||
- EssentialsSpawn
|
- EssentialsSpawn
|
||||||
- ProtocolLib
|
- ProtocolLib
|
||||||
- floodgate
|
- floodgate
|
||||||
|
folia-supported: true
|
||||||
commands:
|
commands:
|
||||||
authme:
|
authme:
|
||||||
description: AuthMe op commands
|
description: AuthMe op commands
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user