mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +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
df842c355e
commit
e2700d3b28
@ -276,10 +276,12 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
case RAIN:
|
||||
this.player.setPlayerWeather(WeatherType.DOWNFALL);
|
||||
break;
|
||||
case RESET:
|
||||
default:
|
||||
case WORLD:
|
||||
this.player.resetPlayerWeather();
|
||||
break;
|
||||
default:
|
||||
//do nothing as this is PlotWeather.OFF
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,13 +362,14 @@ public class PlotListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (plot.getFlag(TimeFlag.class) != TimeFlag.TIME_DISABLED.getValue().longValue()) {
|
||||
player.setTime(Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
final PlotWeather plotWeather = plot.getFlag(WeatherFlag.class);
|
||||
if (plotWeather != PlotWeather.CLEAR) {
|
||||
player.setWeather(PlotWeather.RESET);
|
||||
if (plotWeather != PlotWeather.OFF) {
|
||||
player.setWeather(PlotWeather.WORLD);
|
||||
}
|
||||
|
||||
Location lastLoc = player.getMeta("music");
|
||||
|
@ -26,5 +26,8 @@
|
||||
package com.plotsquared.core.plot;
|
||||
|
||||
public enum PlotWeather {
|
||||
RAIN, CLEAR, RESET
|
||||
RAIN,
|
||||
CLEAR,
|
||||
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_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.
|
||||
@ -60,8 +61,11 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
||||
case "off":
|
||||
case "sun":
|
||||
return flagOf(PlotWeather.CLEAR);
|
||||
case "reset":
|
||||
case "world":
|
||||
return flagOf(PlotWeather.WORLD);
|
||||
default:
|
||||
return flagOf(PlotWeather.RESET);
|
||||
return flagOf(PlotWeather.OFF);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,6 +87,8 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
||||
return PLOT_WEATHER_FLAG_RAIN;
|
||||
case CLEAR:
|
||||
return PLOT_WEATHER_FLAG_CLEAR;
|
||||
case WORLD:
|
||||
return PLOT_WEATHER_FLAG_WORLD;
|
||||
default:
|
||||
return PLOT_WEATHER_FLAG_OFF;
|
||||
}
|
||||
@ -90,7 +96,7 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
||||
|
||||
@Override public Collection<String> getTabCompletions() {
|
||||
return Arrays
|
||||
.asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset");
|
||||
.asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset", "world");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user