本文整理匯總了Java中org.bukkit.scheduler.BukkitScheduler.scheduleAsyncDelayedTask方法的典型用法代碼示例。如果您正苦於以下問題:Java BukkitScheduler.scheduleAsyncDelayedTask方法的具體用法?Java BukkitScheduler.scheduleAsyncDelayedTask怎麽用?Java BukkitScheduler.scheduleAsyncDelayedTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.scheduler.BukkitScheduler
的用法示例。
在下文中一共展示了BukkitScheduler.scheduleAsyncDelayedTask方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: scheduleOnBukkitScheduler
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
private static int scheduleOnBukkitScheduler(Plugin plugin, Runnable command, long ticks, ConcurrencyMode concurrencyMode) {
BukkitScheduler scheduler = plugin.getServer().getScheduler();
if (concurrencyMode == ConcurrencyMode.SYNCHRONOUS) {
return scheduler.scheduleSyncDelayedTask(plugin, command, ticks);
} else {
return scheduler.scheduleAsyncDelayedTask(plugin, command, ticks);
}
}
示例2: onPlayerDeath
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = (Player) event.getEntity();
final InvRestoreDB db = new InvRestoreDB();
final String name = player.getName();
final Knapsack knapsack = new Knapsack(player);
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(this, new Runnable() {
@Override
public void run() {
db.newKey(name, knapsack);
}
}, 1);
}
示例3: dutyChat
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void dutyChat(AsyncPlayerChatEvent e) {
if (e.getPlayer().hasPermission("commandspy.track")) {
final String message = e.getMessage();
final String name = e.getPlayer().getName();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "General", ("Chat: " + message))).run();
}
},1);
}
}
示例4: dutyWorldChange
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void dutyWorldChange(PlayerChangedWorldEvent e) {
if (e.getPlayer().hasPermission("commandspy.track")) {
final String name = e.getPlayer().getName();
final World from = e.getFrom();
final String to = SQDuties.getPluginMain().getServer().getName();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "General", ("Changed worlds from " + from + " to " + to))).run();
}
},1);
}
}
示例5: dutyDrop
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void dutyDrop(PlayerDropItemEvent e) {
if (e.getPlayer().hasPermission("commandspy.track")) {
final String item = e.getItemDrop().getItemStack().getType().toString();
final String name = e.getPlayer().getName();
final Location location = e.getPlayer().getLocation();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "Items", "Dropped Item " + item + " at " + locationToString(location))).run();
}
},1);
}
}
示例6: dutyPickup
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void dutyPickup(PlayerPickupItemEvent e) {
if (e.getPlayer().hasPermission("commandspy.track")) {
final String item = e.getItem().getItemStack().getType().toString();
final String name = e.getPlayer().getName();
final Location location = e.getPlayer().getLocation();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "Items", "Picked up Item " + item + " at " + locationToString(location))).run();
}
},1);
}
}
示例7: invOpen
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void invOpen(InventoryOpenEvent e) {
if (e.getPlayer().hasPermission("commandspy.track")) {
final String title = e.getInventory().getTitle();
final String name = e.getPlayer().getName();
final Location location = e.getPlayer().getLocation();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "Inventory", ("Opened " + title + "| Location: " + locationToString(location)))).run();
}
},1);
}
}
示例8: clickInventory
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void clickInventory(InventoryClickEvent e) {
if (e.getWhoClicked().hasPermission("commandspy.track")) {
final String name = e.getWhoClicked().getName();
final String invName = e.getInventory().getName();
final InventoryAction invAction = e.getAction();
final ItemStack item = e.getCurrentItem();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "Inventory", (invName + "|" + invAction + "|" + item))).run();
}
},1);
}
}
示例9: creativeInventory
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void creativeInventory(InventoryCreativeEvent e) {
if (e.getWhoClicked().hasPermission("commandspy.track")) {
final String name = e.getWhoClicked().getName();
final InventoryAction invAction = e.getAction();
final ItemStack item = e.getCurrentItem();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "Inventory", ("Own Inventory " + invAction + "|" + item))).run();
}
},1);
}
}
示例10: command
import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@EventHandler
public void command(PlayerCommandPreprocessEvent e) {
if (e.getPlayer().hasPermission("commandspy.track")) {
final String message = e.getMessage();
final String name = e.getPlayer().getName();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleAsyncDelayedTask(SQDuties.getPluginMain(), new Runnable() {
@Override
public void run() {
(new CommandSpyFile(name, "General", ("Command: " + message))).run();
}
},1);
}
}