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