Minecraft Data Packs / Server Utility

Accept the rules / Player need to confirm the rules before they can move

  • check_circle Advancements
  • check_circle Functions
  • 2,162 views, 6 today
  • 133 downloads, 0 today
  • 5
  • 7
  • 5
lerokko's Avatar lerokko
Level 27 : Expert Professor
5
This pack forces players to accept the rules on your server when they join. They can not move until they clicked the line in chat to consent to them.

To set it up, firstly, you have to add your rules to the datapack. You do that in the server26rules.zip\data\server26rules\functions\rules.mcfunction file. Replace the tellraw command in line 4 with one that contains your rules (or multiple). Tellraw commands can be created with the website https://www.minecraftjson.com/. They are quite extensive, but do not fret, you will not need to understand most of the features you can just write a text and color it if you like. (Don't forget to leave out the slash at the start commands in mcfunction do not start with a slash)


Secondly, you need to tell the datapack where your spawn is. Its the place where players will be frozen in pace until they confirm the rules. Since there is no efficient way (I know of) for datapacks to detect where the world-spawn is, you have to set it yourself. Run the command /function server26rules:set_teleport at your world-spawn to set it. It will also not move automatically when you move the spawn point. You have to run this command again at the new spawn point BEFORE set the actual world-spawn there. If you do it the other way around the game might still teleport players to the old location occasionally.


DISCLAIMER: Only use on new worlds or with caution. This pack tracks who accepted the rules via a hidden advancement. That means even players that played before the pack was installed will be teleported to the location you specified but in the dimension they are currently in! This pack is not designed for worlds that players already have played in! If you need to make this work on an existing world please comment below or message me about this.


FYI: If a player is in spectator they are exempt from being frozen. You can put players into spectator and they can explore the map without accepting but once you put them back in any other gamemode they will be ported back to the spawn-point you defined in this pack.


Players are also able to reconnect to the server before accepting. The rules will be displayed again and they really have to accept them before moving. You can reset the confirmation for a player by running /advancement revoke PLAYERNAME only server26rules:root which can be useful for testing.


For the more command savvy among you there is a function called server26rules:confirmation that is run when a player accepts the rules. You can add your own logic there on what additional stuff you would want to happen.
CompatibilityMinecraft 1.13
toMinecraft 1.20
Tags

Create an account or sign in to comment.

1
09/08/2023 1:52 pm
Level 5 : Apprentice Miner
Lentejas Con Marichuelas
Lentejas Con Marichuelas's Avatar
Update to version 1.20 pls bro
1
09/08/2023 3:14 pm
Level 27 : Expert Professor
lerokko
lerokko's Avatar
Does it work on 1.20? I have not tried it. If it does I update the post if not I can look into it.
1
09/08/2023 3:18 pm
Level 5 : Apprentice Miner
Lentejas Con Marichuelas
Lentejas Con Marichuelas's Avatar
Nono I say if you can please update to version 1.20
1
09/11/2023 9:54 am
Level 27 : Expert Professor
lerokko
lerokko's Avatar
I now have spent my time testing the current pack in 1.20. It works flawlessly. This is what I meant in my comment I asked you to try it first before asking me to spent my time on this.

It says 1.19 but it works in 1.20 just use it as is there is no need to update. I am sorry if I sound irritated, cause I am. I think this may be a language barrier but I now spent 15 minutes of my day just to find out it was already working which is what I asked you to confirm in my comment :/ Maybe I was not explicit enough and too brief in my phrasing.
1
09/13/2023 10:47 am
Level 5 : Apprentice Miner
Lentejas Con Marichuelas
Lentejas Con Marichuelas's Avatar
Ok XD, 1 week ago my PC broke down that's why I asked
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome