2

Let's say I want to build a multiplayer server where players can build on their own plots but be unable to build on others'.

I know I could use plugins, but I'm trying to avoid that if I can.

I also know I could use things like {CanPlaceOn:...}, then tag the blocks specified in the tag by player. But then every player would require their own tags, and that would be hard enough to develop such a set of blocks for one player, much less anticipating how many players would be joining.

So is there any other way to do this in vanilla MC?

5
  • 1
    Please, show some effort. We've been over this.
    – Frank
    Jul 14, 2017 at 17:27
  • 1
    @Frank I tried. {CanPlaceOn} was the only thing I could come up with. I'm not an experience MC player that I can pull esoteric commands out of thin air.
    – DonielF
    Jul 14, 2017 at 20:09
  • Several things you should consider. First, it is much more effective and simpler with plugins, you can avoid it but it will be a lot of work. Second, doing a simple google search will get you some good answers, many coming from this site. Jul 14, 2017 at 20:16
  • @KingsleyZhong I understand plugins would be faster, but for reasons too long to explain here I'd rather avoid them. And I did try Googling, but it turned up nothing.
    – DonielF
    Jul 14, 2017 at 20:29
  • If you tried, then show us what you tried. Show some effort, man! It doesn't have to work; it just has to be something.
    – Frank
    Jul 14, 2017 at 21:05

2 Answers 2

5

If the players are in Survival normally, you can set them to Adventure mode. If they are in Creative normally, you can set them to Spectator mode. I would for example give a tag to everyone who can build in a certain area, switch the game mode accordingly of everyone who doesn't have that tag. In this example I use Creative and Spectator mode.

Initialization: Give every player who should be able to build in the plot from x=200,z=300 to x=300,z=400 the tag canBuild2_3:

/tag ExamplePlayer add canBuild2_3

Loop:

execute as @a[gamemode=creative,tag=!canBuild2_3] at @s run gamemode spectator @s[x=200,z=300,dx=100,dz=100]
execute as @a[gamemode=spectator,tag=!canBuild2_3] at @s unless entity @s[x=200,z=300,dx=100,dz=100] run gamemode creative

Players can still stand outside the plot and place/break blocks at the corner areas inside the plot, but you can just make the area a bit bigger. For more plots, you just copy everything above for it. You can just let it run one after the other (all commands for one plot, then all commands for the next plot, etc.).

(Btw, if you are in one plot that you are allowed to build in and simultaneously in another, overlapping plot that you're not allowed to build in, then the plot that comes last in the execution order decides if you're in Creative or in Spectator.)

I've updated this to 1.14 and made it generally a lot smarter and better for performance. It now only uses the one tag (if you're allowed to build there) and doesn't constantly add and remove a temporary tag to/from you. It also does absolutely nothing for people who shouldn't be affected by it and works at all heights, even below 0 and above 256.

0

My first guess is to use an execute command to tp away all players without the name of the plot's owner. Would require an individual set up for each player however.

Using the testfor command with a radius covering a player's building plot could be used to check for the 'wrong' players and trigger a tp or change of game mode to adventure - restricting the 'wrong' players from building and breaking. again I think this would require an individual set up for each player also.

Using target selectors such as @a[!name= ] would target every named player other than the name given to the command.

Hope this can help get the ball rolling!

1
  • Radius works much better for this kind of thing than x y z dx dy dz, because they don't have a negative (would reduce the amount of tags in my answer from 3 per plot to 2 per plot), but it's spherical and that's probably not what's usually wanted for plots. Jul 14, 2017 at 18:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .