mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Change to the newer, shorter scheduler methods.
This commit is contained in:
parent
db2bf9ee51
commit
c3a69c8c55
@ -336,7 +336,7 @@ public final class DatabaseManager {
|
||||
if (connection != null && !connection.isClosed()) {
|
||||
// Schedule a database save if we really had an outage
|
||||
if (reconnectAttempt > 1) {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new SQLReconnectTask(), 5);
|
||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new SQLReconnectTask(), 5);
|
||||
}
|
||||
nextReconnectTimestamp = 0;
|
||||
reconnectAttempt = 0;
|
||||
|
@ -88,7 +88,7 @@ public class BlockListener implements Listener {
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
if (event.isSticky()) {
|
||||
// Needed only because under some circumstances Minecraft doesn't move the block
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StickyPistonTrackerTask(event), 2);
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, new StickyPistonTrackerTask(event), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,39 +405,39 @@ public class mcMMO extends JavaPlugin {
|
||||
BukkitScheduler scheduler = getServer().getScheduler();
|
||||
|
||||
// Parties are loaded at the end of first server tick otherwise Server.getOfflinePlayer throws an IndexOutOfBoundsException
|
||||
scheduler.scheduleSyncDelayedTask(this, new PartyLoaderTask(), 0);
|
||||
scheduler.runTaskLater(this, new PartyLoaderTask(), 0);
|
||||
|
||||
// Periodic save timer (Saves every 10 minutes by default)
|
||||
long saveIntervalTicks = Config.getInstance().getSaveInterval() * 1200;
|
||||
|
||||
scheduler.scheduleSyncRepeatingTask(this, new SaveTimerTask(), saveIntervalTicks, saveIntervalTicks);
|
||||
scheduler.runTaskTimer(this, new SaveTimerTask(), saveIntervalTicks, saveIntervalTicks);
|
||||
// Regen & Cooldown timer (Runs every second)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new SkillMonitorTask(), 20, 20);
|
||||
scheduler.runTaskTimer(this, new SkillMonitorTask(), 20, 20);
|
||||
// Bleed timer (Runs every two seconds)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new BleedTimerTask(), 40, 40);
|
||||
scheduler.runTaskTimer(this, new BleedTimerTask(), 40, 40);
|
||||
|
||||
// Old & Powerless User remover
|
||||
int purgeInterval = Config.getInstance().getPurgeInterval();
|
||||
|
||||
if (purgeInterval == 0) {
|
||||
scheduler.scheduleSyncDelayedTask(this, new UserPurgeTask(), 40); // Start 2 seconds after startup.
|
||||
scheduler.runTaskLater(this, new UserPurgeTask(), 40); // Start 2 seconds after startup.
|
||||
}
|
||||
else if (purgeInterval > 0) {
|
||||
long purgeIntervalTicks = purgeInterval * 60 * 60 * 20;
|
||||
|
||||
scheduler.scheduleSyncRepeatingTask(this, new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
||||
scheduler.runTaskTimer(this, new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
||||
}
|
||||
|
||||
// Automatically remove old members from parties
|
||||
long kickInterval = Config.getInstance().getAutoPartyKickInterval();
|
||||
|
||||
if (kickInterval == 0) {
|
||||
scheduler.scheduleSyncDelayedTask(this, new PartyAutoKickTask(), 40); // Start 2 seconds after startup.
|
||||
scheduler.runTaskLater(this, new PartyAutoKickTask(), 40); // Start 2 seconds after startup.
|
||||
}
|
||||
else if (kickInterval > 0) {
|
||||
long kickIntervalTicks = kickInterval * 60 * 60 * 20;
|
||||
|
||||
scheduler.scheduleSyncRepeatingTask(this, new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||
scheduler.runTaskTimer(this, new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class SaveTimerTask implements Runnable {
|
||||
BukkitScheduler bukkitScheduler = mcMMO.p.getServer().getScheduler();
|
||||
|
||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers().values()) {
|
||||
bukkitScheduler.scheduleSyncDelayedTask(mcMMO.p, new PlayerProfileSaveTask(mcMMOPlayer), count);
|
||||
bukkitScheduler.runTaskLater(mcMMO.p, new PlayerProfileSaveTask(mcMMOPlayer), count);
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class McrankCommandAsyncTask implements Runnable {
|
||||
public void run() {
|
||||
final Map<String, Integer> skills = DatabaseManager.readSQLRank(playerName);
|
||||
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
|
||||
|
@ -28,7 +28,7 @@ public class MctopCommandAsyncTask implements Runnable {
|
||||
public void run() {
|
||||
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
final HashMap<Integer, ArrayList<String>> userslist = DatabaseManager.read("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 ORDER BY " + query + " DESC, user LIMIT " + ((page * 10) - 10) + ",10");
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
|
@ -18,7 +18,7 @@ public class TrackedEntity implements Runnable {
|
||||
this.livingEntity = livingEntity;
|
||||
this.id = livingEntity.getUniqueId();
|
||||
this.scheduler = mcMMO.p.getServer().getScheduler();
|
||||
this.taskId = scheduler.scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000);
|
||||
this.taskId = scheduler.runTaskTimer(mcMMO.p, this, 12000, 12000).getTaskId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,7 +97,7 @@ public final class HolidayManager {
|
||||
final int firework_amount = 10;
|
||||
for (int i = 0; i < firework_amount; i++) {
|
||||
int delay = (int) (Math.random() * 3) + 4;
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
spawnFireworks((Player) sender);
|
||||
|
@ -28,7 +28,7 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
|
||||
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
|
||||
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
|
||||
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,7 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
if (baseXP != 0) {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new AwardCombatXpTask(mcMMOPlayer, skillType, baseXP, target), 0);
|
||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new AwardCombatXpTask(mcMMOPlayer, skillType, baseXP, target), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user