-
Notifications
You must be signed in to change notification settings - Fork 0
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
4b97634
commit e9995a4
Showing
10 changed files
with
250 additions
and
86 deletions.
There are no files selected for viewing
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
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
52 changes: 52 additions & 0 deletions
52
src/main/java/us/mytheria/bloblib/entities/inventory/BlobInventoryClickEvent.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,52 @@ | ||
package us.mytheria.bloblib.entities.inventory; | ||
|
||
import org.bukkit.event.inventory.ClickType; | ||
import org.bukkit.event.inventory.InventoryAction; | ||
import org.bukkit.event.inventory.InventoryClickEvent; | ||
import org.bukkit.event.inventory.InventoryType; | ||
import org.bukkit.inventory.InventoryView; | ||
import org.jetbrains.annotations.NotNull; | ||
import us.mytheria.bloblib.api.BlobLibSoundAPI; | ||
import us.mytheria.bloblib.entities.message.BlobSound; | ||
|
||
import java.util.Objects; | ||
|
||
public class BlobInventoryClickEvent extends InventoryClickEvent { | ||
@NotNull | ||
private String clickSound; | ||
private boolean playClickSound; | ||
|
||
public static BlobInventoryClickEvent of(@NotNull InventoryClickEvent event) { | ||
Objects.requireNonNull(event, "'event' cannot be null"); | ||
return new BlobInventoryClickEvent(event.getView(), event.getSlotType(), event.getRawSlot(), event.getClick(), event.getAction()); | ||
} | ||
|
||
private BlobInventoryClickEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action) { | ||
super(view, type, slot, click, action); | ||
this.clickSound = "Builder.Button-Click"; | ||
this.playClickSound = true; | ||
} | ||
|
||
public boolean playClickSound() { | ||
return playClickSound; | ||
} | ||
|
||
public void setPlayClickSound(boolean playClickSound) { | ||
this.playClickSound = playClickSound; | ||
} | ||
|
||
@NotNull | ||
public String getClickSound() { | ||
return clickSound; | ||
} | ||
|
||
public void setClickSound(@NotNull String clickSound) { | ||
Objects.requireNonNull(clickSound, "'clickSound' cannot be null"); | ||
this.clickSound = clickSound; | ||
} | ||
|
||
@NotNull | ||
public BlobSound getClickBlobSound() { | ||
return Objects.requireNonNull(BlobLibSoundAPI.getInstance().getSound(getClickSound()), "Not a valid BlobSound: " + getClickSound()); | ||
} | ||
} |
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
Oops, something went wrong.