diff --git a/resources/config/v12/de/config.yml b/resources/config/v12/de/config.yml index d9204ff..18280ec 100644 --- a/resources/config/v12/de/config.yml +++ b/resources/config/v12/de/config.yml @@ -221,8 +221,8 @@ cauldron: # alcohol: Alkoholgehalt 0-100 in absoluter Menge bei perfektem Getränk (wird dem Spieler hinzugefügt, bei 100 = tot) # lore: Auflistung von zusätzlichem Text auf dem fertigen Trank. (Farbcodes möglich: z.b. &6) # Lore nur für bestimmte Qualität möglich mit + Schlecht, ++ Mittel, +++ Gut, vorne anhängen. -# servercommands: Liste von Befehlen ausgeführt vom -Server- wenn der Trank getrunken wird (%player_name% benutzbar) -# playercommands: Liste von Befehlen ausgeführt vom -Spieler- wenn der Trank getrunken wird (%player_name% benutzbar) +# servercommands: Liste von Befehlen ausgeführt vom -Server- wenn der Trank getrunken wird (%player_name% %quality% benutzbar) +# playercommands: Liste von Befehlen ausgeführt vom -Spieler- wenn der Trank getrunken wird (%player_name% %quality% benutzbar) # drinkmessage: Nachricht im Chat beim trinken des Trankes # drinktitle: Nachricht als Titel auf dem Bildschirm an den Spieler beim trinken des Trankes # customModelData: Custom Model Data Modelldaten. Mit dieser Zahl kann die Tranktextur mit einem Resourcepack geändert werden diff --git a/resources/config/v12/en/config.yml b/resources/config/v12/en/config.yml index 6275524..2167716 100644 --- a/resources/config/v12/en/config.yml +++ b/resources/config/v12/en/config.yml @@ -222,8 +222,8 @@ cauldron: # alcohol: Absolute amount of alcohol 0-100 in a perfect potion (will be added directly to the player, where 100 means fainting) # lore: List of additional text on the finished brew. (Formatting codes possible: such as &6) # Specific lore for quality possible, using + bad, ++ normal, +++ good, added to the front of the line. -# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name%) -# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name%) +# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name% %quality%) +# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name% %quality%) # drinkmessage: Chat-message to the Player when drinking the Brew # drinktitle: Title on Screen to the Player when drinking the Brew # customModelData: Custom Model Data Tag. This is a number that can be used to add custom textures to the item. diff --git a/resources/config/v12/fr/config.yml b/resources/config/v12/fr/config.yml index be5209f..3a2c083 100644 --- a/resources/config/v12/fr/config.yml +++ b/resources/config/v12/fr/config.yml @@ -225,8 +225,8 @@ cauldron: # alcohol: Le montant d'alcool absolu dans une boisson parfaite (cela sera ajouté directement au joueur, où 100% entraînera l'évanouissement), un degré d'alcooléisme en fait # lore: Liste des textes supplémentaires sur le breuvage fini. (Codes de formatage possibles : tels que &6) # Texte spécifique de qualité possible, en utilisant + mauvais, ++ normal, +++ bon, ajouté à l'avant de la ligne. -# servercommands: Liste des commandes exécutées par le serveur lors de la consommation de la potion (Peut utiliser %player_name%) -# playercommands: Liste des commandes exécutées par le joueur lors de la consommation de la potion (Peut utiliser %player_name%) +# servercommands: Liste des commandes exécutées par le serveur lors de la consommation de la potion (Peut utiliser %player_name% %quality%) +# playercommands: Liste des commandes exécutées par le joueur lors de la consommation de la potion (Peut utiliser %player_name% %quality%) # drinkmessage: Chat-message au joueur lorsqu'il boit la potion # drinktitle: Titre à l'écran du joueur lorsqu'il boit la potion # customModelData: Custom Model Data Tag. This is a number that can be used to add custom textures to the item. diff --git a/resources/config/v12/it/config.yml b/resources/config/v12/it/config.yml index 571f61f..bb29382 100644 --- a/resources/config/v12/it/config.yml +++ b/resources/config/v12/it/config.yml @@ -220,8 +220,8 @@ cauldron: # alcohol: Volume alcolico da 0 a 100 nella versione perfetta (sarà aggiunta direttamente al giocatore, dove 100 è la quantità massima di alcohol assorbibile. # lore: List of additional text on the finished brew. (Formatting codes possible: such as &6) # Specific lore for quality possible, using + bad, ++ normal, +++ good, added to the front of the line. -# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name%) -# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name%) +# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name% %quality%) +# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name% %quality%) # drinkmessage: Chat-message to the Player when drinking the Brew # drinktitle: Title on Screen to the Player when drinking the Brew # customModelData: Custom Model Data Tag. This is a number that can be used to add custom textures to the item. diff --git a/resources/config/v13/de/config.yml b/resources/config/v13/de/config.yml index ae9a625..dd41915 100644 --- a/resources/config/v13/de/config.yml +++ b/resources/config/v13/de/config.yml @@ -354,8 +354,8 @@ cauldron: # alcohol: Alkoholgehalt 0-100 in absoluter Menge bei perfektem Getränk (wird dem Spieler hinzugefügt, bei 100 = tot) # lore: Auflistung von zusätzlichem Text auf dem fertigen Trank. (Farbcodes möglich: z.b. &6) # Lore nur für bestimmte Qualität möglich mit + Schlecht, ++ Mittel, +++ Gut, vorne anhängen. -# servercommands: Liste von Befehlen ausgeführt vom -Server- wenn der Trank getrunken wird (%player_name% benutzbar) -# playercommands: Liste von Befehlen ausgeführt vom -Spieler- wenn der Trank getrunken wird (%player_name% benutzbar) +# servercommands: Liste von Befehlen ausgeführt vom -Server- wenn der Trank getrunken wird (%player_name% %quality% benutzbar) +# playercommands: Liste von Befehlen ausgeführt vom -Spieler- wenn der Trank getrunken wird (%player_name% %quality% benutzbar) # drinkmessage: Nachricht im Chat beim trinken des Trankes # drinktitle: Nachricht als Titel auf dem Bildschirm an den Spieler beim trinken des Trankes # customModelData: Custom Model Data Modelldaten. Mit dieser Zahl kann die Tranktextur mit einem Resourcepack geändert werden diff --git a/resources/config/v13/en/config.yml b/resources/config/v13/en/config.yml index dae6317..5e07129 100644 --- a/resources/config/v13/en/config.yml +++ b/resources/config/v13/en/config.yml @@ -354,8 +354,8 @@ cauldron: # alcohol: Absolute amount of alcohol 0-100 in a perfect potion (will be added directly to the player, where 100 means fainting) # lore: List of additional text on the finished brew. (Formatting codes possible: such as &6) # Specific lore for quality possible, using + bad, ++ normal, +++ good, added to the front of the line. -# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name%) -# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name%) +# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name% %quality%) +# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name% %quality%) # drinkmessage: Chat-message to the Player when drinking the Brew # drinktitle: Title on Screen to the Player when drinking the Brew # customModelData: Custom Model Data Tag. This is a number that can be used to add custom textures to the item. diff --git a/resources/config/v13/fr/config.yml b/resources/config/v13/fr/config.yml index 67a84e2..4f7bb6f 100644 --- a/resources/config/v13/fr/config.yml +++ b/resources/config/v13/fr/config.yml @@ -358,8 +358,8 @@ cauldron: # alcohol: Le montant d'alcool absolu dans une boisson parfaite (cela sera ajouté directement au joueur, où 100% entraînera l'évanouissement), un degré d'alcooléisme en fait # lore: Liste des textes supplémentaires sur le breuvage fini. (Codes de formatage possibles : tels que &6) # Texte spécifique de qualité possible, en utilisant + mauvais, ++ normal, +++ bon, ajouté à l'avant de la ligne. -# servercommands: Liste des commandes exécutées par le serveur lors de la consommation de la potion (Peut utiliser %player_name%) -# playercommands: Liste des commandes exécutées par le joueur lors de la consommation de la potion (Peut utiliser %player_name%) +# servercommands: Liste des commandes exécutées par le serveur lors de la consommation de la potion (Peut utiliser %player_name% %quality%) +# playercommands: Liste des commandes exécutées par le joueur lors de la consommation de la potion (Peut utiliser %player_name% %quality%) # drinkmessage: Chat-message au joueur lorsqu'il boit la potion # drinktitle: Titre à l'écran du joueur lorsqu'il boit la potion # customModelData: Custom Model Data Tag. This is a number that can be used to add custom textures to the item. diff --git a/resources/config/v13/it/config.yml b/resources/config/v13/it/config.yml index ff837c4..9685018 100644 --- a/resources/config/v13/it/config.yml +++ b/resources/config/v13/it/config.yml @@ -354,8 +354,8 @@ cauldron: # alcohol: Volume alcolico da 0 a 100 nella versione perfetta (sarà aggiunta direttamente al giocatore, dove 100 è la quantità massima di alcohol assorbibile. # lore: List of additional text on the finished brew. (Formatting codes possible: such as &6) # Specific lore for quality possible, using + bad, ++ normal, +++ good, added to the front of the line. -# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name%) -# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name%) +# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name% %quality%) +# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name% %quality%) # drinkmessage: Chat-message to the Player when drinking the Brew # drinktitle: Title on Screen to the Player when drinking the Brew # customModelData: Custom Model Data Tag. This is a number that can be used to add custom textures to the item. diff --git a/resources/config/v13/zh/config.yml b/resources/config/v13/zh/config.yml index d996015..f87e753 100644 --- a/resources/config/v13/zh/config.yml +++ b/resources/config/v13/zh/config.yml @@ -357,8 +357,8 @@ cauldron: # alcohol: 完美质量的饮品所含有的酒精度(百分数, 会被直接添加到玩家身上, 100意为直接昏迷) # lore: List of additional text on the finished brew. (Formatting codes possible: such as &6) # Specific lore for quality possible, using + bad, ++ normal, +++ good, added to the front of the line. -# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name%) -# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name%) +# servercommands: List of Commands executed by the -Server- when drinking the brew (Can use %player_name% %quality%) +# playercommands: List of Commands executed by the -Player- when drinking the brew (Can use %player_name% %quality%) # drinkmessage: Chat-message to the Player when drinking the Brew # drinktitle: Title on Screen to the Player when drinking the Brew # customModelData: Custom Model Data Tag. This is a number that can be used to add custom textures to the item. diff --git a/resources/languages/de.yml b/resources/languages/de.yml index cbccf15..8d0bb9a 100644 --- a/resources/languages/de.yml +++ b/resources/languages/de.yml @@ -44,7 +44,7 @@ Error_PlayerCommand: '&cDieser Befehl kann nur als Spieler ausgeführt werden' Error_Recipeload: '&cEs konnten nicht alle Rezepte wiederhergesellt werden: Siehe Serverlog!' Error_ShowHelp: 'Benutze &6/brew help &fum die Hilfe anzuzeigen' Error_UnknownCommand: Unbekannter Befehl -Error_YmlRead: 'config.yml konnte nicht gelesen werden, ist die Datei im korrekten yml-Format (korrekte Leerzeichen usw.)?' +Error_YmlRead: 'config.yml konnte nicht gelesen werden, ist die Datei im korrekten yml-Format (korrekte Leerzeichen, Strings mit '' '' usw.)?' # Etc Etc_Page: Seite diff --git a/resources/languages/en.yml b/resources/languages/en.yml index b163a2a..ad6597a 100644 --- a/resources/languages/en.yml +++ b/resources/languages/en.yml @@ -44,7 +44,7 @@ Error_PlayerCommand: '&cThis command can only be executed as a player!' Error_Recipeload: '&cNot all recipes could be restored: More information in the server log!' Error_ShowHelp: Use &6/brew help &fto display the help Error_UnknownCommand: Unknown Command -Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces etc.)' +Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces, using '' '' etc.)' # Etc Etc_Barrel: Barrel diff --git a/resources/languages/fr.yml b/resources/languages/fr.yml index ba1ff9b..98360fe 100644 --- a/resources/languages/fr.yml +++ b/resources/languages/fr.yml @@ -44,7 +44,7 @@ Error_PlayerCommand: '&cCette commande ne peut être executée que par un joueur Error_Recipeload: '&cToutes les recettes n´ont pu être restaurées: Plus d´informations dans les logs du serveur !' Error_ShowHelp: Utilisez &6/brew help &fpour regarder l´aide Error_UnknownCommand: Commande inconnue -Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces etc.)' +Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces, using '' '' etc.)' # Etc Etc_Barrel: Baril diff --git a/resources/languages/it.yml b/resources/languages/it.yml index c365ffc..429625e 100755 --- a/resources/languages/it.yml +++ b/resources/languages/it.yml @@ -44,7 +44,7 @@ Error_PlayerCommand: '&cQuesto comando può essere eseguito solo da un giocatore Error_Recipeload: '&cNon è stato possibile recuperare tutte le ricette: ulteriori informazioni nel file log!' Error_ShowHelp: Usa &6/brew help &fper visualizzare l''aiuto Error_UnknownCommand: Comando sconosciuto -Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces etc.)' +Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces, using '' '' etc.)' # Varie Etc_Barrel: Barile diff --git a/resources/languages/tw.yml b/resources/languages/tw.yml index 7760204..a292755 100644 --- a/resources/languages/tw.yml +++ b/resources/languages/tw.yml @@ -44,7 +44,7 @@ Error_PlayerCommand: '&c這個指令只能由玩家執行!' Error_Recipeload: '&c並非所有配方都可以有用:服務器日誌中的更多信息!' Error_ShowHelp: 使用 &6/brew help &f顯示幫助 Error_UnknownCommand: 未知的指令 -Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces etc.)' +Error_YmlRead: 'Could not read file config.yml, please make sure the file is in valid yml format (correct spaces, using '' '' etc.)' # Etc Etc_Barrel: 釀造桶 diff --git a/src/com/dre/brewery/BCauldron.java b/src/com/dre/brewery/BCauldron.java index 8c98a57..2f99aa6 100644 --- a/src/com/dre/brewery/BCauldron.java +++ b/src/com/dre/brewery/BCauldron.java @@ -281,18 +281,21 @@ public class BCauldron { return; } if (ingredientAdd(clickedBlock, item, player)) { - boolean isBucket = item.getType().equals(Material.WATER_BUCKET) - || item.getType().equals(Material.LAVA_BUCKET) - || item.getType().equals(Material.MILK_BUCKET); + boolean isBucket = item.getType().name().endsWith("_BUCKET"); + boolean isBottle = LegacyUtil.isBottle(item.getType()); if (item.getAmount() > 1) { item.setAmount(item.getAmount() - 1); if (isBucket) { giveItem(player, new ItemStack(Material.BUCKET)); + } else if (isBottle) { + giveItem(player, new ItemStack(Material.GLASS_BOTTLE)); } } else { if (isBucket) { setItemInHand(event, Material.BUCKET, handSwap); + } else if (isBottle) { + setItemInHand(event, Material.GLASS_BOTTLE, handSwap); } else { setItemInHand(event, Material.AIR, handSwap); } diff --git a/src/com/dre/brewery/BPlayer.java b/src/com/dre/brewery/BPlayer.java index ee6c1b6..d47c92c 100644 --- a/src/com/dre/brewery/BPlayer.java +++ b/src/com/dre/brewery/BPlayer.java @@ -167,7 +167,7 @@ public class BPlayer { } if (brew.hasRecipe()) { - brew.getCurrentRecipe().applyDrinkFeatures(player); + brew.getCurrentRecipe().applyDrinkFeatures(player, brew.getQuality()); } P.p.metricsForDrink(brew); diff --git a/src/com/dre/brewery/recipe/BRecipe.java b/src/com/dre/brewery/recipe/BRecipe.java index 4937a3f..0aea473 100644 --- a/src/com/dre/brewery/recipe/BRecipe.java +++ b/src/com/dre/brewery/recipe/BRecipe.java @@ -448,22 +448,22 @@ public class BRecipe { return false; } - public void applyDrinkFeatures(Player player) { + public void applyDrinkFeatures(Player player, int quality) { if (playercmds != null && !playercmds.isEmpty()) { for (String cmd : playercmds) { - player.performCommand(cmd.replaceAll("%player_name%", player.getName())); + player.performCommand(BUtil.applyPlaceholders(cmd, player.getName(), quality)); } } if (servercmds != null && !servercmds.isEmpty()) { for (String cmd : servercmds) { - P.p.getServer().dispatchCommand(P.p.getServer().getConsoleSender(), cmd.replaceAll("%player_name%", player.getName())); + P.p.getServer().dispatchCommand(P.p.getServer().getConsoleSender(), BUtil.applyPlaceholders(cmd, player.getName(), quality)); } } if (drinkMsg != null) { - player.sendMessage(drinkMsg.replaceAll("%player_name%", player.getName())); + player.sendMessage(BUtil.applyPlaceholders(drinkMsg, player.getName(), quality)); } if (drinkTitle != null) { - player.sendTitle("", drinkTitle.replaceAll("%player_name%", player.getName()), 10, 90, 30); + player.sendTitle("", BUtil.applyPlaceholders(drinkTitle, player.getName(), quality), 10, 90, 30); } } diff --git a/src/com/dre/brewery/utility/BUtil.java b/src/com/dre/brewery/utility/BUtil.java index 64c7563..68a94f1 100644 --- a/src/com/dre/brewery/utility/BUtil.java +++ b/src/com/dre/brewery/utility/BUtil.java @@ -164,6 +164,18 @@ public class BUtil { return -1; } + /** + * Replaces the Placeholders %player_name% and %quality% in the given input string + * + * @param input The String to replace the placeholders in + * @param player Player Name to replace %player_name% + * @param quality Quality to replace %quality% + * @return The String with all placeholders replaced + */ + public static String applyPlaceholders(String input, String player, int quality) { + return input.replaceAll("%player_name%", player).replaceAll("%quality%", String.valueOf(quality)); + } + /* **************************************** */ /* ********* ********* */ /* ********* Brewery Utils ********* */ diff --git a/src/com/dre/brewery/utility/LegacyUtil.java b/src/com/dre/brewery/utility/LegacyUtil.java index 9310066..d72b3c1 100644 --- a/src/com/dre/brewery/utility/LegacyUtil.java +++ b/src/com/dre/brewery/utility/LegacyUtil.java @@ -129,6 +129,15 @@ public class LegacyUtil { return false; } + public static boolean isBottle(Material type) { + if (type == Material.POTION) return true; + if (!P.use1_9) return false; + if (type == Material.LINGERING_POTION || type == Material.SPLASH_POTION) return true; + if (!P.use1_13) return false; + if (type == Material.EXPERIENCE_BOTTLE) return true; + return type.name().equals("HONEY_BOTTLE"); + } + public static boolean areStairsInverted(Block block) { if (!P.use1_13) { @SuppressWarnings("deprecation")