Skip to content

Commit

Permalink
Remove enchant from mino head
Browse files Browse the repository at this point in the history
  • Loading branch information
zelytra committed Aug 26, 2021
1 parent fed737a commit 076c401
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static void registerEvents(Daedalus pl) {
pm.registerEvents(new AresWarBanner(), pl);
pm.registerEvents(new ArtemisHorn(), pl);
pm.registerEvents(new PoseidonCoche(), pl);
pm.registerEvents(new MinotaurHead(), pl);


/*Gods Handlers*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package fr.zelytra.daedalus.events.running.environnement.items.listener;

import fr.zelytra.daedalus.Daedalus;
import fr.zelytra.daedalus.managers.items.CustomItemStack;
import fr.zelytra.daedalus.managers.items.CustomMaterial;
import org.bukkit.GameMode;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;

public class MinotaurHead implements Listener {

@EventHandler
public void onHeadRemove(InventoryClickEvent e) {
if (!Daedalus.getInstance().getGameManager().isRunning()) return;

if (e.getWhoClicked().getGameMode() != GameMode.SURVIVAL) return;

if (e.getInventory().getType() != InventoryType.CRAFTING) return;

if (e.getCurrentItem() == null) return;

if (CustomItemStack.getCustomMaterial(e.getCurrentItem()) == CustomMaterial.MINOTAUR_HEAD)
e.setCancelled(true);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void onCustomDeath(EntityDamageEvent e) {
}

}
if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { //Kill by falling
if (e.getCause() == EntityDamageEvent.DamageCause.FALL && e.getEntity().getLastDamageCause() != null) { //Kill by falling
Player killer = (Player) ((EntityDamageByEntityEvent) e.getEntity().getLastDamageCause()).getDamager();
killByAMino = daedalus.getGameManager().getFactionManager().getFactionOf(killer).getGodsEnum() == GodsEnum.MINOTAURE; //Tuer par un mino
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ private void deathFX(EntityDamageEvent e) {
return;

} else if (e.getCause() == EntityDamageEvent.DamageCause.FALL) {
if (e.getEntity().getLastDamageCause() == null) {
Bukkit.broadcastMessage(faction.getType().getPrefix() + e.getEntity().getName() + GameSettings.LANG.textOf("death.definitive"));
return;
}
damageEvent = (EntityDamageByEntityEvent) e.getEntity().getLastDamageCause();

Bukkit.broadcastMessage(faction.getType().getPrefix() + e.getEntity().getName() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ private void respawnFX(EntityDamageEvent e) {
return;

} else if (e.getCause() == EntityDamageEvent.DamageCause.FALL) {
if (e.getEntity().getLastDamageCause() == null) {
Bukkit.broadcastMessage(faction.getType().getPrefix() + e.getEntity().getName() + GameSettings.LANG.textOf("death.default"));
return;
}

damageEvent = (EntityDamageByEntityEvent) e.getEntity().getLastDamageCause();

Bukkit.broadcastMessage(faction.getType().getPrefix() + e.getEntity().getName() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import fr.zelytra.daedalus.managers.gods.Gods;
import fr.zelytra.daedalus.managers.items.CustomItemStack;
import fr.zelytra.daedalus.managers.items.CustomMaterial;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

Expand All @@ -24,11 +21,6 @@ public Minotaure(Faction faction) {
playerList.remove(god.getUniqueId());

ItemStack item = new CustomItemStack(CustomMaterial.MINOTAUR_HEAD).getItem();
ItemMeta meta = item.getItemMeta();
meta.addEnchant(Enchantment.BINDING_CURSE,1,false);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(meta);

faction.getGod().getInventory().setHelmet(item);

}
Expand Down

0 comments on commit 076c401

Please sign in to comment.