Added Invalid Location to checkpoint

Fixed Checkpoint cooldown
Made it so you have to buy vaults from /f getvault, and buy banners from /f banner
Particle based seechunk that works when moving between chunks
Particle support for 1.7-1.12
Made fly particles mode subtle
This commit is contained in:
Naman
2018-03-28 19:33:10 -05:00
parent 3d2bf73497
commit cdf870b782
17 changed files with 179 additions and 2934 deletions

View File

@@ -2,22 +2,35 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.Particle.ParticleEffect;
import com.massivecraft.factions.util.VisualizeUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.inventivetalent.particle.ParticleEffect;
import java.util.logging.Level;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class CmdSeeChunk extends FCommand {
private boolean useParticles;
private int length;
private ParticleEffect effect;
//Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn.
public static HashMap<String, Boolean> seeChunkMap = new HashMap<>();
Long interval = 10L;
private int taskID = -1;
//I remade it cause of people getting mad that I had the same seechunk as drtshock
public CmdSeeChunk() {
super();
@@ -32,18 +45,50 @@ public class CmdSeeChunk extends FCommand {
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());
interval = P.p.getConfig().getLong("see-chunk.interval", 10L);
effect = ParticleEffect.valueOf(P.p.getConfig().getString("see-chunk.particle", "REDSTONE"));
}
@Override
public void perform() {
if (seeChunkMap.containsKey(me.getName())) {
seeChunkMap.remove(me.getName());
msg(TL.COMMAND_SEECHUNK_DISABLED);
} else {
seeChunkMap.put(me.getName(), true);
msg(TL.COMMAND_SEECHUNK_ENABLED);
manageTask();
}
}
private void manageTask() {
if (taskID != -1) {
if (seeChunkMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(taskID);
taskID = -1;
}
} else {
startTask();
}
}
private void startTask() {
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() {
@Override
public void run() {
Iterator itr = seeChunkMap.keySet().iterator();
while (itr.hasNext()) {
Object nameObject = itr.next();
String name = nameObject + "";
Player player = Bukkit.getPlayer(name);
showBorders(player);
}
manageTask();
}
}, 0, interval);
}
private void showBorders(Player me) {
World world = me.getWorld();
FLocation flocation = new FLocation(me);
int chunkX = (int) flocation.getX();
@@ -70,14 +115,16 @@ public class CmdSeeChunk extends FCommand {
}
private void showPillar(Player player, World world, int blockX, int blockZ) {
List<Player> onePlayer = Arrays.asList(player);
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).add(0.5, 0, 0.5);
if (loc.getBlock().getType() != Material.AIR) {
continue;
}
if (useParticles) {
this.effect.display(0, 0, 0, 10, 1, loc, player);
//api didnt seem to have anything for a single player, so I used a one player list :P
effect.send(onePlayer, loc, 0, 0, 0, 0, 1, 50);
} else {
int typeId = blockY % 5 == 0 ? Material.REDSTONE_LAMP_ON.getId() : Material.STAINED_GLASS.getId();
VisualizeUtil.addLocation(player, loc, typeId);