use of org.bukkit.block.Block in project TotalFreedomMod by TotalFreedom.
the class Command_landmine method run.
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
if (!ConfigEntry.LANDMINES_ENABLED.getBoolean()) {
msg("The landmine is currently disabled.", ChatColor.GREEN);
return true;
}
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) {
msg("Explosions are currently disabled.", ChatColor.GREEN);
return true;
}
double radius = 2.0;
if (args.length >= 1) {
if ("list".equals(args[0])) {
final Iterator<Landmine> landmines = plugin.lm.getLandmines().iterator();
while (landmines.hasNext()) {
msg(landmines.next().toString());
}
return true;
}
try {
radius = Math.max(2.0, Math.min(6.0, Double.parseDouble(args[0])));
} catch (NumberFormatException ex) {
}
}
final Block landmine = playerSender.getLocation().getBlock().getRelative(BlockFace.DOWN);
landmine.setType(Material.TNT);
plugin.lm.add(new Landmine(landmine.getLocation(), playerSender, radius));
msg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
return true;
}
use of org.bukkit.block.Block in project TotalFreedomMod by TotalFreedom.
the class AdminWorld method generateWorld.
@Override
protected World generateWorld() {
final WorldCreator worldCreator = new WorldCreator(getName());
worldCreator.generateStructures(false);
worldCreator.type(WorldType.NORMAL);
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generator(new CleanroomChunkGenerator(GENERATION_PARAMETERS));
final World world = Bukkit.getServer().createWorld(worldCreator);
world.setSpawnFlags(false, false);
world.setSpawnLocation(0, 50, 0);
final Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST);
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
signData.setFacingDirection(BlockFace.NORTH);
welcomeSign.setLine(0, ChatColor.GREEN + "AdminWorld");
welcomeSign.setLine(1, ChatColor.DARK_GRAY + "---");
welcomeSign.setLine(2, ChatColor.YELLOW + "Spawn Point");
welcomeSign.setLine(3, ChatColor.DARK_GRAY + "---");
welcomeSign.update();
plugin.gr.commitGameRules();
return world;
}
use of org.bukkit.block.Block in project TotalFreedomMod by TotalFreedom.
the class Flatlands method generateWorld.
@Override
protected World generateWorld() {
if (!ConfigEntry.FLATLANDS_GENERATE.getBoolean()) {
return null;
}
wipeFlatlandsIfFlagged();
final WorldCreator worldCreator = new WorldCreator(getName());
worldCreator.generateStructures(false);
worldCreator.type(WorldType.NORMAL);
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generator(new CleanroomChunkGenerator(GENERATION_PARAMETERS));
final World world = Bukkit.getServer().createWorld(worldCreator);
world.setSpawnFlags(false, false);
world.setSpawnLocation(0, 50, 0);
final Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST);
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
signData.setFacingDirection(BlockFace.NORTH);
welcomeSign.setLine(0, ChatColor.GREEN + "Flatlands");
welcomeSign.setLine(1, ChatColor.DARK_GRAY + "---");
welcomeSign.setLine(2, ChatColor.YELLOW + "Spawn Point");
welcomeSign.setLine(3, ChatColor.DARK_GRAY + "---");
welcomeSign.update();
plugin.gr.commitGameRules();
return world;
}
use of org.bukkit.block.Block in project TotalFreedomMod by TotalFreedom.
the class RollbackEntry method restore.
public void restore() {
final Block block = Bukkit.getWorld(worldName).getBlockAt(x, y, z);
if (isBreak) {
block.setType(getMaterial());
DepreciationAggregator.setData_Block(block, data);
} else {
block.setType(Material.AIR);
}
}
use of org.bukkit.block.Block in project Minigames by AddstarMC.
the class Events method breakScoreboard.
@EventHandler(ignoreCancelled = true)
private void breakScoreboard(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() == Material.WALL_SIGN) {
if (block.hasMetadata("MGScoreboardSign")) {
Minigame minigame = (Minigame) block.getMetadata("Minigame").get(0).value();
minigame.getScoreboardData().removeDisplay(block);
}
}
}
Aggregations