Skip to content

Commit

Permalink
- Skip drawing SpawnPoint particles in unloaded chunks.
Browse files Browse the repository at this point in the history
    - Closes #5899.
LlmDl committed May 7, 2022

Verified

This commit was signed with the committer’s verified signature.
ayushmishra2005 Ayush Mishra
1 parent 39bf7d8 commit 718da4f
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion resources/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -7447,4 +7447,6 @@ v0.92.0.11:
- Fix Error seen when a plugin cancels the NationPreAddEnemyEvent.
- Closes #5893.
- Add Town & Nation LuckPerms Contexts courtesy of Galster-dev, with PR #5883. (First-Time Contributor!)
- These are contexts that apply per-town and per-nation, making it possible to give permissions to a single Town's members etc.
- These are contexts that apply per-town and per-nation, making it possible to give permissions to a single Town's members etc.
- Skip drawing SpawnPoint particles in unloaded chunks.
- Closes #5899.
10 changes: 7 additions & 3 deletions src/com/palmergames/bukkit/towny/object/SpawnPoint.java
Original file line number Diff line number Diff line change
@@ -39,13 +39,17 @@ public SpawnPointLocation getSpawnPointLocation() {
}

public void drawParticle() {
if (!location.isWorldLoaded() ||
!location.getWorld().getChunkAt(location).isLoaded())
return;

Location origin = centreLocation(location);
int i = 0;

for (RingCoord ringPosition : RING_PATTERN) {
Location point = origin.clone().add(ringPosition.getX(), 0.0d, ringPosition.getZ());
Bukkit.getScheduler().scheduleSyncDelayedTask(Towny.getPlugin(), ()-> Bukkit.getWorld(location.getWorld().getName()).spawnParticle(Particle.CRIT_MAGIC, point, 1, 0.0, 0.0, 0.0, 0.0), i*4);
i++;
Location point = origin.clone().add(ringPosition.getX(), 0.0d, ringPosition.getZ());
Bukkit.getScheduler().scheduleSyncDelayedTask(Towny.getPlugin(), ()-> location.getWorld().spawnParticle(Particle.CRIT_MAGIC, point, 1, 0.0, 0.0, 0.0, 0.0), i*4);
i++;
}
}

0 comments on commit 718da4f

Please sign in to comment.