1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-08-27 14:16:09 +02:00
parent 4232caf17a
commit fcbae02a4b
5 changed files with 26 additions and 5 deletions

View File

@ -83,6 +83,7 @@
* Fixed #2243
* Fixed #2249
* Fixed #1022
* Fixed #2208
## Release Candidate 15 (01 Aug 2020)

View File

@ -0,0 +1,6 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.medical;
public interface MedicalSupply {
}

View File

@ -1,5 +1,6 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.medical;
import org.bukkit.attribute.Attribute;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
@ -11,6 +12,8 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class Medicine extends SimpleSlimefunItem<ItemConsumptionHandler> {
private static final double HEALING_AMOUNT = 8.0;
public Medicine(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
@ -26,6 +29,10 @@ public class Medicine extends SimpleSlimefunItem<ItemConsumptionHandler> {
if (p.hasPotionEffect(PotionEffectType.CONFUSION)) p.removePotionEffect(PotionEffectType.CONFUSION);
if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) p.removePotionEffect(PotionEffectType.BLINDNESS);
double health = p.getHealth() + HEALING_AMOUNT;
double maxHealth = p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
p.setHealth(Math.min(health, maxHealth));
p.setFireTicks(0);
};
}

View File

@ -2,9 +2,9 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.medical;
import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
@ -16,6 +16,8 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class Vitamins extends SimpleSlimefunItem<ItemUseHandler> {
private static final double HEALING_AMOUNT = 8.0;
public Vitamins(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
@ -40,7 +42,10 @@ public class Vitamins extends SimpleSlimefunItem<ItemUseHandler> {
if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) p.removePotionEffect(PotionEffectType.BLINDNESS);
p.setFireTicks(0);
p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 2));
double health = p.getHealth() + HEALING_AMOUNT;
double maxHealth = p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
p.setHealth(Math.min(health, maxHealth));
e.cancel();
};

View File

@ -1,11 +1,10 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.weapons;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener;
@ -25,6 +24,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
*/
public class VampireBlade extends SlimefunItem {
private static final double HEALING_AMOUNT = 4.0;
private final ItemSetting<Integer> chance = new ItemSetting<>("chance", 45);
public VampireBlade(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
@ -44,7 +44,9 @@ public class VampireBlade extends SlimefunItem {
public void heal(Player p) {
p.playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.7F, 0.7F);
p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 1));
double health = p.getHealth() + HEALING_AMOUNT;
double maxHealth = p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
p.setHealth(Math.min(health, maxHealth));
}
}