mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16: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
df842c355e
commit
e2700d3b28
@ -276,10 +276,12 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
case RAIN:
|
case RAIN:
|
||||||
this.player.setPlayerWeather(WeatherType.DOWNFALL);
|
this.player.setPlayerWeather(WeatherType.DOWNFALL);
|
||||||
break;
|
break;
|
||||||
case RESET:
|
case WORLD:
|
||||||
default:
|
|
||||||
this.player.resetPlayerWeather();
|
this.player.resetPlayerWeather();
|
||||||
break;
|
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()) {
|
if (plot.getFlag(TimeFlag.class) != TimeFlag.TIME_DISABLED.getValue().longValue()) {
|
||||||
player.setTime(Long.MAX_VALUE);
|
player.setTime(Long.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
Location lastLoc = player.getMeta("music");
|
Location lastLoc = player.getMeta("music");
|
||||||
|
@ -26,5 +26,8 @@
|
|||||||
package com.plotsquared.core.plot;
|
package com.plotsquared.core.plot;
|
||||||
|
|
||||||
public enum PlotWeather {
|
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_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.
|
||||||
@ -60,8 +61,11 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
|||||||
case "off":
|
case "off":
|
||||||
case "sun":
|
case "sun":
|
||||||
return flagOf(PlotWeather.CLEAR);
|
return flagOf(PlotWeather.CLEAR);
|
||||||
|
case "reset":
|
||||||
|
case "world":
|
||||||
|
return flagOf(PlotWeather.WORLD);
|
||||||
default:
|
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;
|
return PLOT_WEATHER_FLAG_RAIN;
|
||||||
case CLEAR:
|
case CLEAR:
|
||||||
return PLOT_WEATHER_FLAG_CLEAR;
|
return PLOT_WEATHER_FLAG_CLEAR;
|
||||||
|
case WORLD:
|
||||||
|
return PLOT_WEATHER_FLAG_WORLD;
|
||||||
default:
|
default:
|
||||||
return PLOT_WEATHER_FLAG_OFF;
|
return PLOT_WEATHER_FLAG_OFF;
|
||||||
}
|
}
|
||||||
@ -90,7 +96,7 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
|||||||
|
|
||||||
@Override public Collection<String> getTabCompletions() {
|
@Override public Collection<String> getTabCompletions() {
|
||||||
return Arrays
|
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