當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。