本文整理汇总了Java中org.bukkit.World.save方法的典型用法代码示例。如果您正苦于以下问题:Java World.save方法的具体用法?Java World.save怎么用?Java World.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.World
的用法示例。
在下文中一共展示了World.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.bukkit.World; //导入方法依赖的package包/类
@Override
public boolean run() {
Location spawn = SkyWarsReloaded.getCfg().getSpawn();
if (spawn == null) {
sender.sendMessage(ChatColor.RED + "YOU MUST SET SPAWN BEFORE YOU CAN SAVE A MAP");
return true;
}
String worldName = args[1].toLowerCase();
for (World world: SkyWarsReloaded.get().getServer().getWorlds()) {
if (world.getName().equalsIgnoreCase(worldName)) {
World editWorld = SkyWarsReloaded.get().getServer().getWorld(worldName);
for (Player player: editWorld.getPlayers()) {
player.teleport(spawn, TeleportCause.PLUGIN);
}
editWorld.save();
SkyWarsReloaded.getWC().unloadWorld(worldName);
File dataDirectory = new File (SkyWarsReloaded.get().getDataFolder(), "maps");
File target = new File (dataDirectory, worldName);
SkyWarsReloaded.getWC().deleteWorld(target);
File source = new File (SkyWarsReloaded.get().getServer().getWorldContainer().getAbsolutePath(), worldName);
SkyWarsReloaded.getWC().copyWorld(source, target);
SkyWarsReloaded.getWC().deleteWorld(source);
sender.sendMessage(new Messaging.MessageFormatter().setVariable("mapname", worldName).format("maps.saved"));
if (SkyWarsReloaded.getMC().mapRegistered(worldName)) {
sender.sendMessage(new Messaging.MessageFormatter().format("maps.register-reminder"));
}
return true;
}
}
sender.sendMessage(new Messaging.MessageFormatter().setVariable("mapname", worldName).format("error.map-not-in-edit"));
return true;
}
示例2: execute
import org.bukkit.World; //导入方法依赖的package包/类
@Override
public boolean execute(CommandSender sender, String[] args) {
Gamer g = Gamer.get(sender.getName());
World w = g.getPlayer().getWorld();
w.save();
Chat.player(sender, "&eYou have saved the world!");
return false;
}