mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 22:26:45 +01:00
Implement "off" to PlotWeather flag and make it default
- Players with "player weather" will no longer have their weather reset on plots that do not set the PlotWeather flag
This commit is contained in:
parent
942d799c9c
commit
3cd9b76805
@ -265,7 +265,10 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
switch (weather) {
|
switch (weather) {
|
||||||
case CLEAR -> this.player.setPlayerWeather(WeatherType.CLEAR);
|
case CLEAR -> this.player.setPlayerWeather(WeatherType.CLEAR);
|
||||||
case RAIN -> this.player.setPlayerWeather(WeatherType.DOWNFALL);
|
case RAIN -> this.player.setPlayerWeather(WeatherType.DOWNFALL);
|
||||||
default -> this.player.resetPlayerWeather();
|
case WORLD -> this.player.resetPlayerWeather();
|
||||||
|
default -> {
|
||||||
|
//do nothing as this is PlotWeather.OFF
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,8 +440,8 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PlotWeather plotWeather = plot.getFlag(WeatherFlag.class);
|
final PlotWeather plotWeather = plot.getFlag(WeatherFlag.class);
|
||||||
if (plotWeather != PlotWeather.CLEAR) {
|
if (plotWeather != PlotWeather.OFF) {
|
||||||
player.setWeather(PlotWeather.RESET);
|
player.setWeather(PlotWeather.WORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
try (final MetaDataAccess<Location> musicAccess =
|
try (final MetaDataAccess<Location> musicAccess =
|
||||||
|
@ -28,5 +28,6 @@ package com.plotsquared.core.plot;
|
|||||||
public enum PlotWeather {
|
public enum PlotWeather {
|
||||||
RAIN,
|
RAIN,
|
||||||
CLEAR,
|
CLEAR,
|
||||||
RESET
|
WORLD,
|
||||||
|
OFF
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
|||||||
|
|
||||||
public static final WeatherFlag PLOT_WEATHER_FLAG_RAIN = new WeatherFlag(PlotWeather.RAIN);
|
public static final WeatherFlag PLOT_WEATHER_FLAG_RAIN = new WeatherFlag(PlotWeather.RAIN);
|
||||||
public static final WeatherFlag PLOT_WEATHER_FLAG_CLEAR = new WeatherFlag(PlotWeather.CLEAR);
|
public static final WeatherFlag PLOT_WEATHER_FLAG_CLEAR = new WeatherFlag(PlotWeather.CLEAR);
|
||||||
public static final WeatherFlag PLOT_WEATHER_FLAG_OFF = new WeatherFlag(PlotWeather.RESET);
|
public static final WeatherFlag PLOT_WEATHER_FLAG_WORLD = new WeatherFlag(PlotWeather.WORLD);
|
||||||
|
public static final WeatherFlag PLOT_WEATHER_FLAG_OFF = new WeatherFlag(PlotWeather.OFF);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new flag instance.
|
* Construct a new flag instance.
|
||||||
@ -57,7 +58,8 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
|||||||
return switch (input.toLowerCase()) {
|
return switch (input.toLowerCase()) {
|
||||||
case "rain" -> flagOf(PlotWeather.RAIN);
|
case "rain" -> flagOf(PlotWeather.RAIN);
|
||||||
case "clear" -> flagOf(PlotWeather.CLEAR);
|
case "clear" -> flagOf(PlotWeather.CLEAR);
|
||||||
default -> flagOf(PlotWeather.RESET);
|
case "reset" -> flagOf(PlotWeather.WORLD);
|
||||||
|
default -> flagOf(PlotWeather.OFF);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +83,7 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
|||||||
return switch (value) {
|
return switch (value) {
|
||||||
case RAIN -> PLOT_WEATHER_FLAG_RAIN;
|
case RAIN -> PLOT_WEATHER_FLAG_RAIN;
|
||||||
case CLEAR -> PLOT_WEATHER_FLAG_CLEAR;
|
case CLEAR -> PLOT_WEATHER_FLAG_CLEAR;
|
||||||
|
case WORLD -> PLOT_WEATHER_FLAG_WORLD;
|
||||||
default -> PLOT_WEATHER_FLAG_OFF;
|
default -> PLOT_WEATHER_FLAG_OFF;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user