mirror of
https://github.com/MassiveCraft/Factions.git
synced 2025-02-21 22:31:49 +01:00
Add see chunk particles
This commit is contained in:
parent
8a3e5d652e
commit
8777919cf7
9
pom.xml
9
pom.xml
@ -47,6 +47,10 @@
|
|||||||
<pattern>com.google.gson</pattern>
|
<pattern>com.google.gson</pattern>
|
||||||
<shadedPattern>com.massivecraft.factions.shade.com.google.gson</shadedPattern>
|
<shadedPattern>com.massivecraft.factions.shade.com.google.gson</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>com.darkblade12</pattern>
|
||||||
|
<shadedPattern>com.massivecraft.factions.shade.com.darkblade12</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@ -314,6 +318,11 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.darkblade12</groupId>
|
||||||
|
<artifactId>particleeffect</artifactId>
|
||||||
|
<version>1.7.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.darkblade12.particleeffect.ParticleEffect;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.util.VisualizeUtil;
|
import com.massivecraft.factions.util.VisualizeUtil;
|
||||||
@ -9,8 +10,14 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class CmdSeeChunk extends FCommand {
|
public class CmdSeeChunk extends FCommand {
|
||||||
|
|
||||||
|
private boolean useParticles;
|
||||||
|
private int length;
|
||||||
|
private ParticleEffect effect;
|
||||||
|
|
||||||
public CmdSeeChunk() {
|
public CmdSeeChunk() {
|
||||||
super();
|
super();
|
||||||
aliases.add("seechunk");
|
aliases.add("seechunk");
|
||||||
@ -22,6 +29,16 @@ public class CmdSeeChunk extends FCommand {
|
|||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeAdmin = 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
|
@Override
|
||||||
@ -51,15 +68,19 @@ public class CmdSeeChunk extends FCommand {
|
|||||||
showPillar(me, world, blockX, blockZ);
|
showPillar(me, world, blockX, blockZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
private void showPillar(Player player, World world, int blockX, int blockZ) {
|
||||||
public static void showPillar(Player player, World world, int blockX, int blockZ) {
|
|
||||||
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
|
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
|
||||||
Location loc = new Location(world, blockX, blockY, blockZ);
|
Location loc = new Location(world, blockX, blockY, blockZ);
|
||||||
if (loc.getBlock().getType() != Material.AIR) {
|
if (loc.getBlock().getType() != Material.AIR) {
|
||||||
continue;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,15 @@ enter-titles:
|
|||||||
fade-out: 20
|
fade-out: 20
|
||||||
also-show-chat: false
|
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
|
# ToolTips
|
||||||
# This section is to configure tooltips for things like /f list
|
# This section is to configure tooltips for things like /f list
|
||||||
|
Loading…
Reference in New Issue
Block a user