use of org.bukkit.World 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.World in project TotalFreedomMod by TotalFreedom.
the class WorldManager method gotoWorld.
public void gotoWorld(Player player, String targetWorld) {
if (player == null) {
return;
}
if (player.getWorld().getName().equalsIgnoreCase(targetWorld)) {
playerMsg(player, "Going to main world.", ChatColor.GRAY);
player.teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
return;
}
for (World world : Bukkit.getWorlds()) {
if (world.getName().equalsIgnoreCase(targetWorld)) {
playerMsg(player, "Going to world: " + targetWorld, ChatColor.GRAY);
player.teleport(world.getSpawnLocation());
return;
}
}
playerMsg(player, "World " + targetWorld + " not found.", ChatColor.GRAY);
}
use of org.bukkit.World in project TotalFreedomMod by TotalFreedom.
the class Command_smite method smite.
public static void smite(Player player, String reason) {
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
if (reason != null) {
FUtil.bcastMsg(" Reason: " + reason, ChatColor.RED);
}
// Deop
player.setOp(false);
// Set gamemode to survival
player.setGameMode(GameMode.SURVIVAL);
// Clear inventory
player.getInventory().clear();
// Strike with lightning effect
final Location targetPos = player.getLocation();
final World world = player.getWorld();
for (int x = -1; x <= 1; x++) {
for (int z = -1; z <= 1; z++) {
final Location strike_pos = new Location(world, targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
world.strikeLightning(strike_pos);
}
}
// Kill
player.setHealth(0.0);
if (reason != null) {
player.sendMessage(ChatColor.RED + "You've been smitten. Reason: " + reason);
}
}
use of org.bukkit.World in project TotalFreedomMod by TotalFreedom.
the class Command_unloadchunks method run.
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
FUtil.adminAction(sender.getName(), "Unloading unused chunks", false);
int numChunks = 0;
for (World world : server.getWorlds()) {
numChunks += unloadUnusedChunks(world);
}
FUtil.playerMsg(sender, numChunks + " chunks unloaded.");
return true;
}
use of org.bukkit.World in project TotalFreedomMod by TotalFreedom.
the class Command_status method run.
@Override
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
// Temporary
msg("For information about TotalFreedomMod, try /tfm", ChatColor.GREEN);
msg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.YELLOW);
msg("Loaded worlds:", ChatColor.BLUE);
int i = 0;
for (World world : server.getWorlds()) {
msg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
}
return true;
}
Aggregations