mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-18 22:24:35 +00:00
Merge remote-tracking branch 'origin/master'
Conflicts: .classpath src/com/projectkorra/ProjectKorra/RevertChecker.java
This commit is contained in:
commit
6737c255bf
5 changed files with 552 additions and 693 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/BukkitForPlugins1.8.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/Factions.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/Factions.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/GriefPrevention.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/GriefPrevention.jar"/>
|
||||||
|
@ -13,6 +14,5 @@
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldEdit.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldEdit.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldGuard.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldGuard.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/plugins/KorraRPG.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/plugins/KorraRPG.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/BukkitForPlugins1.8.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -75,6 +75,9 @@ import com.palmergames.bukkit.towny.object.WorldCoord;
|
||||||
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
|
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
|
||||||
import com.palmergames.bukkit.towny.war.flagwar.TownyWar;
|
import com.palmergames.bukkit.towny.war.flagwar.TownyWar;
|
||||||
import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
|
import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
|
||||||
|
import com.projectkorra.ProjectKorra.Element;
|
||||||
|
import com.projectkorra.ProjectKorra.Information;
|
||||||
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
import com.projectkorra.ProjectKorra.Ability.AbilityModule;
|
import com.projectkorra.ProjectKorra.Ability.AbilityModule;
|
||||||
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
|
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
|
||||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||||
|
@ -1444,7 +1447,7 @@ public class Methods {
|
||||||
if (gpp != null && respectGriefPrevention) {
|
if (gpp != null && respectGriefPrevention) {
|
||||||
Material type = player.getWorld().getBlockAt(location).getType();
|
Material type = player.getWorld().getBlockAt(location).getType();
|
||||||
if (type == null) type = Material.AIR;
|
if (type == null) type = Material.AIR;
|
||||||
String reason = GriefPrevention.instance.allowBuild(player, location, type);
|
String reason = GriefPrevention.instance.allowBuild(player, location, null);
|
||||||
|
|
||||||
if (ignite.contains(ability)) {
|
if (ignite.contains(ability)) {
|
||||||
|
|
||||||
|
@ -1733,6 +1736,16 @@ public class Methods {
|
||||||
else
|
else
|
||||||
return ParticleEffect.CLOUD;
|
return ParticleEffect.CLOUD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Collection<Player> getPlayersAroundPoint(Location location, double distance) {
|
||||||
|
Collection<Player> players = new HashSet<Player>();
|
||||||
|
for (Player player: Bukkit.getOnlinePlayers()) {
|
||||||
|
if (player.getLocation().distance(location) <= distance) {
|
||||||
|
players.add(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return players;
|
||||||
|
}
|
||||||
|
|
||||||
public static void playAirbendingParticles(Location loc, int amount) {
|
public static void playAirbendingParticles(Location loc, int amount) {
|
||||||
playAirbendingParticles(loc, amount, (float) Math.random(), (float) Math.random(), (float) Math.random());
|
playAirbendingParticles(loc, amount, (float) Math.random(), (float) Math.random(), (float) Math.random());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.projectkorra.ProjectKorra;
|
package com.projectkorra.ProjectKorra;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
@ -42,44 +43,35 @@ public class RevertChecker implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<Chunk> call() throws Exception {
|
public ArrayList<Chunk> call() throws Exception {
|
||||||
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||||
|
|
||||||
for (Player player : server.getOnlinePlayers()) {
|
for (Player player : server.getOnlinePlayers()) {
|
||||||
Chunk chunk = player.getLocation().getChunk();
|
Collection<? extends Player> players = server.getOnlinePlayers();
|
||||||
if (!chunks.contains(chunk))
|
|
||||||
chunks.add(chunk);
|
for (Player player2 : players) {
|
||||||
|
Chunk chunk = player2.getLocation().getChunk();
|
||||||
|
if (!chunks.contains(chunk))
|
||||||
|
chunks.add(chunk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return chunks;
|
return chunks;
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
|
|
||||||
if (plugin.getConfig().getBoolean("Properties.Earth.RevertEarthbending")) {
|
if (plugin.getConfig().getBoolean("Properties.Earth.RevertEarthbending")) {
|
||||||
|
|
||||||
// ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
|
||||||
// Player[] players = plugin.getServer().getOnlinePlayers();
|
|
||||||
//
|
|
||||||
// for (Player player : players) {
|
|
||||||
// Chunk chunk = player.getLocation().getChunk();
|
|
||||||
// if (!chunks.contains(chunk))
|
|
||||||
// chunks.add(chunk);
|
|
||||||
// }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Tools.verbose("Calling future at t="
|
|
||||||
// + System.currentTimeMillis());
|
|
||||||
returnFuture = plugin
|
returnFuture = plugin
|
||||||
.getServer()
|
.getServer()
|
||||||
.getScheduler()
|
.getScheduler()
|
||||||
.callSyncMethod(plugin,
|
.callSyncMethod(plugin,
|
||||||
new getOccupiedChunks(plugin.getServer()));
|
new getOccupiedChunks(plugin.getServer()));
|
||||||
ArrayList<Chunk> chunks = returnFuture.get();
|
ArrayList<Chunk> chunks = returnFuture.get();
|
||||||
// Tools.verbose("Future called, t=" +
|
|
||||||
// System.currentTimeMillis());
|
|
||||||
|
|
||||||
Map<Block, Information> earth = new HashMap<Block, Information>();
|
Map<Block, Information> earth = new HashMap<Block, Information>();
|
||||||
earth.putAll(Methods.movedearth);
|
earth.putAll(Methods.movedearth);
|
||||||
|
@ -118,41 +110,6 @@ public class RevertChecker implements Runnable {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (Block block : Tools.tempearthblocks.keySet()) {
|
|
||||||
// if (revertQueue.containsKey(block))
|
|
||||||
// continue;
|
|
||||||
// boolean remove = true;
|
|
||||||
//
|
|
||||||
// Block index = Tools.tempearthblocks.get(block);
|
|
||||||
// if (Tools.movedearth.containsKey(index)) {
|
|
||||||
// Information info = Tools.movedearth.get(index);
|
|
||||||
// if (time < info.getTime() + ConfigManager.revertchecktime
|
|
||||||
// || (chunks.contains(index.getChunk()) && safeRevert)) {
|
|
||||||
// remove = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (remove)
|
|
||||||
// addToRevertQueue(block);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (Block block : Tools.movedearth.keySet()) {
|
|
||||||
// if (movedEarthQueue.containsKey(block))
|
|
||||||
// continue;
|
|
||||||
// Information info = Tools.movedearth.get(block);
|
|
||||||
// if (time >= info.getTime() + ConfigManager.revertchecktime) {
|
|
||||||
// // if (Tools.tempearthblocks.containsKey(info.getBlock()))
|
|
||||||
// // Tools.verbose("PROBLEM!");
|
|
||||||
// // block.setType(info.getType());
|
|
||||||
// // Tools.movedearth.remove(block);
|
|
||||||
// addToMovedEarthQueue(block, info.getType());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Tools.writeToLog("Still " + Tools.tempearthblocks.size()
|
|
||||||
// + " remaining.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,14 +129,14 @@ public class RevertChecker implements Runnable {
|
||||||
if (!earthRevertQueue.containsKey(block))
|
if (!earthRevertQueue.containsKey(block))
|
||||||
earthRevertQueue.put(block, block);
|
earthRevertQueue.put(block, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void revertEarthBlocks() {
|
public static void revertEarthBlocks() {
|
||||||
for (Block block : earthRevertQueue.keySet()) {
|
for (Block block : earthRevertQueue.keySet()) {
|
||||||
Methods.revertBlock(block);
|
Methods.revertBlock(block);
|
||||||
earthRevertQueue.remove(block);
|
earthRevertQueue.remove(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void revertAirBlocks() {
|
public static void revertAirBlocks() {
|
||||||
for (int ID : airRevertQueue.keySet()) {
|
for (int ID : airRevertQueue.keySet()) {
|
||||||
Methods.revertAirBlock(ID);
|
Methods.revertAirBlock(ID);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,7 @@ public class LavaFlow
|
||||||
public static double SHIFT_REMOVE_SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftRemoveSpeed");
|
public static double SHIFT_REMOVE_SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftRemoveSpeed");
|
||||||
public static long SHIFT_REMOVE_DELAY = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.LavaFlow.ShiftCleanupDelay");
|
public static long SHIFT_REMOVE_DELAY = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.LavaFlow.ShiftCleanupDelay");
|
||||||
public static double PARTICLE_DENSITY = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ParticleDensity");
|
public static double PARTICLE_DENSITY = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ParticleDensity");
|
||||||
|
|
||||||
public static double CLICK_RANGE = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRange");
|
public static double CLICK_RANGE = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRange");
|
||||||
public static double CLICK_LAVA_RADIUS = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius");
|
public static double CLICK_LAVA_RADIUS = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius");
|
||||||
public static double CLICK_LAND_RADIUS = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius");
|
public static double CLICK_LAND_RADIUS = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius");
|
||||||
|
@ -43,7 +43,7 @@ public class LavaFlow
|
||||||
public static long CLICK_LAND_CLEANUP_DELAY = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandCleanupDelay");
|
public static long CLICK_LAND_CLEANUP_DELAY = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandCleanupDelay");
|
||||||
public static double LAVA_CREATE_SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLavaCreateSpeed");
|
public static double LAVA_CREATE_SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLavaCreateSpeed");
|
||||||
public static double LAND_CREATE_SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLandCreateSpeed");
|
public static double LAND_CREATE_SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLandCreateSpeed");
|
||||||
|
|
||||||
public static long AS_SHIFT_COOLDOWN = 0;
|
public static long AS_SHIFT_COOLDOWN = 0;
|
||||||
public static double AS_SHIFT_PLATFORM_RADIUS = 3;
|
public static double AS_SHIFT_PLATFORM_RADIUS = 3;
|
||||||
public static double AS_SHIFT_MAX_RADIUS = 16;
|
public static double AS_SHIFT_MAX_RADIUS = 16;
|
||||||
|
@ -55,16 +55,16 @@ public class LavaFlow
|
||||||
public static long AS_CLICK_LAVA_DELAY = 2000;
|
public static long AS_CLICK_LAVA_DELAY = 2000;
|
||||||
public static long AS_CLICK_LAND_DELAY = 0;
|
public static long AS_CLICK_LAND_DELAY = 0;
|
||||||
public static long AS_CLICK_COOLDOWN = 0;
|
public static long AS_CLICK_COOLDOWN = 0;
|
||||||
|
|
||||||
public static int UPWARD_FLOW = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaFlow.UpwardFlow");
|
public static int UPWARD_FLOW = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaFlow.UpwardFlow");
|
||||||
public static int DOWNWARD_FLOW = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaFlow.DownwardFlow");
|
public static int DOWNWARD_FLOW = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaFlow.DownwardFlow");
|
||||||
public static boolean ALLOW_NATURAL_FLOW = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Earth.LavaFlow.AllowNaturalFlow");
|
public static boolean ALLOW_NATURAL_FLOW = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Earth.LavaFlow.AllowNaturalFlow");
|
||||||
|
|
||||||
private static final double PARTICLE_OFFSET = 3;
|
private static final double PARTICLE_OFFSET = 3;
|
||||||
|
|
||||||
public static ArrayList<LavaFlow> instances = new ArrayList<LavaFlow>();
|
public static ArrayList<LavaFlow> instances = new ArrayList<LavaFlow>();
|
||||||
public static ArrayList<TempBlock> totalBlocks = new ArrayList<TempBlock>();
|
public static ArrayList<TempBlock> totalBlocks = new ArrayList<TempBlock>();
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
private BendingPlayer bplayer;
|
private BendingPlayer bplayer;
|
||||||
private long time;
|
private long time;
|
||||||
|
@ -77,7 +77,7 @@ public class LavaFlow
|
||||||
private double currentRadius = 0;
|
private double currentRadius = 0;
|
||||||
private ArrayList<TempBlock> affectedBlocks = new ArrayList<TempBlock>();
|
private ArrayList<TempBlock> affectedBlocks = new ArrayList<TempBlock>();
|
||||||
private ArrayList<BukkitRunnable> tasks = new ArrayList<BukkitRunnable>();
|
private ArrayList<BukkitRunnable> tasks = new ArrayList<BukkitRunnable>();
|
||||||
|
|
||||||
public LavaFlow(Player player, AbilityType type)
|
public LavaFlow(Player player, AbilityType type)
|
||||||
{
|
{
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
|
@ -92,7 +92,7 @@ public class LavaFlow
|
||||||
if(shiftFlows.size() > 0 && !player.isSneaking())
|
if(shiftFlows.size() > 0 && !player.isSneaking())
|
||||||
for(LavaFlow lf : shiftFlows)
|
for(LavaFlow lf : shiftFlows)
|
||||||
lf.shiftCounter++;
|
lf.shiftCounter++;
|
||||||
|
|
||||||
if(bplayer.isOnCooldown("lavaflowcooldownshift")){
|
if(bplayer.isOnCooldown("lavaflowcooldownshift")){
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
|
@ -111,7 +111,7 @@ public class LavaFlow
|
||||||
makeLava = !isLava(sourceBlock);
|
makeLava = !isLava(sourceBlock);
|
||||||
long cooldown = makeLava ? CLICK_LAVA_COOLDOWN : CLICK_LAND_COOLDOWN;
|
long cooldown = makeLava ? CLICK_LAVA_COOLDOWN : CLICK_LAND_COOLDOWN;
|
||||||
cooldown = AvatarState.isAvatarState(player) ? AS_CLICK_COOLDOWN : cooldown;
|
cooldown = AvatarState.isAvatarState(player) ? AS_CLICK_COOLDOWN : cooldown;
|
||||||
|
|
||||||
if(makeLava){
|
if(makeLava){
|
||||||
if(bplayer.isOnCooldown("lavaflowmakelava")){
|
if(bplayer.isOnCooldown("lavaflowmakelava")){
|
||||||
remove();
|
remove();
|
||||||
|
@ -120,7 +120,7 @@ public class LavaFlow
|
||||||
else
|
else
|
||||||
bplayer.addCooldown("lavaflowmakelava", cooldown);
|
bplayer.addCooldown("lavaflowmakelava", cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!makeLava){
|
if(!makeLava){
|
||||||
if(bplayer.isOnCooldown("lavaflowmakeland")){
|
if(bplayer.isOnCooldown("lavaflowmakeland")){
|
||||||
remove();
|
remove();
|
||||||
|
@ -132,7 +132,7 @@ public class LavaFlow
|
||||||
instances.add(this);
|
instances.add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void progress()
|
public void progress()
|
||||||
{
|
{
|
||||||
if(shiftCounter > 0 && type == AbilityType.SHIFT){
|
if(shiftCounter > 0 && type == AbilityType.SHIFT){
|
||||||
|
@ -145,7 +145,7 @@ public class LavaFlow
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == AbilityType.SHIFT)
|
if(type == AbilityType.SHIFT)
|
||||||
{
|
{
|
||||||
double removeDelay = AvatarState.isAvatarState(player) ? AS_SHIFT_REMOVE_DELAY : SHIFT_REMOVE_DELAY;
|
double removeDelay = AvatarState.isAvatarState(player) ? AS_SHIFT_REMOVE_DELAY : SHIFT_REMOVE_DELAY;
|
||||||
|
@ -164,7 +164,7 @@ public class LavaFlow
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String ability = Methods.getBoundAbility(player);
|
String ability = Methods.getBoundAbility(player);
|
||||||
if(ability == null){
|
if(ability == null){
|
||||||
remove();
|
remove();
|
||||||
|
@ -181,7 +181,7 @@ public class LavaFlow
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double platformRadius = AvatarState.isAvatarState(player) ? AS_SHIFT_PLATFORM_RADIUS : SHIFT_PLATFORM_RADIUS;
|
double platformRadius = AvatarState.isAvatarState(player) ? AS_SHIFT_PLATFORM_RADIUS : SHIFT_PLATFORM_RADIUS;
|
||||||
double maxRadius = AvatarState.isAvatarState(player) ? AS_SHIFT_MAX_RADIUS : SHIFT_MAX_RADIUS;
|
double maxRadius = AvatarState.isAvatarState(player) ? AS_SHIFT_MAX_RADIUS : SHIFT_MAX_RADIUS;
|
||||||
double flowSpeed = AvatarState.isAvatarState(player) ? AS_SHIFT_FLOW_SPEED : SHIFT_FLOW_SPEED;
|
double flowSpeed = AvatarState.isAvatarState(player) ? AS_SHIFT_FLOW_SPEED : SHIFT_FLOW_SPEED;
|
||||||
|
@ -204,15 +204,21 @@ public class LavaFlow
|
||||||
}
|
}
|
||||||
else if(Math.random() < PARTICLE_DENSITY
|
else if(Math.random() < PARTICLE_DENSITY
|
||||||
&& dSquared < Math.pow(currentRadius + PARTICLE_OFFSET, 2)
|
&& dSquared < Math.pow(currentRadius + PARTICLE_OFFSET, 2)
|
||||||
&& currentRadius + PARTICLE_OFFSET < maxRadius)
|
&& currentRadius + PARTICLE_OFFSET < maxRadius) {
|
||||||
ParticleEffect.LAVA.display(loc, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 1);
|
try {
|
||||||
|
ParticleEffect.LAVA.sendToPlayers(Methods.getPlayersAroundPoint(loc, 100), loc, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
currentRadius += flowSpeed;
|
currentRadius += flowSpeed;
|
||||||
if(currentRadius > maxRadius) currentRadius = maxRadius;
|
if(currentRadius > maxRadius) currentRadius = maxRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The variable makeLava refers to whether or not the ability is trying to
|
* The variable makeLava refers to whether or not the ability is trying to
|
||||||
* remove land in place of lava or if makeLava = false then lava is being replaced
|
* remove land in place of lava or if makeLava = false then lava is being replaced
|
||||||
|
@ -245,17 +251,22 @@ public class LavaFlow
|
||||||
{
|
{
|
||||||
double radius = AvatarState.isAvatarState(player) ? AS_CLICK_RADIUS : CLICK_LAVA_RADIUS;
|
double radius = AvatarState.isAvatarState(player) ? AS_CLICK_RADIUS : CLICK_LAVA_RADIUS;
|
||||||
for(double x = -radius; x <= radius; x++)
|
for(double x = -radius; x <= radius; x++)
|
||||||
for(double z = -radius; z <= radius; z++)
|
for(double z = -radius; z <= radius; z++)
|
||||||
{
|
{
|
||||||
Location loc = origin.clone().add(x,0,z);
|
Location loc = origin.clone().add(x,0,z);
|
||||||
Block tempBlock = getTopBlock(loc,UPWARD_FLOW,DOWNWARD_FLOW);
|
Block tempBlock = getTopBlock(loc,UPWARD_FLOW,DOWNWARD_FLOW);
|
||||||
if(tempBlock != null
|
if(tempBlock != null
|
||||||
&& !isLava(tempBlock)
|
&& !isLava(tempBlock)
|
||||||
&& Math.random() < PARTICLE_DENSITY
|
&& Math.random() < PARTICLE_DENSITY
|
||||||
&& tempBlock.getLocation().distanceSquared(origin) <= Math.pow(radius,2))
|
&& tempBlock.getLocation().distanceSquared(origin) <= Math.pow(radius,2))
|
||||||
ParticleEffect.LAVA.display(loc, 0, 0, 0, 0, 1);
|
try {
|
||||||
|
ParticleEffect.LAVA.sendToPlayers(Methods.getPlayersAroundPoint(loc, 100), loc, 0, 0, 0, 0, 1);
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +286,7 @@ public class LavaFlow
|
||||||
Block tempBlock = getTopBlock(loc,UPWARD_FLOW,DOWNWARD_FLOW);
|
Block tempBlock = getTopBlock(loc,UPWARD_FLOW,DOWNWARD_FLOW);
|
||||||
if(tempBlock == null)
|
if(tempBlock == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double dSquared = distanceSquaredXZ(tempBlock.getLocation(),origin);
|
double dSquared = distanceSquaredXZ(tempBlock.getLocation(),origin);
|
||||||
if(dSquared < Math.pow(radius,2) && !Methods.isRegionProtectedFromBuild(player, "LavaFlow", loc))
|
if(dSquared < Math.pow(radius,2) && !Methods.isRegionProtectedFromBuild(player, "LavaFlow", loc))
|
||||||
{
|
{
|
||||||
|
@ -285,7 +296,12 @@ public class LavaFlow
|
||||||
if(Math.random() < LAVA_CREATE_SPEED)
|
if(Math.random() < LAVA_CREATE_SPEED)
|
||||||
createLava(tempBlock);
|
createLava(tempBlock);
|
||||||
else
|
else
|
||||||
ParticleEffect.LAVA.display(loc, 0, 0, 0, 0, 1);
|
try {
|
||||||
|
ParticleEffect.LAVA.sendToPlayers(Methods.getPlayersAroundPoint(loc, 100), loc, 0, 0, 0, 0, 1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(!makeLava && isLava(tempBlock))
|
else if(!makeLava && isLava(tempBlock))
|
||||||
{
|
{
|
||||||
|
@ -319,8 +335,8 @@ public class LavaFlow
|
||||||
}
|
}
|
||||||
else if(isEarthbendableMaterial(block.getType(), player))
|
else if(isEarthbendableMaterial(block.getType(), player))
|
||||||
valid = true;
|
valid = true;
|
||||||
|
|
||||||
|
|
||||||
if(valid){
|
if(valid){
|
||||||
TempBlock tblock = new TempBlock(block,Material.STATIONARY_LAVA,(byte) 0);
|
TempBlock tblock = new TempBlock(block,Material.STATIONARY_LAVA,(byte) 0);
|
||||||
totalBlocks.add(tblock);
|
totalBlocks.add(tblock);
|
||||||
|
@ -347,9 +363,9 @@ public class LavaFlow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
testBlock.setType(REVERT_MATERIAL);
|
testBlock.setType(REVERT_MATERIAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeOnDelay()
|
public void removeOnDelay()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -366,7 +382,7 @@ public class LavaFlow
|
||||||
br.runTaskLater(ProjectKorra.plugin, (long) (delay / 1000.0 * 20.0));
|
br.runTaskLater(ProjectKorra.plugin, (long) (delay / 1000.0 * 20.0));
|
||||||
tasks.add(br);
|
tasks.add(br);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove()
|
public void remove()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -393,13 +409,13 @@ public class LavaFlow
|
||||||
for(BukkitRunnable task : tasks)
|
for(BukkitRunnable task : tasks)
|
||||||
task.cancel();
|
task.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void progressAll()
|
public static void progressAll()
|
||||||
{
|
{
|
||||||
for(int i = instances.size() - 1; i >= 0; i--)
|
for(int i = instances.size() - 1; i >= 0; i--)
|
||||||
instances.get(i).progress();
|
instances.get(i).progress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeAll()
|
public static void removeAll()
|
||||||
{
|
{
|
||||||
for(int i = instances.size() - 1; i >= 0; i--)
|
for(int i = instances.size() - 1; i >= 0; i--)
|
||||||
|
@ -407,7 +423,7 @@ public class LavaFlow
|
||||||
instances.get(i).remove();
|
instances.get(i).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Block> getAdjacentBlocks(Location loc)
|
public static ArrayList<Block> getAdjacentBlocks(Location loc)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -478,14 +494,14 @@ public class LavaFlow
|
||||||
return blockHolder;
|
return blockHolder;
|
||||||
blockHolder = tempBlock;
|
blockHolder = tempBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(blockHolder.getType() == Material.AIR && Math.abs(y) < Math.abs(negativeY))
|
while(blockHolder.getType() == Material.AIR && Math.abs(y) < Math.abs(negativeY))
|
||||||
{
|
{
|
||||||
y--;
|
y--;
|
||||||
blockHolder = loc.clone().add(0,y,0).getBlock();
|
blockHolder = loc.clone().add(0,y,0).getBlock();
|
||||||
if(blockHolder.getType() != Material.AIR)
|
if(blockHolder.getType() != Material.AIR)
|
||||||
return blockHolder;
|
return blockHolder;
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -506,7 +522,7 @@ public class LavaFlow
|
||||||
if ((!Methods.isRegionProtectedFromBuild(player, "LavaFlow", testblock.getLocation()))
|
if ((!Methods.isRegionProtectedFromBuild(player, "LavaFlow", testblock.getLocation()))
|
||||||
&& (isEarthbendableMaterial(testblock.getType(), player) || isLava(testblock)))
|
&& (isEarthbendableMaterial(testblock.getType(), player) || isLava(testblock)))
|
||||||
return testblock;
|
return testblock;
|
||||||
|
|
||||||
Location location = player.getEyeLocation();
|
Location location = player.getEyeLocation();
|
||||||
Vector vector = location.getDirection().clone().normalize();
|
Vector vector = location.getDirection().clone().normalize();
|
||||||
for (double i = 0; i <= range; i++) {
|
for (double i = 0; i <= range; i++) {
|
||||||
|
|
Loading…
Reference in a new issue