mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-05 05:55:26 +02:00
Move bleeding to mcBleedTimer
Put all the logic handling adding/removing/contains there and encapsulate our List Additionally, should prevent a ConcurrentModificationException by locking, but I'm not 100% on the contiains not throing such an exception.
This commit is contained in:
@@ -35,6 +35,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -51,9 +52,6 @@ public class mcMMO extends JavaPlugin {
|
||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||
|
||||
private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION
|
||||
private Runnable mcMMO_SaveTimer = new mcSaveTimer(this); //Periodic saving of Player Data
|
||||
|
||||
//Alias - Command
|
||||
public HashMap<String, String> aliasMap = new HashMap<String, String>();
|
||||
|
||||
@@ -138,11 +136,14 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
|
||||
//Periodic save timer (Saves every 10 minutes)
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_SaveTimer, 0, LoadProperties.saveInterval * 1200);
|
||||
BukkitScheduler scheduler = getServer().getScheduler();
|
||||
|
||||
//Bleed & Regen timer (Runs every 20 seconds)
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_Timer, 0, 20);
|
||||
//Periodic save timer (Saves every 10 minutes)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new mcSaveTimer(this), 0, LoadProperties.saveInterval * 1200);
|
||||
//Regen & Cooldown timer (Runs every second)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new mcTimer(this), 0, 20);
|
||||
//Bleed timer (Runs every two seconds)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new mcBleedTimer(this), 0, 40);
|
||||
|
||||
registerCommands();
|
||||
|
||||
|
Reference in New Issue
Block a user