forked from lishid/OpenInv
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove deprecated methods, restructure (#219)
- Loading branch information
Showing
63 changed files
with
970 additions
and
917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
api/src/main/java/com/lishid/openinv/event/PlayerSaveEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.lishid.openinv.event; | ||
|
||
|
||
import com.google.errorprone.annotations.RestrictedApi; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.event.player.PlayerEvent; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* Event fired before a {@link Player} loaded via OpenInv is saved. | ||
*/ | ||
public class PlayerSaveEvent extends PlayerEvent implements Cancellable { | ||
|
||
private static final HandlerList HANDLERS = new HandlerList(); | ||
|
||
private boolean cancelled = false; | ||
|
||
/** | ||
* Construct a new {@code PlayerSaveEvent}. | ||
* | ||
* <p>The constructor is not considered part of the API, and may be subject to change.</p> | ||
* | ||
* @param player the player to be saved | ||
*/ | ||
@RestrictedApi( | ||
explanation = "Constructor is not considered part of the API and may be subject to change.", | ||
link = "", | ||
allowedOnPath = ".*/com/lishid/openinv/event/(OpenPlayerSaveEvent|OpenEvents).java") | ||
@ApiStatus.Internal | ||
PlayerSaveEvent(@NotNull Player player) { | ||
super(player); | ||
} | ||
|
||
/** | ||
* Get whether the event is cancelled. | ||
* | ||
* @return true if the event is cancelled | ||
*/ | ||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
/** | ||
* Set whether the event is cancelled. | ||
* | ||
* @param cancel whether the event is cancelled | ||
*/ | ||
@Override | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return HANDLERS; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return HANDLERS; | ||
} | ||
|
||
} |
Oops, something went wrong.