mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Added changes req. by TTB
This commit is contained in:
parent
adcb52becf
commit
c98292b08c
@ -39,16 +39,20 @@ public class SlimefunBootsListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onDamage(EntityDamageEvent e) {
|
||||
if (e.getEntity() instanceof Player) {
|
||||
if (e.getCause() == DamageCause.FALL) {
|
||||
if (e.getEntity() instanceof Player && e.getCause() == DamageCause.FALL) {
|
||||
onFallDamage(e);
|
||||
} else if (e instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
|
||||
|
||||
if (event.getDamager() instanceof EnderPearl) {
|
||||
onEnderPearlDamage(e);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEnderPearlDamage(EntityDamageByEntityEvent e) {
|
||||
if (e.getDamager() instanceof EnderPearl && e.getEntity() instanceof Player) {
|
||||
Player p = (Player) e.getEntity();
|
||||
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
|
||||
|
||||
if (boots != null && boots.getId().equals("ENDER_BOOTS") && Slimefun.hasUnlocked(p, boots, true)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,15 +75,6 @@ public class SlimefunBootsListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void onEnderPearlDamage(@Nonnull EntityDamageEvent e) {
|
||||
Player p = (Player) e.getEntity();
|
||||
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
|
||||
|
||||
if (boots != null && boots.getId().equals("ENDER_BOOTS") && Slimefun.hasUnlocked(p, boots, true)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTrample(PlayerInteractEvent e) {
|
||||
if (e.getAction() == Action.PHYSICAL) {
|
||||
|
Loading…
Reference in New Issue
Block a user