本文整理匯總了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;
}