mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Improving Earthbending Efficiency
Rewrote the isEarthbendable() and isTransparentToEarthbending() methods to be more efficient.
This commit is contained in:
parent
80696816d4
commit
c615437b2d
1 changed files with 16 additions and 17 deletions
|
@ -1029,22 +1029,21 @@ public class Methods {
|
||||||
return isEarthbendable(player, "RaiseEarth", block);
|
return isEarthbendable(player, "RaiseEarth", block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEarthbendable(Player player, String ability,
|
public static boolean isEarthbendable(Player player, String ability, Block block)
|
||||||
Block block) {
|
{
|
||||||
if (isRegionProtectedFromBuild(player, ability,
|
|
||||||
block.getLocation()))
|
|
||||||
return false;
|
|
||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
|
boolean valid = false;
|
||||||
for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks")) {
|
for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks"))
|
||||||
|
if (material == Material.getMaterial(s)){
|
||||||
if (material == Material.getMaterial(s)) {
|
valid = true;
|
||||||
|
break;
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(!valid)
|
||||||
}
|
return false;
|
||||||
|
|
||||||
|
if (!isRegionProtectedFromBuild(player, ability,
|
||||||
|
block.getLocation()))
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1327,10 +1326,10 @@ public class Methods {
|
||||||
|
|
||||||
public static boolean isTransparentToEarthbending(Player player,
|
public static boolean isTransparentToEarthbending(Player player,
|
||||||
String ability, Block block) {
|
String ability, Block block) {
|
||||||
if (isRegionProtectedFromBuild(player, ability,
|
if (!Arrays.asList(transparentToEarthbending).contains(block.getTypeId()))
|
||||||
block.getLocation()))
|
|
||||||
return false;
|
return false;
|
||||||
if (Arrays.asList(transparentToEarthbending).contains(block.getTypeId()))
|
if (!isRegionProtectedFromBuild(player, ability,
|
||||||
|
block.getLocation()))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue