mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-14 04:47:51 +00:00
Adds AirBlast config options and bug fix
Adds config options to stop AirBlast flicking levers, opening doors, pushing buttons and cooling lava. Also fixed a bug where benders could flick/open things in regions they don't have permission for (factions, etc)
This commit is contained in:
parent
ebb0165068
commit
0c6e04080b
2 changed files with 22 additions and 5 deletions
|
@ -37,6 +37,12 @@ public class AirBlast extends CoreAbility {
|
|||
public static double defaultrange = config.get().getDouble("Abilities.Air.AirBlast.Range");
|
||||
public static double affectingradius = config.get().getDouble("Abilities.Air.AirBlast.Radius");
|
||||
public static double defaultpushfactor = config.get().getDouble("Abilities.Air.AirBlast.Push");
|
||||
|
||||
public static boolean flickLevers = config.get().getBoolean("Abilities.Air.AirBlast.CanFlickLevers");
|
||||
public static boolean openDoors = config.get().getBoolean("Abilities.Air.AirBlast.CanOpenDoors");
|
||||
public static boolean pressButtons = config.get().getBoolean("Abilities.Air.AirBlast.CanPressButtons");
|
||||
public static boolean coolLava = config.get().getBoolean("Abilities.Air.AirBlast.CanCoolLava");
|
||||
|
||||
private static double originselectrange = 10;
|
||||
private static final int maxticks = 10000;
|
||||
/* Package visible variables */
|
||||
|
@ -287,8 +293,10 @@ public class AirBlast extends CoreAbility {
|
|||
testblock.getWorld().playEffect(testblock.getLocation(), Effect.EXTINGUISH, 0);
|
||||
}
|
||||
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(getPlayer(), "AirBlast", block.getLocation())) continue;
|
||||
|
||||
Material doorTypes[] = { Material.WOODEN_DOOR, Material.SPRUCE_DOOR, Material.BIRCH_DOOR, Material.JUNGLE_DOOR, Material.ACACIA_DOOR, Material.DARK_OAK_DOOR };
|
||||
if (Arrays.asList(doorTypes).contains(block.getType())) {
|
||||
if (Arrays.asList(doorTypes).contains(block.getType()) && openDoors) {
|
||||
if (block.getData() >= 8) {
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
|
@ -301,7 +309,7 @@ public class AirBlast extends CoreAbility {
|
|||
block.getWorld().playSound(block.getLocation(), Sound.DOOR_OPEN, 10, 1);
|
||||
}
|
||||
}
|
||||
if ((block.getType() == Material.LEVER) && !affectedlevers.contains(block)) {
|
||||
if ((block.getType() == Material.LEVER) && !affectedlevers.contains(block) && flickLevers) {
|
||||
// BlockState state = block.getState();
|
||||
// Lever lever = (Lever) (state.getData());
|
||||
// lever.setPowered(!lever.isPowered());
|
||||
|
@ -331,7 +339,7 @@ public class AirBlast extends CoreAbility {
|
|||
|
||||
affectedlevers.add(block);
|
||||
|
||||
} else if ((block.getType() == Material.STONE_BUTTON) && !affectedlevers.contains(block)) {
|
||||
} else if ((block.getType() == Material.STONE_BUTTON) && !affectedlevers.contains(block) && pressButtons) {
|
||||
|
||||
final Button button = new Button(Material.STONE_BUTTON, block.getData());
|
||||
button.setPowered(!button.isPowered());
|
||||
|
@ -365,7 +373,7 @@ public class AirBlast extends CoreAbility {
|
|||
}.runTaskLater(ProjectKorra.plugin, 10);
|
||||
|
||||
affectedlevers.add(block);
|
||||
} else if ((block.getType() == Material.WOOD_BUTTON) && !affectedlevers.contains(block)) {
|
||||
} else if ((block.getType() == Material.WOOD_BUTTON) && !affectedlevers.contains(block) && pressButtons) {
|
||||
|
||||
final Button button = new Button(Material.WOOD_BUTTON, block.getData());
|
||||
button.setPowered(!button.isPowered());
|
||||
|
@ -401,7 +409,7 @@ public class AirBlast extends CoreAbility {
|
|||
affectedlevers.add(block);
|
||||
}
|
||||
}
|
||||
if ((GeneralMethods.isSolid(block) || block.isLiquid()) && !affectedlevers.contains(block)) {
|
||||
if ((GeneralMethods.isSolid(block) || block.isLiquid()) && !affectedlevers.contains(block) && coolLava) {
|
||||
if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) {
|
||||
if (block.getData() == full) {
|
||||
block.setType(Material.OBSIDIAN);
|
||||
|
@ -439,6 +447,11 @@ public class AirBlast extends CoreAbility {
|
|||
defaultrange = config.get().getDouble("Abilities.Air.AirBlast.Range");
|
||||
affectingradius = config.get().getDouble("Abilities.Air.AirBlast.Radius");
|
||||
defaultpushfactor = config.get().getDouble("Abilities.Air.AirBlast.Push");
|
||||
|
||||
flickLevers = config.get().getBoolean("Abilities.Air.AirBlast.CanFlickLevers");
|
||||
openDoors = config.get().getBoolean("Abilities.Air.AirBlast.CanOpenDoors");
|
||||
pressButtons = config.get().getBoolean("Abilities.Air.AirBlast.CanPressButtons");
|
||||
coolLava = config.get().getBoolean("Abilities.Air.AirBlast.CanCoolLava");
|
||||
maxspeed = 1. / defaultpushfactor;
|
||||
range = defaultrange;
|
||||
pushfactor = defaultpushfactor;
|
||||
|
|
|
@ -201,6 +201,10 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Air.AirBlast.Range", 20);
|
||||
config.addDefault("Abilities.Air.AirBlast.Radius", 2);
|
||||
config.addDefault("Abilities.Air.AirBlast.Push", 3.5);
|
||||
config.addDefault("Abilities.Air.AirBlast.CanFlickLevers", true);
|
||||
config.addDefault("Abilities.Air.AirBlast.CanOpenDoors", true);
|
||||
config.addDefault("Abilities.Air.AirBlast.CanPressButtons", true);
|
||||
config.addDefault("Abilities.Air.AirBlast.CanCoolLava", true);
|
||||
|
||||
config.addDefault("Abilities.Air.AirBubble.Enabled", true);
|
||||
config.addDefault("Abilities.Air.AirBubble.Description", "To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability.");
|
||||
|
|
Loading…
Reference in a new issue