Search in sources :

Example 1 with Task_AFKING

use of com.jaoafa.MyMaid2.Task.Task_AFKING in project MyMaid2 by jaoafa.

the class Cmd_AFK method setAFK_True.

/**
 * プレイヤーをAFKにする
 *
 * @param player 設定するプレイヤー
 * @author mine_book000
 */
public static void setAFK_True(Player player) {
    if (getHeadICE(player)) {
        PlayerInventory playerinv = player.getInventory();
        head.put(player.getName(), playerinv.getHelmet());
        player.getInventory().setHelmet(new ItemStack(Material.ICE));
        player.updateInventory();
    }
    Bukkit.broadcastMessage(ChatColor.DARK_GRAY + player.getName() + " is afk!");
    DiscordSend(player.getName() + " is afk!");
    if (!Achievementjao.getAchievement(player, new AchievementType(11))) {
        player.sendMessage(AchievementAPI.getPrefix() + "実績の解除中に問題が発生しました。もう一度お試しください。");
        return;
    }
    String listname = player.getPlayerListName().replaceAll(player.getName(), ChatColor.DARK_GRAY + player.getName());
    player.setPlayerListName(listname);
    TitleAPI.sendTitle(player, 0, 99999999, 0, ChatColor.RED + "AFK NOW!", ChatColor.BLUE + "" + ChatColor.BOLD + "When you are back, please enter the command '/afk' or Move.");
    try {
        BukkitTask task = new Task_AFKING(player).runTaskTimer(JavaPlugin(), 0L, 5L);
        afking.put(player.getName(), task);
    } catch (java.lang.NoClassDefFoundError e) {
        BugReporter(e);
        afking.put(player.getName(), null);
    }
}
Also used : Task_AFKING(com.jaoafa.MyMaid2.Task.Task_AFKING) AchievementType(com.jaoafa.jaoSuperAchievement.jaoAchievement.AchievementType) BukkitTask(org.bukkit.scheduler.BukkitTask) PlayerInventory(org.bukkit.inventory.PlayerInventory) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

Task_AFKING (com.jaoafa.MyMaid2.Task.Task_AFKING)1 AchievementType (com.jaoafa.jaoSuperAchievement.jaoAchievement.AchievementType)1 ItemStack (org.bukkit.inventory.ItemStack)1 PlayerInventory (org.bukkit.inventory.PlayerInventory)1 BukkitTask (org.bukkit.scheduler.BukkitTask)1