Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the EndermanAttackPlayer event to skript #6596

Merged
merged 10 commits into from
Jun 28, 2024
10 changes: 10 additions & 0 deletions src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import ch.njol.skript.util.slot.InventorySlot;
import ch.njol.skript.util.slot.Slot;
import com.destroystokyo.paper.event.block.AnvilDamagedEvent;
import com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent;
import com.destroystokyo.paper.event.entity.ProjectileCollideEvent;
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
import io.papermc.paper.event.entity.EntityMoveEvent;
Expand Down Expand Up @@ -691,6 +692,15 @@ public Entity get(LightningStrikeEvent event) {
return event.getLightning();
}
}, 0);
// EndermanAttackPlayerEvent
if (Skript.classExists("com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent")) {
EventValues.registerEventValue(EndermanAttackPlayerEvent.class, Player.class, new Getter<Player, EndermanAttackPlayerEvent>() {
@Override
public Player get(EndermanAttackPlayerEvent event) {
return event.getPlayer();
}
}, EventValues.TIME_NOW);
}

// --- PlayerEvents ---
EventValues.registerEventValue(PlayerEvent.class, Player.class, new Getter<Player, PlayerEvent>() {
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/ch/njol/skript/events/SimpleEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,22 @@ public class SimpleEvents {
.since("INSERT VERSION")
.requiredPlugins("Spigot 1.19.4+");
}

if (Skript.classExists("com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent")) {
Skript.registerEvent("Enderman Enrage", SimpleEvent.class, com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent.class, "enderman (enrage|anger)")
.description(
"Called when an enderman gets mad because a player looked at them.",
"Note: This does not stop enderman from targeting the player as a result of getting damaged."
)
.examples(
"# Stops endermen from getting angry players with the permission \"safeFrom.enderman\"",
"on enderman enrage:",
"\tif player has permission \"safeFrom.enderman\":",
"\t\tcancel event"
)
.since("INSERT VERSION")
.requiredPlugins("Paper");
}
}

}