本文整理匯總了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();
}
示例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());
}
示例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();
}
}
示例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();
}
}
示例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;
}
}
}
}
}
}
示例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));
}
示例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) {}
}
}
示例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) {}
}
}
示例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());
}
示例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();
}
示例11: cancelTask
import org.bukkit.scheduler.BukkitTask; //導入方法依賴的package包/類
@Override
public void cancelTask(BukkitTask bukkitTask) {
bukkitTask.cancel();
}
示例12: cancelAllTasks
import org.bukkit.scheduler.BukkitTask; //導入方法依賴的package包/類
public void cancelAllTasks() {
for (BukkitTask task : chunkTasks.values()) {
task.cancel();
}
chunkTasks.clear();
}