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