From 3896e14ef4a60dd974cbf25511a90b8940ccbaa6 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sat, 14 May 2016 19:47:12 +0200 Subject: [PATCH] Send game announcement only to listed worlds --- .../io/github/dre2n/dungeonsxl/task/AnnouncerTask.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/dre2n/dungeonsxl/task/AnnouncerTask.java b/src/main/java/io/github/dre2n/dungeonsxl/task/AnnouncerTask.java index 317dcde3..574a7548 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/task/AnnouncerTask.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/task/AnnouncerTask.java @@ -30,6 +30,8 @@ import org.bukkit.scheduler.BukkitRunnable; */ public class AnnouncerTask extends BukkitRunnable { + DungeonsXL plugin = DungeonsXL.getInstance(); + private List announcers; int index; @@ -40,9 +42,13 @@ public class AnnouncerTask extends BukkitRunnable { @Override public void run() { + Announcer announcer = announcers.get(index); + List worlds = announcer.getWorlds(); for (Player player : Bukkit.getOnlinePlayers()) { - if (!(DungeonsXL.getInstance().getDPlayers().getByPlayer(player) instanceof DInstancePlayer)) { - announcers.get(index).send(player); + if (!(plugin.getDPlayers().getByPlayer(player) instanceof DInstancePlayer)) { + if (worlds == null || worlds.contains(player.getWorld().getName())) { + announcer.send(player); + } } }