diff --git a/src/main/java/world/bentobox/bentobox/api/events/IslandBaseEvent.java b/src/main/java/world/bentobox/bentobox/api/events/IslandBaseEvent.java index 55567d90d..c0002f2fc 100644 --- a/src/main/java/world/bentobox/bentobox/api/events/IslandBaseEvent.java +++ b/src/main/java/world/bentobox/bentobox/api/events/IslandBaseEvent.java @@ -15,10 +15,10 @@ import world.bentobox.bentobox.database.objects.Island; public class IslandBaseEvent extends PremadeEvent implements Cancellable { private boolean cancelled; - private final Island island; - private final UUID playerUUID; - private final boolean admin; - private final Location location; + protected final Island island; + protected final UUID playerUUID; + protected final boolean admin; + protected final Location location; public IslandBaseEvent(Island island) { super(); diff --git a/src/main/java/world/bentobox/bentobox/api/events/team/TeamEvent.java b/src/main/java/world/bentobox/bentobox/api/events/team/TeamEvent.java index de4201d60..a85a85982 100644 --- a/src/main/java/world/bentobox/bentobox/api/events/team/TeamEvent.java +++ b/src/main/java/world/bentobox/bentobox/api/events/team/TeamEvent.java @@ -34,61 +34,81 @@ public class TeamEvent { public static class TeamJoinEvent extends IslandBaseEvent { private TeamJoinEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } public static class TeamInviteEvent extends IslandBaseEvent { private TeamInviteEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } public static class TeamLeaveEvent extends IslandBaseEvent { private TeamLeaveEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } public static class TeamRejectEvent extends IslandBaseEvent { private TeamRejectEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } public static class TeamKickEvent extends IslandBaseEvent { private TeamKickEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } + /** + * Event fires before a make leader is performed on an island. + * To get the old owner, get from the island object. The new leader is the player's UUID. + * @author tastybento + * + */ public static class TeamMakeLeaderEvent extends IslandBaseEvent { private TeamMakeLeaderEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } + /** + * Convenience method to get the old owner of the island + * @return UUID of old owner + */ + public UUID getOldOwner() { + return island.getOwner(); + } + /** + * Convenience method to get the new owner of the island + * @return UUID of new owner + */ + public UUID getNewOwner() { + return playerUUID; + } } public static class TeamInfoEvent extends IslandBaseEvent { private TeamInfoEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } public static class TeamDeleteEvent extends IslandBaseEvent { private TeamDeleteEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } public static class TeamUninviteEvent extends IslandBaseEvent { private TeamUninviteEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } } public static class TeamGeneralEvent extends IslandBaseEvent { private TeamGeneralEvent(Island island, UUID player, boolean admin, Location location) { - // Final variables have to be declared in the constuctor + // Final variables have to be declared in the constructor super(island, player, admin, location); } }