gordonmhy / Jail

A revolutionary player punishment system. Designed for @PocketMine servers.
GNU General Public License v3.0
32 stars 15 forks source link

ERROR-API 3.0.0-ALPHA3 #15

Closed Starflux closed 7 years ago

Starflux commented 7 years ago

PocketMine-MP Version: 1.6.2dev "Unleashed" (API 3.0.0-ALPHA3) Plugin Version: Alpha0.3.0 PHP version: 7.0.15

Hi just wanted to say thank you for developing a great plugin.

i modified the plugin to test with API 3.0.0-ALPHA3.

i was able to enable and create the jail without issue.

however when i try to jail someone (me op) i get the errors in console as below:

[20:18:12] [Server thread/INFO]: Loading pocketmine.yml... [20:18:12] [Server thread/INFO]: Loading server properties... [20:18:12] [Server thread/INFO]: Selected English (eng) as the base language [20:18:12] [Server thread/INFO]: Starting Minecraft: PE server version v1.0.3.0 [20:18:12] [Server thread/INFO]: Opening server on 0.0.0.0:19134 [20:18:13] [Server thread/INFO]: This server is running PocketMine-MP version 1.6.2dev "Unleashed" (API 3.0.0-ALPHA3) [20:18:13] [Server thread/INFO]: PocketMine-MP is distributed under the LGPL License [20:18:13] [Server thread/INFO]: Loading recipes... [20:18:13] [Server thread/INFO]: Loading Jail vAlpha0.3.0 [20:18:13] [Server thread/INFO]: Preparing level "plots" [20:18:13] [Server thread/INFO]: Preparing level "world" [20:18:13] [Server thread/INFO]: Preparing level "mines" [20:18:13] [Server thread/INFO]: Preparing level "Arena" [20:18:13] [Server thread/INFO]: Preparing level "spleef" [20:18:13] [Server thread/INFO]: Preparing level "survive" [20:18:13] [Server thread/INFO]: Preparing level "TNTRUN" [20:18:13] [Server thread/INFO]: Preparing level "CTF2" [20:18:13] [Server thread/INFO]: Enabling Jail vAlpha0.3.0 [20:18:13] [Server thread/INFO]: [Jail] Loading configurations...

Warning: mysqli::__construct(): (HY000/1049): Unknown database 'Jail' in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 619 [20:18:13] [Server thread/INFO]: [Jail] SQL Server connection error: Unknown database 'Jail' [20:18:13] [Server thread/INFO]: [Jail] Loaded Successfully! [20:18:13] [Server thread/INFO]: [Jail] Fetching latest version from repository... [20:18:13] [Server thread/INFO]: [Jail] Result will appear when server query is started. [20:18:13] [Server thread/INFO]: Starting GS4 status listener [20:18:13] [Server thread/INFO]: Setting query port to 19134 [20:18:13] [Server thread/INFO]: Query running on 0.0.0.0:19134 [20:18:13] [Server thread/INFO]: Default game type: Survival Mode

[20:18:15] [Server thread/INFO]: [Jail] No update found! [20:18:46] [Server thread/INFO]: Troll923[/86.163.130.2:1025] logged in with entity id 1 at (world, 253.2406, 69, 257.5541)

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:18:47] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Jail vAlpha0.3.0': Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned on hoyinm14mc\jail\listeners\PlayerListener [20:18:47] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453 [20:18:47] [Server thread/INFO]: Troll923 joined the game

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:18:48] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'Jail vAlpha0.3.0': Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned on hoyinm14mc\jail\listeners\PlayerListener [20:18:48] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:18:49] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'Jail vAlpha0.3.0': Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned on hoyinm14mc\jail\listeners\PlayerListener [20:18:49] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:18:50] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'Jail vAlpha0.3.0': Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned on hoyinm14mc\jail\listeners\PlayerListener [20:18:50] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:18:50] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'Jail vAlpha0.3.0': Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned on hoyinm14mc\jail\listeners\PlayerListener [20:18:50] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:18:53] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerCommandPreprocessEvent' to 'Jail vAlpha0.3.0': Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned on hoyinm14mc\jail\listeners\PlayerListener [20:18:53] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:19:02] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerCommandPreprocessEvent' to 'Jail vAlpha0.3.0': Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned on hoyinm14mc\jail\listeners\PlayerListener [20:19:02] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453

Notice: Undefined index: jailed in phar://C:/Users/steve/Desktop/PocketMine/plugins/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail.php on line 453 [20:19:02] [Server thread/CRITICAL]: Unhandled exception executing command 'jail troll923 jail1 1 ha' in jail: Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned [20:19:02] [Server thread/CRITICAL]: TypeError: "Return value of hoyinm14mc\jail\Jail::isJailed() must be of the type boolean, null returned" (EXCEPTION) in "/phar_zip_Jail_vAlpha0.3.0_dTarOhEF7fILx_m (2)_VL6JXCk6bZ0huoC.phar/src/hoyinm14mc/jail/Jail" at line 453 [20:19:15] [Server thread/INFO]: Troll923 left the game [20:19:15] [Server thread/INFO]: Troll923[/86.163.130.2:1025] logged out due to timeout

If you have time to take a look or even let me know where i am going wrong it would be appreciated.

is this something new with API 3.0.0-ALPHA3?

Kind Reagards Star

gordonmhy commented 7 years ago

Hi! Thanks for reporting the bug! I have tested jailing players for a few times and have found no problem! Could you check if players.yml contains the player's profile and the key 'jailed'?

gordonmhy commented 7 years ago

And btw, do you mind telling me your Twitter ID so I can directly contact you? It can increase the speed of the bug getting fixed.

gordonmhy commented 7 years ago

Try to use Jail Alpha0.3.1 to see if the problem still happens. Delete the config file, players.yml and jails.yml and see if jailing works properly again.

Starflux commented 7 years ago

Apologies i do not have a twitter account i will sort one out today.

however i have just tested Alpha0.3.2 and seems to be working now with no errors in the console.

Thankyou soo much for investing your time in this.

Kind Regards Star

Starflux commented 7 years ago

so i have been playing with it this morning and it appears to work even accross multiple worlds.

i did notice that when i: jailed myself > disconnect >reconnect - i am still in jail with the correct remaining time however the console shows the following error.

[10:23:32] [Server thread/INFO]: Troll923 joined the game [10:23:44] [Server thread/INFO]: [Jail] Jailed player troll923 for 1 min Reason: no reason [10:24:03] [Server thread/INFO]: Troll923 left the game [10:24:03] [Server thread/INFO]: Troll923[/86.163.130.2:1025] logged out due to timeout [10:24:18] [Server thread/INFO]: Troll923[/86.163.130.2:1025] logged in with entity id 2 at (world, 248, 72, 235) [10:24:19] [Server thread/INFO]: [EssentialsPE] Running

Notice: Undefined index: jail in phar://C:/Users/steve/Desktop/PocketMine/plugins/Jail-master.phar/src/hoyinm14mc/jail/listeners/PlayerListener.php on line 66 [10:24:19] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Jail vAlpha0.3.2': Argument 2 passed to hoyinm14mc\jail\Jail::tpJail() must be of the type string, null given, called in phar://C:/Users/steve/Desktop/PocketMine/plugins/Jail-master.phar/src/hoyinm14mc/jail/listeners/PlayerListener.php on line 66 on hoyinm14mc\jail\listeners\PlayerListener [10:24:19] [Server thread/CRITICAL]: TypeError: "Argument 2 passed to hoyinm14mc\jail\Jail::tpJail() must be of the type string, null given, called in phar://C:/Users/steve/Desktop/PocketMine/plugins/Jail-master.phar/src/hoyinm14mc/jail/listeners/PlayerListener.php on line 66" (EXCEPTION) in "/Jail-master.phar/src/hoyinm14mc/jail/Jail" at line 546 [10:24:19] [Server thread/INFO]: Troll923 joined the game

I hope this is useful and i am not just causing you problems.

Kind Regards Star

gordonmhy commented 7 years ago

Thanks for telling me the errors! The error showing in the console when you join the game won't affect how the jailing system works, but I'll still try to fix them.

Starflux commented 7 years ago

just to cause more confusion...

last time was a time out disconnect this time i logged out of the server and tried to reconnect.

I received this message in console, i am the only device configured as Steve.

CONSOLE: [20:00:09] [Server thread/INFO]: Steve[/86.163.130.2:1026] logged out due to Kicked by admin. Reason: [JAIL] Your UUID is duplicated with a jailed player

Player.yml Steve: jailed: false gamemode: 0 voteForJail: votes: 0 votedBy: [] uuid: !php/object "O:21:\"pocketmine\utils\UUID\":2:{s:28:\"\0pocketmine\utils\UUID\0parts\";a:4:{i:0;i:-584882030;i:1;i:1150565655;i:2;i:-1627396589;i:3;i:152615724;}s:30:\"\0pocketmine\utils\UUID\0version\";i:3;}" steve: uuid: dd236892-4494-3d17-8eff-e6130918bb2c

gordonmhy commented 7 years ago

try deleting players.yml and restart the server and try again.

Starflux commented 7 years ago

have tried that already i have just done a basic fresh install just to test.

PocketMine-MP Version: 1.6.2dev "Unleashed" (API 3.0.0-ALPHA3) PHP version: 7.0.15

EconomyAPI v2.0.9 Jail vAlpha0.3.2

1. NO OP player joins the server 1st time no issue

player.yml

Troll923: jailed: false gamemode: 0 voteForJail: votes: 0 votedBy: [] uuid: !php/object "O:21:\"pocketmine\utils\UUID\":2:{s:28:\"\0pocketmine\utils\UUID\0parts\";a:4:{i:0;i:1967146116;i:1;i:-1221905771;i:2;i:-1119061683;i:3;i:-361520988;}s:30:\"\0pocketmine\utils\UUID\0version\";i:3;}" troll923: uuid: 75404484-b72b-3295-8d4c-794dea73a0a4 ...

when non op player attempts to join again receives the message:

Kicked by admin. Reason: [JAIL] Your UUID is duplicated with a jailed player

Note: no change to player.yml

2. OP player joins the server 1st time no issue

Player.yml

Troll923: jailed: false gamemode: 0 voteForJail: votes: 0 votedBy: [] uuid: !php/object "O:21:\"pocketmine\utils\UUID\":2:{s:28:\"\0pocketmine\utils\UUID\0parts\";a:4:{i:0;i:1967146116;i:1;i:-1221905771;i:2;i:-1119061683;i:3;i:-361520988;}s:30:\"\0pocketmine\utils\UUID\0version\";i:3;}" troll923: uuid: 75404484-b72b-3295-8d4c-794dea73a0a4 ...

when op player attempts to join again, joins without issue.

Note: player.yml files are identical in both cases

gordonmhy commented 7 years ago

um let me check it

Starflux commented 7 years ago

was it just me? did you get chance to see anything?

thank you again for taking the time to look into this, it is greatly appreciated.

Kind regards Star

gordonmhy commented 7 years ago

Did you try reinstalling the data file (players.yml) and run the plugin again? As I found that the data you posted above has the old version UUID structure.

A proper UUID should be like this: players.yml:

hoyinm14mc: jailed: false voteForJail: votes: 0 votedBy: [] uuid: 02cb7f95-5b24-3fb7-804d-55f7e451e5d8

gordonmhy commented 7 years ago

Oh and btw, it's probably just the problem of your settings. The UUID checker prevents jailed players from using other names to join the same server. (As each device has its own UUID which is theoretically not modifiable) OP players have the permission "jail.uuidcheck.bypass" as default setting so they can still join the server without any restriction.

gordonmhy commented 7 years ago

Oh I may have found the problem. Lemme try fixing it

Starflux commented 7 years ago

The player in the report above was never jailed it was a straight forward join server, leave server , join server from the same device.

Starflux commented 7 years ago

Forgot to reply that it was a fresh plugin installation, hadn't even set the jail yet.

Starflux commented 7 years ago

i noticed your new commit so i just done a fresh install after removing everything.

"no op" player joined first time:

Troll923: jailed: false gamemode: 0 voteForJail: votes: 0 votedBy: [] uuid: !php/object "O:21:\"pocketmine\utils\UUID\":2:{s:28:\"\0pocketmine\utils\UUID\0parts\";a:4:{i:0;i:1967146116;i:1;i:-1221905771;i:2;i:-1119061683;i:3;i:-361520988;}s:30:\"\0pocketmine\utils\UUID\0version\";i:3;}" troll923: uuid: 75404484-b72b-3295-8d4c-794dea73a0a4

but when he joins a second time still gets:

Kicked by admin. Reason: [JAIL] Your UUID is duplicated with a jailed player

again OP player is fine but like you said this is due to the permission node.

since you mentioned about the bypass permission node i also tried disabling the UUID check by setting it to false in the config.yml

i then tried to log in again with the NON OP and still received:

Kicked by admin. Reason: [JAIL] Your UUID is duplicated with a jailed player

But the console showed this:

[07:01:19] [Server thread/INFO]: Troll923 left the game [07:01:19] [Server thread/INFO]: Troll923[/213.122.220.111:19132] logged out due to Kicked by admin. Reason: [JAIL] Your UUID is duplicated with a jailed player [07:01:19] [Server thread/INFO]: Troll923 joined the game

Note: notice that no entity id was created on join as the player received the kicked by jail screen.

Starflux commented 7 years ago

ok found it!!


Troll923: This is my username in the correct case uuid: !php/object "O:21:\"pocketmine\utils\UUID\":2:{s:28:\"\0pocketmine\utils\UUID\0parts\";a:4:{i:0;i:1967146116;i:1;i:-1221905771;i:2;i:-1119061683;i:3;i:-361520988;}s:30:\"\0pocketmine\utils\UUID\0version\";i:3;}" jailed: false gamemode: 0 voteForJail: votes: 0 votedBy: [] troll923: (this is not as you see the t is lower case) uuid: 75404484-b72b-3295-8d4c-794dea73a0a4 ...

i stopped the server changed troll923: to Troll923:

then started > i was able to join!

however the config was overwritten in that session and was reverted back to troll923: (lower case t)

preventing me from logging in again unless i manually change the config or remove it.

I hope this helps

p.s. i dont know why this doesnt affect the player when OP? or why the disable UUID doesnt seem to disable for NON OP

gordonmhy commented 7 years ago

Oh I know why. Try to install the latest source code (Load it using DevTools)

gordonmhy commented 7 years ago

Only 1 player joined the server before and no one was jailed before?

Starflux commented 7 years ago

That's correct only one. Player and he was not jailed as the jailed was not created.

I will look at loading with dev tools when I get home, this is new to me as I haven't used it yet.

gordonmhy commented 7 years ago

I have just compiled a new version named alpha0.3.3, go get it

Starflux commented 7 years ago

no change from my "ok found it!!" post earlier

the case of the username is still causing issue and the disable UUID: false property does not take effect for the NON OP as still gets the kicked by jail pop up

Troll923: - This is correct jailed: false gamemode: 0 voteForJail: votes: 0 votedBy: [] uuid: !php/object "O:21:\"pocketmine\utils\UUID\":2:{s:28:\"\0pocketmine\utils\UUID\0parts\";a:4:{i:0;i:1967146116;i:1;i:-1221905771;i:2;i:-1119061683;i:3;i:-361520988;}s:30:\"\0pocketmine\utils\UUID\0version\";i:3;}" troll923: This is not correct and when manually changed is overwritten by the plugin. uuid: 75404484-b72b-3295-8d4c-794dea73a0a4

but thankyou soo much for introducing me to devtools! the amount of time i have "wasted" converting zip to phar. i think i mentioned i have played with around 60-80 plugins over the last two weeks.

[14:23:01] [Server thread/INFO]: Starting Minecraft: PE server version v1.0.3.0 [14:23:01] [Server thread/INFO]: Opening server on 0.0.0.0:19134 [14:23:01] [Server thread/INFO]: This server is running PocketMine-MP version 1.6.2dev "Unleashed" (API 3.0.0-ALPHA3) [14:23:01] [Server thread/INFO]: PocketMine-MP is distributed under the LGPL License [14:23:02] [Server thread/INFO]: Loading recipes... [14:23:02] [Server thread/INFO]: Loading EconomyAPI v2.0.9 [14:23:02] [Server thread/INFO]: Loading DevTools v1.11.1 [14:23:02] [Server thread/INFO]: Enabling DevTools v1.11.1 [14:23:02] [Server thread/INFO]: Loading source plugin Jail vAlpha0.3.3 [14:23:02] [Server thread/INFO]: [DevTools] Registered folder plugin loader

Regards Star

Starflux commented 7 years ago

are the usernames you test with lowercase?

as a tempory measure i have managed to use pureperms to give NON OPS the node: jail.uuidcheck.bypass

and now they can log in but i guess this isnt the fix you want

have also just test the jail and this works fine with both OP and NON OP.

no errors in console

gordonmhy commented 7 years ago

@Starflux Yes. In lowercase, but the case of the username actually doesn't matter.. In theory, the latest code should work perfectly even when you use lowercase or uppercase usernames.

gordonmhy commented 7 years ago

By the way, if you have any other problems, open a new issue for it