當前位置: 首頁>>代碼示例>>Java>>正文


Java BukkitScheduler.scheduleSyncRepeatingTask方法代碼示例

本文整理匯總了Java中org.bukkit.scheduler.BukkitScheduler.scheduleSyncRepeatingTask方法的典型用法代碼示例。如果您正苦於以下問題:Java BukkitScheduler.scheduleSyncRepeatingTask方法的具體用法?Java BukkitScheduler.scheduleSyncRepeatingTask怎麽用?Java BukkitScheduler.scheduleSyncRepeatingTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.scheduler.BukkitScheduler的用法示例。


在下文中一共展示了BukkitScheduler.scheduleSyncRepeatingTask方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onEnable

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void onEnable() {
	registerListeners();
	registerCommands();
	ConfigManager.getInstance().setup(this);

	WorldBorder b = Bukkit.getWorld("world").getWorldBorder();
	b.setCenter(new Location(Bukkit.getWorld("world"), 0, 64, 0));
	b.setSize(SettingsManager.border);
	
	BukkitScheduler scheduler = getServer().getScheduler();
	scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
		@Override
		public void run() {
			Bukkit.broadcastMessage("loop all players: :kappa:");
			if(GameManager.getGameSituation()) {
				if(GameManager.getStartTime() + 600000 > System.currentTimeMillis()) {
					b.setSize(b.getSize() - 1);
				}
			}
		}
	}, 0L, 1 * 20L);
}
 
開發者ID:masste,項目名稱:McPlayUHC,代碼行數:23,代碼來源:McPlayUHC.java

示例2: checkForEyepatchEnchant

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void checkForEyepatchEnchant(){
	BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {

		@Override
		public void run() {
			
			for(Player player : Bukkit.getOnlinePlayers()){
				if(player.getInventory().getHelmet() != null){
					ItemStack item = player.getInventory().getHelmet();
					if(new ItemType(item).getArmorType().equals(ArmorTypes.HEAD)){
						Armor detailItem = new Armor(item);
							HashMap<Enchantments, Integer> enchantments = detailItem.getEnchantsAndLevel();
							if(enchantments.containsKey(Enchantments.EYEPATCH)){
								if(player.getActivePotionEffects().contains(PotionEffectType.BLINDNESS)){
									player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 0, 0));
								}
							}
					}
				}
			}
			
		}
       	
       }, 0, 1);
}
 
開發者ID:DamoclesProject,項目名稱:Damocles,代碼行數:27,代碼來源:Eyepatch.java

示例3: init

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
@Override
public void init() {
    this.loadConfig();
    if (!this.setUpLanguage()) return;
    this.setUpAPI();
    this.registerModes();
    this.registerStages();
    this.registerCommands();
    final PluginManager pm = this.getChatterbox().getServer().getPluginManager();
    pm.registerEvents(new ChannelListener(this), this.getChatterbox());
    final BukkitScheduler bs = this.getChatterbox().getServer().getScheduler();
    bs.scheduleSyncRepeatingTask(this.getChatterbox(), new SaveChannelsTask(this), 36000L, 36000L);
    // Turn ConfigChannels into IRCConfigChannels
    this.transformConfigChannels();
    // Create saved channels and set modes on config channels
    this.loadFromIRCChannelsConfig();
    // Make sure all players join their previous channels that have just been made
    this.getChatterbox().getServer().getOnlinePlayers().stream()
        .map(player -> this.getChatterboxAPI().getPlayerAPI().getCPlayer(player))
        .forEach(CPlayer::joinPreviousChannels);
    this.getLogger().info("Loaded.");
}
 
開發者ID:Chatterbox,項目名稱:hooks,代碼行數:23,代碼來源:IRCChannels.java

示例4: init

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void init(Plugin plugin)
{
    BukkitScheduler bs;
    PluginManager   pm;
    String          wn;

    if (radius < 1) {
        for (World w : Bukkit.getWorlds()) {
            wn = w.getName();

            if (worlds.contains(wn))
                subregions.add(new SubRegion(this, wn, 0, 0, true));
        }
    }

    if (event > 0) {
        pm = plugin.getServer().getPluginManager();
        pm.registerEvents(this, plugin);
    }

    if (sweep > 0) {
        bs     = plugin.getServer().getScheduler();
        taskid = bs.scheduleSyncRepeatingTask(plugin, this, sweep, sweep);
    }
}
 
開發者ID:jgeboski,項目名稱:MobSweeper,代碼行數:26,代碼來源:Region.java

示例5: start

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void start() {
    if (!isRunning) {
        BukkitScheduler scheduler = plugin.getServer().getScheduler();
        taskID = scheduler.scheduleSyncRepeatingTask(plugin,
                new Runnable() {
                    public void run() {
                        onSecond();
                    }
                }, 20L, 20L);
        isRunning = true;
    }

    time = -startTime;

    for (Player p : Bukkit.getOnlinePlayers())
        BarUtil.setMessageAndPercent(p, ChatColor.GREEN + "Starting in "
                + -time, 1F);

    plugin.getSignHandler().updateSigns(GameTeam.RED);
    plugin.getSignHandler().updateSigns(GameTeam.BLUE);
    plugin.getSignHandler().updateSigns(GameTeam.GREEN);
    plugin.getSignHandler().updateSigns(GameTeam.YELLOW);
}
 
開發者ID:cancabron,項目名稱:Annihilation,代碼行數:24,代碼來源:PhaseManager.java

示例6: startThreads

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public static void startThreads() {
    BukkitScheduler scheduler = Bukkit.getScheduler();

    // Start sync demigods runnable
    scheduler.scheduleSyncRepeatingTask(StoaPlugin.getInst(), SYNC, 20, 20);
    MessageUtil.sendDebug("Main Demigods SYNC runnable enabled...");

    // Start async demigods runnable
    scheduler.scheduleAsyncRepeatingTask(StoaPlugin.getInst(), ASYNC, 20, 20);
    MessageUtil.sendDebug("Main Demigods ASYNC runnable enabled...");

    // Start favor runnable
    scheduler.scheduleAsyncRepeatingTask(StoaPlugin.getInst(), FAVOR, 20, (StoaPlugin.config().getInt("regeneration_rates.favor") * 20));
    MessageUtil.sendDebug("Favor regeneration runnable enabled...");

    // Enable Deity runnables
    for (Deity deity : Stoa.getMythos().getDeities())
        for (Ability ability : deity.getAbilities())
            if (ability.getRunnable() != null)
                scheduler.scheduleSyncRepeatingTask(StoaPlugin.getInst(), ability.getRunnable(), ability.getDelay(), ability.getRepeat());

    // Triggers
    ThreadUtil.registerSyncAsyncRunnables(StoaPlugin.getInst(), Stoa.getMythos().getSyncAsyncTasks());
}
 
開發者ID:DemigodsRPG,項目名稱:Stoa,代碼行數:25,代碼來源:TaskManager.java

示例7: start

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void start() {
    if (!isRunning) {
        BukkitScheduler scheduler = plugin.getServer().getScheduler();
        taskID = scheduler.scheduleSyncRepeatingTask(plugin,
                new Runnable() {
                    @Override
                    public void run() {
                        onSecond();
                    }
                }, 20L, 20L);
        isRunning = true;
    }

    time = -startTime;

    for (Player p : Bukkit.getOnlinePlayers())
        ActionAPI.sendPlayerAnnouncement(p, ChatColor.DARK_AQUA
                + "Welcome to CrafterNexus!");

    plugin.getSignHandler().updateSigns(GameTeam.RED);
    plugin.getSignHandler().updateSigns(GameTeam.BLUE);
    plugin.getSignHandler().updateSigns(GameTeam.GREEN);
    plugin.getSignHandler().updateSigns(GameTeam.YELLOW);
}
 
開發者ID:MCTyler,項目名稱:CrafterNexus,代碼行數:25,代碼來源:PhaseManager.java

示例8: messageManager

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
private void messageManager() {
	Random randomGenerator = new Random();
	List<String> listMessages = getListMessages();
	System.out.println(listMessages.size()+" messages loaded");
	BukkitScheduler scheduler = getServer().getScheduler();
	scheduler.scheduleSyncRepeatingTask(this, new Runnable() {

		@Override
		public void run() {
			if(getConfig().getBoolean("Enable")) {
				if(Bukkit.getOnlinePlayers().size() >= getConfig().getInt(MIN_PLAYER_CONFIG)) {
					if(!getConfig().getBoolean(RANDOM_CONFIG)) {
						MessageManager.messageDisplayer(getPrefix() + " " + listMessages.get(iMessages));
						iMessages++;
						if (iMessages >= listMessages.size())
							iMessages = 0;
					} else {
						MessageManager.messageDisplayer(getPrefix() + " " + listMessages.get(randomGenerator.nextInt(listMessages.size())));
					}
				}

			}

		}

	}, 0, this.getConfig().getInt("Time")*60*20);
}
 
開發者ID:LotuxPunk,項目名稱:AutoMessageDisplayer,代碼行數:28,代碼來源:AutoMessageDisplayer.java

示例9: keepAlive

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
private void keepAlive() {
    BukkitScheduler scheduler = getServer().getScheduler();
    scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
        @Override
        public void run() {
            try {
                Database.getConnection().prepareStatement("SELECT 1").executeQuery();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }, 0l, 1200L);
}
 
開發者ID:L-E-iT,項目名稱:Eldin-Land-Plugin,代碼行數:14,代碼來源:Main.java

示例10: MobsTimer

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void MobsTimer() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
      scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
          @Override
          public void run() {
          	MobsTimerHashMap.clear();
          }
      }, 0L, Integer.valueOf(20 * getConfig().getInt("Config.MobsInSeconds.Secons")));
}
 
開發者ID:AnonymousDr,項目名稱:ADR,代碼行數:10,代碼來源:mobs.java

示例11: startMessageCycle

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
private void startMessageCycle() {
    if (messages.size() < 1) return;
    BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
    scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {
        public void run() {
            printMessage();
        }
    }, 1200L, 6000L);
}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:10,代碼來源:BroadcastsModule.java

示例12: checkForJumpEnchant

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void checkForJumpEnchant(){
	BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {

		@Override
		public void run() {
			for(Player player : Bukkit.getOnlinePlayers()){
				if(player.getInventory().getBoots() != null){
					ItemStack item = player.getInventory().getBoots();
					if(new ItemType(item).getArmorType().equals(ArmorTypes.FEET)){
						Armor detailItem = new Armor(item);
							HashMap<Enchantments, Integer> enchantments = detailItem.getEnchantsAndLevel();
							if(enchantments.containsKey(Enchantments.JUMP)){
								int amp = 0;
								int level = enchantments.get(Enchantments.JUMP);
								if(level == 1){
									amp = 0;
								}else if(level == 2){
									amp = 1;
								}else if(level == 3){
									amp = 2;
								}
									player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20, amp));
							}
					}
				}
			}
		}
		
       }, 0, 1);
}
 
開發者ID:DamoclesProject,項目名稱:Damocles,代碼行數:32,代碼來源:Jump.java

示例13: checkForSpeedEnchant

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void checkForSpeedEnchant(){
	BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {

		@Override
		public void run() {
			for(Player player : Bukkit.getOnlinePlayers()){
				if(player.getInventory().getBoots() != null){
					ItemStack item = player.getInventory().getBoots();
					if(new ItemType(item).getArmorType().equals(ArmorTypes.FEET)){
						Armor detailItem = new Armor(item);
							HashMap<Enchantments, Integer> enchantments = detailItem.getEnchantsAndLevel();
							if(enchantments.containsKey(Enchantments.SPEED)){
								int amp = 0;
								int level = enchantments.get(Enchantments.SPEED);
								if(level == 1){
									amp = 0;
								}else if(level == 2){
									amp = 1;
								}else if(level == 3){
									amp = 2;
								}
									player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20, amp));
							}
					}
				}
			}
		}
		
       }, 0, 1);
}
 
開發者ID:DamoclesProject,項目名稱:Damocles,代碼行數:32,代碼來源:Speed.java

示例14: checkForBatEnchant

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
public void checkForBatEnchant(){
	BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
       scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {

		@Override
		public void run() {
			
			for(Player player : Bukkit.getOnlinePlayers()){
				if(player.getInventory().getHelmet() != null){
					ItemStack item = player.getInventory().getHelmet();
					
					if(new ItemType(item).getArmorType().equals(ArmorTypes.HEAD)){
						Armor detailItem = new Armor(item);
						HashMap<Enchantments, Integer> enchantments = detailItem.getEnchantsAndLevel();
						if(enchantments.containsKey(Enchantments.BAT_VISION)){
							int amp = 0;
							int level = enchantments.get(Enchantments.BAT_VISION);
							if(level == 1){
								amp = 0;
							}
							player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 20, amp));
						}

					}
				}
			}
			
		}
       	
       }, 0, 1);
}
 
開發者ID:DamoclesProject,項目名稱:Damocles,代碼行數:32,代碼來源:BatVision.java

示例15: startThread

import org.bukkit.scheduler.BukkitScheduler; //導入方法依賴的package包/類
/**
 * Starts the backup thread
 */
public static void startThread() {
    if (Config.getBackupDelay() / 60 / 20 != -1) {
        MessageUtil.sendConsoleMessage("Starting the backup thread for every " + Config.getBackupDelay() + " ticks.");
        BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
        scheduler.scheduleSyncRepeatingTask(getInstance(), new UploadThread(), Config.getBackupDelay(), Config.getBackupDelay());
    }
}
 
開發者ID:Ratismal,項目名稱:DriveBackup,代碼行數:11,代碼來源:DriveBackup.java


注:本文中的org.bukkit.scheduler.BukkitScheduler.scheduleSyncRepeatingTask方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。