本文整理汇总了Java中org.bukkit.World.getSpawnLocation方法的典型用法代码示例。如果您正苦于以下问题:Java World.getSpawnLocation方法的具体用法?Java World.getSpawnLocation怎么用?Java World.getSpawnLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.World
的用法示例。
在下文中一共展示了World.getSpawnLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CPTeleportLocation
import org.bukkit.World; //导入方法依赖的package包/类
public CPTeleportLocation(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
online = section.getBoolean("ONLINE", false);
if(section.contains(Node.LOCATION.get())) {
ConfigurationSection temp = section.getConfigurationSection(Node.LOCATION.get());
ErrorLogger.addPrefix(Node.LOCATION.get());
loc = ConfigUtils.loadLocation(temp);
ErrorLogger.removePrefix();
}else if(section.contains(Node.WORLD.get())){
ErrorLogger.addPrefix(Node.WORLD.get());
String world = section.getString(Node.WORLD.get());
ErrorLogger.removePrefix();
if(world != null) {
World w = Bukkit.getWorld(world);
if(w != null) {
loc = w.getSpawnLocation();
}else
ErrorLogger.addError("World `" + world + "` wasn't found.");
}else
Error.INVALID.add();
}
}
示例2: deserializeLocation
import org.bukkit.World; //导入方法依赖的package包/类
public static Location deserializeLocation(String s) {
if (s.length() == 0)
return SakiRPG.getTutorialSpawn();
String[] data = s.split(Pattern.quote(LOCATION_DIVIDER));
if (data.length == 0)
return SakiRPG.getTutorialSpawn();
try {
double x = Double.parseDouble(data[0]);
double y = Double.parseDouble(data[1]);
if (y < 1)
y = 1;
double z = Double.parseDouble(data[2]);
float yaw = Float.parseFloat(data[3]);
float pitch = Float.parseFloat(data[4]);
World w = SakiRPG.plugin.getServer().getWorld(data[5]);
if (w == null) {
w = SakiRPG.plugin.getServer().getWorld(SakiRPG.GAME_WORLD);
RMessages.announce("ERROR DESERIALIZING LOCATION " + s);
RMessages.announce("Please report this to Misaka if you see it!");
return w.getSpawnLocation();
}
return new Location(w, x, y, z, yaw, pitch);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Corrupted location save: " + s);
}
return SakiRPG.getTutorialSpawn();
}