geforkt von Mirrors/Paper
Add EntityTeleportEndGatewayEvent for entities (closes #1124)
Dieser Commit ist enthalten in:
Ursprung
463d2a2bc0
Commit
056199bd92
42
Spigot-API-Patches/Add-EntityTeleportEndGatewayEvent.patch
Normale Datei
42
Spigot-API-Patches/Add-EntityTeleportEndGatewayEvent.patch
Normale Datei
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 9 Jun 2018 13:08:21 +0100
|
||||
Subject: [PATCH] Add EntityTeleportEndGatewayEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
new file mode 100644
|
||||
index 00000000..80899ecb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.block.EndGateway;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity attempts to teleport in an end gateway
|
||||
+ */
|
||||
+public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent {
|
||||
+
|
||||
+ private final EndGateway gateway;
|
||||
+
|
||||
+ public EntityTeleportEndGatewayEvent(Entity what, Location from, Location to, EndGateway gateway) {
|
||||
+ super(what, from, to);
|
||||
+ this.gateway = gateway;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The gateway triggering the teleport
|
||||
+ *
|
||||
+ * @return EndGateway used
|
||||
+ */
|
||||
+ public EndGateway getGateway() {
|
||||
+ return gateway;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
--
|
32
Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch
Normale Datei
32
Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch
Normale Datei
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 9 Jun 2018 13:08:39 +0100
|
||||
Subject: [PATCH] Implement EntityTeleportEndGatewayEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
index ecbc48b0c..c84569612 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
|
||||
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - EntityTeleportEndGatewayEvent - replicated from above
|
||||
+ org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = entity.getBukkitEntity();
|
||||
+ org.bukkit.Location location = new Location(world.getWorld(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
|
||||
+ location.setPitch(bukkitEntity.getLocation().getPitch());
|
||||
+ location.setYaw(bukkitEntity.getLocation().getYaw());
|
||||
+
|
||||
+ com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(MCUtil.toLocation(world, this.getPosition()).getBlock()));
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- entity.enderTeleportTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
|
||||
+ entity.enderTeleportTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
+ // Paper end - EntityTeleportEndGatewayEvent
|
||||
}
|
||||
|
||||
this.h();
|
||||
--
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren