2019-10-17 16:04:43 -06:00
|
|
|
package dev.esophose.playerparticles.styles;
|
2018-03-04 03:02:02 -07:00
|
|
|
|
2019-12-12 19:32:53 -07:00
|
|
|
import dev.esophose.playerparticles.PlayerParticles;
|
2020-01-10 05:05:22 -07:00
|
|
|
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
2019-12-12 19:32:53 -07:00
|
|
|
import dev.esophose.playerparticles.manager.DataManager;
|
|
|
|
import dev.esophose.playerparticles.manager.ParticleManager;
|
2020-01-05 17:26:45 -07:00
|
|
|
import dev.esophose.playerparticles.particles.PParticle;
|
2019-12-12 19:32:53 -07:00
|
|
|
import dev.esophose.playerparticles.particles.PPlayer;
|
|
|
|
import dev.esophose.playerparticles.particles.ParticlePair;
|
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;
|
|
|
|
|
2020-01-10 05:05:22 -07:00
|
|
|
public class ParticleStyleBlockPlace extends DefaultParticleStyle implements Listener {
|
2018-03-04 03:02:02 -07:00
|
|
|
|
2020-01-10 05:05:22 -07:00
|
|
|
public ParticleStyleBlockPlace() {
|
|
|
|
super("blockplace", false, false, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-09-23 20:42:52 -06:00
|
|
|
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
2019-12-12 19:32:53 -07:00
|
|
|
List<PParticle> particles = new ArrayList<>();
|
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
|
|
|
}
|
|
|
|
|
2020-01-10 05:05:22 -07:00
|
|
|
@Override
|
2018-03-04 03:02:02 -07:00
|
|
|
public void updateTimers() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-01-10 05:05:22 -07:00
|
|
|
@Override
|
|
|
|
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
2018-03-04 03:02:02 -07:00
|
|
|
|
|
|
|
}
|
2020-01-10 05:05:22 -07:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void loadSettings(CommentedFileConfiguration config) {
|
|
|
|
|
2018-12-01 19:34:01 -07:00
|
|
|
}
|
2018-03-04 03:02:02 -07:00
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
|
|
|
public void onBlockPlace(BlockPlaceEvent event) {
|
2019-12-09 12:04:06 -07:00
|
|
|
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
|
|
|
|
2018-03-04 03:02:02 -07:00
|
|
|
Player player = event.getPlayer();
|
2019-12-09 12:04:06 -07:00
|
|
|
PPlayer pplayer = PlayerParticles.getInstance().getManager(DataManager.class).getPPlayer(player.getUniqueId());
|
2018-09-23 20:42:52 -06:00
|
|
|
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();
|
2020-01-14 13:37:22 -07:00
|
|
|
particleManager.displayParticles(player, particle, DefaultStyles.BLOCKPLACE.getParticles(particle, loc));
|
2018-09-27 18:16:50 -06:00
|
|
|
}
|
2018-03-04 03:02:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|