Archiviert
13
0

SPIGOT-3497: Cancelled EntityPortalEvent leads to incorrect behaviour

Dieser Commit ist enthalten in:
md_5 2017-08-08 20:35:29 +10:00
Ursprung 61a31ca0c7
Commit 27b8bf9116

Datei anzeigen

@ -539,7 +539,7 @@
} }
} }
@@ -1893,19 +2236,75 @@ @@ -1893,19 +2236,76 @@
if (!this.world.isClientSide && !this.dead) { if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension"); this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = this.C_(); MinecraftServer minecraftserver = this.C_();
@ -583,6 +583,7 @@
+ event.useTravelAgent(useTravelAgent); + event.useTravelAgent(useTravelAgent);
+ event.getEntity().getServer().getPluginManager().callEvent(event); + event.getEntity().getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !this.isAlive()) { + if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !this.isAlive()) {
+ agent.setCanCreatePortal(oldCanCreate);
+ return null; + return null;
+ } + }
+ exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); + exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo();
@ -618,7 +619,7 @@
BlockPosition blockposition; BlockPosition blockposition;
if (i == 1) { if (i == 1) {
@@ -1934,12 +2333,18 @@ @@ -1934,12 +2334,18 @@
blockposition = new BlockPosition(this); blockposition = new BlockPosition(this);
} }
@ -638,7 +639,7 @@
if (j == 1 && i == 1) { if (j == 1 && i == 1) {
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn()); BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
@@ -1947,6 +2352,7 @@ @@ -1947,6 +2353,7 @@
} else { } else {
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch); entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
} }
@ -646,7 +647,7 @@
boolean flag = entity.attachedToPlayer; boolean flag = entity.attachedToPlayer;
@@ -1954,13 +2360,21 @@ @@ -1954,13 +2361,21 @@
worldserver1.addEntity(entity); worldserver1.addEntity(entity);
entity.attachedToPlayer = flag; entity.attachedToPlayer = flag;
worldserver1.entityJoinedWorld(entity, false); worldserver1.entityJoinedWorld(entity, false);
@ -669,7 +670,7 @@
return entity; return entity;
} else { } else {
return null; return null;
@@ -2064,6 +2478,11 @@ @@ -2064,6 +2479,11 @@
} }
public void setCustomName(String s) { public void setCustomName(String s) {
@ -681,7 +682,7 @@
this.datawatcher.set(Entity.aB, s); this.datawatcher.set(Entity.aB, s);
} }
@@ -2121,7 +2540,26 @@ @@ -2121,7 +2541,26 @@
} }
public void a(AxisAlignedBB axisalignedbb) { public void a(AxisAlignedBB axisalignedbb) {
@ -709,7 +710,7 @@
} }
public float getHeadHeight() { public float getHeadHeight() {
@@ -2295,7 +2733,7 @@ @@ -2295,7 +2734,7 @@
for (Iterator iterator = this.bF().iterator(); iterator.hasNext(); entity.a(oclass, set)) { for (Iterator iterator = this.bF().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
entity = (Entity) iterator.next(); entity = (Entity) iterator.next();
if (oclass.isAssignableFrom(entity.getClass())) { if (oclass.isAssignableFrom(entity.getClass())) {