2011-11-24 16:27:14 +01:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.entity.Player;
|
2013-04-09 12:56:29 +02:00
|
|
|
|
|
|
|
import com.massivecraft.factions.Perm;
|
2012-01-28 19:49:01 +01:00
|
|
|
import com.massivecraft.factions.util.VisualizeUtil;
|
2014-06-04 14:02:23 +02:00
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
|
|
|
import com.massivecraft.massivecore.ps.PS;
|
|
|
|
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
|
2011-11-24 16:27:14 +01:00
|
|
|
|
2014-09-18 13:41:20 +02:00
|
|
|
public class CmdFactionsSeeChunk extends FactionsCommand
|
2011-11-24 16:27:14 +01:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public CmdFactionsSeeChunk()
|
2011-11-24 16:27:14 +01:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// Aliases
|
2013-04-16 10:11:59 +02:00
|
|
|
this.addAliases("sc", "seechunk");
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// Requirements
|
|
|
|
// this.addRequirements(ReqFactionsEnabled.get());
|
2013-04-16 10:11:59 +02:00
|
|
|
this.addRequirements(ReqHasPerm.get(Perm.SEE_CHUNK.node));
|
2013-04-16 09:48:57 +02:00
|
|
|
this.addRequirements(ReqIsPlayer.get());
|
2011-11-24 16:27:14 +01:00
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
2011-11-24 16:27:14 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform()
|
|
|
|
{
|
2013-04-26 20:22:12 +02:00
|
|
|
// Args
|
|
|
|
World world = me.getWorld();
|
|
|
|
PS chunk = PS.valueOf(me).getChunk(true);
|
|
|
|
int chunkX = chunk.getChunkX();
|
|
|
|
int chunkZ = chunk.getChunkZ();
|
2011-11-24 16:27:14 +01:00
|
|
|
|
2013-04-26 20:22:12 +02:00
|
|
|
// Apply
|
2011-11-24 16:27:14 +01:00
|
|
|
int blockX;
|
|
|
|
int blockZ;
|
|
|
|
|
|
|
|
blockX = chunkX*16;
|
|
|
|
blockZ = chunkZ*16;
|
2013-04-26 20:22:12 +02:00
|
|
|
showPillar(me, world, blockX, blockZ);
|
2011-11-24 16:27:14 +01:00
|
|
|
|
|
|
|
blockX = chunkX*16 + 15;
|
|
|
|
blockZ = chunkZ*16;
|
2013-04-26 20:22:12 +02:00
|
|
|
showPillar(me, world, blockX, blockZ);
|
2011-11-24 16:27:14 +01:00
|
|
|
|
|
|
|
blockX = chunkX*16;
|
|
|
|
blockZ = chunkZ*16 + 15;
|
2013-04-26 20:22:12 +02:00
|
|
|
showPillar(me, world, blockX, blockZ);
|
2011-11-24 16:27:14 +01:00
|
|
|
|
|
|
|
blockX = chunkX*16 + 15;
|
|
|
|
blockZ = chunkZ*16 + 15;
|
2013-04-26 20:22:12 +02:00
|
|
|
showPillar(me, world, blockX, blockZ);
|
|
|
|
|
|
|
|
// Inform
|
|
|
|
msg("<i>Visualized %s", chunk.toString(PSFormatHumanSpace.get()));
|
2011-11-24 16:27:14 +01:00
|
|
|
}
|
|
|
|
|
2013-09-20 12:50:32 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
2013-04-26 20:22:12 +02:00
|
|
|
public static void showPillar(Player player, World world, int blockX, int blockZ)
|
2011-11-24 16:27:14 +01:00
|
|
|
{
|
2012-05-09 05:56:37 +02:00
|
|
|
for (int blockY = 0; blockY < world.getMaxHeight(); blockY++)
|
2011-11-24 16:27:14 +01:00
|
|
|
{
|
2012-05-09 05:56:37 +02:00
|
|
|
Location loc = new Location(world, blockX, blockY, blockZ);
|
2013-09-20 12:50:32 +02:00
|
|
|
if (loc.getBlock().getType() != Material.AIR) continue;
|
2012-05-09 05:56:37 +02:00
|
|
|
int typeId = blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId();
|
|
|
|
VisualizeUtil.addLocation(player, loc, typeId);
|
2011-11-24 16:27:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|