added proof of concept
This commit is contained in:
parent
334cbc10c4
commit
2b8dfad337
@ -1,9 +1,16 @@
|
||||
package xyz.louisvallat.sweetdreams;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public final class SweetDreams extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
@ -18,4 +25,18 @@ public final class SweetDreams extends JavaPlugin implements Listener {
|
||||
getLogger().info("Disabling plugin...");
|
||||
getLogger().info("Done disabling.");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onSleepEvent(PlayerBedEnterEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
player.sendMessage("You are sleeping");
|
||||
getServer().broadcastMessage(player.getName() + " is sleeping!");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onWakeEvent(PlayerBedLeaveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
player.sendMessage("You are awoken");
|
||||
getServer().broadcastMessage(player.getName() + " has awoken!");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user