mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 03:30:10 +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/Bending Plugins/TagAPI.jar"/>
|
||||
<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"/>
|
||||
</classpath>
|
||||
|
|
|
@ -43,5 +43,13 @@ public class AbilityModule extends AbilityLoadable implements Cloneable {
|
|||
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 HashMap<String, String> authors;
|
||||
public static HashSet<String> harmlessabilities;
|
||||
public static HashSet<String> igniteabilities;
|
||||
public static HashSet<String> explodeabilities;
|
||||
|
||||
public static HashMap<String, String> descriptions;
|
||||
|
||||
|
@ -45,6 +47,8 @@ public class AbilityModuleManager {
|
|||
descriptions = new HashMap<String, String>();
|
||||
authors = new HashMap<String, String>();
|
||||
harmlessabilities = new HashSet<String>();
|
||||
explodeabilities = new HashSet<String>();
|
||||
igniteabilities = new HashSet<String>();
|
||||
ability = loader.load(AbilityModule.class);
|
||||
fill();
|
||||
}
|
||||
|
@ -57,6 +61,8 @@ public class AbilityModuleManager {
|
|||
abilities.add(a.name());
|
||||
airbendingabilities.add(a.name());
|
||||
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)) {
|
||||
|
@ -64,6 +70,8 @@ public class AbilityModuleManager {
|
|||
abilities.add(a.name());
|
||||
waterbendingabilities.add(a.name());
|
||||
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)) {
|
||||
|
@ -71,6 +79,7 @@ public class AbilityModuleManager {
|
|||
abilities.add(a.name());
|
||||
earthbendingabilities.add(a.name());
|
||||
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)) {
|
||||
|
@ -78,6 +87,10 @@ public class AbilityModuleManager {
|
|||
abilities.add(a.name());
|
||||
firebendingabilities.add(a.name());
|
||||
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)) {
|
||||
|
@ -85,6 +98,7 @@ public class AbilityModuleManager {
|
|||
abilities.add(a.name());
|
||||
chiabilities.add(a.name());
|
||||
descriptions.put(a.name(), ProjectKorra.plugin.getConfig().getString("Abilities.Chi." + a.name() + ".Description"));
|
||||
if (a == StockAbilities.HighJump) harmlessabilities.add(a.name());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -50,6 +50,13 @@ public class ConfigManager {
|
|||
plugin.getConfig().addDefault("Properties.GlobalCooldown", 500);
|
||||
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.Water.CanBendWithWeapons", true);
|
||||
|
|
|
@ -11,6 +11,10 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
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.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
|
@ -28,8 +32,25 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
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.AbilityModuleManager;
|
||||
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.WaterManipulation;
|
||||
import com.projectkorra.ProjectKorra.waterbending.WaterSpout;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
||||
public class Methods {
|
||||
|
||||
|
@ -47,6 +69,13 @@ public class Methods {
|
|||
public Methods(ProjectKorra 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(
|
||||
Material.DIAMOND_PICKAXE);
|
||||
|
@ -1162,15 +1191,21 @@ public class Methods {
|
|||
return faces[besti];
|
||||
|
||||
}
|
||||
|
||||
public static boolean isHarmlessAbility(String ability) {
|
||||
return Arrays.asList(AbilityModuleManager.harmlessabilities).contains(ability);
|
||||
}
|
||||
|
||||
public static boolean isRegionProtectedFromBuild(Player player,
|
||||
String ability, Location loc) {
|
||||
|
||||
List<Abilities> ignite = new ArrayList<Abilities>();
|
||||
ignite.add(Abilities.Blaze);
|
||||
List<Abilities> explode = new ArrayList<Abilities>();
|
||||
explode.add(Abilities.FireBlast);
|
||||
explode.add(Abilities.Lightning);
|
||||
Set<String> ignite = AbilityModuleManager.igniteabilities;
|
||||
Set<String> explode = AbilityModuleManager.explodeabilities;
|
||||
// List<Abilities> ignite = new ArrayList<Abilities>();
|
||||
// ignite.add(Abilities.Blaze);
|
||||
// List<Abilities> explode = new ArrayList<Abilities>();
|
||||
// explode.add(Abilities.FireBlast);
|
||||
// explode.add(Abilities.Lightning);
|
||||
|
||||
if (ability == null && allowharmless)
|
||||
return false;
|
||||
|
@ -1218,7 +1253,6 @@ public class Methods {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
if (explode.contains(ability)) {
|
||||
if (wg.getGlobalStateManager().get(location.getWorld()).blockTNTExplosions)
|
||||
return true;
|
||||
|
@ -1238,17 +1272,17 @@ public class Methods {
|
|||
if (psp != null && respectPreciousStones) {
|
||||
PreciousStones ps = (PreciousStones) psp;
|
||||
|
||||
if (ignite.contains(ability)) {
|
||||
if (ps.getForceFieldManager().hasSourceField(location,
|
||||
FieldFlag.PREVENT_FIRE))
|
||||
return true;
|
||||
}
|
||||
// if (ignite.contains(ability)) {
|
||||
// if (ps.getForceFieldManager().hasSourceField(location,
|
||||
// FieldFlag.PREVENT_FIRE))
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if (explode.contains(ability)) {
|
||||
if (ps.getForceFieldManager().hasSourceField(location,
|
||||
FieldFlag.PREVENT_EXPLOSIONS))
|
||||
return true;
|
||||
}
|
||||
// if (explode.contains(ability)) {
|
||||
// if (ps.getForceFieldManager().hasSourceField(location,
|
||||
// FieldFlag.PREVENT_EXPLOSIONS))
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if (ps.getForceFieldManager().hasSourceField(location,
|
||||
FieldFlag.PREVENT_PLACE))
|
||||
|
@ -1256,13 +1290,13 @@ public class Methods {
|
|||
}
|
||||
|
||||
if (fcp != null && mcore != null && respectFactions) {
|
||||
if (ignite.contains(ability)) {
|
||||
|
||||
}
|
||||
|
||||
if (explode.contains(ability)) {
|
||||
|
||||
}
|
||||
// if (ignite.contains(ability)) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (explode.contains(ability)) {
|
||||
//
|
||||
// }
|
||||
|
||||
if (!FactionsListenerMain.canPlayerBuildAt(player,
|
||||
PS.valueOf(loc.getBlock()), false)) {
|
||||
|
@ -1290,13 +1324,13 @@ public class Methods {
|
|||
location, 3, (byte) 0,
|
||||
TownyPermission.ActionType.BUILD);
|
||||
|
||||
if (ignite.contains(ability)) {
|
||||
|
||||
}
|
||||
|
||||
if (explode.contains(ability)) {
|
||||
|
||||
}
|
||||
// if (ignite.contains(ability)) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (explode.contains(ability)) {
|
||||
//
|
||||
// }
|
||||
|
||||
if (!bBuild) {
|
||||
PlayerCache cache = twn.getCache(player);
|
||||
|
|
|
@ -18,6 +18,13 @@ Properties:
|
|||
Water: AQUA
|
||||
Earth: GREEN
|
||||
Chi: GOLD
|
||||
RegionProtection:
|
||||
AllowHarmlessAbilities: true
|
||||
RespectWorldGuard: true
|
||||
RespectGriefPrevention: true
|
||||
RespectFactions: true
|
||||
RespectTowny: true
|
||||
RespectPreciousStones: true
|
||||
Air:
|
||||
CanBendWithWeapons: false
|
||||
Water:
|
||||
|
|
Loading…
Reference in a new issue