mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
2 bugfixes
- Fixes FS-309 by checking if a material provided is actually a block before caging someone. - Fixes a bug that causes the command to throw an ArrayOutOfBoundsException if one were to use a command like `/cage player1 block`.
This commit is contained in:
parent
f57fc56f4a
commit
36bd8c0fad
@ -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:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user