Skip to content

Commit

Permalink
[1.10.5-dev3]新增是否在IA重载时一起重载的开关,修复最大页码为0时,翻页会出现错误的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
YufiriaMazenta committed Jul 12, 2024
1 parent 8ab8c62 commit a92a0b5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 27 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.5-dev2"
version = "1.10.5-dev3"

plugins {
`java-library`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public class PluginConfigs {
public final static BooleanConfigEntry BSTATS = new BooleanConfigEntry("bstats", true);
public final static BooleanConfigEntry RELEASE_DEFAULT_RECIPES = new BooleanConfigEntry("release_default_recipes", true);
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);

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.yufiriamazenta.craftorithm.listener;

import com.github.yufiriamazenta.craftorithm.config.PluginConfigs;
import com.github.yufiriamazenta.craftorithm.recipe.RecipeManager;
import dev.lone.itemsadder.api.Events.ItemsAdderLoadDataEvent;
import org.bukkit.event.EventHandler;
Expand All @@ -10,10 +11,15 @@ public enum ItemsAdderHandler implements Listener {

INSTANCE;

private boolean isEnable = true;

@EventHandler(priority = EventPriority.MONITOR)
public void onItemsAdderLoaded(ItemsAdderLoadDataEvent event) {
if (!PluginConfigs.RELOAD_WHEN_IA_RELOAD.value() && !isEnable)
return;
RecipeManager.INSTANCE.reloadRecipeManager();
OtherPluginsListenerProxy.INSTANCE.reloadOtherPluginsListener();
isEnable = false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public Inventory getInventory() {
}

public void nextPage() {
setPage(Math.min(page + 1, maxPage - 1)).resetIcons();
setPage(Math.min(page + 1, Math.max(0, maxPage - 1))).resetIcons();
refreshInventory();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public RecipeListMenu(Player player, Collection<NamespacedKey> recipeKeys, Menu
}

public void nextPage() {
setPage(Math.min(page + 1, maxPage - 1)).resetIcons();
setPage(Math.min(page + 1, Math.max(0, maxPage - 1))).resetIcons();
inventoryCache.clear();
for (Integer slot : slotMap.keySet()) {
inventoryCache.setItem(slot, slotMap.get(slot).display());
Expand Down

This file was deleted.

4 changes: 3 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ enable_anvil_recipe: true
#是否启用bstats插件使用数据统计
bstats: true
#是否释放默认的配方模板文件
release_default_recipes: true
release_default_recipes: true
#是否在ItemsAdder重载时也重载Craftorithm
reload_when_ia_reload: true

0 comments on commit a92a0b5

Please sign in to comment.