mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Added some chi changes
Created a ChiblockingManager and also made it so HealingWaters cannot heal the blindness from Smokescreen
This commit is contained in:
parent
e0d12c3ca6
commit
65daa0c840
6 changed files with 52 additions and 9 deletions
|
@ -88,7 +88,6 @@ public class BendingManager implements Runnable {
|
||||||
ProjectKorra.time_step = interval;
|
ProjectKorra.time_step = interval;
|
||||||
|
|
||||||
AvatarState.manageAvatarStates();
|
AvatarState.manageAvatarStates();
|
||||||
ChiPassive.handlePassive();
|
|
||||||
TempPotionEffect.progressAll();
|
TempPotionEffect.progressAll();
|
||||||
handleDayNight();
|
handleDayNight();
|
||||||
Flight.handle();
|
Flight.handle();
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
|
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
|
||||||
import com.projectkorra.ProjectKorra.Utilities.CraftingRecipes;
|
import com.projectkorra.ProjectKorra.Utilities.CraftingRecipes;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirbendingManager;
|
import com.projectkorra.ProjectKorra.airbending.AirbendingManager;
|
||||||
|
import com.projectkorra.ProjectKorra.chiblocking.ChiblockingManager;
|
||||||
import com.projectkorra.ProjectKorra.earthbending.EarthbendingManager;
|
import com.projectkorra.ProjectKorra.earthbending.EarthbendingManager;
|
||||||
import com.projectkorra.ProjectKorra.firebending.FirebendingManager;
|
import com.projectkorra.ProjectKorra.firebending.FirebendingManager;
|
||||||
import com.projectkorra.ProjectKorra.waterbending.WaterbendingManager;
|
import com.projectkorra.ProjectKorra.waterbending.WaterbendingManager;
|
||||||
|
@ -43,6 +44,7 @@ public class ProjectKorra extends JavaPlugin {
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new WaterbendingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new WaterbendingManager(this), 0, 1);
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(this), 0, 1);
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new FirebendingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new FirebendingManager(this), 0, 1);
|
||||||
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new ChiblockingManager(this), 0, 1);
|
||||||
|
|
||||||
DBConnection.init();
|
DBConnection.init();
|
||||||
for (Player player: Bukkit.getOnlinePlayers()) {
|
for (Player player: Bukkit.getOnlinePlayers()) {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.projectkorra.ProjectKorra.chiblocking;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
|
|
||||||
|
public class ChiblockingManager implements Runnable {
|
||||||
|
|
||||||
|
public ProjectKorra plugin;
|
||||||
|
|
||||||
|
public ChiblockingManager(ProjectKorra plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
ChiPassive.handlePassive();
|
||||||
|
Smokescreen.removeFromHashMap(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ public class Smokescreen {
|
||||||
|
|
||||||
public static HashMap<String, Long> cooldowns = new HashMap<String, Long>();
|
public static HashMap<String, Long> cooldowns = new HashMap<String, Long>();
|
||||||
public static List<Integer> snowballs = new ArrayList<Integer>();
|
public static List<Integer> snowballs = new ArrayList<Integer>();
|
||||||
|
public static HashMap<String, Long> blinded = new HashMap<String, Long>();
|
||||||
/*
|
/*
|
||||||
* TODO: Make stuff configurable
|
* TODO: Make stuff configurable
|
||||||
*/
|
*/
|
||||||
|
@ -69,6 +70,18 @@ public class Smokescreen {
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
Player p = (Player) entity;
|
Player p = (Player) entity;
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, duration * 20, 2));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, duration * 20, 2));
|
||||||
|
blinded.put(p.getName(), System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeFromHashMap(Entity entity) {
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
Player p = (Player) entity;
|
||||||
|
if(blinded.containsKey(p.getName())) {
|
||||||
|
if(blinded.get(p.getName()) + duration >= System.currentTimeMillis()) {
|
||||||
|
blinded.remove(p.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||||
import com.projectkorra.ProjectKorra.Methods;
|
import com.projectkorra.ProjectKorra.Methods;
|
||||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
import com.projectkorra.ProjectKorra.TempBlock;
|
import com.projectkorra.ProjectKorra.TempBlock;
|
||||||
|
import com.projectkorra.ProjectKorra.chiblocking.Smokescreen;
|
||||||
|
|
||||||
public class HealingWaters {
|
public class HealingWaters {
|
||||||
|
|
||||||
|
@ -64,6 +65,9 @@ public class HealingWaters {
|
||||||
}
|
}
|
||||||
for(PotionEffect effect : player.getActivePotionEffects()) {
|
for(PotionEffect effect : player.getActivePotionEffects()) {
|
||||||
if(Methods.isNegativeEffect(effect.getType())) {
|
if(Methods.isNegativeEffect(effect.getType())) {
|
||||||
|
if((effect.getType() == PotionEffectType.BLINDNESS) && Smokescreen.blinded.containsKey(player.getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
player.removePotionEffect(effect.getType());
|
player.removePotionEffect(effect.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,16 +302,17 @@ public class WaterManipulation {
|
||||||
|
|
||||||
double radius = FireBlast.affectingradius;
|
double radius = FireBlast.affectingradius;
|
||||||
Player source = player;
|
Player source = player;
|
||||||
if (EarthBlast.annihilateBlasts(location, radius, source)
|
if(!(location == null)) {
|
||||||
|| WaterManipulation.annihilateBlasts(location, radius, source)
|
if (EarthBlast.annihilateBlasts(location, radius, source)
|
||||||
|| FireBlast.annihilateBlasts(location, radius, source)) {
|
|| WaterManipulation.annihilateBlasts(location, radius, source)
|
||||||
breakBlock();
|
|| FireBlast.annihilateBlasts(location, radius, source)) {
|
||||||
new WaterReturn(player, sourceblock);
|
breakBlock();
|
||||||
return false;
|
new WaterReturn(player, sourceblock);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Combustion.removeAroundPoint(location, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
Combustion.removeAroundPoint(location, radius);
|
|
||||||
|
|
||||||
location = location.clone().add(direction);
|
location = location.clone().add(direction);
|
||||||
|
|
||||||
block = location.getBlock();
|
block = location.getBlock();
|
||||||
|
|
Loading…
Reference in a new issue