本文整理匯總了Java中org.bukkit.event.weather.WeatherChangeEvent.setCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java WeatherChangeEvent.setCancelled方法的具體用法?Java WeatherChangeEvent.setCancelled怎麽用?Java WeatherChangeEvent.setCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.weather.WeatherChangeEvent
的用法示例。
在下文中一共展示了WeatherChangeEvent.setCancelled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onWeatherEvent
import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@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;
}
}
}
示例2: 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);
}
}
}
}
示例3: 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;
}
}
示例4: 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);
}
}
示例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
public void onWeatherChange(WeatherChangeEvent event) {
event.getWorld().setThunderDuration(0);
event.getWorld().setWeatherDuration(0);
event.getWorld().setThundering(false);
event.setCancelled(true);
}
示例7: onWeatherChange
import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onWeatherChange(WeatherChangeEvent e) {
if (SkyWarsReloaded.getCfg().weatherDisabled()) {
Location spawn = SkyWarsReloaded.getCfg().getSpawn();
if (spawn != null) {
if (spawn.getWorld().equals(e.getWorld())) {
e.setCancelled(true);
}
}
}
}
示例8: WeatherDisable
import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void WeatherDisable(WeatherChangeEvent e) {
if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Weather.Enable")) {
if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Weather.World.All_World")) {
if (WorldUtils.getWW().contains(e.getWorld().getName())) {
e.setCancelled(true);
}
} else {
e.setCancelled(true);
}
}
}
示例9: 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);
}
}
示例10: onWeatherChange
import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onWeatherChange(WeatherChangeEvent event) {
World world = event.getWorld();
if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.WEATHER)) {
event.setCancelled(true);
}
}
示例11: onWeatherChange
import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onWeatherChange(final WeatherChangeHook hook) {
WeatherChangeEvent event = new WeatherChangeEvent(new CanaryWorld(hook.getWorld()), hook.turningOn());
event.setCancelled(hook.isCanceled());
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
hook.setCanceled();
}
}
示例12: 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);
}
示例13: 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);
}
}
}
}
示例14: 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);
}
}
示例15: 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;
}
}