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