mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
isIgniteAbility() and isExplodeAbility() added
For Region Protection. ProjectKorra respects explosion and fire flags in various plugins, so this will allow an ability to register as such. isIgnite() means the ability produces fire (Like Blaze) and isExplodeAbility() means the ability produces an explode (Like FireBlast and Lightning)
This commit is contained in:
parent
efc880eb13
commit
5776ad28e1
6 changed files with 107 additions and 30 deletions
|
@ -4,5 +4,12 @@
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/BukkitForPlugins.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/BukkitForPlugins.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/TagAPI.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/TagAPI.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/GriefPrevention.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/mcore.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/PreciousStones.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/Towny.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="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -43,5 +43,13 @@ public class AbilityModule extends AbilityLoadable implements Cloneable {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isIgniteAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExplodeAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ public class AbilityModuleManager {
|
||||||
public static HashSet<String> shiftabilities;
|
public static HashSet<String> shiftabilities;
|
||||||
public static HashMap<String, String> authors;
|
public static HashMap<String, String> authors;
|
||||||
public static HashSet<String> harmlessabilities;
|
public static HashSet<String> harmlessabilities;
|
||||||
|
public static HashSet<String> igniteabilities;
|
||||||
|
public static HashSet<String> explodeabilities;
|
||||||
|
|
||||||
public static HashMap<String, String> descriptions;
|
public static HashMap<String, String> descriptions;
|
||||||
|
|
||||||
|
@ -45,6 +47,8 @@ public class AbilityModuleManager {
|
||||||
descriptions = new HashMap<String, String>();
|
descriptions = new HashMap<String, String>();
|
||||||
authors = new HashMap<String, String>();
|
authors = new HashMap<String, String>();
|
||||||
harmlessabilities = new HashSet<String>();
|
harmlessabilities = new HashSet<String>();
|
||||||
|
explodeabilities = new HashSet<String>();
|
||||||
|
igniteabilities = new HashSet<String>();
|
||||||
ability = loader.load(AbilityModule.class);
|
ability = loader.load(AbilityModule.class);
|
||||||
fill();
|
fill();
|
||||||
}
|
}
|
||||||
|
@ -57,6 +61,8 @@ public class AbilityModuleManager {
|
||||||
abilities.add(a.name());
|
abilities.add(a.name());
|
||||||
airbendingabilities.add(a.name());
|
airbendingabilities.add(a.name());
|
||||||
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Air." + a.name() + ".Description"));
|
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Air." + a.name() + ".Description"));
|
||||||
|
if (a == StockAbilities.AirScooter) harmlessabilities.add(a.name());
|
||||||
|
if (a == StockAbilities.AirSpout) harmlessabilities.add(a.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (StockAbilities.isWaterbending(a)) {
|
else if (StockAbilities.isWaterbending(a)) {
|
||||||
|
@ -64,6 +70,8 @@ public class AbilityModuleManager {
|
||||||
abilities.add(a.name());
|
abilities.add(a.name());
|
||||||
waterbendingabilities.add(a.name());
|
waterbendingabilities.add(a.name());
|
||||||
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Water." + a.name() + ".Description"));
|
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Water." + a.name() + ".Description"));
|
||||||
|
if (a == StockAbilities.WaterSpout) harmlessabilities.add(a.name());
|
||||||
|
if (a == StockAbilities.HealingWaters) harmlessabilities.add(a.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (StockAbilities.isEarthbending(a)) {
|
else if (StockAbilities.isEarthbending(a)) {
|
||||||
|
@ -71,6 +79,7 @@ public class AbilityModuleManager {
|
||||||
abilities.add(a.name());
|
abilities.add(a.name());
|
||||||
earthbendingabilities.add(a.name());
|
earthbendingabilities.add(a.name());
|
||||||
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Earth." + a.name() + ".Description"));
|
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Earth." + a.name() + ".Description"));
|
||||||
|
if (a == StockAbilities.Tremorsense) harmlessabilities.add(a.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (StockAbilities.isFirebending(a)) {
|
else if (StockAbilities.isFirebending(a)) {
|
||||||
|
@ -78,6 +87,10 @@ public class AbilityModuleManager {
|
||||||
abilities.add(a.name());
|
abilities.add(a.name());
|
||||||
firebendingabilities.add(a.name());
|
firebendingabilities.add(a.name());
|
||||||
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Fire." + a.name() + ".Description"));
|
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Fire." + a.name() + ".Description"));
|
||||||
|
if (a == StockAbilities.Illumination) harmlessabilities.add(a.name());
|
||||||
|
if (a == StockAbilities.Blaze) igniteabilities.add(a.name());
|
||||||
|
if (a == StockAbilities.FireBlast) explodeabilities.add(a.name());
|
||||||
|
if (a == StockAbilities.Lightning) explodeabilities.add(a.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (StockAbilities.isChiBlocking(a)) {
|
else if (StockAbilities.isChiBlocking(a)) {
|
||||||
|
@ -85,6 +98,7 @@ public class AbilityModuleManager {
|
||||||
abilities.add(a.name());
|
abilities.add(a.name());
|
||||||
chiabilities.add(a.name());
|
chiabilities.add(a.name());
|
||||||
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Chi." + a.name() + ".Description"));
|
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Chi." + a.name() + ".Description"));
|
||||||
|
if (a == StockAbilities.HighJump) harmlessabilities.add(a.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -50,6 +50,13 @@ public class ConfigManager {
|
||||||
plugin.getConfig().addDefault("Properties.GlobalCooldown", 500);
|
plugin.getConfig().addDefault("Properties.GlobalCooldown", 500);
|
||||||
plugin.getConfig().addDefault("Properties.SeaLevel", 62);
|
plugin.getConfig().addDefault("Properties.SeaLevel", 62);
|
||||||
|
|
||||||
|
config.addDefault("Properties.RegionProtection.AllowHarmlessAbilities", true);
|
||||||
|
config.addDefault("Properties.RegionProtection.RespectWorldGuard", true);
|
||||||
|
config.addDefault("Properties.RegionProtection.RespectGriefPrevention", true);
|
||||||
|
config.addDefault("Properties.RegionProtection.RespectFactions", true);
|
||||||
|
config.addDefault("Properties.RegionProtection.RespectTowny", true);
|
||||||
|
config.addDefault("Properties.RegionProtection.RespectPreciousStones", true);
|
||||||
|
|
||||||
plugin.getConfig().addDefault("Properties.Air.CanBendWithWeapons", false);
|
plugin.getConfig().addDefault("Properties.Air.CanBendWithWeapons", false);
|
||||||
|
|
||||||
plugin.getConfig().addDefault("Properties.Water.CanBendWithWeapons", true);
|
plugin.getConfig().addDefault("Properties.Water.CanBendWithWeapons", true);
|
||||||
|
|
|
@ -11,6 +11,10 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
|
import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag;
|
||||||
|
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
|
@ -28,8 +32,25 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.listeners.FactionsListenerMain;
|
||||||
|
import com.massivecraft.mcore.ps.PS;
|
||||||
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
|
import com.palmergames.bukkit.towny.TownyMessaging;
|
||||||
|
import com.palmergames.bukkit.towny.TownySettings;
|
||||||
|
import com.palmergames.bukkit.towny.object.Coord;
|
||||||
|
import com.palmergames.bukkit.towny.object.PlayerCache;
|
||||||
|
import com.palmergames.bukkit.towny.object.PlayerCache.TownBlockStatus;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownyPermission;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownyWorld;
|
||||||
|
import com.palmergames.bukkit.towny.object.WorldCoord;
|
||||||
|
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
|
||||||
|
import com.palmergames.bukkit.towny.war.flagwar.TownyWar;
|
||||||
|
import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
|
||||||
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;
|
||||||
|
@ -39,6 +60,7 @@ import com.projectkorra.ProjectKorra.earthbending.EarthPassive;
|
||||||
import com.projectkorra.ProjectKorra.waterbending.FreezeMelt;
|
import com.projectkorra.ProjectKorra.waterbending.FreezeMelt;
|
||||||
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.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
|
||||||
public class Methods {
|
public class Methods {
|
||||||
|
|
||||||
|
@ -48,6 +70,13 @@ public class Methods {
|
||||||
Methods.plugin = plugin;
|
Methods.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean allowharmless = plugin.getConfig().getBoolean("Properties.RegionProtection.AllowHarmlessAbilities");
|
||||||
|
private static boolean respectWorldGuard = plugin.getConfig().getBoolean("Properties.RegionProtection.RespectWorldGuard");
|
||||||
|
private static boolean respectPreciousStones = plugin.getConfig().getBoolean("Properties.RegionProtection.RespectPreciousStones");
|
||||||
|
private static boolean respectFactions = plugin.getConfig().getBoolean("Properties.RegionProtection.RespectFactions");
|
||||||
|
private static boolean respectTowny = plugin.getConfig().getBoolean("Properties.RegionProtection.RespectTowny");
|
||||||
|
private static boolean respectGriefPrevention = plugin.getConfig().getBoolean("Properties.RegionProtection.RespectGriefPrevention");
|
||||||
|
|
||||||
private static final ItemStack pickaxe = new ItemStack(
|
private static final ItemStack pickaxe = new ItemStack(
|
||||||
Material.DIAMOND_PICKAXE);
|
Material.DIAMOND_PICKAXE);
|
||||||
public static ConcurrentHashMap<Block, Information> movedearth = new ConcurrentHashMap<Block, Information>();
|
public static ConcurrentHashMap<Block, Information> movedearth = new ConcurrentHashMap<Block, Information>();
|
||||||
|
@ -1163,14 +1192,20 @@ public class Methods {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isHarmlessAbility(String ability) {
|
||||||
|
return Arrays.asList(AbilityModuleManager.harmlessabilities).contains(ability);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isRegionProtectedFromBuild(Player player,
|
public static boolean isRegionProtectedFromBuild(Player player,
|
||||||
String ability, Location loc) {
|
String ability, Location loc) {
|
||||||
|
|
||||||
List<Abilities> ignite = new ArrayList<Abilities>();
|
Set<String> ignite = AbilityModuleManager.igniteabilities;
|
||||||
ignite.add(Abilities.Blaze);
|
Set<String> explode = AbilityModuleManager.explodeabilities;
|
||||||
List<Abilities> explode = new ArrayList<Abilities>();
|
// List<Abilities> ignite = new ArrayList<Abilities>();
|
||||||
explode.add(Abilities.FireBlast);
|
// ignite.add(Abilities.Blaze);
|
||||||
explode.add(Abilities.Lightning);
|
// List<Abilities> explode = new ArrayList<Abilities>();
|
||||||
|
// explode.add(Abilities.FireBlast);
|
||||||
|
// explode.add(Abilities.Lightning);
|
||||||
|
|
||||||
if (ability == null && allowharmless)
|
if (ability == null && allowharmless)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1218,7 +1253,6 @@ public class Methods {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (explode.contains(ability)) {
|
if (explode.contains(ability)) {
|
||||||
if (wg.getGlobalStateManager().get(location.getWorld()).blockTNTExplosions)
|
if (wg.getGlobalStateManager().get(location.getWorld()).blockTNTExplosions)
|
||||||
return true;
|
return true;
|
||||||
|
@ -1238,17 +1272,17 @@ public class Methods {
|
||||||
if (psp != null && respectPreciousStones) {
|
if (psp != null && respectPreciousStones) {
|
||||||
PreciousStones ps = (PreciousStones) psp;
|
PreciousStones ps = (PreciousStones) psp;
|
||||||
|
|
||||||
if (ignite.contains(ability)) {
|
// if (ignite.contains(ability)) {
|
||||||
if (ps.getForceFieldManager().hasSourceField(location,
|
// if (ps.getForceFieldManager().hasSourceField(location,
|
||||||
FieldFlag.PREVENT_FIRE))
|
// FieldFlag.PREVENT_FIRE))
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (explode.contains(ability)) {
|
// if (explode.contains(ability)) {
|
||||||
if (ps.getForceFieldManager().hasSourceField(location,
|
// if (ps.getForceFieldManager().hasSourceField(location,
|
||||||
FieldFlag.PREVENT_EXPLOSIONS))
|
// FieldFlag.PREVENT_EXPLOSIONS))
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (ps.getForceFieldManager().hasSourceField(location,
|
if (ps.getForceFieldManager().hasSourceField(location,
|
||||||
FieldFlag.PREVENT_PLACE))
|
FieldFlag.PREVENT_PLACE))
|
||||||
|
@ -1256,13 +1290,13 @@ public class Methods {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fcp != null && mcore != null && respectFactions) {
|
if (fcp != null && mcore != null && respectFactions) {
|
||||||
if (ignite.contains(ability)) {
|
// if (ignite.contains(ability)) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (explode.contains(ability)) {
|
// if (explode.contains(ability)) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!FactionsListenerMain.canPlayerBuildAt(player,
|
if (!FactionsListenerMain.canPlayerBuildAt(player,
|
||||||
PS.valueOf(loc.getBlock()), false)) {
|
PS.valueOf(loc.getBlock()), false)) {
|
||||||
|
@ -1290,13 +1324,13 @@ public class Methods {
|
||||||
location, 3, (byte) 0,
|
location, 3, (byte) 0,
|
||||||
TownyPermission.ActionType.BUILD);
|
TownyPermission.ActionType.BUILD);
|
||||||
|
|
||||||
if (ignite.contains(ability)) {
|
// if (ignite.contains(ability)) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (explode.contains(ability)) {
|
// if (explode.contains(ability)) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!bBuild) {
|
if (!bBuild) {
|
||||||
PlayerCache cache = twn.getCache(player);
|
PlayerCache cache = twn.getCache(player);
|
||||||
|
|
|
@ -18,6 +18,13 @@ Properties:
|
||||||
Water: AQUA
|
Water: AQUA
|
||||||
Earth: GREEN
|
Earth: GREEN
|
||||||
Chi: GOLD
|
Chi: GOLD
|
||||||
|
RegionProtection:
|
||||||
|
AllowHarmlessAbilities: true
|
||||||
|
RespectWorldGuard: true
|
||||||
|
RespectGriefPrevention: true
|
||||||
|
RespectFactions: true
|
||||||
|
RespectTowny: true
|
||||||
|
RespectPreciousStones: true
|
||||||
Air:
|
Air:
|
||||||
CanBendWithWeapons: false
|
CanBendWithWeapons: false
|
||||||
Water:
|
Water:
|
||||||
|
|
Loading…
Reference in a new issue