本文整理汇总了Java中org.bukkit.scheduler.BukkitTask.getTaskId方法的典型用法代码示例。如果您正苦于以下问题:Java BukkitTask.getTaskId方法的具体用法?Java BukkitTask.getTaskId怎么用?Java BukkitTask.getTaskId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.scheduler.BukkitTask
的用法示例。
在下文中一共展示了BukkitTask.getTaskId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
}
}
}
}
示例2: taskId
import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
@Override
public int taskId(BukkitTask bukkitTask) {
return bukkitTask.getTaskId();
}
示例3: onCommand
import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!isAllowed(sender, command)) {
sender.sendMessage(org.bukkit.ChatColor.DARK_RED + "Not whitelisted");
return true;
}
List<BaseComponent[]> lines = Lists.newArrayList();
List<BukkitTask> pendingTasks = Bukkit.getScheduler().getPendingTasks();
for (BukkitTask pendingTask : pendingTasks) {
Plugin owner = pendingTask.getOwner();
int taskId = pendingTask.getTaskId();
boolean sync = pendingTask.isSync();
String id = Integer.toString(taskId);
if (sync) {
id += "-Sync";
} else if (Bukkit.getScheduler().isCurrentlyRunning(taskId)) {
id += "-Running";
}
lines.add(new ComponentBuilder(owner.getName())
.color(PRIMARY_COLOR)
.append('-' + id)
.color(SECONDARY_COLOR)
.create());
Class<?> runnableClass = getRunnableClass(pendingTask);
if (runnableClass != null) {
lines.add(new ComponentBuilder(" Task: ")
.color(PRIMARY_COLOR)
.append(runnableClass.getSimpleName())
.color(SECONDARY_COLOR)
.create());
}
}
Pagination pagination = new Pagination("Stacktrace", lines);
pagination.send(sender);
plugin.getPaginations().put(sender, pagination);
return true;
}
示例4: runRepeating
import org.bukkit.scheduler.BukkitTask; //导入方法依赖的package包/类
@Override
public int runRepeating(Runnable runnable, int seconds) {
BukkitTask task = Bukkit.getScheduler().runTaskTimer(plugin, runnable, 0, seconds * 20);
return task.getTaskId();
}