Skip to content

Commit

Permalink
Bumped version to 1.0.6 + Fixed forms causing ISEs for float/int argu…
Browse files Browse the repository at this point in the history
…ments
  • Loading branch information
DaPigGuy committed May 22, 2020
1 parent 6825b9a commit b9fbdcf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: PiggyFactions
main: DaPigGuy\PiggyFactions\PiggyFactions
version: 1.0.5
version: 1.0.6
api: 3.2.0
author: DaPigGuy
softdepend: [EconomyAPI, MultiEconomy, PiggyCustomEnchants, HRKChat]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use CortexPE\Commando\args\BaseArgument;
use CortexPE\Commando\args\BooleanArgument;
use CortexPE\Commando\args\FloatArgument;
use CortexPE\Commando\args\IntegerArgument;
use CortexPE\Commando\args\StringEnumArgument;
use CortexPE\Commando\BaseSubCommand;
use DaPigGuy\PiggyFactions\factions\Faction;
Expand Down Expand Up @@ -122,7 +124,16 @@ public function onFormRun(Player $sender, ?Faction $faction, FactionsPlayer $mem
foreach ($this->getArgumentList() as $position => $arguments) {
/** @var PiggyArgument $argument */
foreach ($arguments as $argument) {
$args[$argument->getName()] = (($enum = $argument->getWrappedArgument()) instanceof StringEnumArgument && !$enum instanceof BooleanArgument) ? $enums[$position][$data[$position]] : $data[$position];
$wrappedArgument = $argument->getWrappedArgument();
if ($wrappedArgument instanceof StringEnumArgument && !$wrappedArgument instanceof BooleanArgument) {
$args[$argument->getName()] = $enums[$position][$data[$position]];
} elseif ($wrappedArgument instanceof IntegerArgument) {
$args[$argument->getName()] = (int)$data[$position];
} elseif ($wrappedArgument instanceof FloatArgument) {
$args[$argument->getName()] = (float)$data[$position];
} else {
$args[$argument->getName()] = $data[$position];
}
}
}
$this->onRun($player, $this->getName(), $args);
Expand Down

0 comments on commit b9fbdcf

Please sign in to comment.