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


Java BukkitTask.cancel方法代码示例

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


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

示例1: remove

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
public void remove(Player player)
{
    BukkitTask bukkitTask = this.destroyTasks.get(player.getUniqueId());

    if (bukkitTask != null)
        bukkitTask.cancel();

    LivingEntity[] livingEntities = this.balloons.get(player.getUniqueId());

    if (livingEntities == null)
        return;

    this.balloons.remove(player.getUniqueId());

    for (LivingEntity livingEntity : livingEntities)
        livingEntity.remove();
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:18,代码来源:BalloonCosmetic.java

示例2: runTaskTimer

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
@Test
public void runTaskTimer()
{
	AtomicInteger count = new AtomicInteger(0);
	Runnable callback = () -> {
		count.incrementAndGet();
	};
	BukkitTask task = scheduler.runTaskTimer(null, callback, 10L, 2L);
	assertNotNull(task);
	scheduler.performTicks(9L);
	assertEquals(0, count.get());
	scheduler.performOneTick();
	assertEquals(1, count.get());
	scheduler.performOneTick();
	assertEquals(1, count.get());
	scheduler.performOneTick();
	assertEquals(2, count.get());
	task.cancel();
	scheduler.performOneTick();
	assertEquals(2, count.get());
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:22,代码来源:BukkitSchedulerMockTest.java

示例3: onPlayerQuit

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
    if (!this.useTaskInstead)
        return;
    BukkitTask task = wallBorderTask.remove(event.getPlayer().getUniqueId());
    if (task != null) {
        task.cancel();
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:10,代码来源:WallBorderListener.java

示例4: cancel

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
@Override
public void cancel(){
	for(BukkitTask runnable : trailRunnables.values()){
		runnable.cancel();
	}
	trailDelays.clear();
	trailRunnables.clear();
	for(Trail trail : subTrails){
		trail.cancel();
	}
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:12,代码来源:ParticleTrail.java

示例5: resetPendingPartyTask

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
private void resetPendingPartyTask() {
	for (BukkitTask bt : Bukkit.getScheduler().getPendingTasks()) {
		if (bt.getOwner() instanceof Parties) {
			if (party.getListPartiesToDelete().containsValue(bt.getTaskId())) {
				for (Entry<String, Integer> et : getPartyHandler().getListPartiesToDelete().entrySet()) {
					if (et.getValue() == bt.getTaskId()) {
						bt.cancel();
						party.deleteTimedParty(et.getKey(), true);
						break;
					}
				}
			}
		}
	}
}
 
开发者ID:AlessioDP,项目名称:Parties,代码行数:16,代码来源:Parties.java

示例6: createTask

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
private BukkitTask createTask(String path, BukkitTask existing, Runnable runnable) {
    if (existing != null) {
        existing.cancel();
    }

    if (config.getInt(path, -1) <= 0) return null;
    return Bukkit.getScheduler().runTaskTimer(plugin, runnable, 0, 20 * config.getInt(path));
}
 
开发者ID:sgtcaze,项目名称:NametagEdit,代码行数:9,代码来源:NametagHandler.java

示例7: shutdown

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
public void shutdown() {
	if (loaderTasks == null) return;
	for (BukkitTask task : loaderTasks) {
		try {
			task.cancel();
		} catch (Exception e) {}
	}
}
 
开发者ID:ProgrammerDan,项目名称:BanStick,代码行数:9,代码来源:BanStickProxyHandler.java

示例8: shutdown

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
public void shutdown() {
	if (torListUpdaters == null) return;
	for (BukkitTask task : torListUpdaters) {
		try {
			task.cancel();
		} catch (Exception e) {}
	}
}
 
开发者ID:ProgrammerDan,项目名称:BanStick,代码行数:9,代码来源:BanStickTorUpdater.java

示例9: destroy

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
/**
 * Inactivates associated modules for the Contraption
 */
public void destroy() {
    for (BukkitTask task : tasks) {
        try {
            task.cancel();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        }

    }
    SoundType.DESTRUCTION.play(anchor.getLocation());
}
 
开发者ID:gmlaxfanatic,项目名称:Contraptions,代码行数:15,代码来源:Contraption.java

示例10: stopWorkers

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
public void stopWorkers() {
  for (BukkitTask task : this.runningTasks) {
    try {
      task.cancel();
    } catch (Exception ex) {
      BedwarsRel.getInstance().getBugsnag().notify(ex);
      // already cancelled
    }
  }

  this.runningTasks.clear();
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:13,代码来源:Game.java

示例11: cancelTask

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
@Override
public void cancelTask(BukkitTask bukkitTask) {
    bukkitTask.cancel();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:BukkitSchedulerBackend.java

示例12: cancelAllTasks

import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
public void cancelAllTasks() {
    for (BukkitTask task : chunkTasks.values()) {
        task.cancel();
    }
    chunkTasks.clear();
}
 
开发者ID:MineGaming,项目名称:cubit,代码行数:7,代码来源:WorldListener.java


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