本文整理汇总了Java中org.bukkit.scheduler.BukkitScheduler.cancelTask方法的典型用法代码示例。如果您正苦于以下问题:Java BukkitScheduler.cancelTask方法的具体用法?Java BukkitScheduler.cancelTask怎么用?Java BukkitScheduler.cancelTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.scheduler.BukkitScheduler
的用法示例。
在下文中一共展示了BukkitScheduler.cancelTask方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import org.bukkit.scheduler.BukkitScheduler; //导入方法依赖的package包/类
public void close(Plugin plugin)
{
BukkitScheduler bs;
if (taskid >= 0) {
bs = plugin.getServer().getScheduler();
bs.cancelTask(taskid);
taskid = -1;
}
for (HandlerList h : HandlerList.getHandlerLists())
h.unregister(this);
subregions.clear();
}
示例2: cancelTask
import org.bukkit.scheduler.BukkitScheduler; //导入方法依赖的package包/类
public void cancelTask() {
if (bukkitTaskId != -1) {
BukkitScheduler sc = plugin.getServer().getScheduler();
sc.cancelTask(bukkitTaskId);
bukkitTaskId = -1;
}
}
示例3: Stop
import org.bukkit.scheduler.BukkitScheduler; //导入方法依赖的package包/类
public void Stop() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.cancelTask(task);
}
示例4: postTeleport
import org.bukkit.scheduler.BukkitScheduler; //导入方法依赖的package包/类
public void postTeleport(final ABPortal from, final ABPortal portal, final ModInfo info, final Entity entity) {
final Block block = info.location.getBlock();
if (block.getType() != Material.LEVER)
return;
final ABPortal owner = info.getPortal();
if ( owner == null )
return;
final Material m = info.item.getType();
final boolean player = entity instanceof Player;
if ( owner.equals(portal) ) {
// Entity Incoming
if ((m == Material.STONE_PLATE && !player) || (m != Material.STONE_PLATE && m != Material.WOOD_PLATE))
return;
} else {
// Entity Outgoing
if ((m == Material.STONE_BUTTON && !player) || (m != Material.STONE_BUTTON && m != Material.WOOD_BUTTON))
return;
}
final long duration = parseDuration(info.flags.get("duration"));
final BukkitScheduler scheduler = portal.getPlugin().getServer().getScheduler();
final BlockState bs = block.getState();
final Lever lever = (Lever) bs.getData();
final boolean powered = lever.isPowered();
final Flipper flipper;
if (info.task != -1) {
flipper = new Flipper(info, block, !powered);
scheduler.cancelTask(info.task);
} else {
flipper = new Flipper(info, block, powered);
lever.setPowered(!powered);
bs.setData(lever);
bs.update();
}
info.task = scheduler.scheduleSyncDelayedTask(portal.getPlugin(), flipper, duration);
}