Commits

DerFrZocker authored and md_5 committed f511cfe1f1a
#1013, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType

This also moves the conversion from and to legacy material to the method calls of legacy plugins, and no longer allows them directly in the server. This has the side effect of fixing some legacy plugin issues, such as SPIGOT-4288, SPIGOT-6161. Also fixes legacy items sometimes not stacking in inventory when using addItem, a client disconnect when using legacy items in recipes and probably some more.
No tags

src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java

Modified
1 1 package org.bukkit.event.inventory;
2 2
3 +import org.bukkit.Bukkit;
3 4 import org.bukkit.Material;
4 5 import org.bukkit.block.Block;
5 6 import org.bukkit.entity.Player;
6 7 import org.bukkit.event.block.BlockExpEvent;
8 +import org.bukkit.material.MaterialData;
7 9 import org.jetbrains.annotations.NotNull;
8 10
9 11 /**
10 12 * This event is called when a player takes items out of the furnace
11 13 */
12 14 public class FurnaceExtractEvent extends BlockExpEvent {
13 15 private final Player player;
14 16 private final Material itemType;
15 17 private final int itemAmount;
16 18
17 19 public FurnaceExtractEvent(@NotNull Player player, @NotNull Block block, @NotNull Material itemType, int itemAmount, int exp) {
18 20 super(block, exp);
19 21 this.player = player;
22 + if (itemType != null && itemType.isLegacy()) {
23 + itemType = Bukkit.getUnsafe().fromLegacy(new MaterialData(itemType), true);
24 + }
20 25 this.itemType = itemType;
21 26 this.itemAmount = itemAmount;
22 27 }
23 28
24 29 /**
25 30 * Get the player that triggered the event
26 31 *
27 32 * @return the relevant player
28 33 */
29 34 @NotNull

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut