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


Java WeatherChangeEvent.isCancelled方法代碼示例

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


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

示例1: setStorm

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
public void setStorm(boolean hasStorm) {
    CraftServer server = world.getServer();

    WeatherChangeEvent weather = new WeatherChangeEvent(this, hasStorm);
    server.getPluginManager().callEvent(weather);
    if (!weather.isCancelled()) {
        world.worldInfo.setRaining(hasStorm);

        // These numbers are from Minecraft
        if (hasStorm) {
            setWeatherDuration(rand.nextInt(12000) + 12000);
        } else {
            setWeatherDuration(rand.nextInt(168000) + 12000);
        }
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:17,代碼來源:CraftWorld.java

示例2: 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;
    }
  }
}
 
開發者ID:BedwarsRel,項目名稱:BedwarsRel,代碼行數:20,代碼來源:WeatherListener.java

示例3: setStorm

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
public void setStorm(boolean hasStorm) {
    CraftServer server = world.getServer();

    WeatherChangeEvent weather = new WeatherChangeEvent(this, hasStorm);
    server.getPluginManager().callEvent(weather);
    if (!weather.isCancelled()) {
        world.worldData.setStorm(hasStorm);

        // These numbers are from Minecraft
        if (hasStorm) {
            setWeatherDuration(rand.nextInt(12000) + 12000);
        } else {
            setWeatherDuration(rand.nextInt(168000) + 12000);
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:17,代碼來源:CraftWorld.java

示例4: Y

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
private void Y() {
    // CraftBukkit start
    WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(weather);

    ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(thunder);
    if (!weather.isCancelled()) {
        this.worldData.setWeatherDuration(0);
        this.worldData.setStorm(false);
    }
    if (!thunder.isCancelled()) {
        this.worldData.setThunderDuration(0);
        this.worldData.setThundering(false);
    }
    // CraftBukkit end
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:18,代碼來源:WorldServer.java

示例5: Z

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
private void Z() {
    // CraftBukkit start
    WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(weather);

    ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(thunder);
    if (!weather.isCancelled()) {
        this.worldData.setWeatherDuration(0);
        this.worldData.setStorm(false);
    }
    if (!thunder.isCancelled()) {
        this.worldData.setThunderDuration(0);
        this.worldData.setThundering(false);
    }
    // CraftBukkit end
}
 
開發者ID:AlmuraDev,項目名稱:Almura-Server,代碼行數:18,代碼來源:WorldServer.java

示例6: resetRainAndThunder

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
private void resetRainAndThunder()
{
    // CraftBukkit start
    WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(weather);
    ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(thunder);

    if (!weather.isCancelled())
    {
        this.worldInfo.setRainTime(0);
        this.worldInfo.setRaining(false);
    }

    if (!thunder.isCancelled())
    {
        this.worldInfo.setThunderTime(0);
        this.worldInfo.setThundering(false);
    }

    // CraftBukkit end
    if (!weather.isCancelled() && !thunder.isCancelled()) provider.resetRainAndThunder(); // Cauldron
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:24,代碼來源:WorldServer.java

示例7: X

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
private void X() {
    // CraftBukkit start
    WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(weather);

    ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
    this.getServer().getPluginManager().callEvent(thunder);
    if (!weather.isCancelled()) {
        this.worldData.setWeatherDuration(0);
        this.worldData.setStorm(false);
    }
    if (!thunder.isCancelled()) {
        this.worldData.setThunderDuration(0);
        this.worldData.setThundering(false);
    }
    // CraftBukkit end
}
 
開發者ID:didoupimpon,項目名稱:Craft-city,代碼行數:18,代碼來源:WorldServer.java

示例8: setStorm

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
public void setStorm(boolean hasStorm) {
    CraftServer server = world.getServer();

    WeatherChangeEvent weather = new WeatherChangeEvent((org.bukkit.World) this, hasStorm);
    server.getPluginManager().callEvent(weather);
    if (!weather.isCancelled()) {
        world.field_72986_A.func_76084_b(hasStorm);

        // These numbers are from Minecraft
        if (hasStorm) {
            setWeatherDuration(rand.nextInt(12000) + 12000);
        } else {
            setWeatherDuration(rand.nextInt(168000) + 12000);
        }
    }
}
 
開發者ID:agaricusb,項目名稱:MCPBukkit,代碼行數:17,代碼來源:CraftWorld.java

示例9: 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();
    }
}
 
開發者ID:CanaryBukkitTeam,項目名稱:CanaryBukkit,代碼行數:10,代碼來源:CanaryWorldListener.java

示例10: setStorm

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
public void setStorm(boolean flag) {
    // CraftBukkit start
    org.bukkit.World world = Bukkit.getWorld(getName());
    if (world != null) {
        WeatherChangeEvent weather = new WeatherChangeEvent(world, flag);
        Bukkit.getServer().getPluginManager().callEvent(weather);
        if (weather.isCancelled()) {
            return;
        }

        setWeatherDuration(0); // Will force a time reset
    }
    // CraftBukkit end
    this.t = flag;
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:16,代碼來源:WorldData.java

示例11: 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

示例12: o

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
protected void o() {
    if (!this.worldProvider.g) {
        if (!this.isStatic) {
            int i = this.worldData.getThunderDuration();

            if (i <= 0) {
                if (this.worldData.isThundering()) {
                    this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
                } else {
                    this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
                }
            } else {
                --i;
                this.worldData.setThunderDuration(i);
                if (i <= 0) {
                    // CraftBukkit start
                    ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
                    this.getServer().getPluginManager().callEvent(thunder);
                    if (!thunder.isCancelled()) {
                        this.worldData.setThundering(!this.worldData.isThundering());
                    }
                    // CraftBukkit end
                }
            }

            this.o = this.p;
            if (this.worldData.isThundering()) {
                this.p = (float) ((double) this.p + 0.01D);
            } else {
                this.p = (float) ((double) this.p - 0.01D);
            }

            this.p = MathHelper.a(this.p, 0.0F, 1.0F);
            int j = this.worldData.getWeatherDuration();

            if (j <= 0) {
                if (this.worldData.hasStorm()) {
                    this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
                } else {
                    this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
                }
            } else {
                --j;
                this.worldData.setWeatherDuration(j);
                if (j <= 0) {
                    // CraftBukkit start
                    WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
                    this.getServer().getPluginManager().callEvent(weather);

                    if (!weather.isCancelled()) {
                        this.worldData.setStorm(!this.worldData.hasStorm());
                    }
                    // CraftBukkit end
                }
            }

            this.m = this.n;
            if (this.worldData.hasStorm()) {
                this.n = (float) ((double) this.n + 0.01D);
            } else {
                this.n = (float) ((double) this.n - 0.01D);
            }

            this.n = MathHelper.a(this.n, 0.0F, 1.0F);
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:68,代碼來源:World.java

示例13: o

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
protected void o() {
    if (!this.worldProvider.g) {
        int i = this.worldData.getThunderDuration();

        if (i <= 0) {
            if (this.worldData.isThundering()) {
                this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
            } else {
                this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
            }
        } else {
            --i;
            this.worldData.setThunderDuration(i);
            if (i <= 0) {
                // CraftBukkit start
                ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
                this.getServer().getPluginManager().callEvent(thunder);
                if (!thunder.isCancelled()) {
                    this.worldData.setThundering(!this.worldData.isThundering());
                }
                // CraftBukkit end
            }
        }

        int j = this.worldData.getWeatherDuration();

        if (j <= 0) {
            if (this.worldData.hasStorm()) {
                this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
            } else {
                this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
            }
        } else {
            --j;
            this.worldData.setWeatherDuration(j);
            if (j <= 0) {
                // CraftBukkit start
                WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
                this.getServer().getPluginManager().callEvent(weather);

                if (!weather.isCancelled()) {
                    this.worldData.setStorm(!this.worldData.hasStorm());
                }
                // CraftBukkit end
            }
        }

        this.m = this.n;
        if (this.worldData.hasStorm()) {
            this.n = (float) ((double) this.n + 0.01D);
        } else {
            this.n = (float) ((double) this.n - 0.01D);
        }

        if (this.n < 0.0F) {
            this.n = 0.0F;
        }

        if (this.n > 1.0F) {
            this.n = 1.0F;
        }

        this.o = this.p;
        if (this.worldData.isThundering()) {
            this.p = (float) ((double) this.p + 0.01D);
        } else {
            this.p = (float) ((double) this.p - 0.01D);
        }

        if (this.p < 0.0F) {
            this.p = 0.0F;
        }

        if (this.p > 1.0F) {
            this.p = 1.0F;
        }
    }
}
 
開發者ID:AlmuraDev,項目名稱:Almura-Server,代碼行數:79,代碼來源:World.java

示例14: n

import org.bukkit.event.weather.WeatherChangeEvent; //導入方法依賴的package包/類
protected void n() {
    if (!this.worldProvider.f) {
        int i = this.worldData.getThunderDuration();

        if (i <= 0) {
            if (this.worldData.isThundering()) {
                this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
            } else {
                this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
            }
        } else {
            --i;
            this.worldData.setThunderDuration(i);
            if (i <= 0) {
                // CraftBukkit start
                ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
                this.getServer().getPluginManager().callEvent(thunder);
                if (!thunder.isCancelled()) {
                    this.worldData.setThundering(!this.worldData.isThundering());
                }
                // CraftBukkit end
            }
        }

        int j = this.worldData.getWeatherDuration();

        if (j <= 0) {
            if (this.worldData.hasStorm()) {
                this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
            } else {
                this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
            }
        } else {
            --j;
            this.worldData.setWeatherDuration(j);
            if (j <= 0) {
                // CraftBukkit start
                WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
                this.getServer().getPluginManager().callEvent(weather);

                if (!weather.isCancelled()) {
                    this.worldData.setStorm(!this.worldData.hasStorm());
                }
                // CraftBukkit end
            }
        }

        this.m = this.n;
        if (this.worldData.hasStorm()) {
            this.n = (float) ((double) this.n + 0.01D);
        } else {
            this.n = (float) ((double) this.n - 0.01D);
        }

        if (this.n < 0.0F) {
            this.n = 0.0F;
        }

        if (this.n > 1.0F) {
            this.n = 1.0F;
        }

        this.o = this.p;
        if (this.worldData.isThundering()) {
            this.p = (float) ((double) this.p + 0.01D);
        } else {
            this.p = (float) ((double) this.p - 0.01D);
        }

        if (this.p < 0.0F) {
            this.p = 0.0F;
        }

        if (this.p > 1.0F) {
            this.p = 1.0F;
        }
    }
}
 
開發者ID:didoupimpon,項目名稱:Craft-city,代碼行數:79,代碼來源:World.java


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