2014-10-08 09:24:03 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.util.VisualizeUtil;
|
2015-11-06 02:10:29 +01:00
|
|
|
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
2014-10-08 09:24:03 +02:00
|
|
|
import com.massivecraft.massivecore.ps.PS;
|
|
|
|
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
|
2017-03-24 13:05:58 +01:00
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.entity.Player;
|
2014-10-08 09:24:03 +02:00
|
|
|
|
|
|
|
public class CmdFactionsSeeChunkOld extends FactionsCommand
|
|
|
|
{
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
public CmdFactionsSeeChunkOld()
|
|
|
|
{
|
|
|
|
// Aliases
|
2017-02-10 16:38:36 +01:00
|
|
|
this.addAliases("sco");
|
2014-10-08 09:24:03 +02:00
|
|
|
|
|
|
|
// Requirements
|
2015-11-06 02:10:29 +01:00
|
|
|
this.addRequirements(RequirementIsPlayer.get());
|
2014-10-08 09:24:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform()
|
|
|
|
{
|
|
|
|
// Args
|
|
|
|
World world = me.getWorld();
|
2014-11-18 10:00:15 +01:00
|
|
|
PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
|
2014-10-08 09:24:03 +02:00
|
|
|
int chunkX = chunk.getChunkX();
|
|
|
|
int chunkZ = chunk.getChunkZ();
|
|
|
|
|
|
|
|
// Apply
|
|
|
|
int blockX;
|
|
|
|
int blockZ;
|
|
|
|
|
|
|
|
blockX = chunkX*16;
|
|
|
|
blockZ = chunkZ*16;
|
|
|
|
showPillar(me, world, blockX, blockZ);
|
|
|
|
|
|
|
|
blockX = chunkX*16 + 15;
|
|
|
|
blockZ = chunkZ*16;
|
|
|
|
showPillar(me, world, blockX, blockZ);
|
|
|
|
|
|
|
|
blockX = chunkX*16;
|
|
|
|
blockZ = chunkZ*16 + 15;
|
|
|
|
showPillar(me, world, blockX, blockZ);
|
|
|
|
|
|
|
|
blockX = chunkX*16 + 15;
|
|
|
|
blockZ = chunkZ*16 + 15;
|
|
|
|
showPillar(me, world, blockX, blockZ);
|
|
|
|
|
|
|
|
// Inform
|
|
|
|
msg("<i>Visualized %s", chunk.toString(PSFormatHumanSpace.get()));
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
public static void showPillar(Player player, World world, int blockX, int blockZ)
|
|
|
|
{
|
|
|
|
for (int blockY = 0; blockY < world.getMaxHeight(); blockY++)
|
|
|
|
{
|
|
|
|
Location loc = new Location(world, blockX, blockY, blockZ);
|
|
|
|
if (loc.getBlock().getType() != Material.AIR) continue;
|
|
|
|
int typeId = blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId();
|
|
|
|
VisualizeUtil.addLocation(player, loc, typeId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|