Class SkipNightEvent

java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.general.SkipNightEvent
All Implemented Interfaces:
Cancellable

public final class SkipNightEvent extends Event implements Cancellable
Called when the night will be skipped (this happens when all players are sleeping in a bed during night time).
  • Method Details

    • getSkippedMinutes

      public int getSkippedMinutes()
      Gets the amount of minutes that will be skipped.
      Returns:
      the skipped minutes.
    • getCurrentHour

      public int getCurrentHour()
      Gets the current time (hour).
      Returns:
      the current time.
    • getCurrentMinutes

      public int getCurrentMinutes()
      Gets the current time (minutes).
      Returns:
      the current time.
    • getTargetHour

      public int getTargetHour()
      Gets the target time (hour), i.e the new time after skipping the night.
      Returns:
      the new time (hour).
    • getTargetMinutes

      public int getTargetMinutes()
      Gets the target time (minutes), i.e the new time after skipping the night.
      Returns:
      the new time (minutes).
    • setTargetTime

      public void setTargetTime(int hours, int minutes)
      Sets a new target time, which is the time that will be set after skipping the night.
      Parameters:
      hours - the new hours.
      minutes - the new minutes.
      Example: After skipping a night, we want the time to be 3:30 pm
      1@EventMethod
      2public void onSkipNightEvent(SkipNightEvent e) {
      3 e.setTargetTime(3, 30);
      4}
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Determines if the event is cancelled. If an event is cancelled, it will no longer be executed, but other plugins will still receive the event.

      Please note: If the event is threaded, cancellation has no effect, i.e the event will still be executed.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the event is cancelled, or false if not.
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: Cancellable
      Cancels this event. This means it will no longer be executed, but other plugins will still receive the event.

      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - set to true if you want to cancel this event.
      Example: Cancel "PlayerEnterAreaEvent", i.e prevent player from entering an area
      1//Listener class
      2public class PlayerListener implements Listener{
      3 @EventMethod
      4 public void onEnterArea(PlayerEnterAreaEvent evt){
      5 //Now the player will not be able to enter the area, i.e.
      6 //he will be teleported back to his old position (outside the area)
      7 evt.setCancelled(true);
      8 }
      9}