gpt4 book ai didi

org.bukkit.event.weather.WeatherChangeEvent.setCancelled()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 22:59:05 29 4
gpt4 key购买 nike

本文整理了Java中org.bukkit.event.weather.WeatherChangeEvent.setCancelled()方法的一些代码示例,展示了WeatherChangeEvent.setCancelled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeatherChangeEvent.setCancelled()方法的具体详情如下:
包路径:org.bukkit.event.weather.WeatherChangeEvent
类名称:WeatherChangeEvent
方法名:setCancelled

WeatherChangeEvent.setCancelled介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onWeatherChange(WeatherChangeEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getWorld()));
  if (event.toWeatherState()) {
    if (wcfg.disableWeather) {
      event.setCancelled(true);
    }
  } else {
    if (!wcfg.disableWeather && wcfg.alwaysRaining) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: DRE2N/DungeonsXL

@EventHandler
public void onWeatherChange(WeatherChangeEvent event) {
  DInstanceWorld dWorld = dWorlds.getInstanceByWorld(event.getWorld());
  if (dWorld instanceof DEditWorld && event.toWeatherState()) {
    event.setCancelled(true);
  } else if (dWorld instanceof DGameWorld) {
    Game game = Game.getByGameWorld((DGameWorld) dWorld);
    Boolean raining = game.getRules().isRaining();
    if (raining == null) {
      return;
    }
    if ((raining && !event.toWeatherState()) || (!raining && event.toWeatherState())) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: TotalFreedom/TotalFreedomMod

@EventHandler(priority = EventPriority.HIGH)
public void onWeatherChange(WeatherChangeEvent event)
{
  try
  {
    if (event.getWorld().equals(adminworld.getWorld()) && adminworld.getWeatherMode() != WorldWeather.OFF)
    {
      return;
    }
  }
  catch (Exception ex)
  {
  }
  if (ConfigEntry.DISABLE_WEATHER.getBoolean() && event.toWeatherState())
  {
    event.setCancelled(true);
  }
}

代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common

@EventHandler
public void onWeatherEvent(WeatherChangeEvent we) {
 if (we.isCancelled()) {
  return;
 }
 List<Game> games = BedwarsRel.getInstance().getGameManager().getGamesByWorld(we.getWorld());
 if (games.size() == 0) {
  return;
 }
 for (Game game : games) {
  if (game.getState() != GameState.STOPPED) {
   we.setCancelled(true);
   break;
  }
 }
}

代码示例来源:origin: BedwarsRel/BedwarsRel

@EventHandler
public void onWeatherEvent(WeatherChangeEvent we) {
 if (we.isCancelled()) {
  return;
 }
 List<Game> games = BedwarsRel.getInstance().getGameManager().getGamesByWorld(we.getWorld());
 if (games.size() == 0) {
  return;
 }
 for (Game game : games) {
  if (game.getState() != GameState.STOPPED) {
   we.setCancelled(true);
   break;
  }
 }
}

代码示例来源:origin: Multiverse/Multiverse-Core

/**
 * This method is called when the weather changes.
 * @param event The Event that was fired.
 */
@EventHandler
public void weatherChange(WeatherChangeEvent event) {
  if (event.isCancelled()) {
    return;
  }
  MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getWorld().getName());
  if (world != null) {
    // If it's going to start raining and we have weather disabled
    event.setCancelled((event.toWeatherState() && !world.isWeatherEnabled()));
  }
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com