Minecraft Data Packs / Server Utility

Limited Spectator Mode

  • check_circle Functions
  • 14,502 views, 2 today
  • 1,319 downloads, 0 today
  • 14
  • 9
  • 12
Tirco's Avatar Tirco
Level 29 : Expert 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
CompatibilityMinecraft 1.15
Tags

2 Update Logs

Update #2 : by Tirco 02/19/2020 6:00:02 amFeb 19th, 2020

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

Create an account or sign in to comment.

1
08/22/2020 10:33 am
Level 1 : New Miner
nikit204
nikit204's Avatar
1.16?
1
08/23/2020 3:22 pm
Level 29 : Expert Modder
Tirco
Tirco's Avatar
Should work just fine without updating. Might be listed as outdated, so I'll look into it when I have the time :)
1
06/21/2020 2:58 pm
Level 1 : New Miner
EgErVali
EgErVali's Avatar
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
06/02/2020 1:22 pmhistory
Level 1 : New Miner
Raiders_Play
Raiders_Play's Avatar
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
06/02/2020 2:30 pm
Level 1 : New Miner
Raiders_Play
Raiders_Play's Avatar
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
06/03/2020 12:39 am
Level 1 : New Miner
Raiders_Play
Raiders_Play's Avatar
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
01/11/2020 2:54 pm
Level 1 : New Miner
Cayderino
Cayderino's Avatar
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
02/19/2020 6:00 am
Level 29 : Expert Modder
Tirco
Tirco's Avatar
Should work fine with any version. To be safe I updated the Pack.mcmeta to v5, and tested it. Worked fine. :)
1
08/24/2019 10:19 am
Level 1 : New Miner
Inputifo
Inputifo's Avatar
Is there anyway to add a shortcut key to activate it?
1
08/28/2019 1:40 am
Level 29 : Expert Modder
Tirco
Tirco's Avatar
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.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome