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