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


Java Skript.MAXBLOCKID属性代码示例

本文整理汇总了Java中ch.njol.skript.Skript.MAXBLOCKID属性的典型用法代码示例。如果您正苦于以下问题:Java Skript.MAXBLOCKID属性的具体用法?Java Skript.MAXBLOCKID怎么用?Java Skript.MAXBLOCKID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ch.njol.skript.Skript的用法示例。


在下文中一共展示了Skript.MAXBLOCKID属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: register

@Override
	public void register(final Trigger trigger) {
//		if (types == null) {
//			final BlockLocation l = new BlockLocation(world, x, y, z);
//			List<Trigger> ts = blockTriggers.get(l);
//			if (ts == null)
//				blockTriggers.put(l, ts = new ArrayList<Trigger>());
//			ts.add(trigger);
//		} else {
		for (final ItemType t : types) {
			for (final ItemData d : t) {
				if (d.getId() > Skript.MAXBLOCKID)
					continue;
				List<Trigger> ts = itemTypeTriggers.get(d.getId());
				if (ts == null)
					itemTypeTriggers.put(d.getId(), ts = new ArrayList<Trigger>());
				ts.add(trigger);
			}
		}
//		}
		if (!registeredExecutor) {
			Bukkit.getPluginManager().registerEvent(PlayerMoveEvent.class, new Listener() {}, SkriptConfig.defaultEventPriority.value(), executor, Skript.getInstance(), true);
			registeredExecutor = true;
		}
	}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:25,代码来源:EvtMoveOn.java

示例2: hasItem

/**
 * @return Whether this ItemType has at least one ItemData that represents an item
 */
public boolean hasItem() {
	for (final ItemData d : types) {
		if (d.getId() > Skript.MAXBLOCKID)
			return true;
	}
	return false;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:10,代码来源:ItemType.java

示例3: hasBlock

/**
 * @return Whether this ItemType has at least one ItemData that represents a block
 */
public boolean hasBlock() {
	for (final ItemData d : types) {
		if (d.getId() <= Skript.MAXBLOCKID)
			return true;
	}
	return false;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:10,代码来源:ItemType.java

示例4: setBlock

/**
 * Sets the given block to this ItemType
 * 
 * @param block The block to set
 * @param applyPhysics Whether to run a physics check just after setting the block
 * @return Whether the block was successfully set
 */
public boolean setBlock(final Block block, final boolean applyPhysics) {
	for (final ItemData d : types) {
		if (d.typeid > Skript.MAXBLOCKID)
			continue;
		if (BlockUtils.set(block, d.typeid, (byte) d.dataMin, (byte) d.dataMax, applyPhysics))
			return true;
	}
	return false;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:16,代码来源:ItemType.java

示例5: getDebugName

public String getDebugName(final short dataMin, final short dataMax, final boolean p) {
//		if (names == null)
//			return p ? plural : singular;
		@SuppressWarnings("null")
		final NonNullPair<String, String> s = names.get(new NonNullPair<Short, Short>(Short.valueOf(dataMin), Short.valueOf(dataMax)));
		if (s != null)
			return p ? s.getSecond() : s.getFirst();
		if (dataMin == -1 && dataMax == -1 || dataMin == 0 && dataMax == 0)
			return p ? plural : singular;
		return (p ? plural : singular) + ":" + (dataMin == -1 ? 0 : dataMin) + (dataMin == dataMax ? "" : "-" + (dataMax == -1 ? (id <= Skript.MAXBLOCKID ? 15 : Short.MAX_VALUE) : dataMax));
	}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:11,代码来源:MaterialName.java

示例6: init

@Override
	public boolean init(final Literal<?>[] args, final int matchedPattern, final ParseResult parser) {
//		if (parser.regexes.get(0).group().equalsIgnoreCase("<block>")/* && isValidatingInput*/)
//			return true;
//		final Matcher m = Pattern.compile("<block:(.+)>").matcher(parser.regexes.get(0).group());
//		if (m.matches()) {
//			final Block b = (Block) Skript.deserialize("block", m.group(1));
//			if (b == null)
//				return false;
//			world = b.getWorld();
//			x = b.getX();
//			y = b.getY();
//			z = b.getZ();
//		} else {
		@SuppressWarnings("unchecked")
		final Literal<? extends ItemType> l = (Literal<? extends ItemType>) args[0];//SkriptParser.parseLiteral(parser.regexes.get(0).group(), ItemType.class, ParseContext.EVENT);
		if (l == null)
			return false;
		types = l.getAll();
		for (final ItemType t : types) {
			boolean hasBlock = false;
			for (final ItemData d : t) {
				if (d.getId() == -1) {
					Skript.error("Can't use an 'on walk' event with an alias that matches all blocks");
					return false;
				}
				if (d.getId() <= Skript.MAXBLOCKID && d.getId() != 0) // don't allow air
					hasBlock = true;
			}
			if (!hasBlock) {
				Skript.error(t + " is not a block and can thus not be walked on");
				return false;
			}
		}
//		}
		return true;
	}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:37,代码来源:EvtMoveOn.java

示例7: iterator

@Override
@Nullable
public Iterator<ItemStack> iterator(final Event e) {
	Iterator<ItemStack> iter;
	if (types == null) {
		iter = new Iterator<ItemStack>() {
			
			private final Iterator<Material> iter = new ArrayIterator<Material>(Material.values());
			
			@Override
			public boolean hasNext() {
				return iter.hasNext();
			}
			
			@Override
			public ItemStack next() {
				return new ItemStack(iter.next());
			}
			
			@Override
			public void remove() {}
			
		};
	} else {
		@SuppressWarnings("null")
		final Iterator<ItemType> it = new ArrayIterator<ItemType>(types.getArray(e));
		if (!it.hasNext())
			return null;
		iter = new Iterator<ItemStack>() {
			
			@SuppressWarnings("null")
			Iterator<ItemStack> current = it.next().getAll().iterator();
			
			@SuppressWarnings("null")
			@Override
			public boolean hasNext() {
				while (!current.hasNext() && it.hasNext()) {
					current = it.next().getAll().iterator();
				}
				return current.hasNext();
			}
			
			@SuppressWarnings("null")
			@Override
			public ItemStack next() {
				if (!hasNext())
					throw new NoSuchElementException();
				return current.next();
			}
			
			@Override
			public void remove() {}
			
		};
	}
	
	if (!blocks)
		return iter;
	
	return new CheckedIterator<ItemStack>(iter, new NullableChecker<ItemStack>() {
		@SuppressWarnings("deprecation")
		@Override
		public boolean check(final @Nullable ItemStack is) {
			return is != null && is.getTypeId() <= Skript.MAXBLOCKID;
		}
	});
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:67,代码来源:ExprItems.java


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