Add see chunk particles

This commit is contained in:
Trent Hensler 2018-03-25 16:43:51 -07:00
parent 8a3e5d652e
commit 8777919cf7
3 changed files with 43 additions and 4 deletions

View File

@ -47,6 +47,10 @@
<pattern>com.google.gson</pattern>
<shadedPattern>com.massivecraft.factions.shade.com.google.gson</shadedPattern>
</relocation>
<relocation>
<pattern>com.darkblade12</pattern>
<shadedPattern>com.massivecraft.factions.shade.com.darkblade12</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
@ -314,6 +318,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.darkblade12</groupId>
<artifactId>particleeffect</artifactId>
<version>1.7.0-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.cmd;
import com.darkblade12.particleeffect.ParticleEffect;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.VisualizeUtil;
@ -9,8 +10,14 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.logging.Level;
public class CmdSeeChunk extends FCommand {
private boolean useParticles;
private int length;
private ParticleEffect effect;
public CmdSeeChunk() {
super();
aliases.add("seechunk");
@ -22,6 +29,16 @@ public class CmdSeeChunk extends FCommand {
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.useParticles = p.getConfig().getBoolean("see-chunk.particles", true);
this.length = p.getConfig().getInt("see-chunk.length", 10);
String effectName = p.getConfig().getString("see-chunk.particle", "BARRIER");
this.effect = ParticleEffect.fromName(effectName.toUpperCase());
if (this.effect == null) {
this.effect = ParticleEffect.BARRIER;
}
p.log(Level.INFO, "Using %s as the ParticleEffect for /f sc", effect.getName());
}
@Override
@ -51,15 +68,19 @@ public class CmdSeeChunk extends FCommand {
showPillar(me, world, blockX, blockZ);
}
@SuppressWarnings("deprecation")
public static void showPillar(Player player, World world, int blockX, int blockZ) {
private void showPillar(Player player, World world, int blockX, int blockZ) {
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
Location loc = new Location(world, blockX, blockY, blockZ);
if (loc.getBlock().getType() != Material.AIR) {
continue;
}
int typeId = blockY % 5 == 0 ? Material.REDSTONE_LAMP_ON.getId() : Material.STAINED_GLASS.getId();
VisualizeUtil.addLocation(player, loc, typeId);
if (useParticles) {
this.effect.display(0, 0, 0, 10, 1, loc, player);
} else {
int typeId = blockY % 5 == 0 ? Material.REDSTONE_LAMP_ON.getId() : Material.STAINED_GLASS.getId();
VisualizeUtil.addLocation(player, loc, typeId);
}
}
}

View File

@ -104,6 +104,15 @@ enter-titles:
fade-out: 20
also-show-chat: false
# /f seechunk options
# Get a list of particle effects here:
# https://github.com/DarkBlade12/ParticleEffect/blob/master/src/main/java/com/darkblade12/particleeffect/ParticleEffect.java
see-chunk:
# If disabled, it will use fake blocks like before (can cause client side lag)
particles: true
particle: "BARRIER"
# How long should we show these particles? No idea the units, 10 just seemed good.
length: 10
# ToolTips
# This section is to configure tooltips for things like /f list