mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
mcMMO now requires the latest MC version (currently 1.17.1)
Fixed a few bugs from API breaks
This commit is contained in:
@ -3,9 +3,12 @@ package com.gmail.nossr50.events.fake;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.inventory.BrewEvent;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FakeBrewEvent extends BrewEvent implements FakeEvent {
|
||||
public FakeBrewEvent(Block brewer, BrewerInventory contents, int fuelLevel) {
|
||||
super(brewer, contents, fuelLevel);
|
||||
public FakeBrewEvent(Block brewer, BrewerInventory contents, List<ItemStack> results, int fuelLevel) {
|
||||
super(brewer, contents, results, fuelLevel);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public final class AlchemyPotionBrewer {
|
||||
}
|
||||
|
||||
List<AlchemyPotion> inputList = new ArrayList<>();
|
||||
ItemStack[] outputList = new ItemStack[3];
|
||||
var outputList = new ArrayList<ItemStack>();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ItemStack item = inventory.getItem(i);
|
||||
@ -129,11 +129,11 @@ public final class AlchemyPotionBrewer {
|
||||
inputList.add(input);
|
||||
|
||||
if (output != null) {
|
||||
outputList[i] = output.toItemStack(item.getAmount()).clone();
|
||||
outputList.set(i, output.toItemStack(item.getAmount()).clone());
|
||||
}
|
||||
}
|
||||
|
||||
FakeBrewEvent event = new FakeBrewEvent(brewingStand.getBlock(), inventory, ((BrewingStand) brewingStand).getFuelLevel());
|
||||
FakeBrewEvent event = new FakeBrewEvent(brewingStand.getBlock(), inventory, outputList, ((BrewingStand) brewingStand).getFuelLevel());
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || inputList.isEmpty()) {
|
||||
@ -141,8 +141,8 @@ public final class AlchemyPotionBrewer {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if(outputList[i] != null) {
|
||||
inventory.setItem(i, outputList[i]);
|
||||
if(outputList.get(i) != null) {
|
||||
inventory.setItem(i, outputList.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@ public class Herbalism {
|
||||
/**
|
||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} to check ability activation for
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
protected static boolean convertGreenTerraBlocks(BlockState blockState) {
|
||||
@ -22,16 +22,16 @@ public class Herbalism {
|
||||
blockState.setType(Material.MOSSY_STONE_BRICKS);
|
||||
return true;
|
||||
|
||||
case DIRT :
|
||||
case GRASS_PATH :
|
||||
case DIRT:
|
||||
case DIRT_PATH:
|
||||
blockState.setType(Material.GRASS_BLOCK);
|
||||
return true;
|
||||
|
||||
case COBBLESTONE :
|
||||
case COBBLESTONE:
|
||||
blockState.setType(Material.MOSSY_COBBLESTONE);
|
||||
return true;
|
||||
|
||||
default :
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -39,19 +39,19 @@ public class Herbalism {
|
||||
/**
|
||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} to check ability activation for
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
protected static boolean convertShroomThumb(BlockState blockState) {
|
||||
switch (blockState.getType()) {
|
||||
case DIRT :
|
||||
case DIRT:
|
||||
case GRASS_BLOCK:
|
||||
case GRASS_PATH :
|
||||
case DIRT_PATH:
|
||||
blockState.setType(Material.MYCELIUM);
|
||||
return true;
|
||||
|
||||
default :
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user