Fix for HeatControlSolidify error on reload (#600)

* Fix for HeatControlSolidify error on reload

* Remove unnecessary imports
This commit is contained in:
Christopher Martin 2016-10-13 23:27:58 -07:00 committed by GitHub
parent 3de75dade4
commit 81e5c53de5
2 changed files with 20 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.firebending.BlazeArc;
import com.projectkorra.projectkorra.firebending.HeatControlSolidify;
import com.projectkorra.projectkorra.util.Information;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.rpg.RPGMethods;
@ -217,6 +218,7 @@ public abstract class FireAbility extends ElementalAbility {
public static void stopBending() {
BlazeArc.removeAllCleanup();
HeatControlSolidify.revertAllInstances();
for (Location loc : TEMP_FIRE.keySet()) {
revertTempFire(loc);
}

View file

@ -7,10 +7,12 @@ import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.List;
@ -119,13 +121,27 @@ public class HeatControlSolidify extends FireAbility {
@Override
public void remove() {
ProjectKorra.plugin.getServer().getScheduler().scheduleSyncDelayedTask(ProjectKorra.plugin, new Runnable() {
if(Bukkit.getServer().getPluginManager().isPluginEnabled(ProjectKorra.plugin.getName())) {
revert();
} else {
HeatControlSolidify.super.remove();
}
}
public void revert() {
new BukkitRunnable() {
@Override
public void run() {
revertAll();
HeatControlSolidify.super.remove();
}
}, revertTime);
}.runTaskLater(ProjectKorra.plugin, revertTime);
}
public static void revertAllInstances() {
for (HeatControlSolidify heatControlSolidify : getAbilities(HeatControlSolidify.class)) {
heatControlSolidify.revertAll();
}
}
public void resetLocation(Location loc) {