mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-22 08:04:34 +00:00
Update LavaFlow to new sourcing system
This commit is contained in:
parent
59033dab88
commit
a26e091a52
4 changed files with 11 additions and 9 deletions
|
@ -168,7 +168,7 @@ public class LavaFlow {
|
||||||
}
|
}
|
||||||
instances.add(this);
|
instances.add(this);
|
||||||
} else if (type == AbilityType.CLICK) {
|
} else if (type == AbilityType.CLICK) {
|
||||||
Block sourceBlock = BlockSource.getEarthOrLavaSourceBlock(player, clickRange, clickRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player));
|
Block sourceBlock = BlockSource.getEarthOrLavaSourceBlock(player, clickRange, clickRange, ClickType.CLICK, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
|
||||||
if (sourceBlock == null) {
|
if (sourceBlock == null) {
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
|
@ -372,7 +372,6 @@ public class LavaFlow {
|
||||||
*
|
*
|
||||||
* @param testBlock the block to attempt to remove
|
* @param testBlock the block to attempt to remove
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void removeLava(Block testBlock) {
|
public void removeLava(Block testBlock) {
|
||||||
for (int i = 0; i < TEMP_LAVA_BLOCKS.size(); i++) {
|
for (int i = 0; i < TEMP_LAVA_BLOCKS.size(); i++) {
|
||||||
TempBlock tblock = TEMP_LAVA_BLOCKS.get(i);
|
TempBlock tblock = TEMP_LAVA_BLOCKS.get(i);
|
||||||
|
@ -384,8 +383,8 @@ public class LavaFlow {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TempBlock tblock = new TempBlock(testBlock, REVERT_MATERIAL, testBlock.getData());
|
TempBlock tblock = new TempBlock(testBlock, REVERT_MATERIAL, (byte) 0);
|
||||||
affectedBlocks.add(tblock);
|
affectedBlocks.add(tblock);
|
||||||
TEMP_LAND_BLOCKS.add(tblock);
|
TEMP_LAND_BLOCKS.add(tblock);
|
||||||
}
|
}
|
||||||
|
@ -526,7 +525,10 @@ public class LavaFlow {
|
||||||
public static boolean isEarthbendableMaterial(Material mat, Player player) {
|
public static boolean isEarthbendableMaterial(Material mat, Player player) {
|
||||||
for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks"))
|
for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks"))
|
||||||
if (mat == Material.getMaterial(s))
|
if (mat == Material.getMaterial(s))
|
||||||
return true;
|
return true;
|
||||||
|
if (ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.SandBlocks").contains(mat.toString()) && EarthMethods.canSandbend(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.MetalBlocks").contains(mat.toString()) && EarthMethods.canMetalbend(player)) {
|
if (ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.MetalBlocks").contains(mat.toString()) && EarthMethods.canMetalbend(player)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class LavaWall {
|
||||||
|
|
||||||
public boolean prepare() {
|
public boolean prepare() {
|
||||||
cancelPrevious();
|
cancelPrevious();
|
||||||
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, dynamic, true, EarthMethods.canSandbend(player));
|
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
sourceblock = block;
|
sourceblock = block;
|
||||||
focusBlock();
|
focusBlock();
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class LavaWave {
|
||||||
public boolean prepare() {
|
public boolean prepare() {
|
||||||
cancelPrevious();
|
cancelPrevious();
|
||||||
// Block block = player.getTargetBlock(null, (int) range);
|
// Block block = player.getTargetBlock(null, (int) range);
|
||||||
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player));
|
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
sourceblock = block;
|
sourceblock = block;
|
||||||
focusBlock();
|
focusBlock();
|
||||||
|
|
|
@ -278,13 +278,13 @@ public class BlockSource {
|
||||||
* either {@link ClickType}.SHIFT_DOWN or ClickType.LEFT_CLICK.
|
* either {@link ClickType}.SHIFT_DOWN or ClickType.LEFT_CLICK.
|
||||||
* @return a valid Earth or Lava bendable block, or null if none was found.
|
* @return a valid Earth or Lava bendable block, or null if none was found.
|
||||||
*/
|
*/
|
||||||
public static Block getEarthOrLavaSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean auto, boolean dynamic, boolean earth, boolean sand) {
|
public static Block getEarthOrLavaSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean auto, boolean dynamic, boolean earth, boolean sand, boolean metal) {
|
||||||
/*
|
/*
|
||||||
* When Lava is selected as a source it automatically overrides the
|
* When Lava is selected as a source it automatically overrides the
|
||||||
* previous Earth based source. Only one of these types can exist, so if
|
* previous Earth based source. Only one of these types can exist, so if
|
||||||
* Lava exists then we know Earth is null.
|
* Lava exists then we know Earth is null.
|
||||||
*/
|
*/
|
||||||
Block earthBlock = getEarthSourceBlock(player, autoRange, selectRange, clickType, auto, dynamic, earth, sand, false);
|
Block earthBlock = getEarthSourceBlock(player, autoRange, selectRange, clickType, auto, dynamic, earth, sand, metal);
|
||||||
BlockSourceInformation lavaBlockInfo = getValidBlockSourceInformation(player, selectRange, BlockSourceType.LAVA, clickType);
|
BlockSourceInformation lavaBlockInfo = getValidBlockSourceInformation(player, selectRange, BlockSourceType.LAVA, clickType);
|
||||||
if (earthBlock != null) {
|
if (earthBlock != null) {
|
||||||
return earthBlock;
|
return earthBlock;
|
||||||
|
|
Loading…
Reference in a new issue