mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 11:26:42 +00:00
Added an entity, weathertype, and gamemode registry.
This commit is contained in:
@ -38,6 +38,8 @@ import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.World;
|
||||
@ -348,6 +350,51 @@ public class BukkitWorld extends AbstractWorld {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeatherType getWeather() {
|
||||
if (getWorld().isThundering()) {
|
||||
return WeatherTypes.THUNDER_STORM;
|
||||
} else if (getWorld().hasStorm()) {
|
||||
return WeatherTypes.RAIN;
|
||||
}
|
||||
|
||||
return WeatherTypes.CLEAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRemainingWeatherDuration() {
|
||||
return getWorld().getWeatherDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeather(WeatherType weatherType) {
|
||||
if (weatherType == WeatherTypes.THUNDER_STORM) {
|
||||
getWorld().setThundering(true);
|
||||
} else if (weatherType == WeatherTypes.RAIN) {
|
||||
getWorld().setStorm(true);
|
||||
} else {
|
||||
getWorld().setStorm(false);
|
||||
getWorld().setThundering(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeather(WeatherType weatherType, long duration) {
|
||||
// Who named these methods...
|
||||
if (weatherType == WeatherTypes.THUNDER_STORM) {
|
||||
getWorld().setThundering(true);
|
||||
getWorld().setThunderDuration((int) duration);
|
||||
getWorld().setWeatherDuration((int) duration);
|
||||
} else if (weatherType == WeatherTypes.RAIN) {
|
||||
getWorld().setStorm(true);
|
||||
getWorld().setWeatherDuration((int) duration);
|
||||
} else {
|
||||
getWorld().setStorm(false);
|
||||
getWorld().setThundering(false);
|
||||
getWorld().setWeatherDuration((int) duration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulateBlockMine(Vector pt) {
|
||||
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
||||
|
Reference in New Issue
Block a user