From 3b671a60056394da592853913d81daa46c088346 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Wed, 6 Jul 2016 14:53:26 +0200 Subject: [PATCH] Delay tasks after first --- .../io/github/dre2n/dungeonsxl/DungeonsXL.java | 18 ++++++++++++------ .../github/dre2n/dungeonsxl/sign/DropSign.java | 3 ++- .../dungeonsxl/trigger/FortuneTrigger.java | 5 ++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java index 28c6cd4b..16e4fd28 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java @@ -67,6 +67,7 @@ public class DungeonsXL extends BRPlugin { private static DungeonsXL instance; public static final String[] EXCLUDED_FILES = {"config.yml", "uid.dat", "DXLData.data"}; + public static File BACKUPS; public static File DUNGEONS; public static File LANGUAGES; public static File MAPS; @@ -208,7 +209,7 @@ public void onDisable() { // Stop shedulers getServer().getScheduler().cancelTasks(this); - + // DebukkIt debug.save(); } @@ -219,6 +220,11 @@ public void initFolders() { getDataFolder().mkdir(); } + BACKUPS = new File(getDataFolder(), "backups"); + if (!BACKUPS.exists()) { + BACKUPS.mkdir(); + } + DUNGEONS = new File(getDataFolder(), "dungeons"); if (!DUNGEONS.exists()) { DUNGEONS.mkdir(); @@ -572,7 +578,7 @@ public BukkitTask getAnnouncerTask() { */ public void startAnnouncerTask(long period) { if (!announcers.getAnnouncers().isEmpty()) { - announcerTask = new AnnouncerTask(announcers).runTaskTimer(this, 0L, period); + announcerTask = new AnnouncerTask(announcers).runTaskTimer(this, period, period); } } @@ -587,7 +593,7 @@ public BukkitTask getWorldUnloadTask() { * start a new WorldUnloadTask */ public void startWorldUnloadTask(long period) { - worldUnloadTask = new WorldUnloadTask().runTaskTimer(this, 0L, period); + worldUnloadTask = new WorldUnloadTask().runTaskTimer(this, period, period); } /** @@ -601,7 +607,7 @@ public BukkitTask getLazyUpdateTask() { * start a new LazyUpdateTask */ public void startLazyUpdateTask(long period) { - lazyUpdateTask = new LazyUpdateTask().runTaskTimer(this, 0L, period); + lazyUpdateTask = new LazyUpdateTask().runTaskTimer(this, period, period); } /** @@ -615,7 +621,7 @@ public BukkitTask getUpdateTask() { * start a new LazyUpdateTask */ public void startUpdateTask(long period) { - updateTask = new UpdateTask().runTaskTimer(this, 0L, period); + updateTask = new UpdateTask().runTaskTimer(this, period, period); } /** @@ -629,7 +635,7 @@ public BukkitTask getSecureModeTask() { * start a new SecureModeTask */ public void startSecureModeTask(long period) { - updateTask = new SecureModeTask().runTaskTimer(this, 0L, period); + updateTask = new SecureModeTask().runTaskTimer(this, period, period); } /** diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/DropSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/DropSign.java index 8817bd53..eef2f858 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/DropSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/DropSign.java @@ -83,7 +83,8 @@ public void onTrigger() { getSign().getWorld().dropItem(spawnLocation, item); } else { - new DropItemTask(item, spawnLocation).runTaskTimer(plugin, 0, (long) interval * 20); + long period = (long) interval * 20; + new DropItemTask(item, spawnLocation).runTaskTimer(plugin, period, period); } } diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/FortuneTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/FortuneTrigger.java index 98ae9165..a299edbb 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/FortuneTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/FortuneTrigger.java @@ -22,7 +22,7 @@ import io.github.dre2n.dungeonsxl.world.DGameWorld; /** - * @author Frank Baumann, Daniel Saukel + * @author Daniel Saukel */ public class FortuneTrigger extends Trigger { @@ -35,6 +35,9 @@ public FortuneTrigger(double chance) { } /* Getters and setters */ + /** + * @return the chance + */ public double getChance() { return chance; }