Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 1a5d4ff

Browse files
Use scheduleWithFixedDelay
1 parent 1b173f4 commit 1a5d4ff

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/java/de/oliver/fancyholograms/controller/HologramControllerImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private boolean isWithinVisibilityDistance(@NotNull final Hologram hologram, @No
7878
}
7979

8080
public void initRefreshTask() {
81-
FancyHologramsPlugin.get().getHologramThread().scheduleAtFixedRate(() -> {
81+
FancyHologramsPlugin.get().getHologramThread().scheduleWithFixedDelay(() -> {
8282
for (Hologram hologram : FancyHologramsPlugin.get().getRegistry().getAll()) {
8383
refreshHologram(hologram, Bukkit.getOnlinePlayers().toArray(new Player[0]));
8484
}
@@ -87,10 +87,10 @@ public void initRefreshTask() {
8787

8888
public void initUpdateTask() {
8989
final var updateTimes = CacheBuilder.newBuilder()
90-
.expireAfterAccess(Duration.ofMinutes(5))
91-
.<String, Long>build();
90+
.expireAfterAccess(Duration.ofMinutes(5))
91+
.<String, Long>build();
9292

93-
FancyHologramsPlugin.get().getHologramThread().scheduleAtFixedRate(() -> {
93+
FancyHologramsPlugin.get().getHologramThread().scheduleWithFixedDelay(() -> {
9494
final var time = System.currentTimeMillis();
9595

9696
for (final var hologram : FancyHologramsPlugin.get().getRegistry().getAll()) {
@@ -109,7 +109,7 @@ public void initUpdateTask() {
109109
}
110110
}, 50, 1000, TimeUnit.MILLISECONDS);
111111

112-
FancyHologramsPlugin.get().getHologramThread().scheduleAtFixedRate(() -> {
112+
FancyHologramsPlugin.get().getHologramThread().scheduleWithFixedDelay(() -> {
113113
final var time = System.currentTimeMillis();
114114

115115
for (final var hologram : FancyHologramsPlugin.get().getRegistry().getAll()) {
@@ -136,7 +136,7 @@ public void initUpdateTask() {
136136
}, 50, 50, TimeUnit.MILLISECONDS);
137137
}
138138

139-
/**
139+
/**
140140
* Syncs a hologram with its linked NPC, if any.
141141
*
142142
* @param hologram The hologram to sync.
@@ -158,7 +158,7 @@ public void syncHologramWithNpc(@NotNull final Hologram hologram) {
158158

159159
final var npcScale = npc.getData().getScale();
160160

161-
if(hologram.getData() instanceof DisplayHologramData displayData) {
161+
if (hologram.getData() instanceof DisplayHologramData displayData) {
162162
displayData.setScale(new Vector3f(npcScale));
163163
}
164164

src/main/java/de/oliver/fancyholograms/main/FancyHologramsPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public void onEnable() {
201201
controller.initUpdateTask();
202202

203203
if (configuration.isAutosaveEnabled()) {
204-
getHologramThread().scheduleAtFixedRate(
204+
getHologramThread().scheduleWithFixedDelay(
205205
this::savePersistentHolograms,
206206
configuration.getAutosaveInterval(),
207207
120L, TimeUnit.SECONDS

0 commit comments

Comments
 (0)