Skip to content

Commit

Permalink
* Added the "isCancelBlockPlaceEvent" and "setCancelBlockPlaceEvent" …
Browse files Browse the repository at this point in the history
…methods to the "ShopCreationEvent" allowing cancelling of the internal "BlockPlaceEvent".

* Adjusted all events to set a default cancellation value.

Signed-off-by: XZot1K <[email protected]>
  • Loading branch information
XZot1K committed Nov 3, 2020
1 parent 8df9fc6 commit 85c23c9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion API Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
## API-VERSION 1.2 ##
## API-VERSION 1.2.1 ##
1 change: 1 addition & 0 deletions src/xzot1k/plugins/ds/api/events/ChatInteractionEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public ChatInteractionEvent(Player player, ChatInteractionType chatInteractionTy
setPlayer(player);
setChatInteractionType(chatInteractionType);
setPlayerEntryValue(playerEntryValue);
setCancelled(false);
}

public static HandlerList getHandlerList() {
Expand Down
13 changes: 11 additions & 2 deletions src/xzot1k/plugins/ds/api/events/ShopCreationEvent.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2020 XZot1K, All rights reserved.
*/

package xzot1k.plugins.ds.api.events;

import org.bukkit.Location;
Expand All @@ -13,12 +12,14 @@
public class ShopCreationEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player;
private boolean cancelled;
private boolean cancelled, cancelBlockPlaceEvent;
private Location location;

public ShopCreationEvent(Player player, Location location) {
setPlayer(player);
setLocation(location);
setCancelled(false);
setCancelBlockPlaceEvent(false);
}

public static HandlerList getHandlerList() {
Expand Down Expand Up @@ -56,4 +57,12 @@ public Location getLocation() {
public void setLocation(Location location) {
this.location = location;
}

public boolean isCancelBlockPlaceEvent() {
return cancelBlockPlaceEvent;
}

public void setCancelBlockPlaceEvent(boolean cancelBlockPlaceEvent) {
this.cancelBlockPlaceEvent = cancelBlockPlaceEvent;
}
}
1 change: 1 addition & 0 deletions src/xzot1k/plugins/ds/api/events/ShopDeletionEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class ShopDeletionEvent extends Event implements Cancellable {
public ShopDeletionEvent(Player player, Location location) {
setPlayer(player);
setLocation(location);
setCancelled(false);
}

public static HandlerList getHandlerList() {
Expand Down
1 change: 1 addition & 0 deletions src/xzot1k/plugins/ds/api/events/ShopEditEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class ShopEditEvent extends Event implements Cancellable {
public ShopEditEvent(Player player, Shop shop) {
this.player = player;
this.shop = shop;
setCancelled(false);
}

// getters & setters
Expand Down
1 change: 1 addition & 0 deletions src/xzot1k/plugins/ds/api/events/ShopTransactionEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class ShopTransactionEvent extends Event implements Cancellable {
public ShopTransactionEvent(Player player, Shop shop) {
this.player = player;
this.shop = shop;
setCancelled(false);
}

// getters & setters
Expand Down
1 change: 1 addition & 0 deletions src/xzot1k/plugins/ds/api/events/ShopVisitEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public ShopVisitEvent(Player player, Shop shop, double chargeAmount) {
setPlayer(player);
setShop(shop);
setChargeAmount(chargeAmount);
setCancelled(false);
}

public static HandlerList getHandlerList() {
Expand Down

0 comments on commit 85c23c9

Please sign in to comment.