Skip to content

Commit

Permalink
Add time of day/weather check for bed enter, fixes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
mattboy9921 committed Jul 28, 2024
1 parent a928eca commit 2716c30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/mattlabs/skipnight/Vote.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ public void onLogoff(PlayerQuitEvent event) {
@EventHandler
public void onBedEnter(PlayerBedEnterEvent event) {
Player player = event.getPlayer();
// Player has permission and isn't the only one in the world
// Player has permission, isn't the only one in the world, and it is night (or storming)
if (player.hasPermission("skipnight.vote.night")
&& player.getWorld().getPlayers().size() > 1
&& timer == Timer.OFF) {
&& timer == Timer.OFF
&& (player.getWorld().getTime() > 12516 || player.getWorld().hasStorm())) {
platform.player(player).sendMessage(messages.beforeVote().inBedNoVoteInProg());
}
}
Expand Down

0 comments on commit 2716c30

Please sign in to comment.