Skip to content

Commit 3d7fd22

Browse files
committed
improvements
1 parent 9bfe2fb commit 3d7fd22

6 files changed

Lines changed: 39 additions & 17 deletions

File tree

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>me.waterarchery</groupId>
88
<artifactId>LitLibs</artifactId>
9-
<version>1.1.32</version>
9+
<version>1.1.33</version>
1010
<packaging>jar</packaging>
1111

1212
<name>LitLibs</name>
@@ -287,9 +287,9 @@
287287

288288
<!--XSeries for items-->
289289
<dependency>
290-
<groupId>com.github.poyrazinan</groupId>
290+
<groupId>com.github.cryptomorin</groupId>
291291
<artifactId>XSeries</artifactId>
292-
<version>3faba3231f</version>
292+
<version>13.3.1</version>
293293
</dependency>
294294

295295
<!--Guis-->

src/main/java/me/waterarchery/litlibs/LitLibsPlugin.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ public class LitLibsPlugin extends JavaPlugin {
2626
private BukkitAudiences adventure;;
2727
private Logger litLogger;
2828
private BukkitLibraryManager bukkitLibraryManager;
29-
private final ExecutorService guiThread = Executors.newSingleThreadExecutor();
29+
private final ExecutorService guiThread = Executors.newFixedThreadPool(1, r -> {
30+
Thread t = new Thread(r);
31+
t.setUncaughtExceptionHandler((thread, throwable) -> throwable.printStackTrace());
32+
return t;
33+
});
3034

3135
@Override
3236
public void onLoad() {

src/main/java/me/waterarchery/litlibs/handlers/SoundHandler.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ public void sendSound(Player p, String configPath, double volume) {
2828

2929
public void sendRawSound(Player p, String soundName, double volume, double pitch) {
3030
try {
31-
XSound xSound = XSound.valueOf(soundName);
32-
31+
XSound xSound = null;
32+
for (XSound sound : XSound.values()) {
33+
if (sound.name().equalsIgnoreCase(soundName)) {
34+
xSound = sound;
35+
break;
36+
}
37+
}
38+
39+
if (xSound == null) return;
3340
xSound.play(p, (float) volume, (float) pitch);
3441
}
3542
catch (IllegalArgumentException e) {

src/main/java/me/waterarchery/litlibs/libs/ParticleAPI.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import me.waterarchery.litlibs.version.Version;
44
import me.waterarchery.litlibs.version.VersionHandler;
5+
import org.bukkit.Color;
56
import org.bukkit.Location;
67
import org.bukkit.Particle;
78
import org.bukkit.entity.Player;
@@ -25,7 +26,13 @@ public static void createParticle(Location location, String particleName) {
2526
// TODO IMPLEMENT PROPER PARTICLE API
2627
for (Particle particle : Particle.values()) {
2728
if (particle.name().equalsIgnoreCase(particleName)) {
28-
location.getWorld().spawnParticle(particle, location, 0, 0, 0, 0, 1);
29+
if (particle.name().contains("DUST")) {
30+
Particle.DustOptions dustOptions = new Particle.DustOptions(Color.fromARGB(255, 255, 255, 255), 1);
31+
location.getWorld().spawnParticle(particle, location, 0, 0, 0, 0, 1, dustOptions);
32+
}
33+
else {
34+
location.getWorld().spawnParticle(particle, location, 0, 0, 0, 0, 1);
35+
}
2936
return;
3037
}
3138
}

src/main/java/me/waterarchery/litlibs/listeners/ChunkListeners.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,23 @@ public void onNpcLoad(ChunkLoadEvent event) {
2929
String world = chunk.getWorld().getName();
3030

3131
NPCHandler npcHandler = NPCHandler.getInstance();
32-
boolean nullCheck = false;
3332

3433
// Copying array list to preventing the concurrent modification
35-
for (NPC npc : new ArrayList<>(npcHandler.getNpcs())) {
36-
if (npc == null) {
37-
nullCheck = true;
38-
continue;
39-
}
34+
chunkThreadPool.submit(() -> {
35+
boolean nullCheck = false;
36+
37+
for (NPC npc : new ArrayList<>(npcHandler.getNpcs())) {
38+
if (npc == null) {
39+
nullCheck = true;
40+
continue;
41+
}
4042

41-
if (!npc.isDespawned()) continue;
42-
if (world.equalsIgnoreCase(npc.getWorldName()) && npc.getChunkX() == x && npc.getChunkZ() == z) npc.setDespawned(false);
43-
}
43+
if (!npc.isDespawned()) continue;
44+
if (npc.getChunkX() == x && npc.getChunkZ() == z && world.equals(npc.getWorldName())) npc.setDespawned(false);
45+
}
4446

45-
if (nullCheck) npcHandler.getNpcs().remove(null);
47+
if (nullCheck) npcHandler.getNpcs().remove(null);
48+
});
4649
}
4750

4851
@EventHandler (ignoreCancelled = true, priority = EventPriority.HIGHEST)

src/main/resources/plugin.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ softdepend:
1818
- AxGens
1919
- Citizens
2020
- FancyNpcs
21+
- FancyHolograms
2122
- RoyaleEconomy

0 commit comments

Comments
 (0)