This commit is contained in:
Brianna 2019-08-06 14:30:02 -04:00
parent 39ae730873
commit 42331bc009
2 changed files with 30 additions and 1 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "EpicEnchants"
path: "/builds/$CI_PROJECT_PATH"
version: "1.0.1"
version: "1.0.2"
build:
stage: build

View File

@ -0,0 +1,29 @@
package com.songoda.epicenchants.effect.effects;
import com.songoda.epicenchants.effect.EffectExecutor;
import com.songoda.epicenchants.enums.EventType;
import com.songoda.epicenchants.utils.objects.ItemBuilder;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class DropHeld extends EffectExecutor {
public DropHeld(ConfigurationSection section) {
super(section);
}
@Override
public void execute(@NotNull Player user, @Nullable LivingEntity opponent, int level, EventType eventType) {
consume(entity -> {
Player player = ((Player) entity);
if (player.getItemInHand().getType() != Material.AIR) {
entity.getLocation().getWorld().dropItemNaturally(entity.getLocation(), new ItemBuilder(player
.getItemInHand()).build());
player.setItemInHand(null);
}
}, user, opponent);
}
}