Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SpawnBorderEffects implements heavyLoad {
- private final Set<Location> location;
- private final Location containerLocation;
- private Player player;
- private final long time;
- private final long milliPerTick;
- private final ContainerRegistryAPI registry = ContainerRegistryAPI.getInstance();
- public SpawnBorderEffects(Set<Location> location, Player player, Location containerLocation, long showTime, long milliPerTick) {
- this.location = location;
- this.player = player;
- this.containerLocation = containerLocation;
- this.milliPerTick = milliPerTick;
- time = System.currentTimeMillis() + (1000L * (showTime > 1 ? showTime : YamlSettingsContainers.getEffectBorderShowTime(this.registry.getContainerFileName(this.containerLocation), this.registry.getCurrentUpdate(this.containerLocation))));
- }
- private void spawnEffects() {
- for (Location location : this.location) {
- if (this.player == null && containerLocation != null)
- this.player = registry.getPlayer(containerLocation);
- if (this.player != null) {
- String particle = YamlSettingsContainers.getEffectSuctionBorder(registry.getContainerFileName(this.containerLocation), registry.getCurrentUpdate(this.containerLocation));
- this.player.spawnParticle(particle != null ? Particle.valueOf(particle) : Particle.BARRIER, location, 0, 0.0, 0.0, 0.0, 1.0);
- }
- }
- }
- @Override
- public void compute() {
- spawnEffects();
- }
- @Override
- public boolean reschedule() {
- return System.currentTimeMillis() <= rescheduleMaxRunTime();
- }
- @Override
- public long getMilliPerTick() {
- return milliPerTick;
- }
- @Override
- public boolean computeWithDelay(int conter) {
- return true;
- }
- @Override
- public long rescheduleMaxRunTime() {
- return time;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement