本文整理汇总了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();
}