Each player now gets the same reminder (#12)

Each player now gets the same reminder

+ Reminders are logged to console now
+ Fixes #11

Co-authored-by: Joey Hines <joey@ahines.net>
Reviewed-on: https://git.canopymc.net/Canopy/QoL/pulls/12
Reviewed-by: Etzelia <etzelia@hotmail.com>
Co-Authored-By: ZeroHD <joey@ahines.net>
Co-Committed-By: ZeroHD <joey@ahines.net>
pull/13/head
Joey Hines 2021-07-12 21:36:03 +00:00 committed by Etzelia
parent 3ae415d7d0
commit 3c54c249a1
1 changed files with 5 additions and 1 deletions

View File

@ -1,11 +1,13 @@
package xyz.etztech.qol; package xyz.etztech.qol;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.dynmap.DynmapAPI; import org.dynmap.DynmapAPI;
import org.dynmap.markers.Marker; import org.dynmap.markers.Marker;
import org.dynmap.markers.MarkerAPI; import org.dynmap.markers.MarkerAPI;
@ -144,9 +146,11 @@ public class QoL extends JavaPlugin {
Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), new Runnable() { Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), new Runnable() {
@Override @Override
public void run() { public void run() {
BaseComponent [] msg = reminder.nextReminder();
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {
player.spigot().sendMessage(reminder.nextReminder()); player.spigot().sendMessage(msg);
} }
Bukkit.getConsoleSender().spigot().sendMessage(msg);
} }
}, 0, EtzTechUtil.minutesToTicks(reminder.getFrequency())); }, 0, EtzTechUtil.minutesToTicks(reminder.getFrequency()));
} }