Implement per-player Weather API. Adds BUKKIT-812
This commit is contained in:
committed by
Travis Watkins
parent
a7a5f273e3
commit
1bde25bb33
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -829,6 +830,26 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
public WeatherType weather = null;
|
||||
|
||||
public WeatherType getPlayerWeather() {
|
||||
return this.weather;
|
||||
}
|
||||
|
||||
public void setPlayerWeather(WeatherType type, boolean plugin) {
|
||||
if (!plugin && this.weather != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.weather = type;
|
||||
this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0));
|
||||
}
|
||||
|
||||
public void resetPlayerWeather() {
|
||||
this.weather = null;
|
||||
this.setPlayerWeather(this.o().getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "(" + this.name + " at " + this.locX + "," + this.locY + "," + this.locZ + ")";
|
||||
|
||||
Reference in New Issue
Block a user