2019-10-17 16:04:43 -06:00
|
|
|
package dev.esophose.playerparticles.styles;
|
2018-03-04 03:02:02 -07:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
import org.bukkit.event.Listener;
|
|
|
|
import org.bukkit.event.block.BlockPlaceEvent;
|
|
|
|
|
2019-10-17 16:04:43 -06:00
|
|
|
import dev.esophose.playerparticles.manager.DataManager;
|
|
|
|
import dev.esophose.playerparticles.manager.ParticleManager;
|
|
|
|
import dev.esophose.playerparticles.particles.PPlayer;
|
|
|
|
import dev.esophose.playerparticles.particles.ParticlePair;
|
|
|
|
import dev.esophose.playerparticles.styles.api.PParticle;
|
|
|
|
import dev.esophose.playerparticles.styles.api.ParticleStyle;
|
2018-03-04 03:02:02 -07:00
|
|
|
|
|
|
|
public class ParticleStyleBlockPlace implements ParticleStyle, Listener {
|
|
|
|
|
2018-09-23 20:42:52 -06:00
|
|
|
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
2018-03-04 03:02:02 -07:00
|
|
|
List<PParticle> particles = new ArrayList<PParticle>();
|
2018-10-06 13:53:31 -06:00
|
|
|
|
|
|
|
location.add(0.5, 0.5, 0.5); // Center around the block
|
2018-03-04 03:02:02 -07:00
|
|
|
|
2019-01-26 00:34:50 -07:00
|
|
|
for (int i = 0; i < 10; i++)
|
2018-10-06 13:53:31 -06:00
|
|
|
particles.add(new PParticle(location, 0.75F, 0.75F, 0.75F, 0.05F));
|
2018-03-04 03:02:02 -07:00
|
|
|
|
2018-09-23 20:42:52 -06:00
|
|
|
return particles;
|
2018-03-04 03:02:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public void updateTimers() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return "blockplace";
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean canBeFixed() {
|
|
|
|
return false;
|
|
|
|
}
|
2018-11-16 03:26:08 -07:00
|
|
|
|
|
|
|
public boolean canToggleWithMovement() {
|
|
|
|
return false;
|
|
|
|
}
|
2018-12-01 19:34:01 -07:00
|
|
|
|
|
|
|
public double getFixedEffectOffset() {
|
|
|
|
return 0;
|
|
|
|
}
|
2018-03-04 03:02:02 -07:00
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
|
|
|
public void onBlockPlace(BlockPlaceEvent event) {
|
|
|
|
Player player = event.getPlayer();
|
2018-09-23 20:42:52 -06:00
|
|
|
PPlayer pplayer = DataManager.getPPlayer(player.getUniqueId());
|
|
|
|
if (pplayer != null) {
|
2018-09-27 18:16:50 -06:00
|
|
|
for (ParticlePair particle : pplayer.getActiveParticlesForStyle(DefaultStyles.BLOCKPLACE)) {
|
2018-10-05 21:01:28 -06:00
|
|
|
Location loc = event.getBlock().getLocation().clone();
|
2018-09-23 20:42:52 -06:00
|
|
|
ParticleManager.displayParticles(particle, DefaultStyles.BLOCKPLACE.getParticles(particle, loc));
|
2018-09-27 18:16:50 -06:00
|
|
|
}
|
2018-03-04 03:02:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|