Skip to content

Commit

Permalink
Merge pull request #144 from mrgeneralq/hotfix
Browse files Browse the repository at this point in the history
hotfix for players not being registered
  • Loading branch information
mrgeneralq authored Sep 1, 2022
2 parents 713a1a6 + 941fdac commit e07f9e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.mrgeneralq</groupId>
<artifactId>sleep-most</artifactId>
<version>5.1.0</version>
<version>5.1.1</version>
<name>SleepMost</name>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import me.mrgeneralq.sleepmost.interfaces.IInsomniaService;
import me.mrgeneralq.sleepmost.interfaces.ISleepMostPlayerService;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.entity.Player;

import java.util.stream.Collectors;

public class InsomniaService implements IInsomniaService {

private final ISleepMostPlayerService sleepMostPlayerService;
Expand All @@ -26,12 +29,16 @@ public void enableInsomnia(World world) {

@Override
public void disableInsomnia(Player player, World world) {

if(!player.isOnline())
return;

this.sleepMostPlayerService.getPlayer(player).setInsomniaStatus(world, false);
}

@Override
public void disableInsomnia(World world) {
for(Player p: world.getPlayers())
for(Player p: world.getPlayers().stream().filter(OfflinePlayer::isOnline).collect(Collectors.toList()))
this.disableInsomnia(p, world);
}

Expand Down

0 comments on commit e07f9e1

Please sign in to comment.