mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixed #1813
This commit is contained in:
parent
f5022ca790
commit
882d28cabe
@ -85,6 +85,7 @@
|
||||
* Fixed #1806
|
||||
* Fixed #1807
|
||||
* Fixed Coolers accepting non-Juice items
|
||||
* Fixed #1813
|
||||
|
||||
## Release Candidate 10 (28 Mar 2020)
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -10,9 +10,9 @@
|
||||
<version>4.3-UNOFFICIAL</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<!-- Bukkit properties -->
|
||||
<bukkit.version>1.15.2</bukkit.version>
|
||||
|
@ -43,7 +43,7 @@ public class MultiBlockInteractEvent extends Event implements Cancellable {
|
||||
* @return The {@link Player} who interacted with the {@link MultiBlock}
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,16 +52,21 @@ public class MultiBlockInteractEvent extends Event implements Cancellable {
|
||||
* @return The {@link MultiBlock} of this {@link MultiBlockInteractEvent}
|
||||
*/
|
||||
public MultiBlock getMultiBlock() {
|
||||
return this.multiBlock;
|
||||
return multiBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the specific {@link Block} that was interacted with.
|
||||
*
|
||||
* @return The {@link Block} that was clicked
|
||||
*/
|
||||
public Block getClickedBlock() {
|
||||
return this.clickedBlock;
|
||||
return clickedBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,10 +66,23 @@ public class PlayerRightClickEvent extends Event {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the {@link ItemStack} that was held in the hand of the {@link Player}.
|
||||
* It will never return null, should there be no {@link ItemStack} then it will return
|
||||
* {@code new ItemStack(Material.AIR)}.
|
||||
*
|
||||
* @return The {@link ItemStack} that the {@link Player} right clicked with
|
||||
*/
|
||||
public ItemStack getItem() {
|
||||
return itemStack.orElse(new ItemStack(Material.AIR));
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the hand that was used in this interaction.
|
||||
* Can either be {@code EquipmentSlot.HAND} or {@code EquipmentSlot.OFF_HAND}.
|
||||
*
|
||||
* @return The hand used in this {@link Event}
|
||||
*/
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package io.github.thebusybiscuit.slimefun4.api.items;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* This class represents a Setting for a {@link SlimefunItem} that can be modified via
|
||||
@ -125,6 +128,15 @@ public class ItemSetting<T> {
|
||||
if (defaultValue.getClass().isInstance(configuredValue)) {
|
||||
this.value = (T) configuredValue;
|
||||
}
|
||||
else {
|
||||
this.value = defaultValue;
|
||||
String found = configuredValue == null ? "null" : configuredValue.getClass().getSimpleName();
|
||||
|
||||
Slimefun.getLogger().log(Level.WARNING, "Slimefun has found an invalid config setting in your Items.yml!");
|
||||
Slimefun.getLogger().log(Level.WARNING, "Please only use settings that are valid.");
|
||||
Slimefun.getLogger().log(Level.WARNING, " at \"{0}.{1}\"", new Object[] { item.getID(), getKey() });
|
||||
Slimefun.getLogger().log(Level.WARNING, "Expected \"{0}\" but found: \"{1}\"", new Object[] { defaultValue.getClass().getSimpleName(), found });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class SolarHelmet extends SlimefunItem {
|
||||
|
||||
private final ItemSetting<Float> chargeSetting = new ItemSetting<>("charge-amount", 0.1F);
|
||||
private final ItemSetting<Double> chargeSetting = new ItemSetting<>("charge-amount", 0.1);
|
||||
|
||||
public SolarHelmet(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe, null);
|
||||
@ -18,7 +18,7 @@ public class SolarHelmet extends SlimefunItem {
|
||||
addItemSetting(chargeSetting);
|
||||
}
|
||||
|
||||
public float getChargeAmount() {
|
||||
public double getChargeAmount() {
|
||||
return chargeSetting.getValue();
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class ArmorTask implements Runnable {
|
||||
SlimefunItem item = SlimefunItem.getByItem(p.getInventory().getHelmet());
|
||||
|
||||
if (item instanceof SolarHelmet && Slimefun.hasUnlocked(p, item, true) && hasSunlight(p)) {
|
||||
ItemEnergy.chargeInventory(p, ((SolarHelmet) item).getChargeAmount());
|
||||
ItemEnergy.chargeInventory(p, (float) ((SolarHelmet) item).getChargeAmount());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user