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-26 14:31:51 +02:00
parent 6e6a953009
commit c8ab9e8568
8 changed files with 58 additions and 18 deletions

View File

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

View File

@ -538,7 +538,7 @@ public final class SlimefunItems {
public static final SlimefunItemStack TALISMAN_TRAVELLER = new SlimefunItemStack("TRAVELLER_TALISMAN", Material.EMERALD, "&aTalisman of the Traveller", "", "&fWhile you have this Talisman", "&fin your Inventory it gives", "&fyou a 60% Chance for a decent", "&fSpeed Buff when you start sprinting");
public static final SlimefunItemStack TALISMAN_WARRIOR = new SlimefunItemStack("WARRIOR_TALISMAN", Material.EMERALD, "&aTalisman of the Warrior", "", "&fWhile you have this Talisman", "&fin your Inventory it gives", "&fyou Strength III whenever you get hit", "&fbut will then be consumed");
public static final SlimefunItemStack TALISMAN_KNIGHT = new SlimefunItemStack("KNIGHT_TALISMAN", Material.EMERALD, "&aTalisman of the Knight", "", "&fWhile you have this Talisman", "&fin your Inventory it gives", "&fyou a 30% Chance for 5 Seconds of Regeneration", "&fwhenever You get hit", "&fbut will then be consumed");
public static final SlimefunItemStack TALISMAN_WHIRLWIND = new SlimefunItemStack("WHIRLWIND_TALISMAN", Material.EMERALD, "&aTalisman of the Whirlwind", "", "&fWhile you have this Talisman", "&fin your Inventory it will reflect", "&f60% of all Projectiles fired at you");
public static final SlimefunItemStack TALISMAN_WHIRLWIND = new SlimefunItemStack("WHIRLWIND_TALISMAN", Material.EMERALD, "&aTalisman of the Whirlwind", "", "&fHaving this Talisman", "&fin your Inventory will reflect", "&f60% of any projectiles fired at you.", "&e&oOnly a thrown Trident can pierce", "&e&othrough this layer of protection");
public static final SlimefunItemStack TALISMAN_WIZARD = new SlimefunItemStack("WIZARD_TALISMAN", Material.EMERALD, "&aTalisman of the Wizard", "", "&fWhile you have this Talisman", "&fin your Inventory it allows you to", "&fobtain Fortune Level 4/5 however", "&fit also has a chance to lower the", "&fLevel of some Enchantments on your Item");
/* Staves */

View File

@ -0,0 +1,25 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.armor;
import org.bukkit.block.data.type.Farmland;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* The {@link FarmerShoes} are just a simple pair of boots which allows a {@link Player} to walk
* on {@link Farmland} without breaking it.
*
* @author TheBusyBiscuit
*
*/
public class FarmerShoes extends SlimefunItem {
public FarmerShoes(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
}

View File

@ -80,7 +80,7 @@ public class StomperBoots extends SlimefunItem {
* @return A {@link Vector} to determine the velocity for our {@link Entity}
*/
private Vector getShockwave(Location origin, Location target) {
// As the distance approached zero we might slip into a "division by zero" when normalizing
// As the distance approaches zero we might slip into a "division by zero" when normalizing
if (origin.distanceSquared(target) < 0.05) {
return new Vector(0, 1, 0);
}

View File

@ -1,6 +1,7 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.backpacks;
import org.bukkit.Sound;
import org.bukkit.block.EnderChest;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -9,8 +10,16 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* The {@link EnderBackpack} is a pretty simple {@link SlimefunItem} which opens your
* {@link EnderChest} upon right clicking.
*
* @author TheBusyBiscuit
*
*/
public class EnderBackpack extends SimpleSlimefunItem<ItemUseHandler> implements NotPlaceable {
public EnderBackpack(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {

View File

@ -12,13 +12,11 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.FarmerShoes;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.StomperBoots;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.Slimefun;
@ -88,14 +86,11 @@ public class SlimefunBootsListener implements Listener {
Block b = e.getClickedBlock();
if (b != null && b.getType() == Material.FARMLAND) {
ItemStack boots = e.getPlayer().getInventory().getBoots();
Player p = e.getPlayer();
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
if (SlimefunUtils.isItemSimilar(boots, SlimefunItems.FARMER_SHOES, true)) {
SlimefunItem item = SlimefunItems.FARMER_SHOES.getItem();
if (Slimefun.hasUnlocked(e.getPlayer(), item, true)) {
e.setCancelled(true);
}
if (boots instanceof FarmerShoes && Slimefun.hasUnlocked(p, boots, true)) {
e.setCancelled(true);
}
}
}

View File

@ -17,6 +17,7 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Trident;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -75,12 +76,20 @@ public class TalismanListener implements Listener {
Talisman.checkFor(e, SlimefunItems.TALISMAN_WARRIOR);
}
if (e.getCause() == DamageCause.PROJECTILE && ((EntityDamageByEntityEvent) e).getDamager() instanceof Projectile) {
Projectile projectile = (Projectile) ((EntityDamageByEntityEvent) e).getDamager();
if (e.getCause() == DamageCause.PROJECTILE) {
onProjectileDamage(e);
}
}
}
if (Talisman.checkFor(e, SlimefunItems.TALISMAN_WHIRLWIND)) {
returnProjectile((Player) e.getEntity(), projectile);
}
private void onProjectileDamage(EntityDamageEvent e) {
EntityDamageByEntityEvent event = ((EntityDamageByEntityEvent) e);
if (event.getDamager() instanceof Projectile && !(event.getDamager() instanceof Trident)) {
Projectile projectile = (Projectile) event.getDamager();
if (Talisman.checkFor(e, SlimefunItems.TALISMAN_WHIRLWIND)) {
returnProjectile((Player) e.getEntity(), projectile);
}
}
}

View File

@ -31,6 +31,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.androids.FisherAn
import io.github.thebusybiscuit.slimefun4.implementation.items.androids.MinerAndroid;
import io.github.thebusybiscuit.slimefun4.implementation.items.androids.ProgrammableAndroid;
import io.github.thebusybiscuit.slimefun4.implementation.items.androids.WoodcutterAndroid;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.FarmerShoes;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.HazmatArmorPiece;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.Parachute;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece;
@ -1047,7 +1048,7 @@ public final class SlimefunItemSetup {
new ItemStack[] {new ItemStack(Material.OAK_SLAB), null, new ItemStack(Material.OAK_SLAB), new ItemStack(Material.OAK_SLAB), null, new ItemStack(Material.OAK_SLAB), new ItemStack(Material.OAK_SLAB), new ItemStack(Material.CAULDRON), new ItemStack(Material.OAK_SLAB)})
.register(plugin);
new SlimefunItem(categories.magicalArmor, SlimefunItems.FARMER_SHOES, RecipeType.ARMOR_FORGE,
new FarmerShoes(categories.magicalArmor, SlimefunItems.FARMER_SHOES, RecipeType.ARMOR_FORGE,
new ItemStack[] {null, null, null, new ItemStack(Material.HAY_BLOCK), null, new ItemStack(Material.HAY_BLOCK), new ItemStack(Material.HAY_BLOCK), null, new ItemStack(Material.HAY_BLOCK)})
.register(plugin);