More /cage tweaks

This commit is contained in:
JeromSar 2013-08-26 15:04:36 +02:00
parent fd6aa7b94b
commit fbdf2b5fc2
5 changed files with 61 additions and 11 deletions

View File

@ -1,5 +1,5 @@
#Mon, 26 Aug 2013 01:01:42 +0200
#Mon, 26 Aug 2013 15:12:00 +0200
program.VERSION=3.1
program.BUILDNUM=490
program.BUILDDATE=08/26/2013 01\:01 AM
program.BUILDNUM=501
program.BUILDDATE=08/26/2013 03\:12 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Mon Aug 26 01:01:42 CEST 2013
build.number=491
#Mon Aug 26 15:12:00 CEST 2013
build.number=502

View File

@ -21,6 +21,17 @@ public class Command_cage extends TFM_Command
return false;
}
if (TFM_Util.isStopCommand(args[0]) && sender instanceof Player)
{
TFM_Util.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);;
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
playerdata.setCaged(false);
playerdata.regenerateHistory();
playerdata.clearHistory();
return true;
}
Player player;
try
{
@ -79,7 +90,7 @@ public class Command_cage extends TFM_Command
playerdata.regenerateHistory();
playerdata.clearHistory();
TFM_Util.buildHistory(targetPos, 2, playerdata);
TFM_Util.generateCube(targetPos, 2, outerMaterial);
TFM_Util.generateHollowCube(targetPos, 2, outerMaterial);
TFM_Util.generateCube(targetPos, 1, innerMaterial);
player.setGameMode(GameMode.SURVIVAL);

View File

@ -323,7 +323,7 @@ public class TFM_PlayerListener implements Listener
playerdata.regenerateHistory();
playerdata.clearHistory();
TFM_Util.buildHistory(targetPos, 2, playerdata);
TFM_Util.generateCube(targetPos, 2, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER));
TFM_Util.generateHollowCube(targetPos, 2, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER));
TFM_Util.generateCube(targetPos, 1, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
}
}

View File

@ -16,6 +16,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
@ -150,19 +151,57 @@ public class TFM_Util
{
for (int zOffset = -length; zOffset <= length; zOffset++)
{
final Block block = center.getRelative(xOffset, yOffset, zOffset);
if (block.getType() != material)
{
block.setType(material);
}
}
}
}
}
public static void generateHollowCube(Location location, int length, Material material)
{
Block center = location.getBlock();
for (int xOffset = -length; xOffset <= length; xOffset++)
{
for (int yOffset = -length; yOffset <= length; yOffset++)
{
for (int zOffset = -length; zOffset <= length; zOffset++)
{
// Hollow
if (Math.abs(xOffset) != length && Math.abs(yOffset) != length && Math.abs(zOffset) != length)
{
continue;
}
final Block block = center.getRelative(xOffset, yOffset, zOffset);
if (material != Material.SKULL)
{
center.getRelative(xOffset, yOffset, zOffset).setType(material);
// Glowstone light
if (material != Material.GLASS && xOffset == 0 && yOffset == 2 && zOffset == 0)
{
block.setType(Material.GLOWSTONE);
continue;
}
block.setType(material);
}
else
else // Darth mode
{
final Block block = center.getRelative(xOffset, yOffset, zOffset);
if (Math.abs(xOffset) == length && Math.abs(yOffset) == length && Math.abs(zOffset) == length)
{
block.setType(Material.GLOWSTONE);
continue;
}
block.setType(Material.SKULL);
Skull skull = (Skull) block.getState();
skull.setSkullType(SkullType.PLAYER);
skull.setOwner("DarthSalamon");
skull.update();
//skull.setRotation(block.getFace(center));
}
}
}