mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-01-03 13:38:20 +00:00
parent
0684c7b469
commit
102ea0c3c0
7 changed files with 22 additions and 27 deletions
|
@ -123,6 +123,7 @@ import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
import com.projectkorra.projectkorra.util.ReflectionHandler.PackageType;
|
import com.projectkorra.projectkorra.util.ReflectionHandler.PackageType;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
|
|
||||||
|
@ -1159,7 +1160,7 @@ public class GeneralMethods {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAdjacentToThreeOrMoreSources(Block block) {
|
public static boolean isAdjacentToThreeOrMoreSources(Block block) {
|
||||||
if (TempBlock.isTempBlock(block) || block.equals(null)) {
|
if ((TempBlock.isTempBlock(block) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(block))) || block.equals(null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int sources = 0;
|
int sources = 0;
|
||||||
|
|
|
@ -318,7 +318,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a TempBlock of Air bellow FallingSand blocks, prevent it from updating.
|
// If there is a TempBlock of Air bellow FallingSand blocks, prevent it from updating.
|
||||||
if (!event.isCancelled() && (block.getType() == Material.SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL) && TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN)) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR) {
|
if (!event.isCancelled() && (block.getType() == Material.SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL || block.getType() == Material.DRAGON_EGG) && TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN)) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ public abstract class WaterAbility extends ElementalAbility {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isIcebendable(player, block.getType(), false)) {
|
if (isIcebendable(player, block.getType(), false)) {
|
||||||
if (TempBlock.isTempBlock(block)) {
|
if (TempBlock.isTempBlock(block) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(block))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return block;
|
return block;
|
||||||
|
@ -175,7 +175,7 @@ public abstract class WaterAbility extends ElementalAbility {
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(player, "PlantDisc", location)) {
|
if (GeneralMethods.isRegionProtectedFromBuild(player, "PlantDisc", location)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (isPlantbendable(player, block.getType(), onlyLeaves)) {
|
} else if (isPlantbendable(player, block.getType(), onlyLeaves)) {
|
||||||
if (TempBlock.isTempBlock(block)) {
|
if (TempBlock.isTempBlock(block) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(block))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return block;
|
return block;
|
||||||
|
@ -213,15 +213,8 @@ public abstract class WaterAbility extends ElementalAbility {
|
||||||
if ((!isTransparent(player, block) && !isIce(block) && !isPlant(block)) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) {
|
if ((!isTransparent(player, block) && !isIce(block) && !isPlant(block)) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (isWaterbendable(player, null, block) && (!isPlant(block) || plantbending)) {
|
} else if (isWaterbendable(player, null, block) && (!isPlant(block) || plantbending)) {
|
||||||
if (TempBlock.isTempBlock(block)) {
|
if (TempBlock.isTempBlock(block) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(block))) {
|
||||||
continue;
|
continue;
|
||||||
/*
|
|
||||||
* TempBlock tb = TempBlock.get(block); byte full = 0x0; if
|
|
||||||
* (tb.getState().getRawData() != full &&
|
|
||||||
* (tb.getState().getType() != Material.WATER ||
|
|
||||||
* tb.getState().getType() != Material.STATIONARY_WATER)) {
|
|
||||||
* continue; }
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +271,7 @@ public abstract class WaterAbility extends ElementalAbility {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TempBlock.isTempBlock(block)) {
|
if (TempBlock.isTempBlock(block) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(block))) {
|
||||||
return false;
|
return false;
|
||||||
} else if (isWater(block) && block.getData() == full) {
|
} else if (isWater(block) && block.getData() == full) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -159,8 +159,6 @@ public class EarthPassive {
|
||||||
return false;
|
return false;
|
||||||
} else if (TempBlock.isTempBlock(block)) {
|
} else if (TempBlock.isTempBlock(block)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (TempBlock.isTouchingTempBlock(block)) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -172,8 +170,6 @@ public class EarthPassive {
|
||||||
return false;
|
return false;
|
||||||
} else if (LavaSurgeWave.isBlockWave(to) || LavaSurgeWave.isBlockWave(from)) {
|
} else if (LavaSurgeWave.isBlockWave(to) || LavaSurgeWave.isBlockWave(from)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (TempBlock.isTempBlock(to) || TempBlock.isTempBlock(from)) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.Torrent;
|
import com.projectkorra.projectkorra.waterbending.Torrent;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.combo.WaterCombo;
|
import com.projectkorra.projectkorra.waterbending.combo.WaterCombo;
|
||||||
import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
|
import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
|
||||||
|
@ -318,7 +319,7 @@ public class HeatControl extends FireAbility {
|
||||||
WaterSpoutWave.thaw(block);
|
WaterSpoutWave.thaw(block);
|
||||||
WaterCombo.thaw(block);
|
WaterCombo.thaw(block);
|
||||||
|
|
||||||
if (isMeltable(block) && !TempBlock.isTempBlock(block)) {
|
if (isMeltable(block) && !TempBlock.isTempBlock(block) && WaterManipulation.canPhysicsChange(block)) {
|
||||||
if (block.getType() == Material.SNOW) {
|
if (block.getType() == Material.SNOW) {
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
return;
|
return;
|
||||||
|
@ -414,7 +415,11 @@ public class HeatControl extends FireAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHarmlessAbility() {
|
public boolean isHarmlessAbility() {
|
||||||
return this.heatControlType.equals(HeatControlType.COOK);
|
if (this.heatControlType != null) {
|
||||||
|
return this.heatControlType.equals(HeatControlType.COOK);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -60,7 +61,7 @@ public class BlockSource {
|
||||||
|
|
||||||
if (coreAbil instanceof WaterAbility) {
|
if (coreAbil instanceof WaterAbility) {
|
||||||
Block waterBlock = WaterAbility.getWaterSourceBlock(player, MAX_RANGE, true);
|
Block waterBlock = WaterAbility.getWaterSourceBlock(player, MAX_RANGE, true);
|
||||||
if (waterBlock != null && !TempBlock.isTempBlock(waterBlock)) {
|
if (waterBlock != null) {
|
||||||
putSource(player, waterBlock, BlockSourceType.WATER, clickType);
|
putSource(player, waterBlock, BlockSourceType.WATER, clickType);
|
||||||
if (WaterAbility.isPlant(waterBlock)) {
|
if (WaterAbility.isPlant(waterBlock)) {
|
||||||
putSource(player, waterBlock, BlockSourceType.PLANT, clickType);
|
putSource(player, waterBlock, BlockSourceType.PLANT, clickType);
|
||||||
|
@ -163,7 +164,7 @@ public class BlockSource {
|
||||||
public static Block getSourceBlock(Player player, double range, BlockSourceType sourceType, ClickType clickType) {
|
public static Block getSourceBlock(Player player, double range, BlockSourceType sourceType, ClickType clickType) {
|
||||||
BlockSourceInformation info = getValidBlockSourceInformation(player, range, sourceType, clickType);
|
BlockSourceInformation info = getValidBlockSourceInformation(player, range, sourceType, clickType);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
if (TempBlock.isTempBlock(info.getBlock())) {
|
if (TempBlock.isTempBlock(info.getBlock()) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(info.getBlock()))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return info.getBlock();
|
return info.getBlock();
|
||||||
|
@ -266,7 +267,10 @@ public class BlockSource {
|
||||||
if (allowSnow && sourceBlock == null) {
|
if (allowSnow && sourceBlock == null) {
|
||||||
sourceBlock = getSourceBlock(player, range, BlockSourceType.SNOW, clickType);
|
sourceBlock = getSourceBlock(player, range, BlockSourceType.SNOW, clickType);
|
||||||
}
|
}
|
||||||
if (sourceBlock != null && !sourceBlock.getType().equals(Material.AIR) && (WaterAbility.isWater(sourceBlock) || WaterAbility.isPlant(sourceBlock) || WaterAbility.isSnow(sourceBlock) || WaterAbility.isIce(sourceBlock)) && !TempBlock.isTempBlock(sourceBlock)) {
|
if (sourceBlock != null && !sourceBlock.getType().equals(Material.AIR) && (WaterAbility.isWater(sourceBlock) || WaterAbility.isPlant(sourceBlock) || WaterAbility.isSnow(sourceBlock) || WaterAbility.isIce(sourceBlock))) {
|
||||||
|
if (TempBlock.isTempBlock(sourceBlock) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(sourceBlock))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return sourceBlock;
|
return sourceBlock;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -416,8 +416,6 @@ public class WaterManipulation extends WaterAbility {
|
||||||
return false;
|
return false;
|
||||||
} else if (SurgeWave.isBlockWave(to) || SurgeWave.isBlockWave(from)) {
|
} else if (SurgeWave.isBlockWave(to) || SurgeWave.isBlockWave(from)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (TempBlock.isTempBlock(to) || TempBlock.isTempBlock(from)) {
|
|
||||||
return false;
|
|
||||||
} else if (isAdjacentToFrozenBlock(to) || isAdjacentToFrozenBlock(from)) {
|
} else if (isAdjacentToFrozenBlock(to) || isAdjacentToFrozenBlock(from)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -435,9 +433,7 @@ public class WaterManipulation extends WaterAbility {
|
||||||
return false;
|
return false;
|
||||||
} else if (SurgeWave.isBlockWave(block)) {
|
} else if (SurgeWave.isBlockWave(block)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (TempBlock.isTempBlock(block)) {
|
} else if (TempBlock.isTempBlock(block) && !PhaseChange.getFrozenBlocksAsTempBlock().contains(TempBlock.get(block))) {
|
||||||
return false;
|
|
||||||
} else if (TempBlock.isTouchingTempBlock(block)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue