forked from SteamWar/SteamWar
Use @LinkedTimer for the timers of linked classes
The repeating timers that linked classes and the plugin main classes started once for the whole runtime now use @LinkedTimer, on Spigot (BauSystem, SpigotCore, LobbySystem, MissileWars, TowerRun, Teamserver) and Velocity. The FightInfoPacketSenders of MissileWars and TowerRun are linked themselves instead of being started by the main class.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
|
||||
package de.steamwar.towerrun;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedTimer;
|
||||
import de.steamwar.network.NetworkSender;
|
||||
import de.steamwar.network.packets.common.FightInfoPacket;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
@@ -33,6 +35,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
public class FightInfoPacketSender implements Runnable {
|
||||
|
||||
private final World world = Bukkit.getWorlds().get(0);
|
||||
@@ -44,6 +47,7 @@ public class FightInfoPacketSender implements Runnable {
|
||||
private final String redName = "§cAlive";
|
||||
|
||||
@Override
|
||||
@LinkedTimer(delay = 1, period = 1, unit = LinkedTimer.Unit.SECONDS)
|
||||
public void run() {
|
||||
if (Config.test()) {
|
||||
return;
|
||||
|
||||
@@ -71,7 +71,5 @@ public class TowerRun extends JavaPlugin {
|
||||
Bukkit.shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskTimer(this, new FightInfoPacketSender(), 20, 20);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user