forked from Navoei/CustomDiscs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bugs related to discs not going to into hoppers. Particles now …
…show for the entire duration of a custom song.
- Loading branch information
Showing
6 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/me/Navoei/customdiscsplugin/ParticleManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package me.Navoei.customdiscsplugin; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.Particle; | ||
import org.bukkit.block.Jukebox; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.scheduler.BukkitRunnable; | ||
|
||
import java.util.HashMap; | ||
|
||
public class ParticleManager extends BukkitRunnable { | ||
|
||
static PlayerManager playerManager = PlayerManager.instance(); | ||
static HashMap<Location, ParticleManager> locationParticleManager = new HashMap<>(); | ||
|
||
public static void start(Jukebox jukebox) { | ||
ParticleManager particleManager = new ParticleManager(); | ||
particleManager.jukebox = jukebox; | ||
if (locationParticleManager.containsKey(jukebox.getLocation())) return; | ||
locationParticleManager.put(jukebox.getLocation(), particleManager); | ||
locationParticleManager.get(jukebox.getLocation()).runTaskTimer(CustomDiscs.getInstance(), 0, 20); | ||
} | ||
|
||
//private float seconds; | ||
private Jukebox jukebox; | ||
|
||
|
||
@Override | ||
public void run() { | ||
|
||
if (!playerManager.isAudioPlayerPlaying(jukebox.getLocation())) { | ||
locationParticleManager.remove(jukebox.getLocation()); | ||
cancel(); | ||
} else { | ||
//if (!jukebox.isPlaying()) { | ||
jukebox.getLocation().getWorld().spawnParticle(Particle.NOTE, jukebox.getLocation().add(0.5, 1.1, 0.5), 1); | ||
//} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters