Skip to content

Commit 6c93075

Browse files
committed
Synchronization to avoid problems
1 parent 812cd66 commit 6c93075

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/eu/decentsoftware/holograms/api/animations/AnimationManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public void tick() {
3737
step.incrementAndGet();
3838
}
3939

40-
public void destroy() {
40+
public synchronized void destroy() {
4141
this.unregister();
4242
this.animationMap.clear();
4343
}
4444

45-
public void reload() {
45+
public synchronized void reload() {
4646
this.animationMap.clear();
4747
this.registerAnimation(new TypewriterAnimation());
4848
this.registerAnimation(new WaveAnimation());

src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public HologramManager() {
5555
}
5656

5757
@Override
58-
public void tick() {
58+
public synchronized void tick() {
5959
for (Hologram hologram : Hologram.getCachedHolograms()) {
6060
if (hologram.isEnabled()) {
6161
for (Player player : Bukkit.getOnlinePlayers()) {
@@ -150,15 +150,15 @@ public void onQuit(@NonNull Player player) {
150150
/**
151151
* Reload this manager and all the holograms.
152152
*/
153-
public void reload() {
153+
public synchronized void reload() {
154154
this.destroy();
155155
this.loadHolograms();
156156
}
157157

158158
/**
159159
* Destroy this manager and all the holograms.
160160
*/
161-
public void destroy() {
161+
public synchronized void destroy() {
162162
// Destroy registered holograms
163163
for (Hologram hologram : getHolograms()) {
164164
hologram.destroy();

0 commit comments

Comments
 (0)