Misc, PlayerListener & SQLDatabaseManager

This commit is contained in:
HSGamer 2023-08-18 17:26:16 +07:00
parent 38e0810f93
commit f480884653
3 changed files with 9 additions and 12 deletions

View File

@ -18,12 +18,12 @@ import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.sql.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
public final class SQLDatabaseManager implements DatabaseManager {
@ -1356,7 +1356,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL");
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
new GetUUIDUpdatesRequired().runTaskLaterAsynchronously(mcMMO.p, 100); // wait until after first purge
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new GetUUIDUpdatesRequired(), 100 * Misc.TICK_MS_CONVERSION_FACTOR, TimeUnit.MILLISECONDS); // wait until after first purge
}
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
@ -1369,7 +1369,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
}
private class GetUUIDUpdatesRequired extends BukkitRunnable {
private class GetUUIDUpdatesRequired implements Runnable {
public void run() {
massUpdateLock.lock();
List<String> names = new ArrayList<>();

View File

@ -49,9 +49,9 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.*;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
public class PlayerListener implements Listener {
private final mcMMO plugin;
@ -149,12 +149,10 @@ public class PlayerListener implements Listener {
new MobHealthDisplayUpdaterTask(attacker).run();
// set the name back
new BukkitRunnable() {
@Override
public void run() {
MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p);
}
}.runTaskLater(mcMMO.p, 1);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(attacker,
() -> MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p),
Misc.TICK_MS_CONVERSION_FACTOR, TimeUnit.MILLISECONDS
);
}
/**

View File

@ -12,7 +12,6 @@ import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -327,7 +326,7 @@ public final class Misc {
experienceOrb.setExperience(experienceValue);
}
private static class SpawnOrbTask extends BukkitRunnable {
private static class SpawnOrbTask implements Runnable {
private final Location location;
private int orbExpValue;