Skip to content

Commit

Permalink
[1.10.7]修复铁砧配方的匹配问题,新增debug配置项
Browse files Browse the repository at this point in the history
  • Loading branch information
YufiriaMazenta committed Aug 2, 2024
1 parent 1b371bc commit 9e072d2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import java.text.SimpleDateFormat
version = "1.10.6"
version = "1.10.7"

plugins {
`java-library`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void enable() {
MsgSender.info("&c[Craftorithm] Unsupported Version");
throw new UnsupportedVersionException();
}
CrypticLib.setDebug(PluginConfigs.DEBUG.value());
ItemManager.INSTANCE.loadItemManager();
regListeners();
initArcenciel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import com.github.yufiriamazenta.craftorithm.Craftorithm;
import com.github.yufiriamazenta.craftorithm.arcenciel.ArcencielDispatcher;
import com.github.yufiriamazenta.craftorithm.config.Languages;
import com.github.yufiriamazenta.craftorithm.config.PluginConfigs;
import com.github.yufiriamazenta.craftorithm.item.ItemManager;
import com.github.yufiriamazenta.craftorithm.item.impl.CraftorithmItemProvider;
import com.github.yufiriamazenta.craftorithm.listener.OtherPluginsListenerProxy;
import com.github.yufiriamazenta.craftorithm.recipe.RecipeManager;
import com.github.yufiriamazenta.craftorithm.util.ItemUtils;
import com.github.yufiriamazenta.craftorithm.util.LangUtil;
import crypticlib.CrypticLib;
import org.bukkit.command.CommandSender;

import java.util.List;
Expand All @@ -35,6 +37,7 @@ public boolean execute(CommandSender sender, List<String> args) {

public static void reloadPlugin() {
reloadConfigs();
CrypticLib.setDebug(PluginConfigs.DEBUG.value());
CraftorithmItemProvider.INSTANCE.reloadItemProvider();
ItemManager.INSTANCE.reloadCustomCookingFuel();
RecipeManager.INSTANCE.reloadRecipeManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ public class PluginConfigs {
public final static BooleanConfigEntry RELEASE_DEFAULT_RECIPES = new BooleanConfigEntry("release_default_recipes", false);
public final static BooleanConfigEntry ENABLE_ANVIL_RECIPE = new BooleanConfigEntry("enable_anvil_recipe", true);
public final static BooleanConfigEntry RELOAD_WHEN_IA_RELOAD = new BooleanConfigEntry("reload_when_ia_reload", true);
public final static BooleanConfigEntry DEBUG = new BooleanConfigEntry("debug", false);

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import com.github.yufiriamazenta.craftorithm.recipe.custom.AnvilRecipe;
import com.github.yufiriamazenta.craftorithm.recipe.custom.PotionMixRecipe;
import crypticlib.CrypticLib;
import crypticlib.chat.MsgSender;
import crypticlib.chat.TextProcessor;
import crypticlib.ui.display.Icon;
import crypticlib.ui.menu.Menu;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.*;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -104,6 +107,17 @@ public Inventory getInventory() {
return inventory;
}

@Override
public Icon onClick(int slot, InventoryClickEvent event) {
MsgSender.debug(event.getClick().name());
return super.onClick(slot, event);
}

@Override
public void onDrag(InventoryDragEvent event) {
event.setCancelled(true);
}

public void setShapedRecipeMenu() {
ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
String[] shape = shapedRecipe.getShape();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ public AnvilRecipe matchAnvilRecipe(ItemStack base, ItemStack addition) {
String additionId = ItemManager.INSTANCE.matchItemName(addition, true);
for (Map.Entry<NamespacedKey, AnvilRecipe> anvilRecipeEntry : anvilRecipeMap.entrySet()) {
AnvilRecipe anvilRecipe = anvilRecipeEntry.getValue();
String recipeBaseId = ItemManager.INSTANCE.matchItemName(base, true);
String recipeAdditionId = ItemManager.INSTANCE.matchItemName(addition, true);
String recipeBaseId = ItemManager.INSTANCE.matchItemName(anvilRecipe.base(), true);
String recipeAdditionId = ItemManager.INSTANCE.matchItemName(anvilRecipe.addition(), true);
if (!Objects.equals(baseId, recipeBaseId))
continue;
if (base.getAmount() < anvilRecipe.base().getAmount())
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ bstats: true
#是否释放默认的配方模板文件
release_default_recipes: false
#是否在ItemsAdder重载时也重载Craftorithm
reload_when_ia_reload: true
reload_when_ia_reload: true
#是否开启调试
debug: true

0 comments on commit 9e072d2

Please sign in to comment.