1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2021-03-14 11:02:47 +01:00
parent 2c2ba73500
commit e39c2b661c
6 changed files with 39 additions and 15 deletions

View File

@ -1,5 +1,5 @@
# Table of contents # Table of contents
- [Release Candidate 21 (TBD)](#release-candidate-21-tbd) - [Release Candidate 21 (14 Mar 2021)](#release-candidate-21-14-mar-2021)
- [Release Candidate 20 (30 Jan 2021)](#release-candidate-20-30-jan-2021) - [Release Candidate 20 (30 Jan 2021)](#release-candidate-20-30-jan-2021)
- [Release Candidate 19 (11 Jan 2021)](#release-candidate-19-11-jan-2021) - [Release Candidate 19 (11 Jan 2021)](#release-candidate-19-11-jan-2021)
- [Release Candidate 18 (03 Dec 2020)](#release-candidate-18-03-dec-2020) - [Release Candidate 18 (03 Dec 2020)](#release-candidate-18-03-dec-2020)
@ -21,7 +21,7 @@
- [Release Candidate 2 (29 Sep 2019)](#release-candidate-2-29-sep-2019) - [Release Candidate 2 (29 Sep 2019)](#release-candidate-2-29-sep-2019)
- [Release Candidate 1 (26 Sep 2019)](#release-candidate-1-26-sep-2019) - [Release Candidate 1 (26 Sep 2019)](#release-candidate-1-26-sep-2019)
## Release Candidate 21 (TBD) ## Release Candidate 21 (14 Mar 2021)
#### Additions #### Additions
* Nether Wart Blocks can now be turned into Nether Warts using a Grind Stone * Nether Wart Blocks can now be turned into Nether Warts using a Grind Stone
@ -62,6 +62,7 @@
* Fixed #2877 * Fixed #2877
* Fixed #2878 * Fixed #2878
* Fixed Mining Androids being broken * Fixed Mining Androids being broken
* Fixed #2883
## Release Candidate 20 (30 Jan 2021) ## Release Candidate 20 (30 Jan 2021)

View File

@ -18,6 +18,8 @@ import java.util.List;
* This {@link Event} is called when an {@link ExplosiveTool} is used to break blocks. * This {@link Event} is called when an {@link ExplosiveTool} is used to break blocks.
* *
* @author GallowsDove * @author GallowsDove
*
* @see ExplosiveTool
* *
*/ */
public class ExplosiveToolBreakBlocksEvent extends PlayerEvent implements Cancellable { public class ExplosiveToolBreakBlocksEvent extends PlayerEvent implements Cancellable {
@ -26,30 +28,45 @@ public class ExplosiveToolBreakBlocksEvent extends PlayerEvent implements Cancel
private final ItemStack itemInHand; private final ItemStack itemInHand;
private final ExplosiveTool explosiveTool; private final ExplosiveTool explosiveTool;
private final List<Block> blocks; private final Block mainBlock;
private final List<Block> additionalBlocks;
private boolean cancelled; private boolean cancelled;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
public ExplosiveToolBreakBlocksEvent(Player player, List<Block> blocks, ItemStack item, ExplosiveTool explosiveTool) { public ExplosiveToolBreakBlocksEvent(Player player, Block block, List<Block> blocks, ItemStack item, ExplosiveTool explosiveTool) {
super(player); super(player);
Validate.notEmpty(blocks, "Blocks cannot be null or empty"); Validate.notNull(block, "The center block cannot be null!");
Validate.notNull(blocks, "Blocks cannot be null");
Validate.notNull(item, "Item cannot be null"); Validate.notNull(item, "Item cannot be null");
Validate.notNull(explosiveTool, "ExplosiveTool cannot be null"); Validate.notNull(explosiveTool, "ExplosiveTool cannot be null");
this.blocks = blocks; this.mainBlock = block;
this.additionalBlocks = blocks;
this.itemInHand = item; this.itemInHand = item;
this.explosiveTool = explosiveTool; this.explosiveTool = explosiveTool;
} }
/**
* This returns the primary {@link Block} that was broken.
* This {@link Block} triggered this {@link Event} and is not included
* in {@link #getAdditionalBlocks()}.
*
* @return The primary broken {@link Block}
*/
@Nonnull
public Block getPrimaryBlock() {
return this.mainBlock;
}
/** /**
* Gets the {@link Block} {@link List} of blocks destroyed in this event. * Gets the {@link Block} {@link List} of blocks destroyed in this event.
* *
* @return The broken blocks * @return The broken blocks
*/ */
@Nonnull @Nonnull
public List<Block> getBlocks() { public List<Block> getAdditionalBlocks() {
return this.blocks; return this.additionalBlocks;
} }
/** /**

View File

@ -158,8 +158,6 @@ public class ItemSetting<T> {
* This method is called by a {@link SlimefunItem} which wants to load its {@link ItemSetting} * This method is called by a {@link SlimefunItem} which wants to load its {@link ItemSetting}
* from the {@link Config} file. * from the {@link Config} file.
* *
* @param item
* The {@link SlimefunItem} who called this method
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void reload() { public void reload() {
@ -169,7 +167,7 @@ public class ItemSetting<T> {
Object configuredValue = SlimefunPlugin.getItemCfg().getValue(item.getId() + '.' + getKey()); Object configuredValue = SlimefunPlugin.getItemCfg().getValue(item.getId() + '.' + getKey());
if (defaultValue.getClass().isInstance(configuredValue)) { if (defaultValue.getClass().isInstance(configuredValue)) {
// We can unsafe cast here, we did an isInstance(...) check before! // We can do an unsafe cast here, we did an isInstance(...) check before!
T newValue = (T) configuredValue; T newValue = (T) configuredValue;
if (validateInput(newValue)) { if (validateInput(newValue)) {

View File

@ -29,6 +29,9 @@ import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
/** /**
* The {@link ElectricSmeltery} is an electric version of the standard {@link Smeltery}. * The {@link ElectricSmeltery} is an electric version of the standard {@link Smeltery}.
* *
@ -41,6 +44,7 @@ public class ElectricSmeltery extends AContainer implements NotHopperable {
private static final int[] inputBorder = { 0, 1, 2, 3, 9, 12, 18, 21, 27, 30, 36, 37, 38, 39 }; private static final int[] inputBorder = { 0, 1, 2, 3, 9, 12, 18, 21, 27, 30, 36, 37, 38, 39 };
private static final int[] outputBorder = { 14, 15, 16, 17, 23, 26, 32, 33, 34, 35 }; private static final int[] outputBorder = { 14, 15, 16, 17, 23, 26, 32, 33, 34, 35 };
@ParametersAreNonnullByDefault
public ElectricSmeltery(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { public ElectricSmeltery(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe); super(category, item, recipeType, recipe);
@ -113,7 +117,8 @@ public class ElectricSmeltery extends AContainer implements NotHopperable {
}); });
} }
private Comparator<Integer> compareSlots(DirtyChestMenu menu) { @Nonnull
private Comparator<Integer> compareSlots(@Nonnull DirtyChestMenu menu) {
return Comparator.comparingInt(slot -> menu.getItemInSlot(slot).getAmount()); return Comparator.comparingInt(slot -> menu.getItemInSlot(slot).getAmount());
} }

View File

@ -91,7 +91,7 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
} }
} }
ExplosiveToolBreakBlocksEvent event = new ExplosiveToolBreakBlocksEvent(p, blocksToDestroy, item, this); ExplosiveToolBreakBlocksEvent event = new ExplosiveToolBreakBlocksEvent(p, b, blocksToDestroy, item, this);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
@ -101,7 +101,8 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
} }
} }
private List<Block> findBlocks(Block b) { @Nonnull
private List<Block> findBlocks(@Nonnull Block b) {
List<Block> blocks = new ArrayList<>(26); List<Block> blocks = new ArrayList<>(26);
for (int x = -1; x <= 1; x++) { for (int x = -1; x <= 1; x++) {
@ -125,7 +126,7 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
return damageOnUse.getValue(); return damageOnUse.getValue();
} }
protected boolean canBreak(Player p, Block b) { protected boolean canBreak(@Nonnull Player p, @Nonnull Block b) {
if (b.isEmpty() || b.isLiquid()) { if (b.isEmpty() || b.isLiquid()) {
return false; return false;
} else if (SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(b.getType())) { } else if (SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(b.getType())) {

View File

@ -26,6 +26,8 @@ public class ClimbableSurface extends DoubleRangeSetting {
/** /**
* This creates a new {@link ClimbableSurface} for the given {@link Material}. * This creates a new {@link ClimbableSurface} for the given {@link Material}.
* *
* @param climbingPick
* The {@link ClimbingPick} instance
* @param surface * @param surface
* The {@link Material} of this surface * The {@link Material} of this surface
* @param defaultValue * @param defaultValue