Send game announcement only to listed worlds

This commit is contained in:
Daniel Saukel 2016-05-14 19:47:12 +02:00
parent 328e28c254
commit 3896e14ef4

View File

@ -30,6 +30,8 @@ import org.bukkit.scheduler.BukkitRunnable;
*/ */
public class AnnouncerTask extends BukkitRunnable { public class AnnouncerTask extends BukkitRunnable {
DungeonsXL plugin = DungeonsXL.getInstance();
private List<Announcer> announcers; private List<Announcer> announcers;
int index; int index;
@ -40,9 +42,13 @@ public class AnnouncerTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
Announcer announcer = announcers.get(index);
List<String> worlds = announcer.getWorlds();
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {
if (!(DungeonsXL.getInstance().getDPlayers().getByPlayer(player) instanceof DInstancePlayer)) { if (!(plugin.getDPlayers().getByPlayer(player) instanceof DInstancePlayer)) {
announcers.get(index).send(player); if (worlds == null || worlds.contains(player.getWorld().getName())) {
announcer.send(player);
}
} }
} }