-
-
Notifications
You must be signed in to change notification settings - Fork 487
Add "minecraft.spectatetp". #1729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mickey42302
wants to merge
22
commits into
PurpurMC:ver/26.2
Choose a base branch
from
Mickey42302:spectatetp
base: ver/26.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−0
Open
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
252fe38
Add files via upload
Mickey42302 3954084
Add files via upload
Mickey42302 e26f4dc
Add to PurpurConfig
Mickey42302 2436898
Add files via upload
Mickey42302 27800a9
Merge branch 'PurpurMC:ver/26.2' into spectatetp
Mickey42302 0f9cfc3
Delete purpur-server/minecraft-patches/features/0021-Add-spectator-te…
Mickey42302 7e24aa8
Delete purpur-server/minecraft-patches/features/0022-Add-configuratio…
Mickey42302 d552351
Delete purpur-server/minecraft-patches/features/0023-Add-check-for-sp…
Mickey42302 d5052dc
Add files via upload
Mickey42302 07a9f6a
Add requireSpectatorTeleportPermission setting
Mickey42302 d94d0a1
Add files via upload
Mickey42302 1a00bef
Merge branch 'PurpurMC:ver/26.2' into spectatetp
Mickey42302 8d38b72
Update PurpurPermissions.java
Mickey42302 cd88d62
Add files via upload
Mickey42302 d32ef39
Delete purpur-server/minecraft-patches/features/0022-Add-spectatetp-p…
Mickey42302 82b2fe2
Rewriting the original patch file
Mickey42302 fb109cf
Rewriting the original patch file
Mickey42302 70963be
Update PurpurConfig.java
Mickey42302 922e689
Fix configuration key for spectator teleport permission
Mickey42302 01d8d11
Update PurpurConfig.java
Mickey42302 159f2e8
Add files via upload
Mickey42302 5e4d1b3
Add files via upload
Mickey42302 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
purpur-server/minecraft-patches/features/0022-Add-spectator-teleport-permission-node.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
| From: Mickey42302 <bgoodwin423@gmail.com> | ||
| Date: Mon, 20 Jul 2026 15:12:50 -0400 | ||
| Subject: [PATCH] Add spectator teleport permission node | ||
|
|
||
|
|
||
| diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java | ||
| index 1862df44a3319e459b547cebffb16972674856d6..9edf61c70dbf739a4eeee2b238ed7206ec012c37 100644 | ||
| --- a/net/minecraft/server/Main.java | ||
| +++ b/net/minecraft/server/Main.java | ||
| @@ -110,9 +110,16 @@ public class Main { | ||
| // Purpur start - Add toggle for enchant level clamping - load config files early | ||
| org.bukkit.configuration.file.YamlConfiguration purpurConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) options.valueOf("purpur-settings")); | ||
| org.purpurmc.purpur.PurpurConfig.clampEnchantLevels = purpurConfiguration.getBoolean("settings.enchantment.clamp-levels", true); | ||
| + // Purpur end - Add toggle for enchant level clamping - load config files early | ||
| + | ||
| + // Purpur start - Add settings for enabling commands that are unavailable by default. | ||
| org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands = purpurConfiguration.getBoolean("settings.register-minecraft-debug-commands"); // Purpur - register minecraft debug commands | ||
| org.purpurmc.purpur.PurpurConfig.registerMinecraftDisabledCommands = purpurConfiguration.getBoolean("settings.register-minecraft-disabled-commands"); // Purpur - register disabled minecraft commands | ||
| - // Purpur end - Add toggle for enchant level clamping - load config files early | ||
| + // Purpur end - Add settings for enabling commands that are unavailable by default. | ||
| + | ||
| + // Purpur start - Add setting which can be used to enable a permission node that controls the ability for spectators to teleport to other players. | ||
| + org.purpurmc.purpur.PurpurConfig.requirePermissionSpectatorTeleportToPlayers = purpurConfiguration.getBoolean("settings.require-permission-spectator-teleport-to-players"); // Purpur - require permission spectator teleport to players | ||
| + // Purpur end - Add setting which can be used to enable a permission node that controls the ability for spectators to teleport to other players. | ||
|
|
||
| io.papermc.paper.plugin.PluginInitializerManager.load(options); // Paper | ||
| Bootstrap.bootStrap(); | ||
| diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
| index d731cea2005dff7be6e8e82d602b11355a143ec7..d7493ba7267015a86ee9fdace5fe8d4f0d0d6acf 100644 | ||
| --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
| +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
| @@ -2328,11 +2328,13 @@ public class ServerGamePacketListenerImpl | ||
| public void handleTeleportToEntityPacket(final ServerboundTeleportToEntityPacket packet) { | ||
| PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); | ||
| if (this.player.isSpectator()) { | ||
| - for (ServerLevel level : this.server.getAllLevels()) { | ||
| - Entity entity = packet.getEntity(level); | ||
| - if (entity != null) { | ||
| - this.player.teleportTo(level, entity.getX(), entity.getY(), entity.getZ(), Set.of(), entity.getYRot(), entity.getXRot(), true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit | ||
| - return; | ||
| + if (!org.purpurmc.purpur.PurpurConfig.requirePermissionSpectatorTeleportToPlayers || this.player.getBukkitEntity().hasPermission("purpur.spectator-can-teleport-to-players")) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a // Purpur comment |
||
| + for (ServerLevel level : this.server.getAllLevels()) { | ||
| + Entity entity = packet.getEntity(level); | ||
| + if (entity != null) { | ||
| + this.player.teleportTo(level, entity.getX(), entity.getY(), entity.getZ(), Set.of(), entity.getYRot(), entity.getXRot(), true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit | ||
| + return; | ||
| + } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should comment here with // Purpur instead of having // Purpur start and // Purpur end