本文整理汇总了Java中ch.njol.skript.Skript.methodExists方法的典型用法代码示例。如果您正苦于以下问题:Java Skript.methodExists方法的具体用法?Java Skript.methodExists怎么用?Java Skript.methodExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.njol.skript.Skript
的用法示例。
在下文中一共展示了Skript.methodExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetedBlock
import ch.njol.skript.Skript; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Nullable
Block getTargetedBlock(final @Nullable Player p, final Event e) {
if (p == null)
return null;
final long time = Bukkit.getWorlds().get(0).getFullTime();
if (last != e || time != blocksValidForTick) {
targetedBlocks.clear();
blocksValidForTick = time;
last = e;
}
if (!actualTargetedBlock && getTime() <= 0 && targetedBlocks.containsKey(p))
return targetedBlocks.get(p);
// if (e instanceof PlayerInteractEvent && p == ((PlayerInteractEvent) e).getPlayer() && (((PlayerInteractEvent) e).getAction() == Action.LEFT_CLICK_BLOCK || ((PlayerInteractEvent) e).getAction() == Action.RIGHT_CLICK_BLOCK)) {
// targetedBlocks.put(((PlayerInteractEvent) e).getPlayer(), ((PlayerInteractEvent) e).getClickedBlock());
// return ((PlayerInteractEvent) e).getClickedBlock();
// }
try {
Block b;
if(Skript.methodExists(Player.class, "getTargetBlock", Set.class, int.class)){
b = p.getTargetBlock((Set<Material>)null, SkriptConfig.maxTargetBlockDistance.value());
}else{
b = p.getTargetBlock((HashSet<Byte>)null, SkriptConfig.maxTargetBlockDistance.value());
}if (b.getType() == Material.AIR)
b = null;
targetedBlocks.put(p, b);
return b;
} catch (final IllegalStateException ex) {// Bukkit my throw this (for no reason?)
return null;
}
}
示例2: getTicks
import ch.njol.skript.Skript; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static int getTicks(Timespan time) {
if (Skript.methodExists(Timespan.class, "getTicks_i")) {
Number tick = time.getTicks_i();
return tick.intValue();
} else {
return time.getTicks();
}
}
示例3: init
import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
protected boolean init() {
supportsUUIDs = Skript.methodExists(DefaultDomain.class, "getUniqueIds");
return super.init();
}