Klasse SkipNightEvent

java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.general.SkipNightEvent
Alle implementierten Schnittstellen:
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).
  • Methodendetails

    • getSkippedMinutes

      public int getSkippedMinutes()
      Gets the amount of minutes that will be skipped.
      Gibt zurück:
      the skipped minutes.
    • getCurrentHour

      public int getCurrentHour()
      Gets the current time (hour).
      Gibt zurück:
      the current time.
    • getCurrentMinutes

      public int getCurrentMinutes()
      Gets the current time (minutes).
      Gibt zurück:
      the current time.
    • getTargetHour

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

      public int getTargetMinutes()
      Gets the target time (minutes), i.e the new time after skipping the night.
      Gibt zurück:
      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.
      Parameter:
      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()
      Beschreibung aus Schnittstelle kopiert: 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.
      Angegeben von:
      isCancelled in Schnittstelle Cancellable
      Gibt zurück:
      true if the event is cancelled, or false if not.
    • setCancelled

      public void setCancelled(boolean cancel)
      Beschreibung aus Schnittstelle kopiert: Cancellable
      Cancels this event. This means it will no longer be executed, but other plugins will still receive the event.

      Angegeben von:
      setCancelled in Schnittstelle Cancellable
      Parameter:
      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}