本文整理了Java中org.bukkit.Bukkit.getWorld()
方法的一些代码示例,展示了Bukkit.getWorld()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getWorld()
方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getWorld
暂无
代码示例来源:origin: Bukkit/Bukkit
@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;
}
代码示例来源:origin: nsporillo/GlobalWarming
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;
}
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
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;
}
代码示例来源:origin: marcelo-mason/PreciousStones
/**
* Returns a bukkit world
*
* @return
*/
public World toWorld() {
return Bukkit.getWorld(this.getWorld());
}
}
代码示例来源:origin: dzikoysk/WildSkript
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);
}
}
代码示例来源:origin: nsporillo/GlobalWarming
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);
}
代码示例来源:origin: nsporillo/GlobalWarming
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);
}
代码示例来源:origin: nsporillo/GlobalWarming
public WorldConfig(UUID worldId) {
super(String.format("%s.yml", Bukkit.getWorld(worldId).getName()), "world.yml");
super.saveIfNotExist();
this.worldId = worldId;
super.load();
}
代码示例来源:origin: MilkBowl/Vault
@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()]);
}
代码示例来源:origin: Brettflan/WorldBorder
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);
}
}
代码示例来源:origin: MilkBowl/Vault
@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;
}
}
代码示例来源:origin: com.github.shynixn.ball/ball-bukkit-core
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;
}
代码示例来源:origin: com.github.shynixn.ball/ball-bukkit-core
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;
}
代码示例来源:origin: com.github.shynixn.ball/ball-bukkit-core
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;
}
代码示例来源:origin: MilkBowl/Vault
@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;
}
}
代码示例来源:origin: Brettflan/WorldBorder
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);
}
代码示例来源:origin: BuycraftPlugin/BuycraftX
public static Location toBukkit(SerializedBlockLocation location) {
return new Location(Bukkit.getWorld(location.getWorld()), location.getX(), location.getY(),
location.getZ());
}
}
代码示例来源:origin: MilkBowl/Vault
@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;
}
}
代码示例来源:origin: nsporillo/GlobalWarming
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);
}
代码示例来源:origin: CitizensDev/CitizensAPI
@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);
}
内容来源于网络,如有侵权,请联系作者删除!