79 lines
3.0 KiB
Diff
79 lines
3.0 KiB
Diff
From 9f97679b367a7c16081fc43c04df67c4a608eb46 Mon Sep 17 00:00:00 2001
|
|
From: virtualWinter <winter@catmc.club>
|
|
Date: Fri, 21 Jul 2023 05:43:47 +0300
|
|
Subject: [PATCH] Add yaw and pitch to world spawn
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
|
index 325d65a3..3e98db76 100644
|
|
--- a/src/main/java/org/bukkit/World.java
|
|
+++ b/src/main/java/org/bukkit/World.java
|
|
@@ -492,8 +492,22 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|
* @param z Z coordinate
|
|
* @return True if it was successfully set.
|
|
*/
|
|
+
|
|
public boolean setSpawnLocation(int x, int y, int z);
|
|
|
|
+ /**
|
|
+ * Sets the spawn location of the world
|
|
+ *
|
|
+ * @param x X coordinate
|
|
+ * @param y Y coordinate
|
|
+ * @param z Z coordinate
|
|
+ * @param yaw left-right rotation
|
|
+ * @param pitch up-down rotation
|
|
+ * @return True if it was successfully set.
|
|
+ */
|
|
+
|
|
+ public boolean setSpawnLocation(int x, int y, int z, float yaw, float pitch);
|
|
+
|
|
/**
|
|
* Gets the relative in-game time of this world.
|
|
* <p>
|
|
diff --git a/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java b/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java
|
|
index 8bec19c9..b51ab6ca 100644
|
|
--- a/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java
|
|
+++ b/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java
|
|
@@ -36,6 +36,7 @@ public class SetWorldSpawnCommand extends VanillaCommand {
|
|
}
|
|
|
|
final int x, y, z;
|
|
+ Float yaw = null, pitch = null; // Poweruser
|
|
|
|
if (args.length == 0) {
|
|
if (player == null) {
|
|
@@ -48,6 +49,10 @@ public class SetWorldSpawnCommand extends VanillaCommand {
|
|
x = location.getBlockX();
|
|
y = location.getBlockY();
|
|
z = location.getBlockZ();
|
|
+ // Poweruser start
|
|
+ yaw = location.getYaw();
|
|
+ pitch = location.getPitch();
|
|
+ // Poweruser end
|
|
} else if (args.length == 3) {
|
|
try {
|
|
x = getInteger(sender, args[0], MIN_COORD, MAX_COORD, true);
|
|
@@ -62,9 +67,15 @@ public class SetWorldSpawnCommand extends VanillaCommand {
|
|
return false;
|
|
}
|
|
|
|
- world.setSpawnLocation(x, y, z);
|
|
-
|
|
- Command.broadcastCommandMessage(sender, "Set world " + world.getName() + "'s spawnpoint to (" + x + ", " + y + ", " + z + ")");
|
|
+ // Poweruser start
|
|
+ if(yaw != null && pitch != null) {
|
|
+ world.setSpawnLocation(x, y, z, yaw, pitch);
|
|
+ Command.broadcastCommandMessage(sender, "Set world " + world.getName() + "'s spawnpoint to (" + x + ", " + y + ", " + z + ", yaw=" + yaw.floatValue() + ", pitch=" + pitch.floatValue());
|
|
+ } else {
|
|
+ world.setSpawnLocation(x, y, z);
|
|
+ Command.broadcastCommandMessage(sender, "Set world " + world.getName() + "'s spawnpoint to (" + x + ", " + y + ", " + z + ")");
|
|
+ }
|
|
+ // Poweruser end
|
|
return true;
|
|
|
|
}
|
|
--
|
|
2.41.0.windows.1
|
|
|