当前位置: 首页>>代码示例>>Java>>正文


Java World.getSpawnLocation方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:23,代码来源:CPTeleportLocation.java

示例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();
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:29,代码来源:RSerializer.java


注:本文中的org.bukkit.World.getSpawnLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。