FastTransfer icon indicating copy to clipboard operation
FastTransfer copied to clipboard

Removed redundant &0xFF

Open PEMapModder opened this issue 9 years ago • 7 comments

According to a local test in PHP 5.6.3, chr(256) returns a null byte. This shows that chr() used in DataPacket.php returns the integer representation of the least significant byte only, so & 0xFF is not necessary.

PEMapModder avatar Apr 23 '15 10:04 PEMapModder

What if they send an invalid IP ^.^

shoghicp avatar Jun 02 '15 11:06 shoghicp

Can't you do a ping test to check if the server is online? If not return a message like "Invalid server/ip. Is the server offline?"

TheGrimsey avatar Jul 26 '15 17:07 TheGrimsey

@Subtleoliver What about servers that still accept players even when they are full?

PEMapModder avatar Jul 27 '15 02:07 PEMapModder

@PEMapModder There is some variable to check if a player can join(Server is full etc.). I assume there isn't a playerCanConnect Handler for plugin developers. Make them able to change the "canPlayerJoin" thingy. So for example if a player has the (example) JoinWhenFull.join permission they can join. I assume that something like that is already used. call that if it's a valid server. If it returns true send the player.

TheGrimsey avatar Jul 28 '15 07:07 TheGrimsey

You can't execute a function or check permission for an offline player from remote :/

PEMapModder avatar Jul 28 '15 10:07 PEMapModder

@PEMapModder Well. Then just send em over if it's a server. Ping it and then if you get a valid response send the player no matter if the server is full.

TheGrimsey avatar Jul 28 '15 11:07 TheGrimsey

@Subtleoliver this is not the place to discuss it.

Anyway, note that there might be latency between the CanSpawn response and actually sending the StrangePacket to the client. It may range from 0.1 second to seconds. In this period, everything can happen, from a simple player join to the sky falling onto your head.

PEMapModder avatar Jul 28 '15 14:07 PEMapModder