mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-08-26 15:32:50 +02:00
Prevent players with essentials.sleepingignored permission from going to bed. Prevents a bug in bukkit.
This commit is contained in:
parent
81994160e8
commit
f3dc846b1b
|
@ -164,6 +164,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||
pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this);
|
||||
pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this);
|
||||
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
|
||||
pm.registerEvent(Type.PLAYER_BED_ENTER, playerListener, Priority.High, this);
|
||||
|
||||
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
|
||||
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationType;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
@ -380,4 +381,16 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||
user.updateActivity(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerBedEnter(PlayerBedEnterEvent event)
|
||||
{
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (event.getPlayer().isSleepingIgnored()) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage("You can't go to bed, your sleep is ignored.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user