mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
a207d14a0e
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
48 lines
2.7 KiB
Diff
48 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Steve Anton <anxuiz.nx@gmail.com>
|
|
Date: Thu, 3 Mar 2016 00:09:38 -0600
|
|
Subject: [PATCH] Add PlayerInitialSpawnEvent
|
|
|
|
For modifying a player's initial spawn location as they join the server
|
|
|
|
This is a duplicate API from spigot, so use our duplicate subclass and
|
|
improve setPosition to use raw
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 8cdecaf2f63c78196e0c5046fe2431b40e072c8a..a63babe123fad398b07685ec57cd88756435457c 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -209,7 +209,7 @@ public abstract class PlayerList {
|
|
|
|
// Spigot start - spawn location event
|
|
Player bukkitPlayer = player.getBukkitEntity();
|
|
- org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new org.spigotmc.event.player.PlayerSpawnLocationEvent(bukkitPlayer, bukkitPlayer.getLocation());
|
|
+ org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(bukkitPlayer, bukkitPlayer.getLocation()); // Paper use our duplicate event
|
|
cserver.getPluginManager().callEvent(ev);
|
|
|
|
Location loc = ev.getSpawnLocation();
|
|
@@ -217,7 +217,10 @@ public abstract class PlayerList {
|
|
|
|
player.setLevel(worldserver1);
|
|
player.gameMode.setLevel((ServerLevel) player.level);
|
|
- player.absMoveTo(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
|
|
+ // Paper start - set raw so we aren't fully joined to the world (not added to chunk or world)
|
|
+ player.setPosRaw(loc.getX(), loc.getY(), loc.getZ());
|
|
+ player.setRot(loc.getYaw(), loc.getPitch());
|
|
+ // Paper end
|
|
// Spigot end
|
|
|
|
// CraftBukkit - Moved message to after join
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index f3f48c268639937874dd39eea9bd8e119eebdce7..72eb40f748c33572c2828f48ebd1ca7d5d5712c8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -397,7 +397,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
|
return d1 * d1 + d2 * d2 + d3 * d3 < radius * radius;
|
|
}
|
|
|
|
- protected void setRot(float yaw, float pitch) {
|
|
+ public void setRot(float yaw, float pitch) { // Paper - protected -> public
|
|
// CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0
|
|
if (Float.isNaN(yaw)) {
|
|
yaw = 0;
|