aboutsummaryrefslogtreecommitdiffhomepage
path: root/CraftBukkit-Patches/0139-Implement-PlayerSpawnLocationEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'CraftBukkit-Patches/0139-Implement-PlayerSpawnLocationEvent.patch')
-rw-r--r--CraftBukkit-Patches/0139-Implement-PlayerSpawnLocationEvent.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/CraftBukkit-Patches/0139-Implement-PlayerSpawnLocationEvent.patch b/CraftBukkit-Patches/0139-Implement-PlayerSpawnLocationEvent.patch
new file mode 100644
index 0000000000..6b91ec55b3
--- /dev/null
+++ b/CraftBukkit-Patches/0139-Implement-PlayerSpawnLocationEvent.patch
@@ -0,0 +1,41 @@
+From 1e6c4cd85b190314a6c15c05fd2b006270c4fcbc Mon Sep 17 00:00:00 2001
+From: ninja <[email protected]>
+Date: Tue, 8 Apr 2014 14:05:19 +0200
+Subject: [PATCH] Implement PlayerSpawnLocationEvent.
+
+
+diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
+index 4b8835d..ea9fcd9 100644
+--- a/src/main/java/net/minecraft/server/PlayerList.java
++++ b/src/main/java/net/minecraft/server/PlayerList.java
+@@ -36,6 +36,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
+ import org.bukkit.event.player.PlayerRespawnEvent;
+ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
+ import org.bukkit.util.Vector;
++import org.spigotmc.event.player.PlayerSpawnLocationEvent;
+ // CraftBukkit end
+
+ public abstract class PlayerList {
+@@ -99,6 +100,19 @@ public abstract class PlayerList {
+ s1 = networkmanager.getSocketAddress().toString();
+ }
+
++ // Spigot start - spawn location event
++ Player bukkitPlayer = entityplayer.getBukkitEntity();
++ PlayerSpawnLocationEvent ev = new PlayerSpawnLocationEvent(bukkitPlayer, bukkitPlayer.getLocation());
++ Bukkit.getPluginManager().callEvent(ev);
++
++ Location loc = ev.getSpawnLocation();
++ WorldServer world = ((CraftWorld) loc.getWorld()).getHandle();
++
++ entityplayer.spawnIn(world);
++ entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ());
++ entityplayer.b(loc.getYaw(), loc.getPitch()); // should be setYawAndPitch
++ // Spigot end
++
+ // CraftBukkit - Moved message to after join
+ // g.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
+ WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
+--
+1.9.1
+