mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-27 01:41:30 +01:00
feat: Adds previous island owner to IslandOwnershipTransferEvent
(#14)
Instead of resolving the previous owner and risk a potential web/api request getting triggert, although the previous owner might never be used, I decided on just providing the UUID we already have. The plugins can then still find the (Offline)Player themselves when needed.
This commit is contained in:
parent
0b685b31df
commit
3aa85c751e
@ -5,26 +5,34 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class IslandOwnershipTransferEvent extends IslandEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
|
||||
private final OfflinePlayer owner;
|
||||
private final UUID previousOwnerId;
|
||||
|
||||
public IslandOwnershipTransferEvent(Island island, OfflinePlayer owner) {
|
||||
public IslandOwnershipTransferEvent(Island island, OfflinePlayer owner, UUID previousOwnerId) {
|
||||
super(island);
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
this.previousOwnerId = previousOwnerId;
|
||||
}
|
||||
|
||||
public OfflinePlayer getOwner() {
|
||||
return this.owner;
|
||||
}
|
||||
|
||||
public UUID getPreviousOwnerId() {
|
||||
return this.previousOwnerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ public class IslandManager {
|
||||
removeIsland(uuid2);
|
||||
this.islandStorage.put(player.getUniqueId(), island);
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(new IslandOwnershipTransferEvent(island.getAPIWrapper(), player));
|
||||
Bukkit.getServer().getPluginManager().callEvent(new IslandOwnershipTransferEvent(island.getAPIWrapper(), player, uuid2));
|
||||
|
||||
ArrayList<UUID> islandMembers = new ArrayList<>();
|
||||
islandMembers.addAll(island.getRole(IslandRole.MEMBER));
|
||||
|
Loading…
Reference in New Issue
Block a user