For Episode 2:
package me.illuminatiproductions.spigotsandboxproject;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerBedLeaveEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class SpigotSandboxProject extends JavaPlugin implements Listener {
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("The plugin has started UP.");
//Register your events
getServer().getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
System.out.println("Plugin shutdown.");
}
//The Event
@EventHandler
public void onLeaveBed(PlayerBedLeaveEvent event){ //Event triggers when someone leaves a bed
//The code that is run when the player leaves his/her bed ;)
Player player = event.getPlayer(); //A variable representation of the player who left his bed
player.sendMessage("Damn you woke.");
}
}