Skip to content

Commit c73bc7f

Browse files
committed
Added .item:serializer module to automatically load and save item objects.
Added parsers: - [EnchantmentParser](item/serializer/src/main/java/it/angrybear/serializers/EnchantmentParser.java); - [ItemParser](item/serializer/src/main/java/it/angrybear/serializers/ItemParser.java); - [ShapeParser](item/serializer/src/main/java/it/angrybear/serializers/ShapeParser.java); - [ShapedRecipeParser](item/serializer/src/main/java/it/angrybear/serializers/ShapedRecipeParser.java); - [ShapelessRecipeParser](item/serializer/src/main/java/it/angrybear/serializers/ShapelessRecipeParser.java); - [FurnaceRecipeParser](item/serializer/src/main/java/it/angrybear/serializers/FurnaceRecipeParser.java). Added [YAGLParser](item/serializer/src/main/java/it/angrybear/serializers/YAGLParser.java) to automatically load parsers. Added **MovablePersistentItem** to allow moving inside the player inventory. Moved everything to package `it.angrybear.yagl`. Reworked `Item#copy()` method: it will try to get a default empty constructor from the current class. If it fails, it defaults to `ItemImpl`. Fixed `Item#copy(Class)` with automatic resolution of interfaces: passing `Item` or `BukkitItem` will convert them into `ItemImpl` and `BukkitItemImpl`. Fixed `Item#copy(Class)` not checking if current item has field of receiving class. Fixed various bugs in **ShapedRecipe**. Fixed recipes not copying items in their most default state (Item). Fixed invalid casts to `BukkitItem` in `ItemUtils`. Fixed `ItemUtils`: now it will apply model data only for values higher than 0. Fixed visibility issues in `PersistentListener`: every event method is now protected. Fixed PersistentListener with delay system. Fixed MovablePersistentItem not blocking hotbar swap. Updated FulmiCollection to version 1.4.1.
1 parent 16acf3e commit c73bc7f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = 'it.angrybear'
9-
version = '2.1'
9+
version = '2.2'
1010

1111
allprojects {
1212
apply plugin: 'java-library'

item/bukkit/src/main/java/it/angrybear/yagl/listeners/PersistentListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.bukkit.event.block.BlockPlaceEvent;
1212
import org.bukkit.event.entity.PlayerDeathEvent;
1313
import org.bukkit.event.inventory.ClickType;
14+
import org.bukkit.event.inventory.InventoryAction;
1415
import org.bukkit.event.inventory.InventoryClickEvent;
1516
import org.bukkit.event.inventory.InventoryDragEvent;
1617
import org.bukkit.event.player.PlayerDropItemEvent;
@@ -109,7 +110,7 @@ protected void on(InventoryClickEvent event) {
109110
Inventory playerInventory = player.getInventory();
110111

111112
Consumer<PersistentItem> ifPresent = e -> {
112-
if (!(e instanceof MovablePersistentItem) || !playerInventory.equals(clicked))
113+
if (!(e instanceof MovablePersistentItem) || !playerInventory.equals(clicked) || event.getAction().equals(InventoryAction.MOVE_TO_OTHER_INVENTORY))
113114
cancelled(event).accept(e);
114115
};
115116

0 commit comments

Comments
 (0)