本文整理汇总了Java中org.bukkit.World.getUID方法的典型用法代码示例。如果您正苦于以下问题:Java World.getUID方法的具体用法?Java World.getUID怎么用?Java World.getUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.World
的用法示例。
在下文中一共展示了World.getUID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import org.bukkit.World; //导入方法依赖的package包/类
@Override
public void accept(Player player, List<String> args) {
org.bukkit.inventory.ItemStack itemInMainHand = player.getInventory().getItemInMainHand();
if (itemInMainHand == null) {
player.sendMessage(ChatColor.RED + "Put the result of the recipe in your main hand when executing this command.");
return;
}
if (args.isEmpty()) {
player.sendMessage(ChatColor.RED + "Usage: /addrecipe world <key> [<world name>] [<group>]");
return;
}
UUID world = player.getWorld().getUID();
if (args.size() >= 2) {
World bukkitWorld = plugin.getServer().getWorld(args.get(1));
if (bukkitWorld != null) world = bukkitWorld.getUID();
}
String keyString = args.get(0);
String group = args.size() >= 3 ? args.get(2) : "";
NamespacedKey bukkitKey = plugin.getKey(keyString);
ItemStack result = CraftItemStack.asNMSCopy(itemInMainHand);
MinecraftKey key = CraftNamespacedKey.toMinecraft(bukkitKey);
player.openInventory(new WorldRecipeHolder(plugin, result, key, group, player, world).getInventory());
}
示例2: EndWorldWrapper
import org.bukkit.World; //导入方法依赖的package包/类
/**
* Construct a new EndWorldWrapper around an existing world
*
* @param plugin the plugin instance
* @param world the world to wrap
*/
protected EndWorldWrapper(DragonEggDrop plugin, World world) {
this.plugin = plugin;
this.world = world.getUID();
if (world.getEnvironment() != Environment.THE_END)
throw new IllegalArgumentException("EndWorldWrapper worlds must be of environment \"THE_END\"");
}
示例3: getWorldWrapper
import org.bukkit.World; //导入方法依赖的package包/类
/**
* Get the world wrapper for the specified world
*
* @param world the world to get
* @return the world's respective wrapper
*/
public EndWorldWrapper getWorldWrapper(World world) {
if (world == null) return null;
UUID worldId = world.getUID();
if (!worldWrappers.containsKey(worldId))
this.worldWrappers.put(worldId, new EndWorldWrapper(plugin, world));
return this.worldWrappers.get(worldId);
}
示例4: of
import org.bukkit.World; //导入方法依赖的package包/类
public static ChunkLocation of(World world, ChunkPosition position) {
return new ChunkLocation(world.getUID(), position);
}