Tag: bukkit

什么是“类型不匹配”,我该如何解决?

如何解决此错误? 类型不匹配:无法从元素类型Object转换为Block 我在这一行看到了它: for (Block b : blocksToSkip){ 这是完整的代码。 @EventHandler(priority=EventPriority.NORMAL, ignoreCancelled=true) public void onEntityExplode(EntityExplodeEvent ev){ ArrayList blocksToSkip = new ArrayList(); Location rootLoc = ev.getLocation(); if (!SkyMagic.IsInIslandWorld(rootLoc)) return; for (Block b : ev.blockList()){ Location loc = b.getLocation(); IslandData data = SkyMagic.GetIslandAt(loc); if ((data != null) && (data.owner != null)){ blocksToSkip.add(b); } } for (Block b : […]

在Bukkit中从原理图设置块数据?

我试图在.schematic加载并粘贴一个.schematic文件(不需要挂钩MCEdit API)。 下面是我用来粘贴原理图的function/方法。 粘贴时,我在粘贴过程中不断收到NullPointerException 。 当我记录放置的物品时,我看到草块,石头,但不是我的箱子,箱子里的任何东西,或信标(可能更多块)。 此行发生错误: block.setData(blockData[index], true); 我认为这必须与metaData有关,但我如何从原理图文件中获取该信息并将其应用于每个块? 问题: How can i paste items with metaData like (Chest with contents, torches, beacons, etc.? @SuppressWarnings(“deprecation”) public void pasteSchematic(World world, Location loc, Schematic schematic) { byte[] blocks = schematic.getBlocks(); byte[] blockData = schematic.getData(); short length = schematic.getLenght(); short width = schematic.getWidth(); short height = schematic.getHeight(); […]

Java ArrayList IndexOutOfBoundsException索引:1,大小:1

我正在尝试用Java读取某个文件并将其转换为多维数组。 每当我从脚本中读取一行代码时,控制台会说: Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 我知道这个错误是在编码无法达到特定索引时引起的,但我现在还不知道如何修复它。 这是我编码的一个例子。 int x = 1; while (scanner.hasNextLine()) { String line = scanner.nextLine(); //Explode string line String[] Guild = line.split(“\\|”); //Add that value to the guilds array for (int i = 0; i < Guild.length; i++) { ((ArrayList)guildsArray.get(x)).add(Guild[i]); if(sender.getName().equals(Guild[1])) { //The person is the owner of […]

获取YAML路径下的所有节点

我有一个YAML文件,如下所示: Main: topofhouse: x: 276.4375 y: 71.0 z: -60.5 yaw: -290.7768 pitch: 35.400017 2ndfloor: x: 276.5 y: 67.0 z: -60.5 yaw: -8.626648 pitch: 16.199997 home: x: 276.5 y: 63.0 z: -60.5 yaw: -18.976715 pitch: -32.850002 有没有办法让Main下的所有节点?

数据库连接应始终保持打开状态还是仅在需要时打开?

我有一个bukkit插件(minecraft),需要连接到数据库。 请原谅noob问题,但是数据库连接应该始终保持打开状态,还是在需要时打开和关闭?