{"action":"created","issue":{"url":"https://api.github.com/repos/cuberite/cuberite/issues/3243","repository_url":"https://api.github.com/repos/cuberite/cuberite","labels_url":"https://api.github.com/repos/cuberite/cuberite/issues/3243/labels{/name}","comments_url":"https://api.github.com/repos/cuberite/cuberite/issues/3243/comments","events_url":"https://api.github.com/repos/cuberite/cuberite/issues/3243/events","html_url":"https://github.com/cuberite/cuberite/issues/3243","id":162880979,"number":3243,"title":"DoWihPlayer yielding wrong player during HOOK_PLAYER_SPAWNED","user":{"login":"ameuret","id":28158,"avatar_url":"https://avatars.githubusercontent.com/u/28158?v=3","gravatar_id":"","url":"https://api.github.com/users/ameuret","html_url":"https://github.com/ameuret","followers_url":"https://api.github.com/users/ameuret/followers","following_url":"https://api.github.com/users/ameuret/following{/other_user}","gists_url":"https://api.github.com/users/ameuret/gists{/gist_id}","starred_url":"https://api.github.com/users/ameuret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ameuret/subscriptions","organizations_url":"https://api.github.com/users/ameuret/orgs","repos_url":"https://api.github.com/users/ameuret/repos","events_url":"https://api.github.com/users/ameuret/events{/privacy}","received_events_url":"https://api.github.com/users/ameuret/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-29T09:32:40Z","updated_at":"2016-06-29T10:36:42Z","closed_at":null,"body":"Client version:   1.8.9\r\nCommit id:       4e2c92d15f768c7308787f6b8534d9034846700b built at: approx: 2016-06-24 14:42:09 +0200\r\n\r\nThis plugin code produces the following console output.\r\n\r\n```\r\nfunction Initialize(Plugin)\r\n   Plugin:SetName(\"ZEDFancySpawn\")\r\n   Plugin:SetVersion(1)\r\n   cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, ZEDPlayerSpawned)\r\n   \r\n   LOG(\"Initialised \" .. Plugin:GetName() .. \" v.\" .. Plugin:GetVersion())\r\n   return true\r\nend\r\n\r\nfunction ZEDPlayerSpawned(Player)\r\n   \r\n   local FancySpawn = function(Spawnee)\r\n      LOG(Spawnee:GetName() .. \" is about to spawn in a flash of lightning\")\r\n      Spawnee:GetWorld():CastThunderbolt(Spawnee:GetPosX(), Spawnee:GetPosY(), Spawnee:GetPosZ())\r\n      Spawnee:SetVisible(true)\r\n      return true\r\n   end\r\n   \r\n   LOG(Player:GetName() .. \" will spawn like Tony Stark\")\r\n   Player:SetVisible(false)\r\n   if not Player:GetWorld():DoWithPlayer(Player:GetName(), FancySpawn) then\r\n      LOG(\"Unable to find player spawned as \" .. Player:GetName())\r\n   end\r\n   return false\r\nend\r\n```\r\n\r\n# Output\r\n\r\n```\r\n[19:42:58] User voctir authenticated with UUID 4ff2b9b6807443c891066ba3cc177f96\r\n[19:42:58] Player voctir has joined the game\r\n[19:42:58] voctir will spawn like Tony Stark\r\n[19:42:58] PhantomMMIV is about to spawn in a flash of lightning\r\n```\r\n\r\n# Expected\r\n\r\nPlayer `voctir` to be found by `World:DoWithPlayer('voctir', FancySpawn)`\r\n\r\nPlayer `PhantomMMIV` is a player currently connected just to witness the spawn. Only two players connected to his server.\r\n\r\n(I'm available in IRC if that helps)"},"comment":{"url":"https://api.github.com/repos/cuberite/cuberite/issues/comments/229320334","html_url":"https://github.com/cuberite/cuberite/issues/3243#issuecomment-229320334","issue_url":"https://api.github.com/repos/cuberite/cuberite/issues/3243","id":229320334,"user":{"login":"ameuret","id":28158,"avatar_url":"https://avatars.githubusercontent.com/u/28158?v=3","gravatar_id":"","url":"https://api.github.com/users/ameuret","html_url":"https://github.com/ameuret","followers_url":"https://api.github.com/users/ameuret/followers","following_url":"https://api.github.com/users/ameuret/following{/other_user}","gists_url":"https://api.github.com/users/ameuret/gists{/gist_id}","starred_url":"https://api.github.com/users/ameuret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ameuret/subscriptions","organizations_url":"https://api.github.com/users/ameuret/orgs","repos_url":"https://api.github.com/users/ameuret/repos","events_url":"https://api.github.com/users/ameuret/events{/privacy}","received_events_url":"https://api.github.com/users/ameuret/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T10:36:42Z","updated_at":"2016-06-29T10:36:42Z","body":"All right. Thanks for your help.\r\nFor what it's worth, when using:\r\n```lua\r\ncRoot:Get():FindAndDoWithPlayer(Player:GetName(), FancySpawn)\r\n```\r\nThe correct player is selected but the `CastThunderbolt` and the `setVisible` calls seem to have no effect.\r\n\r\nI will do further testing to probe for off-by-one mistakes (>2 players, order of connection, etc.)"}}
{"actor":{"display_login":"ameuret"}}