@Override public boolean execute(CommandSender sender, String currentAlias, String[] args) { if (!testPermission(sender)) return true; World world = null; if (args.length == 1) { world = Bukkit.getWorld(args[0]); if (world == null) { sender.sendMessage(ChatColor.RED + "No world exists with the name '" + args[0] + "'"); return true; } } else if (sender instanceof Player) { world = ((Player) sender).getWorld(); } else { world = Bukkit.getWorlds().get(0); } Command.broadcastCommandMessage(sender, "Toggling downfall " + (world.hasStorm() ? "off" : "on") + " for world '" + world.getName() + "'"); world.setStorm(!world.hasStorm()); return true; }
public static String getDisplayName(UUID worldId) { String worldName = "UNKNOWN"; if (worldId != null) { World world = Bukkit.getWorld(worldId); if (world != null) { worldName = world.getName(); } } return worldName; } }
private static Location deserializeLocation(String l) { try { World w = Bukkit.getWorld(l.split(";")[0]); if (w != null) return new Location(w, Integer.parseInt(l.split(";")[1]), Integer.parseInt(l.split(";")[2]), Integer.parseInt(l.split(";")[3])); } catch (NumberFormatException x) { } return null; }
/** * Returns a bukkit world * * @return */ public World toWorld() { return Bukkit.getWorld(this.getWorld()); } }
public static Location fromS(String s) { String[] t = s.split(";"); int x = Integer.parseInt(t[0]); int y = Integer.parseInt(t[1]); int z = Integer.parseInt(t[2]); World w = Bukkit.getWorld(t[3]); return new Location(w, x, y, z); } }
public Tree(ResultSet rs) throws SQLException { super(rs.getInt(1), rs.getInt(2), Bukkit.getWorld(UUID.fromString(rs.getString(3))) .getBlockAt(rs.getInt(4), rs.getInt(5), rs.getInt(6)).getLocation()); this.isSapling = rs.getBoolean(7); this.size = rs.getInt(8); }
public Furnace(ResultSet rs) throws SQLException { super(rs.getInt(1), rs.getInt(2), Bukkit.getWorld(UUID.fromString(rs.getString(3))) .getBlockAt(rs.getInt(4), rs.getInt(5), rs.getInt(6)).getLocation()); this.active = rs.getBoolean(7); }
public WorldConfig(UUID worldId) { super(String.format("%s.yml", Bukkit.getWorld(worldId).getName()), "world.yml"); super.saveIfNotExist(); this.worldId = worldId; super.load(); }
@Override public String[] getPlayerGroups(String world, String player) { OfflinePlayer op = Bukkit.getOfflinePlayer(player); GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world)); User user = set.getUser(op); Set<Group> children = user.getChildren(true); List<String> groups = new ArrayList<String>(); for (Group child : children) { groups.add(child.getName()); } return groups.toArray(new String[groups.size()]); }
public static void renderChunks(String worldName, List<CoordXZ> coords) { if (!renderEnabled()) return; World world = Bukkit.getWorld(worldName); int y = (world != null) ? world.getMaxHeight() : 255; for (CoordXZ coord : coords) { renderChunk(worldName, coord, y); } }
@Override public String getPrimaryGroup(String world, String player) { OfflinePlayer op = Bukkit.getOfflinePlayer(player); GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world)); User user = set.getUser(op); Set<Group> children = user.getChildren(false); if (!children.isEmpty()) { return children.iterator().next().getName(); } else { return null; } }
public CustomDesign(String uuid, Map<String, Object> data) { super(((CraftWorld) Bukkit.getWorld((String) data.get("location.world"))).getHandle()); this.uuid = UUID.fromString(uuid); this.ballMeta = new BallData(((MemorySection) data.get("meta")).getValues(true)); final Location location = Location.deserialize(((MemorySection) data.get("location")).getValues(true)); this.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); this.persistent = true; }
public CustomDesign(String uuid, Map<String, Object> data) { super(((CraftWorld) Bukkit.getWorld((String) data.get("location.world"))).getHandle()); this.uuid = UUID.fromString(uuid); this.ballMeta = new BallData(((MemorySection) data.get("meta")).getValues(true)); final Location location = Location.deserialize(((MemorySection) data.get("location")).getValues(true)); this.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); this.persistent = true; }
public CustomDesign(String uuid, Map<String, Object> data) { super(((CraftWorld) Bukkit.getWorld((String) data.get("location.world"))).getHandle()); this.uuid = UUID.fromString(uuid); this.ballMeta = new BallData(((MemorySection) data.get("meta")).getValues(true)); final Location location = Location.deserialize(((MemorySection) data.get("location")).getValues(true)); this.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); this.persistent = true; }
@Override public boolean groupHas(String world, String group, String permission) { GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world)); if (set.hasGroup(group)) { Group g = set.getGroup(group); return g.hasPermission(permission, true); } else { return false; } }
public static void renderRegion(String worldName, CoordXZ coord) { if (!renderEnabled()) return; World world = Bukkit.getWorld(worldName); int y = (world != null) ? world.getMaxHeight() : 255; int x = CoordXZ.regionToBlock(coord.x); int z = CoordXZ.regionToBlock(coord.z); api.triggerRenderOfVolume(worldName, x, 0, z, x+511, y, z+511); }
public static Location toBukkit(SerializedBlockLocation location) { return new Location(Bukkit.getWorld(location.getWorld()), location.getX(), location.getY(), location.getZ()); } }
@Override public boolean playerInGroup(String world, String player, String group) { OfflinePlayer op = Bukkit.getOfflinePlayer(player); GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world)); User user = set.getUser(op); if (set.hasGroup(group)) { Group g = set.getGroup(group); return user.hasChild(g, true); } else { return false; } }
public WorldClimateEngine(WorldConfig config) { this.config = config; // Worlds load their own model file String worldName = Bukkit.getWorld(config.getWorldId()).getName(); this.scoreTempModel = new ScoreTempModel(worldName, config.getSensitivity()); this.contributionModel = new ContributionModel(worldName); this.reductionModel = new ReductionModel(worldName); this.entityFitnessModel = new EntityFitnessModel(worldName); this.carbonIndexModel = new CarbonIndexModel(worldName); }
@Override public Location create(DataKey root) { if (!root.keyExists("world")) return null; World world = Bukkit.getWorld(root.getString("world")); double x = root.getDouble("x"), y = root.getDouble("y"), z = root.getDouble("z"); float yaw = normalise(root.getDouble("yaw")), pitch = normalise(root.getDouble("pitch")); return world == null ? new LazilyLoadedLocation(root.getString("world"), x, y, z, yaw, pitch) : new Location(world, x, y, z, yaw, pitch); }