From 6de3207b0e4700dc3d8998ff1e544f4f2b085f92 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 6 Oct 2019 16:59:30 +0000 Subject: [PATCH] Prevent registering recipes if crafting is disabled. Contributed by Sahar. --- .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handler/itemhandlers/Recipes.java | 27 ++++++++++--------- .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ .../handlers/itemhandlers/Recipes.java | 7 +++++ 16 files changed, 120 insertions(+), 12 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index 0d4b3e6dff..00a9071533 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.actor.Playable; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index 0d4b3e6dff..00a9071533 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.actor.Playable; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index 0d4b3e6dff..00a9071533 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.actor.Playable; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index 0d4b3e6dff..00a9071533 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.actor.Playable; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index 0d4b3e6dff..00a9071533 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.actor.Playable; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Recipes.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Recipes.java index ae6c0e90d4..fda6c04891 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Recipes.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package org.l2jmobius.gameserver.handler.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.datatables.csv.RecipeTable; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -46,12 +47,18 @@ public class Recipes implements IItemHandler { return; } - PlayerInstance player = (PlayerInstance) playable; - RecipeList rp = RecipeTable.getInstance().getRecipeByItemId(item.getItemId()); + + final PlayerInstance player = (PlayerInstance) playable; + if (!Config.IS_CRAFTING_ENABLED) + { + player.sendMessage("Crafting is disabled, you cannot register this recipe."); + return; + } + + final RecipeList rp = RecipeTable.getInstance().getRecipeByItemId(item.getItemId()); if (player.hasRecipeList(rp.getId())) { - SystemMessage sm = new SystemMessage(SystemMessageId.RECIPE_ALREADY_REGISTERED); - player.sendPacket(sm); + player.sendPacket(new SystemMessage(SystemMessageId.RECIPE_ALREADY_REGISTERED)); } else if (rp.isDwarvenRecipe()) { @@ -60,8 +67,7 @@ public class Recipes implements IItemHandler if (rp.getLevel() > player.getDwarvenCraft()) { // can't add recipe, becouse create item level too low - SystemMessage sm = new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER); - player.sendPacket(sm); + player.sendPacket(new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER)); } else if (player.getDwarvenRecipeBook().length >= player.GetDwarfRecipeLimit()) { @@ -81,8 +87,7 @@ public class Recipes implements IItemHandler } else { - SystemMessage sm = new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT); - player.sendPacket(sm); + player.sendPacket(new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT)); } } else if (player.hasCommonCraft()) @@ -90,8 +95,7 @@ public class Recipes implements IItemHandler if (rp.getLevel() > player.getCommonCraft()) { // can't add recipe, becouse create item level too low - SystemMessage sm = new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER); - player.sendPacket(sm); + player.sendPacket(new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER)); } else if (player.getCommonRecipeBook().length >= player.GetCommonRecipeLimit()) { @@ -111,8 +115,7 @@ public class Recipes implements IItemHandler } else { - SystemMessage sm = new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT); - player.sendPacket(sm); + player.sendPacket(new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT)); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index 3fd838f10e..37dcbfff23 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/Recipes.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/Recipes.java index ebbd31dfd5..f9a7fc957c 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/Recipes.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/Recipes.java @@ -16,6 +16,7 @@ */ package handlers.itemhandlers; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.impl.RecipeData; import org.l2jmobius.gameserver.handler.IItemHandler; import org.l2jmobius.gameserver.model.RecipeList; @@ -39,6 +40,12 @@ public class Recipes implements IItemHandler return false; } + if (!Config.IS_CRAFTING_ENABLED) + { + playable.sendMessage("Crafting is disabled, you cannot register this recipe."); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); if (player.isCrafting()) {