Froze time using doDayNightCycle instead of setting the time on UpdateEvent.

Signed-off-by: Aaron Brock <TheMineBench@gmail.com>
This commit is contained in:
Aaron Brock 2015-06-20 01:36:05 -04:00
parent da981980df
commit 8ea23f96fc

View File

@ -32,6 +32,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
@ -121,7 +122,12 @@ public class GameLobbyManager implements Listener, IPacketHandler
packetHandler.addPacketHandler(this); packetHandler.addPacketHandler(this);
World world = UtilWorld.getWorld("world"); World world = UtilWorld.getWorld("world");
world.setTime(6000);
world.setStorm(false);
world.setThundering(false);
world.setGameRuleValue("doDaylightCycle", "false");
spawn = new Location(world, 0, 104, 0); spawn = new Location(world, 0, 104, 0);
_gameText = new Location(world, 0, 130, 50); _gameText = new Location(world, 0, 130, 50);
@ -752,9 +758,9 @@ public class GameLobbyManager implements Listener, IPacketHandler
{ {
if (event.getType() == UpdateType.FAST) if (event.getType() == UpdateType.FAST)
{ {
spawn.getWorld().setTime(6000); //spawn.getWorld().setTime(6000);
spawn.getWorld().setStorm(false); //spawn.getWorld().setStorm(false);
spawn.getWorld().setThundering(false); //spawn.getWorld().setThundering(false);
} }
@ -770,7 +776,16 @@ public class GameLobbyManager implements Listener, IPacketHandler
ScoreboardDisplay(event); ScoreboardDisplay(event);
ScoreboardSet(event); ScoreboardSet(event);
} }
@EventHandler
public void onWeather(WeatherChangeEvent event) {
if (!event.getWorld().equals(spawn.getWorld()))
return;
event.setCancelled(true);
}
@EventHandler @EventHandler
private void RemoveInvalidEnts(GameStateChangeEvent event) private void RemoveInvalidEnts(GameStateChangeEvent event)
{ {