Merge pull request #90 from AtlasMediaGroup/FS-309

2 bugfixes, one command (FS-309)
This commit is contained in:
Paldiu 2021-07-16 09:05:57 -05:00 committed by GitHub
commit 0caf972248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,13 +77,26 @@ public class Command_cage extends FreedomCommand
} }
case "block": case "block":
{ {
if (Material.matchMaterial(args[2]) != null) if (args.length >= 3)
{
// Checks the validity of the Material and checks if it's a block.
// This is incredibly inefficient, as Spigot's isBlock() method in Material is an actual
// nightmare of switch-cases.
if (Material.matchMaterial(args[2]) != null && Material.matchMaterial(args[2]).isBlock())
{ {
outerMaterial = Material.matchMaterial(args[2]); outerMaterial = Material.matchMaterial(args[2]);
break; break;
} }
else
{
msg("Invalid block!", ChatColor.RED); msg("Invalid block!", ChatColor.RED);
break; return true;
}
}
else
{
return false;
}
} }
default: default:
{ {