mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 10:08:54 +00:00
Load Scramble Seed key from Config
Remember all used Scramble seeds to unscramble potions
This commit is contained in:
@@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BreweryApi {
|
||||
|
||||
@@ -46,6 +47,7 @@ public class BreweryApi {
|
||||
* Checks if item is actually a Brew
|
||||
* Returns null if item is not a Brew
|
||||
*/
|
||||
@Nullable
|
||||
public static Brew getBrew(ItemStack item) {
|
||||
return Brew.get(item);
|
||||
}
|
||||
@@ -56,6 +58,7 @@ public class BreweryApi {
|
||||
* Checks if meta has a Brew saved
|
||||
* Returns null if meta is not a Brew
|
||||
*/
|
||||
@Nullable
|
||||
public static Brew getBrew(ItemMeta meta) {
|
||||
return Brew.get(meta);
|
||||
}
|
||||
@@ -68,6 +71,7 @@ public class BreweryApi {
|
||||
* May be any Wood, Fence, Sign that is part of a Barrel
|
||||
* Returns null if block is not part of a Barrel
|
||||
*/
|
||||
@Nullable
|
||||
public static Barrel getBarrel(Block block) {
|
||||
return Barrel.get(block);
|
||||
}
|
||||
@@ -77,6 +81,7 @@ public class BreweryApi {
|
||||
* May be any Wood, Fence or Sign that is part of a Barrel
|
||||
* Returns null if block is not part of a Barrel
|
||||
*/
|
||||
@Nullable
|
||||
public static Inventory getBarrelInventory(Block block) {
|
||||
Barrel barrel = Barrel.get(block);
|
||||
if (barrel != null) {
|
||||
@@ -115,6 +120,7 @@ public class BreweryApi {
|
||||
* Get a BCauldron from a Block
|
||||
* Returns null if block is not a BCauldron
|
||||
*/
|
||||
@Nullable
|
||||
public static BCauldron getCauldron(Block block) {
|
||||
return BCauldron.get(block);
|
||||
}
|
||||
@@ -136,6 +142,7 @@ public class BreweryApi {
|
||||
* The name is the middle one of the three if three are set in the config
|
||||
* Returns null if recipe with that name does not exist
|
||||
*/
|
||||
@Nullable
|
||||
public static BRecipe getRecipe(String name) {
|
||||
return BRecipe.get(name);
|
||||
}
|
||||
|
||||
@@ -3,20 +3,23 @@ package com.dre.brewery.api.events.brew;
|
||||
import com.dre.brewery.Brew;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class BrewEvent extends Event {
|
||||
protected final Brew brew;
|
||||
protected final ItemMeta meta;
|
||||
|
||||
public BrewEvent(Brew brew, ItemMeta meta) {
|
||||
public BrewEvent(@NotNull Brew brew, @NotNull ItemMeta meta) {
|
||||
this.brew = brew;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Brew getBrew() {
|
||||
return brew;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ItemMeta getItemMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/*
|
||||
* A Brew has been created or modified
|
||||
@@ -19,15 +20,17 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
|
||||
public BrewModifyEvent(Brew brew, ItemMeta meta, Type type) {
|
||||
public BrewModifyEvent(@NotNull Brew brew, @NotNull ItemMeta meta, @NotNull Type type) {
|
||||
super(brew, meta);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public BrewLore getLore() {
|
||||
return new BrewLore(getBrew(), (PotionMeta) getItemMeta());
|
||||
}
|
||||
@@ -46,6 +49,7 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
||||
Reference in New Issue
Block a user