From b7bc91fd682daf3db12d1f2369b8fd538c756231 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sat, 14 May 2016 15:27:18 +0200 Subject: [PATCH] Move announcer task initialization to main class --- README.md | 2 +- pom.xml | 2 +- .../io/github/dre2n/dungeonsxl/DungeonsXL.java | 17 +++++++++++++++++ .../dre2n/dungeonsxl/announcer/Announcers.java | 2 -- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b6bd4b34..640cd7ca 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Instead of referencing the internals of the implementation directly, DungeonsXL The shaded version of DXL (standard version) contains this library, while the original version needs it as an external plugin. Have a look at the [installation instructions](../../wiki/getting-started#installation) for detailed information. -DungeonsXL currently uses BRCommons 0.6.2. +DungeonsXL currently uses BRCommons 0.6.3. ### Java 7 and higher diff --git a/pom.xml b/pom.xml index b0bb7c34..98d131dd 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ io.github.dre2n commons - 0.6.2 + 0.6.3 io.github.dre2n diff --git a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java index 053794fd..0bde3bc6 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java @@ -42,6 +42,7 @@ import io.github.dre2n.dungeonsxl.requirement.RequirementTypes; import io.github.dre2n.dungeonsxl.reward.DLootInventory; import io.github.dre2n.dungeonsxl.reward.RewardTypes; import io.github.dre2n.dungeonsxl.sign.DSignTypes; +import io.github.dre2n.dungeonsxl.task.AnnouncerTask; import io.github.dre2n.dungeonsxl.task.LazyUpdateTask; import io.github.dre2n.dungeonsxl.task.SecureModeTask; import io.github.dre2n.dungeonsxl.task.UpdateTask; @@ -85,6 +86,7 @@ public class DungeonsXL extends BRPlugin { private DPlayers dPlayers; private Announcers announcers; + private BukkitTask announcerTask; private BukkitTask worldUnloadTask; private BukkitTask lazyUpdateTask; private BukkitTask updateTask; @@ -155,6 +157,7 @@ public class DungeonsXL extends BRPlugin { loadAll(); // Tasks + startAnnouncerTsak(200L); startWorldUnloadTask(1200L); startLazyUpdateTask(20L); startUpdateTask(20L); @@ -501,6 +504,20 @@ public class DungeonsXL extends BRPlugin { return worldUnloadTask; } + /** + * start a new AnnouncerTask + */ + public void startAnnouncerTask(long period) { + announcerTask = new AnnouncerTask(announcers).runTaskTimer(this, 0L, period); + } + + /** + * @return the AnnouncerTask + */ + public BukkitTask getAnnouncerTask() { + return announcerTask; + } + /** * start a new WorldUnloadTask */ diff --git a/src/main/java/io/github/dre2n/dungeonsxl/announcer/Announcers.java b/src/main/java/io/github/dre2n/dungeonsxl/announcer/Announcers.java index 524c7a27..3d61545d 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/announcer/Announcers.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/announcer/Announcers.java @@ -53,8 +53,6 @@ public class Announcers { announcers.add(new Announcer(name, description, worlds, identifier, multiFloor, maxGroupsPerGame, maxPlayersPerGroup)); } } - - new AnnouncerTask(this).runTaskTimer(DungeonsXL.getInstance(), 0, 200); } /**