Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PlayerReplaceEvent for when players changing their uuids
- Loading branch information
1 parent
ad08238
commit 4289271
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
API/src/main/java/com/bgsoftware/superiorskyblock/api/events/PlayerReplaceEvent.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,53 @@ | ||
package com.bgsoftware.superiorskyblock.api.events; | ||
|
||
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* PlayerReplaceEvent is called when a player changes his uuid and replaced with another one. | ||
*/ | ||
public class PlayerReplaceEvent extends Event { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final SuperiorPlayer oldPlayer; | ||
private final SuperiorPlayer newPlayer; | ||
|
||
/** | ||
* The constructor of the event. | ||
* | ||
* @param oldPlayer The old player that had his UUID changed. | ||
* @param newPlayer The new player that has the new UUID. | ||
*/ | ||
public PlayerReplaceEvent(SuperiorPlayer oldPlayer, SuperiorPlayer newPlayer) { | ||
super(!Bukkit.isPrimaryThread()); | ||
this.oldPlayer = oldPlayer; | ||
this.newPlayer = newPlayer; | ||
} | ||
|
||
/** | ||
* Get the old player that had his UUID changed. | ||
*/ | ||
public SuperiorPlayer getOldPlayer() { | ||
return oldPlayer; | ||
} | ||
|
||
/** | ||
* Get the new player that has the new UUID. | ||
*/ | ||
public SuperiorPlayer getNewPlayer() { | ||
return newPlayer; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
} |
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