Data Packs Server Utility

Limited Spectator Mode

  • 16.3k views 0 today
  • save_alt 1.3k downloads
Compatibility
Minecraft 1.15
Changes include
  • Functions
  • 15
  • 10
  • 12
Tirco
Lvl 30Artisan Modder
3
Limited Spectator Mode
is a datapack for Minecraft 1.14+ that enables all players to enter Spectator Mode whenever they want, with a few restrictions.

Restrictions:


1) The player can not travel more than 64 blocks away from where they enabled the spectator mode. If they try to fly further, they will be teleported back to their point of origin.

2) Upon leaving spectator mode, they will be teleported to the point they started, to prevent using the mode as a means of transportation.

How it works:


- Upon joining the server, every player is given a unique ID, stored in the scoreboard value sp_id.

- When they use the command "/trigger sp_on" they will go in to spectator mode, and an armorstand will be summoned at their location, with the same ID as the player.
(The location is shown by a floating golden helmet for players that are not in spectator mode)

- The armorstand will constantly check if the player is within a 64 block radius, and teleport them back if they go to far.

- To leave spectator mode, they player will have to use "/trigger sp_off" this will teleport the player back to the armorstand, and disable spectator mode.

Known "bugs":


1) Unloaded Chunks. (FIXED in latest version)
- If a player teleports away from their armorstand while in spectator mode, and the chunks they were in gets unloaded before the player gets properly teleported, they can move freely in spectator mode. This is only until the chunk with their armorstand gets loaded again. This is unfixable until mojang implements a stable way of keeping a chunk loaded. (the /forceload command can not be used by a datapack, sadly...)

I have implemented a function so that they can not use /trigger sp_off until the chunk with their armorstand is loaded, to prevent using the spectator mode as a mode of teleportation.

Status: Unfixable.

2) Bad admin...

- If an administrator uses /kill @e to kill the armorstand, spectators are stuck in spectator limbo, until an administrator saves them. This is done by using the following commands:

- /scoreboard players <playername> set sp_status 0
- /gamemode <playername> survival.


This should allow them to use the command again freely.

Status: User error...

How to install:


1) Add the spectate.zip file to your datapacks folder.
2) Restart the world/server or use the command /reload.


How to uninstall:


1) Delete the datapack from your datapack folder.
2) Restart the world/server or use the command /reload.
3) Run the following commands to clear the scoreboard values:



/scoreboard objectives remove sp_id
/scoreboard objectives remove sp_off
/scoreboard objectives remove sp_on
/scoreboard objectives remove sp_selector
/scoreboard objectives remove sp_status

2 Update Logs

Update #2 : by Tirco 02/19/2020 6:00:02 amFebruary 19, 2020 @ 11:00 am UTC

Updated to 1.15.2. All I had to do was change the pack format. Let me know if there are issues :)
LOAD MORE LOGS

More like this

  Have something to say?

nikit204
08/22/2020 10:33 am
Level 1 : New Miner
1.16?
1
Tirco
08/23/2020 3:22 pm
Level 30 : Artisan Modder
Should work just fine without updating. Might be listed as outdated, so I'll look into it when I have the time :)
1
EgErVali
06/21/2020 2:58 pm
Level 1 : New Miner
I have a question... If the player is teleported back to the original position after leaving spectator mode then why is the 64 block radius restriction necessary? And in addition, only 64 blocks? That's not a lot.
1
Raiders_Play
06/02/2020 1:22 pm
Level 1 : New Miner
history
Hi
This is what I was looking for my server, allowing players to be able to switch to spectator.
Getting a weird issue since installing.

Respawn bed is lost.
Getting "Your home bed was missing or obstructed" when going through the portal at the end.

I've tried uninstalling but the problem persists...
...
1
Raiders_Play
06/02/2020 2:30 pm
Level 1 : New Miner
Some more testing and removing and adding things... It seems to be related to setting the spawnpoint when clicking/sleeping on a bed. If I use the /spawnpoint command it works.

So the respawn point on beds is broken now.
1
Raiders_Play
06/03/2020 12:39 am
Level 1 : New Miner
Somehow the bed spawn changed...

My base the bed is surrounded with halfslabs, making it look like it is level with the floor and preventing mob spawning.

This behavior has now change. Now I have to remove the half slabs around the beds...
1
Cayderino
01/11/2020 2:54 pm
Level 1 : New Miner
Any possibility that you will update this for 1.15.1? My server has used your datapack for as long as we had 1.14.4 and everyone loved it! :)
1
Tirco
02/19/2020 6:00 am
Level 30 : Artisan Modder
Should work fine with any version. To be safe I updated the Pack.mcmeta to v5, and tested it. Worked fine. :)
1
Inputifo
08/24/2019 10:19 am
Level 1 : New Miner
Is there anyway to add a shortcut key to activate it?
1
Tirco
08/28/2019 1:40 am
Level 30 : Artisan Modder
Sadly, this can't be done with a datapack, as keybinds are handled clientside.



You could download a mod that allows you to create Macros, and bind the command to that macro.
1

Welcome