Plugins-PocketMineMP / AmongUs

A PocketMine-MP Plugin that implements AmongUs
GNU General Public License v3.0
42 stars 7 forks source link

Setting spawn positions crashes the server #20

Closed KadTheHunter closed 4 years ago

KadTheHunter commented 4 years ago

Issue Description

Server crashes when you set the spawn position Step to Reproduce

  1. Create an arena with /aum creategame
  2. Tap a block to set the spawn position

Expected behavior

Expected it to set spawn positions Actual behavior

It crashed the entire server Screenshots

None

PocketMine-MP Info

Additional context or Notes

[21:18:42] [Server thread/CRITICAL]: ErrorException: "Undefined offset: 1" (EXCEPTION) in "plugins/AmongUs_dev-53.phar/src/alvin0319/AmongUs/game/Game" at line 193

Line 193 of Game.php:

[$x, $y, $z] = explode(":", $data);

KadTheHunter commented 4 years ago

Tried it again, same result. It saves the arena (including spawn position) in plugin data however. Upon joining the game via /au join, the tip above hotbar saying you've joined doesn't appear.

alvin0319 commented 4 years ago

Can you provide full log?

including backtrace.

KadTheHunter commented 4 years ago
2020-11-27 [21:18:42] [Server thread/CRITICAL]: ErrorException: "Undefined offset: 1" (EXCEPTION) in "plugins/AmongUs_dev-53.phar/src/alvin0319/AmongUs/game/Game" at line 193
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #0 plugins/AmongUs_dev-53.phar/src/alvin0319/AmongUs/game/Game(193): pocketmine\utils\Utils::errorExceptionHandler(integer 8, string[19] Undefined offset: 1, string[86] phar:///home/container/plugins/AmongUs_dev-53.phar/src/alvin0319/AmongUs/game/Ga, integer 193, array[2])
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #1 (): alvin0319\AmongUs\game\Game->alvin0319\AmongUs\game\{closure}(string[2] 30)
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #2 plugins/AmongUs_dev-53.phar/src/alvin0319/AmongUs/game/Game(195): array_map(object Closure, array[7])
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #3 plugins/AmongUs_dev-53.phar/src/alvin0319/AmongUs/task/WorldCopyAsyncTask(95): alvin0319\AmongUs\game\Game->alvin0319\AmongUs\game\{closure}()
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #4 src/pocketmine/scheduler/AsyncPool(319): alvin0319\AmongUs\task\WorldCopyAsyncTask->onCompletion(object pocketmine\Server)
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #5 src/pocketmine/Server(2395): pocketmine\scheduler\AsyncPool->collectTasks()
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #6 src/pocketmine/Server(2154): pocketmine\Server->tick()
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #7 src/pocketmine/Server(1994): pocketmine\Server->tickProcessor()
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #8 src/pocketmine/Server(1588): pocketmine\Server->start()
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #9 src/pocketmine/PocketMine(273): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[16] /home/container/, string[24] /home/container/plugins/)
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #10 src/pocketmine/PocketMine(304): pocketmine\server()
2020-11-27 [21:18:42] [Server thread/CRITICAL]: #11 (11): require(string[71] phar:///home/container/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
2020-11-27 [21:18:42] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump
2020-11-27 [21:18:42] [Server thread/EMERGENCY]: Please upload the "/home/container/crashdumps/Fri_Nov_27-21.18.42-UTC_2020.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.
2020-11-27 [21:18:42] [Server thread/EMERGENCY]: Failed to communicate with crash archive: Unknown error
alvin0319 commented 4 years ago

@KadTheHunter Could you send path_to_your_server/plugin_data/AmongUs/AmongUsData.json?

KadTheHunter commented 4 years ago

I wiped the data to simplify work I was doing, but I can re-create the problem and send data later.

KadTheHunter commented 4 years ago

@KadTheHunter Could you send path_to_your_server/plugin_data/AmongUs/AmongUsData.json?

[{"settings":{"max_imposter":2,"max_crew":10,"emergency_time":120,"emergency_press":2,"kill_cooldown":25,"min_player_to_start":5,"wait_second":30},"map":"games","spawnPos":"256:43:255:games_0","objectives":[],"mapId":-1,"vents":[]}]

Used latest Dev build (56), same error, and the above is the AmongUsData.json

HydroGames-dev commented 4 years ago

wait a minute

What's your

KadTheHunter commented 4 years ago

World Name: games Config Settings:

#      _                                _   _     
#     / \   _ __ ___   ___  _ __   __ _| | | |___ 
#    / _ \ | '_ ` _ \ / _ \| '_ \ / _` | | | / __|
#   / ___ \| | | | | | (_) | | | | (_| | |_| \__ \
#  /_/   \_\_| |_| |_|\___/|_| |_|\__, |\___/|___/
#                                 |___/
#
# Here you can Customize the AmongUs Plugin Game settings.

# How many games can be made on the server.
# Recommended: 3-5
max_games: 4

# Select which world should the game be made.
world_name: games

Which World I did Setup in: games

Edit: I have 3 worlds, plots, city, and games. games is games with an s, and I already double checked spelling between world name and among us settings, and all my attempts past and current have been in the games world. No other plugin is currently involved in the games world either.

HydroGames-dev commented 4 years ago

Hmm @alvin0319

KadTheHunter commented 4 years ago

Something else I just noticed is that AmongUs made a copy of the games world, and called the folder games_0, though the actual world name appears to still be games. I haven't checked level.dat yet, but /status shows the following: image

I'm assuming (games) references the world name being different from the folder name.

Not sure if this is intentional, or related to the crash, just though I'd let you know.

HydroGames-dev commented 4 years ago

the copy world is where the game works

HydroGames-dev commented 4 years ago

Btw Delete AmongUsData.json and the map games_0

Setup again but this time do /aum setmapimage {id} and then try setting the spawn position

KadTheHunter commented 4 years ago

but this time do /aum setmapimage {id} and then try setting the spawn position

Just tried, and you can't do that because the map ID doesn't exist until you set the spawn position. Literally when you do /aum setmapimage 0, it says there is no map with ID 0, and the same goes for any other number. The Map ID is set/created when you set the spawn positions.

HydroGames-dev commented 4 years ago

Do u have the Virions and plugins needed? SimpleMapRenderer, Invmenu, png-converter etc

https://github.com/alvin0319/AmongUs#dependencies

KadTheHunter commented 4 years ago

Didn't have some of them, just got them and tested again, still has the issue. It sets Map ID as 0, then crashes the server.

ExileWeb commented 4 years ago

I can confirm all of the above is true, however crashes using getFolderName on null @ 681 of Game.

KadTheHunter commented 4 years ago

I can confirm all of the above is true, however crashes using getFolderName on null @ 681 of Game.

Post the exact error in a code block, it helps devs.

ExileWeb commented 4 years ago

I can confirm all of the above is true, however crashes using getFolderName on null @ 681 of Game.

Post the exact error in a code block, it helps devs.

It's pretty self explanatory for any developer but this is the line $this->spawnPos->getLevel()->getFolderName()

HydroGames-dev commented 4 years ago

I can confirm all of the above is true, however crashes using getFolderName on null @ 681 of Game.

Post the exact error in a code block, it helps devs.

It's pretty self explanatory for any developer but this is the line $this->spawnPos->getLevel()->getFolderName()

Check now

ghost commented 4 years ago

in "plugins/AmongUs/src/alvin0319/AmongUs/game/Game" at line 193

When tap block spawn, I've installed all the depend

ghost commented 4 years ago

TypeError: "Argument 1 passed to pocketmine\Server ::unloadLevel() must be an instance of pocketmine\level\Level, null given, called in /r oot/pmmp/plugins/AmongUs/src/alvin0319/AmongUs/AmongUs.php on line 215" (EXCEPTION) in "src/pocketmine/Server" at line 915