本文整理了Java中org.bukkit.Bukkit.getWorlds()
方法的一些代码示例,展示了Bukkit.getWorlds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getWorlds()
方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getWorlds
暂无
代码示例来源:origin: Bukkit/Bukkit
private World getGameWorld(CommandSender sender) {
if (sender instanceof HumanEntity) {
World world = ((HumanEntity) sender).getWorld();
if (world != null) {
return world;
}
} else if (sender instanceof BlockCommandSender) {
return ((BlockCommandSender) sender).getBlock().getWorld();
}
return Bukkit.getWorlds().get(0);
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
for (World world : Bukkit.getWorlds()) {
world.setAutoSave(false);
}
Command.broadcastCommandMessage(sender, "Disabled level saving..");
return true;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
for (World world : Bukkit.getWorlds()) {
world.setAutoSave(true);
}
Command.broadcastCommandMessage(sender, "Enabled level saving..");
return true;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!testPermission(sender)) return true;
long seed;
if (sender instanceof Player) {
seed = ((Player) sender).getWorld().getSeed();
} else {
seed = Bukkit.getWorlds().get(0).getSeed();
}
sender.sendMessage("Seed: " + seed);
return true;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length != 1 || args[0].length() == 0) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
}
Difficulty difficulty = Difficulty.getByValue(getDifficultyForString(sender, args[0]));
if (Bukkit.isHardcore()) {
difficulty = Difficulty.HARD;
}
Bukkit.getWorlds().get(0).setDifficulty(difficulty);
int levelCount = 1;
if (Bukkit.getAllowNether()) {
Bukkit.getWorlds().get(levelCount).setDifficulty(difficulty);
levelCount++;
}
if (Bukkit.getAllowEnd()) {
Bukkit.getWorlds().get(levelCount).setDifficulty(difficulty);
}
Command.broadcastCommandMessage(sender, "Set difficulty to " + difficulty.toString());
return true;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
Command.broadcastCommandMessage(sender, "Forcing save..");
Bukkit.savePlayers();
for (World world : Bukkit.getWorlds()) {
world.save();
}
Command.broadcastCommandMessage(sender, "Save complete.");
return true;
}
代码示例来源:origin: Bukkit/Bukkit
for (World world : Bukkit.getWorlds()) {
world.setTime(value);
for (World world : Bukkit.getWorlds()) {
world.setFullTime(world.getFullTime() + value);
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
}
int duration = (300 + new Random().nextInt(600)) * 20;
if (args.length >= 2) {
duration = getInteger(sender, args[1], 1, 1000000) * 20;
}
World world = Bukkit.getWorlds().get(0);
world.setWeatherDuration(duration);
world.setThunderDuration(duration);
if ("clear".equalsIgnoreCase(args[0])) {
world.setStorm(false);
world.setThundering(false);
Command.broadcastCommandMessage(sender, "Changed weather to clear for " + (duration / 20) + " seconds.");
} else if ("rain".equalsIgnoreCase(args[0])) {
world.setStorm(true);
world.setThundering(false);
Command.broadcastCommandMessage(sender, "Changed weather to rainy for " + (duration / 20) + " seconds.");
} else if ("thunder".equalsIgnoreCase(args[0])) {
world.setStorm(true);
world.setThundering(true);
Command.broadcastCommandMessage(sender, "Changed weather to thundering " + (duration / 20) + " seconds.");
}
return true;
}
代码示例来源: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: GlowstoneMC/Glowstone
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setCenter(CommandUtils
.getLocation(((Player) sender).getLocation(), args[1], "0", args[2]));
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setCenter(x, z);
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setSize(size, time);
} else {
sender.sendMessage(
"World border is " + Bukkit.getWorlds().get(0).getWorldBorder().getSize()
+ " blocks wide.");
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setSize(size + world.getWorldBorder().getSize(), time);
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setDamageBuffer(buffer);
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setDamageAmount(damage);
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setWarningTime(time);
for (World world : Bukkit.getWorlds()) {
world.getWorldBorder().setWarningDistance(blocks);
代码示例来源:origin: Bukkit/Bukkit
world = player.getWorld();
} else {
world = Bukkit.getWorlds().get(0);
代码示例来源:origin: GlowstoneMC/Glowstone
sendBullet(sender, t, b, "glowstone.about.players",
Bukkit.getOnlinePlayers().size());
sendBullet(sender, t, b, "glowstone.about.worlds", Bukkit.getWorlds().size());
sendBullet(sender, t, b, "glowstone.about.plugins",
Bukkit.getPluginManager().getPlugins().length);
代码示例来源:origin: jiongjionger/NeverLag
private List<Chunk> getAllChunk() {
List<Chunk> chunks = new ArrayList<>();
for (World world : Bukkit.getWorlds()) {
chunks.addAll(Arrays.asList(world.getLoadedChunks()));
}
return chunks;
}
代码示例来源:origin: SpigotMC/Spigot-API
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
for (World world : Bukkit.getWorlds()) {
world.setAutoSave(false);
}
Command.broadcastCommandMessage(sender, "Disabled level saving..");
return true;
}
代码示例来源:origin: SpigotMC/Spigot-API
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
for (World world : Bukkit.getWorlds()) {
world.setAutoSave(true);
}
Command.broadcastCommandMessage(sender, "Enabled level saving..");
return true;
}
代码示例来源:origin: SpigotMC/Spigot-API
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!testPermission(sender)) return true;
long seed;
if (sender instanceof Player) {
seed = ((Player) sender).getWorld().getSeed();
} else {
seed = Bukkit.getWorlds().get(0).getSeed();
}
sender.sendMessage("Seed: " + seed);
return true;
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
public static void setupItemSettings() {
for (World world: Bukkit.getWorlds()) {
SlimefunStartup.getWhitelist().setDefaultValue(world.getName() + ".enabled-items.SLIMEFUN_GUIDE", true);
}
Slimefun.setItemVariable("ORE_CRUSHER", "double-ores", true);
}
代码示例来源:origin: SpigotMC/Spigot-API
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
Command.broadcastCommandMessage(sender, "Forcing save..");
Bukkit.savePlayers();
for (World world : Bukkit.getWorlds()) {
world.save();
}
Command.broadcastCommandMessage(sender, "Save complete.");
return true;
}
代码示例来源:origin: jiongjionger/NeverLag
public ServerInfo() {
this.realtimeTPS = NeverLag.getTpsWatcher().getTps();
this.avgTPS = NeverLag.getTpsWatcher().getAverageTPS();
this.realtimeRedstone = RedstoneCounter.getInstance().getRedstoneRealTimeCount(true);
this.avgRedstone = RedstoneCounter.getInstance().getRedstoneAvgCount(true);
this.serverUpTime = DateUtils.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime());
for (World world : Bukkit.getWorlds()) {
worldInfo.add(new WorldInfo(world));
}
}
代码示例来源:origin: nsporillo/GlobalWarming
@Override
public void run() {
for (World world : Bukkit.getWorlds()) {
WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(world.getUID());
if (climateEngine != null && climateEngine.isEffectEnabled(ClimateEffectType.PERMANENT_SLOWNESS)) {
for (Player player : world.getPlayers()) {
updatePlayerSlowness(player, climateEngine.getTemperature());
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!