当前位置: 首页>>代码示例>>Java>>正文


Java ThunderChangeEvent类代码示例

本文整理汇总了Java中org.bukkit.event.weather.ThunderChangeEvent的典型用法代码示例。如果您正苦于以下问题:Java ThunderChangeEvent类的具体用法?Java ThunderChangeEvent怎么用?Java ThunderChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ThunderChangeEvent类属于org.bukkit.event.weather包,在下文中一共展示了ThunderChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setThundering

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
public void setThundering(boolean thundering) {
    if (thundering && !hasStorm()) setStorm(true);
    CraftServer server = world.getServer();

    ThunderChangeEvent thunder = new ThunderChangeEvent(this, thundering);
    server.getPluginManager().callEvent(thunder);
    if (!thunder.isCancelled()) {
        world.worldInfo.setThundering(thundering);

        // These numbers are from Minecraft
        if (thundering) {
            setThunderDuration(rand.nextInt(12000) + 3600);
        } else {
            setThunderDuration(rand.nextInt(168000) + 12000);
        }
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:18,代码来源:CraftWorld.java

示例2: check

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
@SuppressWarnings("null")
@Override
public boolean check(final Event e) {
	if (types == null)
		return true;
	if (!(e instanceof WeatherChangeEvent || e instanceof ThunderChangeEvent))
		return false;
	final boolean rain = e instanceof WeatherChangeEvent ? ((WeatherChangeEvent) e).toWeatherState() : ((ThunderChangeEvent) e).getWorld().hasStorm();
	final boolean thunder = e instanceof ThunderChangeEvent ? ((ThunderChangeEvent) e).toThunderState() : ((WeatherChangeEvent) e).getWorld().isThundering();
	return types.check(e, new Checker<WeatherType>() {
		@Override
		public boolean check(final WeatherType t) {
			return t.isWeather(rain, thunder);
		}
	});
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:17,代码来源:EvtWeatherChange.java

示例3: setThundering

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
public void setThundering(boolean thundering) {
    if (thundering && !hasStorm()) setStorm(true);
    CraftServer server = world.getServer();

    ThunderChangeEvent thunder = new ThunderChangeEvent(this, thundering);
    server.getPluginManager().callEvent(thunder);
    if (!thunder.isCancelled()) {
        world.worldData.setThundering(thundering);

        // These numbers are from Minecraft
        if (thundering) {
            setThunderDuration(rand.nextInt(12000) + 3600);
        } else {
            setThunderDuration(rand.nextInt(168000) + 12000);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:18,代码来源:CraftWorld.java

示例4: Y

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的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.ThunderChangeEvent; //导入依赖的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.ThunderChangeEvent; //导入依赖的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: onThunderChange

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onThunderChange(ThunderChangeEvent event)
{
    try
    {
        if (event.getWorld() == TFM_AdminWorld.getInstance().getWorld() && TFM_AdminWorld.getInstance().getWeatherMode() != TFM_AdminWorld.WeatherMode.OFF)
        {
            return;
        }
    }
    catch (Exception ex)
    {
    }

    if (event.toThunderState() && TFM_ConfigEntry.DISABLE_WEATHER.getBoolean())
    {
        event.setCancelled(true);
        return;
    }
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:21,代码来源:TFM_WeatherListener.java

示例8: X

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的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

示例9: setThundering

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
public void setThundering(boolean thundering) {
    if (thundering && !hasStorm()) setStorm(true);
    CraftServer server = world.getServer();

    ThunderChangeEvent thunder = new ThunderChangeEvent((org.bukkit.World) this, thundering);
    server.getPluginManager().callEvent(thunder);
    if (!thunder.isCancelled()) {
        world.field_72986_A.func_76069_a(thundering);

        // These numbers are from Minecraft
        if (thundering) {
            setThunderDuration(rand.nextInt(12000) + 3600);
        } else {
            setThunderDuration(rand.nextInt(168000) + 12000);
        }
    }
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:18,代码来源:CraftWorld.java

示例10: onThunderChange

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onThunderChange(ThunderChangeEvent event) {
  
  if (plugin.getConfig().getString("toggle.noweather").equals(true)) {	
	boolean storm = event.toThunderState();
	if(storm)
		event.setCancelled(true);
	}
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:10,代码来源:Events.java

示例11: onThunderChange

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onThunderChange(ThunderChangeEvent event) {

    if (plugin.getConfig().getString("toggle.noweather").equals(true)) {
        boolean storm = event.toThunderState();
        if (storm)
            event.setCancelled(true);
    }
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:10,代码来源:Events.java

示例12: Thunder

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
@EventHandler
public void Thunder(ThunderChangeEvent e) {
	if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.ThunderChange.Enable")) {
		if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.ThunderChange.World.All_World")) {
			if (WorldUtils.getWTC().contains(e.getWorld().getName())) {
				e.setCancelled(true);
			}
		} else {
			e.setCancelled(true);
		}
    }
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:13,代码来源:BasicFeatures.java

示例13: onThunderChange

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onThunderChange(ThunderChangeEvent event) {
    boolean storm = event.toThunderState();

    if (storm) {
        event.setCancelled(true);
    }
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:9,代码来源:EnvironmentListener.java

示例14: setThundering

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
public void setThundering(boolean flag) {
    // CraftBukkit start
    org.bukkit.World world = Bukkit.getWorld(getName());
    if (world != null) {
        ThunderChangeEvent thunder = new ThunderChangeEvent(world, flag);
        Bukkit.getServer().getPluginManager().callEvent(thunder);
        if (thunder.isCancelled()) {
            return;
        }

        setThunderDuration(0); // Will force a time reset
    }
    // CraftBukkit end
    this.v = flag;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:16,代码来源:WorldData.java

示例15: onThunderChange

import org.bukkit.event.weather.ThunderChangeEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onThunderChange(final ThunderChangeEvent event)
{
	final ProtectHolder settings = prot.getSettings();

	if (!event.isCancelled() && settings.getData().isDisableThunder() && event.toThunderState())
	{
		event.setCancelled(true);
	}
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:11,代码来源:EssentialsProtectWeatherListener.java


注:本文中的org.bukkit.event.weather.ThunderChangeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。