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


Java Weathers.CLEAR属性代码示例

本文整理汇总了Java中org.spongepowered.api.world.weather.Weathers.CLEAR属性的典型用法代码示例。如果您正苦于以下问题:Java Weathers.CLEAR属性的具体用法?Java Weathers.CLEAR怎么用?Java Weathers.CLEAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.spongepowered.api.world.weather.Weathers的用法示例。


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

示例1: cast

@Override
public SkillResult cast(IActiveCharacter character, ExtendedSkillInfo info, SkillModifier modifier) {
	Player character1 = character.getEntity();

	if (character1.getWorld().getWeather() == Weathers.CLEAR) {
		Vector3d position = character1.getLocation().getPosition();
		if (character1.getWorld().getHighestYAt(position.getFloorX(), position.getFloorZ()) > position.getFloorY()) {
			character1.sendMessage(ChatTypes.ACTION_BAR, Text.builder(SkillLocalization.ASTRONOMY_CANNOT_SEE_THE_SKY)
					.color(TextColors.RED).build());
			return SkillResult.CANCELLED;
		}
		ItemStack is = Utils.createTeleportationScroll(character.getLocation());
		character.getEntity().getInventory().offer(is);
		return SkillResult.OK;
	}
	character1.sendMessage(ChatTypes.ACTION_BAR, Text.builder(SkillLocalization.ASTRONOMY_CANNOT_SEE_THE_SKY)
			.color(TextColors.RED).build());
	return SkillResult.CANCELLED;
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:19,代码来源:Astronomy.java

示例2: parseValue

@Nullable
@Override
public Weather parseValue(CommandSource source, CommandArgs args) throws ArgumentParseException {
    String value = args.next();
    switch (value) {
        case "sun":
        case "clear":
            return Weathers.CLEAR;
        case "rain":
        case "snow":
        case "downfall":
            return Weathers.RAIN;
        case "thunder":
        case "thunderstorm":
        case "thunder_storm":
        case "storm":
            return Weathers.THUNDER_STORM;
        default:
            throw args.createError(Messages.getFormatted(source, "weather.command.weather.invalidweathertype", "%weather%", value));
    }
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:21,代码来源:WeatherArgument.java

示例3: getWeather

private Optional<Weather> getWeather(final String weather_name) {
	Weather weather = null;
	if (weather_name.equalsIgnoreCase("sun")) {
		weather = Weathers.CLEAR;
	} else if (weather_name.equalsIgnoreCase("rain")) {
		weather = Weathers.RAIN;
	} else if (weather_name.equalsIgnoreCase("storm")) {
		weather = Weathers.THUNDER_STORM;
	}
	return Optional.ofNullable(weather);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:11,代码来源:EEWeather.java

示例4: calculateInitialWeather

@Overwrite
protected void calculateInitialWeather() {
    final IMixinWorldInfo info = (IMixinWorldInfo) this.worldInfo;
    info.setWorld(this);
    if (info.getWeather() == null) {
        final Weather weather;
        int duration;
        int rainTime = this.worldInfo.raining ? this.worldInfo.getRainTime() : 0;
        int thunderTime = this.worldInfo.thundering ? this.worldInfo.thunderTime : 0;
        this.worldInfo.thunderTime = thunderTime;
        this.worldInfo.rainTime = rainTime;
        if (rainTime <= 0) {
            weather = Weathers.CLEAR;
            duration = this.worldInfo.getCleanWeatherTime();
        } else if (thunderTime > 0) {
            weather = Weathers.THUNDER_STORM;
            duration = Math.min(rainTime, thunderTime);
        } else {
            weather = Weathers.RAIN;
            duration = rainTime;
        }
        info.setWeather((WeatherType) weather);
        info.setWeatherDuration(duration);
        info.setElapsedWeatherDuration(0);
    }
    this.initWeatherVolume();
}
 
开发者ID:Cybermaxke,项目名称:Weathers,代码行数:27,代码来源:MixinWorld.java

示例5: setRaining

@Override
public void setRaining(boolean state) {
    LanternWeather weather = this.weatherData.getWeather();
    final boolean raining = weather.getOptions().getOrDefault(WeatherOptions.RAIN_STRENGTH).get() > 0;
    if (raining != state) {
        weather = (LanternWeather) (state ? Weathers.RAIN : Weathers.CLEAR);
        this.weatherData.setWeather(weather);
        this.weatherData.setRemainingDuration(weather.getRandomTicksDuration());
        this.weatherData.setRunningDuration(0);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:11,代码来源:LanternWorldProperties.java

示例6: setThundering

@Override
public void setThundering(boolean state) {
    LanternWeather weather = this.weatherData.getWeather();
    final boolean thunderStorm = weather == Weathers.THUNDER_STORM;
    if (thunderStorm != state) {
        weather = (LanternWeather) (state ? Weathers.THUNDER_STORM : Weathers.CLEAR);
        this.weatherData.setWeather(weather);
        this.weatherData.setRemainingDuration(weather.getRandomTicksDuration());
        this.weatherData.setRunningDuration(0);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:11,代码来源:LanternWorldProperties.java

示例7: getWeather

@Override
public LanternWeather getWeather() {
    if (this.weatherUniverse != null) {
        return this.weatherUniverse.getWeather();
    }
    return (LanternWeather) Weathers.CLEAR;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:7,代码来源:LanternWorld.java

示例8: execute

public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	String weatherString = ctx.<String> getOne("weather").get();
	Optional<Integer> duration = ctx.<Integer> getOne("duration");

	if (src instanceof Player)
	{
		Player player = (Player) src;

		Weather weather;

		if (weatherString.toLowerCase().equals("clear") || weatherString.toLowerCase().equals("sun"))
		{
			weather = Weathers.CLEAR;
			player.sendMessage(Text.of(TextColors.GOLD, "Changing weather to ", TextColors.GRAY, "sunny."));
		}
		else if (weatherString.toLowerCase().equals("rain"))
		{
			weather = Weathers.RAIN;
			player.sendMessage(Text.of(TextColors.GOLD, "Changing weather to ", TextColors.GRAY, "rain."));
		}
		else if (weatherString.toLowerCase().equals("storm") || weatherString.toLowerCase().equals("thunderstorm"))
		{
			weather = Weathers.THUNDER_STORM;
			player.sendMessage(Text.of(TextColors.GOLD, "Changing weather to ", TextColors.GRAY, "storm."));
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Input invalid: " + weatherString));
			return CommandResult.success();
		}

		if (duration.isPresent())
		{
			player.getWorld().setWeather(weather, duration.get());
		}
		else
		{
			player.getWorld().setWeather(weather);
		}
		return CommandResult.success();
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be a in-game player to do /weather!"));
		return CommandResult.success();
	}
}
 
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:48,代码来源:WeatherExecutor.java


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