Stop lobbies being night

This commit is contained in:
Sam 2018-01-23 13:17:38 +00:00 committed by Alexander Meech
parent a577e645d2
commit 440ff7feeb

View File

@ -5,6 +5,7 @@ import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
@ -27,13 +28,9 @@ public class MythicalRewardAnimation extends TreasureRewardAnimation
.withFlicker() .withFlicker()
.build(); .build();
private long _currentTime;
public MythicalRewardAnimation(Treasure treasure, TreasureLocation treasureLocation, Location location, RewardData rewardData) public MythicalRewardAnimation(Treasure treasure, TreasureLocation treasureLocation, Location location, RewardData rewardData)
{ {
super(treasure, treasureLocation, location, rewardData); super(treasure, treasureLocation, location, rewardData);
_currentTime = location.getWorld().getTime();
} }
@Override @Override
@ -49,7 +46,10 @@ public class MythicalRewardAnimation extends TreasureRewardAnimation
{ {
if (getTicks() % 5 == 0) if (getTicks() % 5 == 0)
{ {
getLocation().getWorld().setTime(getLocation().getWorld().getTime() + 12000); for (Player player : getLocation().getWorld().getPlayers())
{
player.setPlayerTime(player.getPlayerTime() + 12000, false);
}
} }
if (getTicks() % 2 == 0) if (getTicks() % 2 == 0)
@ -72,6 +72,9 @@ public class MythicalRewardAnimation extends TreasureRewardAnimation
@Override @Override
protected void onFinish() protected void onFinish()
{ {
getLocation().getWorld().setTime(_currentTime); for (Player player : getLocation().getWorld().getPlayers())
{
player.resetPlayerTime();
}
} }
} }