Skip to content

Commit

Permalink
fix: sound location was null?
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedox-die-Ente committed Sep 28, 2024
1 parent 67267b6 commit 1db08cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/me/fedox/talent/utils/GoldenBuzzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public void onSongEnd(SongEndEvent e) {
Bukkit.broadcastMessage(Constants.PLUGIN_PREFIX + "Buzzer Song vorbei!");

toggleRedstoneLamps(false);

Bukkit.getScheduler().cancelTasks(plugin);

isGoldenBuzzerActive = false;
Expand Down
26 changes: 24 additions & 2 deletions src/main/java/me/fedox/talent/utils/ShowManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
public class ShowManager {

private final Talent plugin;
private final Location centerLocation;
private final Random random;
private final List<Location> tourLocations;

Expand All @@ -30,7 +29,6 @@ public class ShowManager {
public ShowManager(Talent plugin, Location location) {
this.plugin = plugin;
this.random = new Random();
this.centerLocation = location;
this.tourLocations = Talent.getInstance().getCameraLocations();
}

Expand Down Expand Up @@ -111,6 +109,14 @@ public void run() {
* Launches a single firework at a random location near the center.
*/
private void launchFirework() {

Location centerLocation = new Location(
Bukkit.getWorld(plugin.getConfig().getString(Constants.LOCATIONS_ON_STAGE_WORLD)),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_X),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_Y),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_Z)
);

Location loc = centerLocation.clone().add(random.nextInt(21) - 10, 0, random.nextInt(21) - 10);
Firework fw = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK_ROCKET);
FireworkMeta fwm = fw.getFireworkMeta();
Expand Down Expand Up @@ -151,6 +157,14 @@ public void run() {
* Spawns particles at random locations near the center.
*/
private void spawnParticles() {

Location centerLocation = new Location(
Bukkit.getWorld(plugin.getConfig().getString(Constants.LOCATIONS_ON_STAGE_WORLD)),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_X),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_Y),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_Z)
);

Particle[] particles = {Particle.TOTEM_OF_UNDYING, Particle.WITCH, Particle.HAPPY_VILLAGER, Particle.NOTE, Particle.HEART};
for (Particle particle : particles) {
centerLocation.getWorld().spawnParticle(particle,
Expand Down Expand Up @@ -217,6 +231,14 @@ public void run() {
* Creates a lightning effect at a random location near the center.
*/
private void lightningEffect() {

Location centerLocation = new Location(
Bukkit.getWorld(plugin.getConfig().getString(Constants.LOCATIONS_ON_STAGE_WORLD)),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_X),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_Y),
plugin.getConfig().getDouble(Constants.LOCATIONS_ON_STAGE_Z)
);

Location loc = centerLocation.clone().add(random.nextInt(41) - 20, 0, random.nextInt(41) - 20);
loc.getWorld().strikeLightningEffect(loc);
}
Expand Down

0 comments on commit 1db08cb

Please sign in to comment.