mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-25 12:05:16 +01:00
Add some Api RecipeName <-> ItemStack
This commit is contained in:
parent
2ee7dd825d
commit
e2d27641af
3
pom.xml
3
pom.xml
@ -107,11 +107,12 @@
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!--MMOLib -->
|
||||
<!-- MMOLib -->
|
||||
<id>MMOPlugins</id>
|
||||
<url>https://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- Shopkeepers -->
|
||||
<id>Lichtspiele</id>
|
||||
<url>https://nexus.lichtspiele.org/repository/releases/</url>
|
||||
</repository>
|
||||
|
@ -453,6 +453,7 @@ recipes:
|
||||
# -- Plugin Kompatiblität --
|
||||
|
||||
# Andere Plugins (wenn installiert) nach Rechten zum öffnen von Fässern checken [true]
|
||||
# Plugins 'Landlord' und 'Protection Stones' nutzen WorldGuard. 'ClaimChunk' wird nativ unterstützt.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -462,6 +463,7 @@ useCitadel: true
|
||||
|
||||
# Beim öffnen eine virtuelle Kiste nutzen um Rechte bei alle anderen Plugins abzufragen
|
||||
# Könnte Anti-Cheat plugins verwirren aber sonst ok zu aktivieren
|
||||
# Diese Option für das Plugin 'Residence' aktivieren, und andere Plugins, die nicht alle Fälle des PlayerInteractEvent checken
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Änderungen an Fassinventaren mit LogBlock aufzeichen [true]
|
||||
|
@ -455,6 +455,7 @@ recipes:
|
||||
# -- Plugin Compatibility --
|
||||
|
||||
# Enable checking of other Plugins (if installed) for Barrel Permissions [true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -464,6 +465,7 @@ useCitadel: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Enable the Logging of Barrel Inventories to LogBlock [true]
|
||||
|
@ -450,6 +450,7 @@ recipes:
|
||||
# -- Compatibilité entre Plugins --
|
||||
|
||||
# Activer la vérification des autres plugins (si installés) pour les permissions des tonneaux. [true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -459,6 +460,7 @@ useCitadel: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Activer l'historique du contenu des tonneaux avec LogBlock [true]
|
||||
|
@ -442,6 +442,7 @@ recipes:
|
||||
# -- Compatibilità con altri plugin --
|
||||
|
||||
# Abilita il controllo della presenza di altri plugin per i permessi relativi ai barili[true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -451,6 +452,7 @@ useCitadel: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Abilita il logging degli inventari dei barili [true]
|
||||
|
@ -850,6 +850,7 @@ recipes:
|
||||
# -- Plugin Kompatiblität --
|
||||
|
||||
# Andere Plugins (wenn installiert) nach Rechten zum öffnen von Fässern checken [true]
|
||||
# Plugins 'Landlord' und 'Protection Stones' nutzen WorldGuard. 'ClaimChunk' wird nativ unterstützt.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -858,6 +859,7 @@ useGMInventories: true
|
||||
|
||||
# Beim Fass öffnen eine virtuelle Kiste nutzen um Rechte bei allen anderen Plugins abzufragen
|
||||
# Könnte Anti-Cheat plugins verwirren aber sonst ok zu aktivieren
|
||||
# Diese Option für das Plugin 'Residence' aktivieren, und andere Plugins, die nicht alle Fälle des PlayerInteractEvent checken
|
||||
useVirtualChestPerms: false
|
||||
|
||||
|
||||
|
@ -844,6 +844,7 @@ recipes:
|
||||
# -- Plugin Compatibility --
|
||||
|
||||
# Enable checking of other Plugins (if installed) for Barrel Permissions [true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -852,6 +853,7 @@ useGMInventories: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Enable the Logging of Barrel Inventories to LogBlock [true]
|
||||
|
@ -844,6 +844,7 @@ recipes:
|
||||
# -- Plugin Compatibility --
|
||||
|
||||
# Enable checking of other Plugins (if installed) for Barrel Permissions [true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -852,6 +853,7 @@ useGMInventories: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Enable the Logging of Barrel Inventories to LogBlock [true]
|
||||
|
@ -850,6 +850,7 @@ recipes:
|
||||
# -- Compatibilité entre Plugins --
|
||||
|
||||
# Activer la vérification des autres plugins (si installés) pour les permissions des tonneaux. [true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -858,6 +859,7 @@ useGMInventories: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Activer l'historique du contenu des tonneaux avec LogBlock [true]
|
||||
|
@ -844,6 +844,7 @@ eggnog:
|
||||
# -- Compatibilità con altri plugin --
|
||||
|
||||
# Abilita il controllo della presenza di altri plugin per i permessi relativi ai barili[true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -852,6 +853,7 @@ useGMInventories: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# Abilita il logging degli inventari dei barili [true]
|
||||
|
@ -848,6 +848,7 @@ recipes:
|
||||
# -- 插件兼容性 --
|
||||
|
||||
# 检查插件以进行权限配置[true]
|
||||
# Plugins 'Landlord' and 'Protection Stones' use the WorldGuard Flag. 'ClaimChunk' is natively supported.
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
@ -856,6 +857,7 @@ useGMInventories: true
|
||||
|
||||
# Use a virtual chest when opening a Barrel to check with all other protection plugins
|
||||
# This could confuse Anti-Cheat plugins, but is otherwise good to use
|
||||
# use this for 'Residence' Plugin and any others that don't check all cases in the PlayerInteractEvent
|
||||
useVirtualChestPerms: false
|
||||
|
||||
# 对LogBlock启用方块数据录入[true]
|
||||
|
@ -147,6 +147,21 @@ public class BreweryApi {
|
||||
return Brew.isBrew(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Brew for the given Recipe Name
|
||||
*
|
||||
* @param recipeName The Name of the Recipe to create this Brew from
|
||||
* @return The Brew that was created. Can use brew.createItem() to get an ItemStack
|
||||
*/
|
||||
@Nullable
|
||||
public static Brew createBrew(String recipeName, int quality) {
|
||||
BRecipe matching = BRecipe.getMatching(recipeName);
|
||||
if (matching != null) {
|
||||
return matching.createBrew(quality);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Brew from the given Recipe.
|
||||
*
|
||||
@ -157,6 +172,62 @@ public class BreweryApi {
|
||||
return recipe.createBrew(quality);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create ItemStack for the given Recipe Name
|
||||
*
|
||||
* @param recipeName The Name of the Recipe to create this Item from
|
||||
* @param quality The Quality of the Brew Item
|
||||
* @return The Brew- ItemStack with Brew information stored on it
|
||||
*/
|
||||
@Nullable
|
||||
public static ItemStack createBrewItem(String recipeName, int quality) {
|
||||
BRecipe matching = BRecipe.getMatching(recipeName);
|
||||
if (matching != null) {
|
||||
return matching.create(quality);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create ItemStack for the given Recipe
|
||||
*
|
||||
* @param recipe The Recipe to create this Item from
|
||||
* @param quality The Quality of the Brew Item
|
||||
* @return The Brew- ItemStack with Brew information stored on it
|
||||
*/
|
||||
public static ItemStack createBrewItem(BRecipe recipe, int quality) {
|
||||
return recipe.create(quality);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Name of the Current Recipe of the given ItemStack
|
||||
*
|
||||
* @param item The ItemStack to get the Recipe Name of
|
||||
* @return The middle-quality name of the current Recipe. Null if it is not a brew, or it currently has no Recipe
|
||||
*/
|
||||
@Nullable
|
||||
public static String getRecipeName(ItemStack item) {
|
||||
Brew brew = Brew.get(item);
|
||||
if (brew != null) {
|
||||
return getRecipeName(brew);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Name of the Current Recipe of the given Brew
|
||||
*
|
||||
* @param brew The Brew to get the Recipe Name of
|
||||
* @return The middle-quality name of the current Brew Recipe. Null if it currently has no Recipe
|
||||
*/
|
||||
@Nullable
|
||||
public static String getRecipeName(Brew brew) {
|
||||
BRecipe recipe = brew.getCurrentRecipe();
|
||||
if (recipe != null) {
|
||||
return recipe.getRecipeName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// # # # # # # # # # # # #
|
||||
// # # # # # Barrel # # # # #
|
||||
|
@ -23,7 +23,7 @@ public class ShopKeepersListener implements Listener {
|
||||
Set<HumanEntity> openedEditors = new HashSet<>();
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onShopCreated(PlayerOpenUIEvent event) {
|
||||
public void onShopkeeperOpen(PlayerOpenUIEvent event) {
|
||||
try {
|
||||
if (event.getUIType() == DefaultUITypes.EDITOR() || event.getUIType() == DefaultUITypes.TRADING()) {
|
||||
openedEditors.add(event.getPlayer());
|
||||
|
Loading…
Reference in New Issue
Block a user