en 1.9 /scoreboard Scoreboard


execute @e ~ ~ ~ scoreboard players operation @e[r=1] EntityPlayerID = @e[r=1] EntityID
execute @a ~ ~ ~ scoreboard players operation @p PlayerEntityID = @p PlayerID

  A list of all entities with EntityPlayerID equivalent to their unique EntityID,
  and a list of players with PlayerEntityID equivalent to their unique PlayerID.

  The matching entity or entities with EntityPlayerID and player or players with PlayerEntityID,
  like EntityPlayerID is 1 and PlayerEntityID is also 1, are linked.

execute @e ~ ~ ~ scoreboard players operation @e[r=1] EntityPlayerID -= @p PlayerEntityID

  Entities' EntityPlayerID is subtracted from the nearest player's PlayerEntityID.
  @e[score_EntityPlayerID_min=0,score_EntityPlayerID=0] is the linked entity or entities.

execute @e ~ ~ ~ scoreboard players operation @p PlayerEntityID -= @e[type=!Player,r=1] EntityPlayerID

  The nearest player to each entity have their PlayerEntityID subtracted from that entity's EntityPlayerID.
  @a[score_PlayerEntityID_min=0,score_PlayerEntityID=0] is the linked player or players.

Don't use this system to replicate /sethome and /home because entities in a unloaded chunk can't be detected without a
chunk loader which is a lot of work to implement for each home that players set. Instead, give players access to 
/spawnpoint or a bed to set their spawn, send players to the end credit screen, and when they exit out of the credit
with the escape key, they are automatically teleported to where they set their spawn at. It is fine if you use chunk loaders 
for static warps like /spawn or /pvparena, but it might be a bit redundant when you can do /tp <x> <y> <z>. Replicating 
/tpa in vanilla requires linking 2 PlayerIDs. I might publish a PlayerID and PlayerID linking system in the future, but don't 
count on it.

The command

Note: Minify the command to avoid issues :)


Created: Mon, 09 Nov 2015 01:31:03, Updated: Fri, 19 May 2017 04:39:34, Views: 137

Share on:  

    


Top entries from silasmonster


Top entries in Scoreboard