-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58ef8c6
commit 13059b6
Showing
4 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/me/angeschossen/lands/api/events/land/block/LandBlockCreationEvent.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,31 @@ | ||
package me.angeschossen.lands.api.events.land.block; | ||
|
||
import me.angeschossen.lands.api.land.block.LandBlock; | ||
import me.angeschossen.lands.api.land.block.removalreason.LandBlockRemovalReason; | ||
import me.angeschossen.lands.api.player.LandPlayer; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class LandBlockCreationEvent extends LandBlockEvent { | ||
public static final HandlerList handlerList = new HandlerList(); | ||
|
||
/** | ||
* Create an instance of this event. | ||
* | ||
* @param landPlayer player that placed the landblock. If null, no player is involved. | ||
* @param landBlock landblock that is being placed | ||
*/ | ||
public LandBlockCreationEvent(@Nullable LandPlayer landPlayer, @NotNull LandBlock landBlock) { | ||
super(landBlock.getContainer().getLand(), landPlayer, landBlock); | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlerList; | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return handlerList; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/me/angeschossen/lands/api/events/land/block/LandBlockEvent.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,35 @@ | ||
package me.angeschossen.lands.api.events.land.block; | ||
|
||
import me.angeschossen.lands.api.events.land.LandEvent; | ||
import me.angeschossen.lands.api.land.Land; | ||
import me.angeschossen.lands.api.land.block.LandBlock; | ||
import me.angeschossen.lands.api.player.LandPlayer; | ||
import org.bukkit.event.Cancellable; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public abstract class LandBlockEvent extends LandEvent implements Cancellable { | ||
|
||
protected final @NotNull LandBlock landBlock; | ||
protected boolean cancelled; | ||
|
||
public LandBlockEvent(@NotNull Land land, @Nullable LandPlayer landPlayer, @NotNull LandBlock landBlock) { | ||
super(land, landPlayer); | ||
this.landBlock = landBlock; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
@NotNull | ||
public final LandBlock getLandBlock() { | ||
return landBlock; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/me/angeschossen/lands/api/events/land/block/LandBlockRemovalEvent.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,49 @@ | ||
package me.angeschossen.lands.api.events.land.block; | ||
|
||
import me.angeschossen.lands.api.events.land.LandEvent; | ||
import me.angeschossen.lands.api.events.land.bank.BankEvent; | ||
import me.angeschossen.lands.api.land.Land; | ||
import me.angeschossen.lands.api.land.block.LandBlock; | ||
import me.angeschossen.lands.api.land.block.removalreason.LandBlockRemovalReason; | ||
import me.angeschossen.lands.api.player.LandPlayer; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class LandBlockRemovalEvent extends LandBlockEvent { | ||
public static final HandlerList handlerList = new HandlerList(); | ||
private final @NotNull LandBlockRemovalReason reason; | ||
|
||
/** | ||
* Create an instance of this event. | ||
* | ||
* @param landPlayer player that initiated the removal. If null, no player is involved. | ||
* @param landBlock landblock that is being removed | ||
* @param reason the reason of the removal | ||
*/ | ||
public LandBlockRemovalEvent(@Nullable LandPlayer landPlayer, @NotNull LandBlock landBlock, @NotNull LandBlockRemovalReason reason) { | ||
super(landBlock.getContainer().getLand(), landPlayer, landBlock); | ||
|
||
this.reason = reason; | ||
} | ||
|
||
/** | ||
* Get the reason of the removal. | ||
* | ||
* @return reason of removal | ||
*/ | ||
@NotNull | ||
public final LandBlockRemovalReason getReason() { | ||
return reason; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlerList; | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return handlerList; | ||
} | ||
} |
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