-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes an issue where users were faced with a "Data too long for column" error when creating an island.
- Loading branch information
Showing
5 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Vecnavium/SkyBlocksPM/commands/args/IslandNameArgument.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Vecnavium\SkyBlocksPM\commands\args; | ||
|
||
use CortexPE\Commando\args\BaseArgument; | ||
use pocketmine\command\CommandSender; | ||
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket; | ||
use function preg_match; | ||
|
||
class IslandNameArgument extends BaseArgument { | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getNetworkType(): int{ | ||
return AvailableCommandsPacket::ARG_TYPE_STRING; | ||
} | ||
|
||
/** | ||
* @param string $testString | ||
* @param CommandSender $sender | ||
* @return bool | ||
*/ | ||
public function canParse(string $testString, CommandSender $sender): bool { | ||
// PM player username validity regex | ||
return (bool)preg_match('/^\w{3,32}$/i', $testString); | ||
} | ||
|
||
/** | ||
* @param string $argument | ||
* @param CommandSender $sender | ||
* @return mixed | ||
*/ | ||
public function parse(string $argument, CommandSender $sender): string { | ||
return $argument; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getTypeName(): string{ | ||
return 'island'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters