Merge branch 'master' into nanohttpd

This commit is contained in:
StevenLawson 2013-08-27 07:18:43 -04:00
commit 3e5e11197f
5 changed files with 272 additions and 206 deletions

View File

@ -1,5 +1,5 @@
#Mon, 26 Aug 2013 17:47:26 +0200 #Tue, 27 Aug 2013 12:35:14 +0200
program.VERSION=3.1 program.VERSION=3.1
program.BUILDNUM=507 program.BUILDNUM=514
program.BUILDDATE=08/26/2013 05\:47 PM program.BUILDDATE=08/27/2013 12\:35 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Mon Aug 26 17:47:26 CEST 2013 #Tue Aug 27 12:35:14 CEST 2013
build.number=508 build.number=515

View File

@ -72,7 +72,7 @@ public class TFM_BlockListener implements Listener
Long lastRan = TFM_Heartbeat.getLastRan(); Long lastRan = TFM_Heartbeat.getLastRan();
if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis()) if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis())
{ {
//TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates."); // TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates.");
} }
else else
{ {
@ -101,12 +101,6 @@ public class TFM_BlockListener implements Listener
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onRollbackBlockBreak(BlockBreakEvent event)
{
TFM_RollbackManager.blockBreak(event);
}
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event) public void onBlockPlace(BlockPlaceEvent event)
{ {
@ -252,11 +246,23 @@ public class TFM_BlockListener implements Listener
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onRollbackBlockBreak(BlockBreakEvent event)
{
if (!TFM_SuperadminList.isUserSuperadmin(event.getPlayer()))
{
TFM_RollbackManager.blockBreak(event);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onRollbackBlockPlace(BlockPlaceEvent event) public void onRollbackBlockPlace(BlockPlaceEvent event)
{
if (!TFM_SuperadminList.isUserSuperadmin(event.getPlayer()))
{ {
TFM_RollbackManager.blockPlace(event); TFM_RollbackManager.blockPlace(event);
} }
}
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onBlockFromTo(BlockFromToEvent event) public void onBlockFromTo(BlockFromToEvent event)

View File

@ -37,7 +37,8 @@ public class TFM_PlayerListener implements Listener
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onPlayerInteract(PlayerInteractEvent event) public void onPlayerInteract(PlayerInteractEvent event)
{ {
Player player = event.getPlayer(); final Player player = event.getPlayer();
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
switch (event.getAction()) switch (event.getAction())
{ {
@ -48,37 +49,46 @@ public class TFM_PlayerListener implements Listener
{ {
case WATER_BUCKET: case WATER_BUCKET:
{ {
if (!TFM_ConfigEntry.ALLOW_WATER_PLACE.getBoolean()) if (TFM_ConfigEntry.ALLOW_WATER_PLACE.getBoolean())
{ {
break;
}
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled."); player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled.");
event.setCancelled(true); event.setCancelled(true);
}
break; break;
} }
case LAVA_BUCKET: case LAVA_BUCKET:
{ {
if (!TFM_ConfigEntry.ALLOW_LAVA_PLACE.getBoolean()) if (TFM_ConfigEntry.ALLOW_LAVA_PLACE.getBoolean())
{ {
break;
}
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled."); player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled.");
event.setCancelled(true); event.setCancelled(true);
}
break; break;
} }
case EXPLOSIVE_MINECART: case EXPLOSIVE_MINECART:
{ {
if (!TFM_ConfigEntry.ALLOW_TNT_MINECARTS.getBoolean()) if (TFM_ConfigEntry.ALLOW_TNT_MINECARTS.getBoolean())
{ {
break;
}
player.getInventory().clear(player.getInventory().getHeldItemSlot()); player.getInventory().clear(player.getInventory().getHeldItemSlot());
player.sendMessage(ChatColor.GRAY + "TNT minecarts are currently disabled."); player.sendMessage(ChatColor.GRAY + "TNT minecarts are currently disabled.");
event.setCancelled(true); event.setCancelled(true);
}
break; break;
} }
} }
break; break;
} }
case LEFT_CLICK_AIR: case LEFT_CLICK_AIR:
case LEFT_CLICK_BLOCK: case LEFT_CLICK_BLOCK:
{ {
@ -102,11 +112,10 @@ public class TFM_PlayerListener implements Listener
break; break;
} }
TFM_Util.playerMsg(player, "Block edits at (" + ChatColor.WHITE + "X" + location.getBlockX() + ", Y" + location.getBlockY() + ", Z" + location.getBlockZ() + ChatColor.BLUE + ")" + ChatColor.WHITE + ":", ChatColor.BLUE); TFM_Util.playerMsg(player, "Block edits at (" + ChatColor.WHITE + "x" + location.getBlockX() + ", y" + location.getBlockY() + ", z" + location.getBlockZ() + ChatColor.BLUE + ")" + ChatColor.WHITE + ":", ChatColor.BLUE);
for (RollbackEntry entry : entries) for (RollbackEntry entry : entries)
{ {
String material = (entry.getType() == EntryType.BLOCK_BREAK ? String.valueOf(entry.getFromMaterial()) : entry.getToMaterial() + (entry.getData() != 0 ? ":" + String.valueOf(entry.getData()) : "")); TFM_Util.playerMsg(player, " - " + ChatColor.BLUE + entry.getAuthor() + " " + entry.getType() + " " + StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.getData() == 0 ? "" : ":" + entry.getData()));
TFM_Util.playerMsg(player, " - " + ChatColor.BLUE + entry.getAuthor() + " " + entry.getType() + " " + material);
} }
break; break;
@ -114,9 +123,11 @@ public class TFM_PlayerListener implements Listener
case BONE: case BONE:
{ {
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if (!playerdata.mobThrowerEnabled())
if (playerdata.mobThrowerEnabled())
{ {
break;
}
Location player_pos = player.getLocation(); Location player_pos = player.getLocation();
Vector direction = player_pos.getDirection().normalize(); Vector direction = player_pos.getDirection().normalize();
@ -125,15 +136,18 @@ public class TFM_PlayerListener implements Listener
playerdata.enqueueMob(rezzed_mob); playerdata.enqueueMob(rezzed_mob);
event.setCancelled(true); event.setCancelled(true);
}
break; break;
} }
case SULPHUR: case SULPHUR:
{ {
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if (!playerdata.isMP44Armed())
if (playerdata.isMP44Armed())
{ {
break;
}
event.setCancelled(true);
if (playerdata.toggleMP44Firing()) if (playerdata.toggleMP44Firing())
{ {
playerdata.startArrowShooter(TotalFreedomMod.plugin); playerdata.startArrowShooter(TotalFreedomMod.plugin);
@ -142,18 +156,22 @@ public class TFM_PlayerListener implements Listener
{ {
playerdata.stopArrowShooter(); playerdata.stopArrowShooter();
} }
event.setCancelled(true);
}
break; break;
} }
case BLAZE_ROD: case BLAZE_ROD:
{ {
if (TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) if (!TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
{ {
if (TFM_SuperadminList.isSeniorAdmin(player, true)) break;
}
if (!TFM_SuperadminList.isSeniorAdmin(player, true))
{ {
break;
}
event.setCancelled(true);
Block targetBlock; Block targetBlock;
if (event.getAction().equals(Action.LEFT_CLICK_AIR)) if (event.getAction().equals(Action.LEFT_CLICK_AIR))
@ -165,53 +183,55 @@ public class TFM_PlayerListener implements Listener
targetBlock = event.getClickedBlock(); targetBlock = event.getClickedBlock();
} }
if (targetBlock != null) if (targetBlock == null)
{
player.getWorld().createExplosion(targetBlock.getLocation(), 4F, true);
player.getWorld().strikeLightning(targetBlock.getLocation());
}
else
{ {
player.sendMessage("Can't resolve target block."); player.sendMessage("Can't resolve target block.");
break;
} }
event.setCancelled(true); player.getWorld().createExplosion(targetBlock.getLocation(), 4F, true);
} player.getWorld().strikeLightning(targetBlock.getLocation());
}
break; break;
} }
case CARROT: case CARROT:
{ {
if (TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) if (!TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
{ {
if (TFM_SuperadminList.isSeniorAdmin(player, true)) break;
{ }
Location player_location = player.getLocation().clone();
Vector player_pos = player_location.toVector().add(new Vector(0.0, 1.65, 0.0)); if (!TFM_SuperadminList.isSeniorAdmin(player, true))
Vector player_dir = player_location.getDirection().normalize(); {
break;
}
Location location = player.getLocation().clone();
Vector playerPostion = location.toVector().add(new Vector(0.0, 1.65, 0.0));
Vector playerDirection = location.getDirection().normalize();
double distance = 150.0; double distance = 150.0;
Block targetBlock = player.getTargetBlock(null, Math.round((float) distance)); Block targetBlock = player.getTargetBlock(null, Math.round((float) distance));
if (targetBlock != null) if (targetBlock != null)
{ {
distance = player_location.distance(targetBlock.getLocation()); distance = location.distance(targetBlock.getLocation());
} }
final List<Block> affected = new ArrayList<Block>(); final List<Block> affected = new ArrayList<Block>();
Block last_block = null; Block lastBlock = null;
for (double offset = 0.0; offset <= distance; offset += (distance / 25.0)) for (double offset = 0.0; offset <= distance; offset += (distance / 25.0))
{ {
Block test_block = player_pos.clone().add(player_dir.clone().multiply(offset)).toLocation(player.getWorld()).getBlock(); Block block = playerPostion.clone().add(playerDirection.clone().multiply(offset)).toLocation(player.getWorld()).getBlock();
if (!test_block.equals(last_block)) if (!block.equals(lastBlock))
{ {
if (test_block.isEmpty()) if (block.isEmpty())
{ {
affected.add(test_block); affected.add(block);
test_block.setType(Material.TNT); block.setType(Material.TNT);
} }
else else
{ {
@ -219,7 +239,7 @@ public class TFM_PlayerListener implements Listener
} }
} }
last_block = test_block; lastBlock = block;
} }
new BukkitRunnable() new BukkitRunnable()
@ -227,18 +247,16 @@ public class TFM_PlayerListener implements Listener
@Override @Override
public void run() public void run()
{ {
for (Block tnt_block : affected) for (Block tntBlock : affected)
{ {
TNTPrimed tnt_primed = tnt_block.getWorld().spawn(tnt_block.getLocation(), TNTPrimed.class); TNTPrimed tnt = tntBlock.getWorld().spawn(tntBlock.getLocation(), TNTPrimed.class);
tnt_primed.setFuseTicks(5); tnt.setFuseTicks(5);
tnt_block.setType(Material.AIR); tntBlock.setType(Material.AIR);
} }
} }
}.runTaskLater(TotalFreedomMod.plugin, 30L); }.runTaskLater(TotalFreedomMod.plugin, 30L);
event.setCancelled(true); event.setCancelled(true);
}
}
break; break;
} }
} }
@ -280,52 +298,52 @@ public class TFM_PlayerListener implements Listener
for (Entry<Player, Double> fuckoff : TotalFreedomMod.fuckoffEnabledFor.entrySet()) for (Entry<Player, Double> fuckoff : TotalFreedomMod.fuckoffEnabledFor.entrySet())
{ {
Player fuckoff_player = fuckoff.getKey(); Player fuckoffPlayer = fuckoff.getKey();
if (fuckoff_player.equals(player) || !fuckoff_player.isOnline()) if (fuckoffPlayer.equals(player) || !fuckoffPlayer.isOnline())
{ {
continue; continue;
} }
double fuckoff_range = fuckoff.getValue().doubleValue(); double fuckoffRange = fuckoff.getValue().doubleValue();
Location mover_pos = player.getLocation(); Location playerLocation = player.getLocation();
Location fuckoff_pos = fuckoff_player.getLocation(); Location fuckoffLocation = fuckoffPlayer.getLocation();
double distanceSquared; double distanceSquared;
try try
{ {
distanceSquared = mover_pos.distanceSquared(fuckoff_pos); distanceSquared = playerLocation.distanceSquared(fuckoffLocation);
} }
catch (IllegalArgumentException ex) catch (IllegalArgumentException ex)
{ {
continue; continue;
} }
if (distanceSquared < (fuckoff_range * fuckoff_range)) if (distanceSquared < (fuckoffRange * fuckoffRange))
{ {
event.setTo(fuckoff_pos.clone().add(mover_pos.subtract(fuckoff_pos).toVector().normalize().multiply(fuckoff_range * 1.1))); event.setTo(fuckoffLocation.clone().add(playerLocation.subtract(fuckoffLocation).toVector().normalize().multiply(fuckoffRange * 1.1)));
break; break;
} }
} }
boolean do_freeze = false; boolean freeze = false;
if (TotalFreedomMod.allPlayersFrozen) if (TotalFreedomMod.allPlayersFrozen)
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_SuperadminList.isUserSuperadmin(player))
{ {
do_freeze = true; freeze = true;
} }
} }
else else
{ {
if (playerdata.isFrozen()) if (playerdata.isFrozen())
{ {
do_freeze = true; freeze = true;
} }
} }
if (do_freeze) if (freeze)
{ {
Location freezeTo = to.clone(); Location freezeTo = to.clone();
@ -340,17 +358,17 @@ public class TFM_PlayerListener implements Listener
{ {
Location targetPos = player.getLocation().add(0, 1, 0); Location targetPos = player.getLocation().add(0, 1, 0);
boolean out_of_cage; boolean outOfCage;
if (!targetPos.getWorld().equals(playerdata.getCagePos().getWorld())) if (!targetPos.getWorld().equals(playerdata.getCagePos().getWorld()))
{ {
out_of_cage = true; outOfCage = true;
} }
else else
{ {
out_of_cage = targetPos.distanceSquared(playerdata.getCagePos()) > (2.5 * 2.5); outOfCage = targetPos.distanceSquared(playerdata.getCagePos()) > (2.5 * 2.5);
} }
if (out_of_cage) if (outOfCage)
{ {
playerdata.setCaged(true, targetPos, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER), playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER)); playerdata.setCaged(true, targetPos, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER), playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
playerdata.regenerateHistory(); playerdata.regenerateHistory();
@ -374,43 +392,51 @@ public class TFM_PlayerListener implements Listener
TFM_Jumppads.getInstance().PlayerMoveEvent(event); TFM_Jumppads.getInstance().PlayerMoveEvent(event);
} }
if (TFM_ConfigEntry.LANDMINES_ENABLED.getBoolean() && TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) if (!(TFM_ConfigEntry.LANDMINES_ENABLED.getBoolean() && TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()))
{ {
return;
}
Iterator<TFM_LandmineData> landmines = TFM_LandmineData.landmines.iterator(); Iterator<TFM_LandmineData> landmines = TFM_LandmineData.landmines.iterator();
while (landmines.hasNext()) while (landmines.hasNext())
{ {
TFM_LandmineData landmine = landmines.next(); TFM_LandmineData landmine = landmines.next();
Location landmine_pos = landmine.location; Location location = landmine.location;
if (landmine_pos.getBlock().getType() != Material.TNT) if (location.getBlock().getType() != Material.TNT)
{ {
landmines.remove(); landmines.remove();
continue; continue;
} }
if (!landmine.player.equals(player)) if (landmine.player.equals(player))
{ {
if (player.getWorld().equals(landmine_pos.getWorld())) break;
}
if (!player.getWorld().equals(location.getWorld()))
{ {
if (player.getLocation().distanceSquared(landmine_pos) <= (landmine.radius * landmine.radius)) break;
}
if (!(player.getLocation().distanceSquared(location) <= (landmine.radius * landmine.radius)))
{ {
break;
}
landmine.location.getBlock().setType(Material.AIR); landmine.location.getBlock().setType(Material.AIR);
TNTPrimed tnt1 = landmine_pos.getWorld().spawn(landmine_pos, TNTPrimed.class); TNTPrimed tnt1 = location.getWorld().spawn(location, TNTPrimed.class);
tnt1.setFuseTicks(40); tnt1.setFuseTicks(40);
tnt1.setPassenger(player); tnt1.setPassenger(player);
tnt1.setVelocity(new Vector(0.0, 2.0, 0.0)); tnt1.setVelocity(new Vector(0.0, 2.0, 0.0));
TNTPrimed tnt2 = landmine_pos.getWorld().spawn(player.getLocation(), TNTPrimed.class); TNTPrimed tnt2 = location.getWorld().spawn(player.getLocation(), TNTPrimed.class);
tnt2.setFuseTicks(1); tnt2.setFuseTicks(1);
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
landmines.remove(); landmines.remove();
} }
}
}
}
}
} }
@ -457,6 +483,7 @@ public class TFM_PlayerListener implements Listener
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
playerdata.setLastMessage(message); playerdata.setLastMessage(message);
// Check for muted // Check for muted
@ -468,11 +495,9 @@ public class TFM_PlayerListener implements Listener
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
else
{
playerdata.setMuted(false); playerdata.setMuted(false);
} }
}
// Strip color from messages // Strip color from messages
message = ChatColor.stripColor(message); message = ChatColor.stripColor(message);
@ -559,9 +584,9 @@ public class TFM_PlayerListener implements Listener
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_SuperadminList.isUserSuperadmin(player))
{ {
for (String test_command : BLOCKED_MUTED_CMDS) for (String commandName : BLOCKED_MUTED_CMDS)
{ {
if (Pattern.compile("^/" + test_command.toLowerCase() + " ").matcher(command).find()) if (Pattern.compile("^/" + commandName.toLowerCase() + " ").matcher(command).find())
{ {
player.sendMessage(ChatColor.RED + "That command is blocked while you are muted."); player.sendMessage(ChatColor.RED + "That command is blocked while you are muted.");
event.setCancelled(true); event.setCancelled(true);
@ -662,13 +687,13 @@ public class TFM_PlayerListener implements Listener
TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(player); TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(player);
boolean superadmin_impostor = TFM_SuperadminList.isSuperadminImpostor(player); boolean impostor = TFM_SuperadminList.isSuperadminImpostor(player);
if (superadmin_impostor || TFM_SuperadminList.isUserSuperadmin(player)) if (impostor || TFM_SuperadminList.isUserSuperadmin(player))
{ {
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_Util.getRank(player)); TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_Util.getRank(player));
if (superadmin_impostor) if (impostor)
{ {
player.getInventory().clear(); player.getInventory().clear();
player.setOp(false); player.setOp(false);

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -140,28 +141,37 @@ public class TFM_RollbackManager
public static class RollbackEntry public static class RollbackEntry
{ {
// Use of primitives to decrease overhead
private final String author; private final String author;
private final Location location; private final String worldName;
private final int toBlockId; // ints have less overhead than Materials private final int x;
private final int fromBlockId; private final short y;
private final int z;
private final short blockId;
private final byte data; private final byte data;
private final boolean isBreak;
private RollbackEntry(String author, Block block, EntryType entryType) private RollbackEntry(String author, Block block, EntryType entryType)
{ {
this.location = block.getLocation().clone(); final Location location = block.getLocation();
this.x = location.getBlockX();
this.y = (short) location.getBlockY();
this.z = location.getBlockZ();
this.worldName = location.getWorld().getName();
this.author = author; this.author = author;
if (entryType == EntryType.BLOCK_BREAK) if (entryType == EntryType.BLOCK_BREAK)
{ {
fromBlockId = block.getTypeId(); this.blockId = (short) block.getTypeId();
toBlockId = Material.AIR.getId(); this.data = block.getData();
data = block.getData(); this.isBreak = true;
} }
else else
{ {
fromBlockId = Material.AIR.getId(); blockId = (short) block.getTypeId();
toBlockId = block.getTypeId();
data = 0; data = 0;
this.isBreak = false;
} }
} }
@ -172,17 +182,35 @@ public class TFM_RollbackManager
public Location getLocation() public Location getLocation()
{ {
return location; try
{
return new Location(Bukkit.getWorld(worldName), (double) x, (double) y, (double) z);
}
catch (Exception ex)
{
TFM_Log.warning("Could not get location of rollback entry at (" + worldName + ":" + x + "," + y + "," + x + ")!");
}
return null;
} }
public Material getFromMaterial() public Material getMaterial()
{ {
return Material.getMaterial(fromBlockId); return Material.getMaterial(blockId);
} }
public Material getToMaterial() public int getX()
{ {
return Material.getMaterial(toBlockId); return x;
}
public int getY()
{
return y;
}
public int getZ()
{
return z;
} }
public byte getData() public byte getData()
@ -192,14 +220,21 @@ public class TFM_RollbackManager
public EntryType getType() public EntryType getType()
{ {
return (getFromMaterial() == Material.AIR ? EntryType.BLOCK_PLACE : EntryType.BLOCK_BREAK); return (isBreak ? EntryType.BLOCK_BREAK : EntryType.BLOCK_PLACE);
} }
public void restore() public void restore()
{ {
Block block = location.getWorld().getBlockAt(location); Block block = Bukkit.getWorld(worldName).getBlockAt(x, y, z);
block.setType(getFromMaterial()); if (isBreak)
{
block.setType(getMaterial());
block.setData(data); block.setData(data);
} }
else
{
block.setType(Material.AIR);
}
}
} }
} }