Fix errorneous call of EntityDismountEvent

This commit is contained in:
Aikar 2016-04-03 19:11:25 -04:00
parent e00a06201b
commit 62071aad36
5 changed files with 19 additions and 28 deletions

View file

@ -1,29 +1,20 @@
From 3034ddd456b81eafd9a8ef34f9dfa72d8f6243af Mon Sep 17 00:00:00 2001
From 5c4d7d8d8e6ff1d01202e5de62da63fe66c55c96 Mon Sep 17 00:00:00 2001
From: Nik Gil <nikmanG@users.noreply.github.com>
Date: Thu, 3 Mar 2016 04:04:19 -0600
Subject: [PATCH] Made EntityDismountEvent Cancellable
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 782abd6..51b2a4f 100644
index 782abd6..c3e6588 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -38,6 +38,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.plugin.PluginManager;
+import org.spigotmc.event.entity.EntityDismountEvent;
// CraftBukkit end
public abstract class Entity implements ICommandListener {
@@ -1742,6 +1743,11 @@ public abstract class Entity implements ICommandListener {
@@ -1741,7 +1741,9 @@ public abstract class Entity implements ICommandListener {
}
}
// CraftBukkit end
Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
- Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
+ // Paper start - make EntityDismountEvent cancellable
+ EntityDismountEvent dismountEvent = new EntityDismountEvent(this.getBukkitEntity(), entity.getBukkitEntity()); // Spigot
+ Bukkit.getPluginManager().callEvent(dismountEvent);
+ if (dismountEvent.isCancelled()) return;
+ if (!new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity()).callEvent()) return;
+ // Paper end
this.passengers.remove(entity);
entity.j = 60;

View file

@ -1,14 +1,14 @@
From 41842af752e620167cec3eb7a00c4dbbf5af8e12 Mon Sep 17 00:00:00 2001
From bc6ae7496c8eabe23ee4e1773211e5fa75eeee33 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:39:54 -0600
Subject: [PATCH] Change implementation of (tile)entity removal list
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 51b2a4f..5c3f179 100644
index c3e6588..5ff5c54 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -120,9 +120,9 @@ public abstract class Entity implements ICommandListener {
@@ -119,9 +119,9 @@ public abstract class Entity implements ICommandListener {
private static final DataWatcherObject<Boolean> aA = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
private static final DataWatcherObject<Boolean> aB = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
public boolean aa;

View file

@ -1,4 +1,4 @@
From b4e8b20eff4c996e4b10d937e0039a622f8d411e Mon Sep 17 00:00:00 2001
From 4fd34aff149d7fee35a8e3b18e2e007bb2225d97 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 23:25:45 -0500
Subject: [PATCH] Disable Scoreboards for non players by default
@ -37,10 +37,10 @@ index b044f33..1758a56 100644
if (scoreboard.addPlayerToTeam(s2, s)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 5c3f179..03944dd 100644
index 5ff5c54..f9626d6 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1851,6 +1851,7 @@ public abstract class Entity implements ICommandListener {
@@ -1847,6 +1847,7 @@ public abstract class Entity implements ICommandListener {
}
public ScoreboardTeamBase aO() {

View file

@ -1,4 +1,4 @@
From c4ee41fc06ca9056f3bf8e7eac25cd6b2083eb3e Mon Sep 17 00:00:00 2001
From 17199e7d96753b3ff9afe62bbd9e821c46807460 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 22 Mar 2016 00:33:47 -0400
Subject: [PATCH] Use a Shared Random for Entities
@ -6,10 +6,10 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 03944dd..2ebeaf9 100644
index f9626d6..4a4fe34 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -45,6 +45,7 @@ public abstract class Entity implements ICommandListener {
@@ -44,6 +44,7 @@ public abstract class Entity implements ICommandListener {
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@ -17,7 +17,7 @@ index 03944dd..2ebeaf9 100644
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@@ -160,7 +161,7 @@ public abstract class Entity implements ICommandListener {
@@ -159,7 +160,7 @@ public abstract class Entity implements ICommandListener {
this.width = 0.6F;
this.length = 1.8F;
this.av = 1;

View file

@ -1,4 +1,4 @@
From fa99f34711fb6354b85ac93c3543dcc218db3e69 Mon Sep 17 00:00:00 2001
From 113483e5a4e9d1f9f4f0b98b2d80ceb075c323ba Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 22 Mar 2016 00:55:23 -0400
Subject: [PATCH] Don't teleport dead entities
@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic.
Potentially an old CB change that's no longer needed.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2ebeaf9..e7af110 100644
index 4a4fe34..49e6661 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2101,7 +2101,7 @@ public abstract class Entity implements ICommandListener {
@@ -2097,7 +2097,7 @@ public abstract class Entity implements ICommandListener {
}
public Entity teleportTo(Location exit, boolean portal) {