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


Java WeatherChangeEvent.toWeatherState方法代碼示例

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


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

示例1: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onWeatherChange(WeatherChangeEvent e) {    
	World w = e.getWorld();
	int trys = RPConfig.getGlobalFlagInt(w.getName()+".rain.trys-before-rain");
	if (e.toWeatherState()){
		if (!rainCounter.containsKey(w)){
			rainCounter.put(w, trys);
			e.setCancelled(true);
		} else {
			int acTry = rainCounter.get(w);
			if (acTry-1 <= 0){    
				Bukkit.getScheduler().runTaskLater(RedProtect.get(), () -> w.setWeatherDuration(RPConfig.getGlobalFlagInt(w.getName()+".rain.duration")*20), 40);
				rainCounter.put(w, trys);
			} else {
				rainCounter.put(w, acTry-1);
    			e.setCancelled(true);
			}
		}    		
	}
}
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:21,代碼來源:RPWorldListener.java

示例2: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onWeatherChange(WeatherChangeEvent event)
{
    try
    {
        if (event.getWorld() == TFM_AdminWorld.getInstance().getWorld() && TFM_AdminWorld.getInstance().getWeatherMode() != TFM_AdminWorld.WeatherMode.OFF)
        {
            return;
        }
    }
    catch (Exception ex)
    {
    }

    if (event.toWeatherState() && TFM_ConfigEntry.DISABLE_WEATHER.getBoolean())
    {
        event.setCancelled(true);
        return;
    }
}
 
開發者ID:Yoshi41023,項目名稱:TatsuCraftMod,代碼行數:21,代碼來源:TFM_WeatherListener.java

示例3: onWeatherChangeEvent

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onWeatherChangeEvent(final WeatherChangeEvent e) {
    if (!Settings.worldName.contains(e.getWorld().getName())) {
        return;
    }
    if (e.toWeatherState()) {
        // It's raining
        plugin.logger(3,"It's raining!");
        startSnow();
    } else {
        // It's stopped raining!
        plugin.logger(3,"Stopped raining!");
        if (snow != null)
            snow.cancel();
    }
}
 
開發者ID:tastybento,項目名稱:greenhouses,代碼行數:17,代碼來源:Ecosystem.java

示例4: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority= EventPriority.HIGHEST)
public void onWeatherChange(WeatherChangeEvent event) {
    boolean rain = event.toWeatherState();
    if(rain) event.setCancelled(true);
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:6,代碼來源:PACreativo.java

示例5: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority=EventPriority.HIGHEST)
public void onWeatherChange(WeatherChangeEvent event) {
	
  if (plugin.getConfig().getString("toggle.noweather").equals(true)) {
    boolean rain = event.toWeatherState();
    if(rain)
        event.setCancelled(true);
  	}
}
 
開發者ID:SlamTheHam,項目名稱:UltraCore,代碼行數:10,代碼來源:Events.java

示例6: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onWeatherChange(WeatherChangeEvent event) {

    if (plugin.getConfig().getString("toggle.noweather").equals(true)) {
        boolean rain = event.toWeatherState();
        if (rain)
            event.setCancelled(true);
    }
}
 
開發者ID:SlamTheHam,項目名稱:UltraCore,代碼行數:10,代碼來源:Events.java

示例7: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority= EventPriority.HIGHEST)
public void onWeatherChange(WeatherChangeEvent event) {
    boolean rain = event.toWeatherState();

    if (rain) {
        event.setCancelled(true);
    }
}
 
開發者ID:ijoeleoli,項目名稱:ZorahPractice,代碼行數:9,代碼來源:EnvironmentListener.java

示例8: ajustWeather

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
public void ajustWeather(WeatherChangeEvent e) {
    Game game = worldGame.get(e.getWorld());
    if (game != null) {
        if (game.mapData.weather.fixed) {
            if (e.toWeatherState() != game.mapData.weather.storm) {
                e.getWorld().setStorm(game.mapData.weather.storm);
            }
        }
    }
}
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:11,代碼來源:GameManager.java

示例9: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onWeatherChange(WeatherChangeEvent ev) {
    boolean changeToStorm = ev.toWeatherState();
    if(changeToStorm && !plugin.getArenaManager().getCurrentArena().stormy
            || !changeToStorm && plugin.getArenaManager().getCurrentArena().stormy)
        ev.setCancelled(true);
    ev.getWorld().setThundering(false);
}
 
開發者ID:ModernDayPlayer,項目名稱:SurvivalGamesX,代碼行數:9,代碼來源:BlockListener.java

示例10: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
/**
 * Tracks weather changes and acid rain
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.NORMAL)
public void onWeatherChange(final WeatherChangeEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());

    // Check that they are in the ASkyBlock world
    // plugin.getLogger().info("weather change noted");
    if (!e.getWorld().getName().equalsIgnoreCase(Settings.worldName)) {
        return;
    }
    this.isRaining = e.toWeatherState();
    // plugin.getLogger().info("is raining = " + isRaining);
}
 
開發者ID:tastybento,項目名稱:acidisland,代碼行數:19,代碼來源:AcidEffect.java

示例11: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onWeatherChange(WeatherChangeEvent event) {
	for(Game game : SurvivalGames.gameManager.getGames()) {
		for(Arena arena : game.getArenas()) {
			if(event.getWorld().equals(arena.getMinimumLocation().getWorld()) && event.toWeatherState()) {
				event.setCancelled(true);
			}
		}
	}
}
 
開發者ID:maker56,項目名稱:UltimateSurvivalGames,代碼行數:11,代碼來源:PlayerListener.java

示例12: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onWeatherChange(WeatherChangeEvent e) {
	if(e.toWeatherState()) {
		e.setCancelled(true);
		World world = e.getWorld();
		world.setStorm(false);
		world.setThundering(false);
		world.setWeatherDuration(100000);
	}
}
 
開發者ID:kyriog,項目名稱:rftd,代碼行數:11,代碼來源:WeatherListener.java

示例13: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onWeatherChange(final WeatherChangeEvent event) {
	if (event.toWeatherState()) { // True if weather is being set to 'raining'
		CraftoScheduler.runTaskLater(this.module, TickDuration.ofSeconds(1), () -> {
			final World world = Utility.getMainWorld();

			world.setWeatherDuration(WeatherComponent.MAX_BAD_WEATHER_DURATION);
			if (world.isThundering()) { world.setThunderDuration(WeatherComponent.MAX_BAD_WEATHER_DURATION); }
		});
	}
}
 
開發者ID:Craftolution,項目名稱:CraftoPlugin,代碼行數:12,代碼來源:WeatherComponent.java

示例14: weatherCheck

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void weatherCheck(WeatherChangeEvent e) {
	if(e.toWeatherState() == true) {
		e.setCancelled(true);
	} else {
		//exit method
		return;
	}
}
 
開發者ID:xize,項目名稱:xEssentials_old_Source,代碼行數:10,代碼來源:weatherEvent.java

示例15: onWeatherChange

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onWeatherChange(final WeatherChangeEvent event)
{
	final ProtectHolder settings = prot.getSettings();

	if (!event.isCancelled() && settings.getData().isDisableStorm() && event.toWeatherState())
	{
		event.setCancelled(true);
	}
}
 
開發者ID:Curtis3321,項目名稱:Essentials,代碼行數:11,代碼來源:EssentialsProtectWeatherListener.java


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