mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-14 04:47:51 +00:00
Updated PK
This commit is contained in:
commit
e39f260bd8
13 changed files with 142 additions and 303 deletions
26
.classpath
26
.classpath
|
@ -1,19 +1,19 @@
|
||||||
<?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/Brendan/Desktop/Korra/bukkit-1.8-R0.1-SNAPSHOT.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/Factions.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/Factions.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/GriefPrevention.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/GriefPrevention.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/LWC.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/LWC.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/MassiveCore.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/MassiveCore.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/NoCheatPlus.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/NoCheatPlus.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/PreciousStones.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/PreciousStones.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/TagAPI.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/TagAPI.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/Towny.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/Towny.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldEdit.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Desktop/Amestria/plugins/WorldEdit.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldGuard.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/WorldGuard.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/plugins/KorraRPG.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Downloads/KorraRPG.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/Spigot.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Brendan/Desktop/Korra/craftbukkit-180.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
Binary file not shown.
|
@ -118,7 +118,7 @@ public class AbilityModuleManager {
|
||||||
if (a == StockAbilities.MetalClips) earthsubabilities.add(a.name());
|
if (a == StockAbilities.MetalClips) earthsubabilities.add(a.name());
|
||||||
if (a == StockAbilities.Extraction) earthsubabilities.add(a.name());
|
if (a == StockAbilities.Extraction) earthsubabilities.add(a.name());
|
||||||
if (a == StockAbilities.LavaFlow) earthsubabilities.add(a.name());
|
if (a == StockAbilities.LavaFlow) earthsubabilities.add(a.name());
|
||||||
if (a == StockAbilities.LavaSurge) earthsubabilities.add(a.name());
|
// if (a == StockAbilities.LavaSurge) earthsubabilities.add(a.name());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public enum StockAbilities {
|
||||||
AvatarState,
|
AvatarState,
|
||||||
|
|
||||||
// Project Korra
|
// Project Korra
|
||||||
Extraction, MetalClips, Smokescreen, Combustion, LavaSurge, LavaFlow, Suffocate, IceBlast, WarriorStance, AcrobatStance;
|
Extraction, MetalClips, Smokescreen, Combustion, LavaFlow, Suffocate, IceBlast, WarriorStance, AcrobatStance;
|
||||||
|
|
||||||
private enum AirbendingAbilities {
|
private enum AirbendingAbilities {
|
||||||
AirBlast, AirBubble, AirShield, AirSuction, AirSwipe, Tornado, AirScooter, AirSpout, AirBurst, Suffocate;
|
AirBlast, AirBubble, AirShield, AirSuction, AirSwipe, Tornado, AirScooter, AirSpout, AirBurst, Suffocate;
|
||||||
|
@ -30,7 +30,7 @@ public enum StockAbilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum EarthbendingAbilities {
|
private enum EarthbendingAbilities {
|
||||||
Catapult, RaiseEarth, EarthGrab, EarthTunnel, EarthBlast, Collapse, Tremorsense, EarthArmor, Shockwave, Extraction, MetalClips, LavaSurge, LavaFlow;
|
Catapult, RaiseEarth, EarthGrab, EarthTunnel, EarthBlast, Collapse, Tremorsense, EarthArmor, Shockwave, Extraction, MetalClips, LavaFlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum FirebendingAbilities {
|
private enum FirebendingAbilities {
|
||||||
|
|
|
@ -463,15 +463,15 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Earth.LavaFlow.AllowNaturalFlow", false);
|
config.addDefault("Abilities.Earth.LavaFlow.AllowNaturalFlow", false);
|
||||||
config.addDefault("Abilities.Earth.LavaFlow.ParticleDensity", 0.33);
|
config.addDefault("Abilities.Earth.LavaFlow.ParticleDensity", 0.33);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.Enabled", true);
|
// config.addDefault("Abilities.Earth.LavaSurge.Enabled", true);
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.Description", "LavaSurge is a fundamental move for any Lavabender out there. To use, simply sneak (Default: Shift) while looking at a source of Earth or Lava, then click in a direction. A surge of lava will swiftly travel towards the target you were pointing at, dealing moderate damage, a large knockback, and setting them on fire.");
|
// config.addDefault("Abilities.Earth.LavaSurge.Description", "LavaSurge is a fundamental move for any Lavabender out there. To use, simply sneak (Default: Shift) while looking at a source of Earth or Lava, then click in a direction. A surge of lava will swiftly travel towards the target you were pointing at, dealing moderate damage, a large knockback, and setting them on fire.");
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.Damage", 4);
|
// config.addDefault("Abilities.Earth.LavaSurge.Damage", 4);
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.Cooldown", 1000);
|
// config.addDefault("Abilities.Earth.LavaSurge.Cooldown", 1000);
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.FractureRadius", 1);
|
// config.addDefault("Abilities.Earth.LavaSurge.FractureRadius", 1);
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.PrepareRange", 7);
|
// config.addDefault("Abilities.Earth.LavaSurge.PrepareRange", 7);
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.TravelRange", 15);
|
// config.addDefault("Abilities.Earth.LavaSurge.TravelRange", 15);
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.MaxLavaWaves", 10);
|
// config.addDefault("Abilities.Earth.LavaSurge.MaxLavaWaves", 10);
|
||||||
config.addDefault("Abilities.Earth.LavaSurge.SourceCanBeEarth", true);
|
// config.addDefault("Abilities.Earth.LavaSurge.SourceCanBeEarth", true);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.MetalClips.Enabled", true);
|
config.addDefault("Abilities.Earth.MetalClips.Enabled", true);
|
||||||
config.addDefault("Abilities.Earth.MetalClips.Description", "MetalClips has the potential to be both an offensive and a utility ability. To start, you must carry smelted Iron Ingots in your inventory. To apply the clips onto an entity, simply click at them. If the entity is a Zombie, a Skeleton, or a Player, the clips will form armor around the entity, giving you some control over them. Each additional clip will give you more control. If you have permission to do so, you may crush the entity against a wall with a 4th clip, hurting them. Without explicit permissions, you will only be able to strap three clips on your target. If the entity is not one of the above, the clip will simply do damage and fall to the ground, to be collected.");
|
config.addDefault("Abilities.Earth.MetalClips.Description", "MetalClips has the potential to be both an offensive and a utility ability. To start, you must carry smelted Iron Ingots in your inventory. To apply the clips onto an entity, simply click at them. If the entity is a Zombie, a Skeleton, or a Player, the clips will form armor around the entity, giving you some control over them. Each additional clip will give you more control. If you have permission to do so, you may crush the entity against a wall with a 4th clip, hurting them. Without explicit permissions, you will only be able to strap three clips on your target. If the entity is not one of the above, the clip will simply do damage and fall to the ground, to be collected.");
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -1445,7 +1448,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);
|
String reason = GriefPrevention.instance.allowBuild(player, location, type);
|
||||||
|
|
||||||
if (ignite.contains(ability)) {
|
if (ignite.contains(ability)) {
|
||||||
|
|
||||||
|
@ -1734,6 +1737,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());
|
||||||
|
|
|
@ -498,9 +498,9 @@ public class PKListener implements Listener {
|
||||||
new MetalClips(player, 1);
|
new MetalClips(player, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abil.equalsIgnoreCase("LavaSurge")) {
|
// if (abil.equalsIgnoreCase("LavaSurge")) {
|
||||||
new LavaSurge(player);
|
// new LavaSurge(player);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (abil.equalsIgnoreCase("LavaFlow")) {
|
if (abil.equalsIgnoreCase("LavaFlow")) {
|
||||||
new LavaFlow(player,LavaFlow.AbilityType.SHIFT);
|
new LavaFlow(player,LavaFlow.AbilityType.SHIFT);
|
||||||
|
|
|
@ -43,45 +43,33 @@ 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>();
|
|
||||||
Collection<? extends Player> players = server.getOnlinePlayers();
|
|
||||||
|
|
||||||
for (Player player : players) {
|
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||||
|
|
||||||
|
for (Player player : server.getOnlinePlayers()) {
|
||||||
Chunk chunk = player.getLocation().getChunk();
|
Chunk chunk = player.getLocation().getChunk();
|
||||||
if (!chunks.contains(chunk))
|
if (!chunks.contains(chunk))
|
||||||
chunks.add(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);
|
||||||
|
@ -120,41 +108,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.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,14 +127,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);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
package com.projectkorra.ProjectKorra.Utilities;
|
package com.projectkorra.ProjectKorra.Utilities;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -10,17 +9,13 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R1.EnumParticle;
|
import net.minecraft.server.v1_8_R1.EnumParticle;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.Utilities.ReflectionHandler.PackageType;
|
import com.projectkorra.ProjectKorra.Utilities.ReflectionHandler.PackageType;
|
||||||
import com.projectkorra.ProjectKorra.Utilities.ReflectionHandler.PacketType;
|
import com.projectkorra.ProjectKorra.Utilities.ReflectionHandler.PacketType;
|
||||||
import com.projectkorra.ProjectKorra.Utilities.ReflectionHandler.SubPackageType;
|
import com.projectkorra.ProjectKorra.Utilities.ReflectionHandler.SubPackageType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ParticleEffect Library v1.4
|
* ParticleEffect Library v1.4
|
||||||
*
|
*
|
||||||
|
@ -206,7 +201,6 @@ public enum ParticleEffect {
|
||||||
* @displayed by bone meal and when trading with a villager
|
* @displayed by bone meal and when trading with a villager
|
||||||
*/
|
*/
|
||||||
HAPPY_VILLAGER("happyVillager");
|
HAPPY_VILLAGER("happyVillager");
|
||||||
|
|
||||||
private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<String, ParticleEffect>();
|
private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<String, ParticleEffect>();
|
||||||
private static final double MAX_RANGE = 16;
|
private static final double MAX_RANGE = 16;
|
||||||
private static Constructor<?> packetPlayOutWorldParticles;
|
private static Constructor<?> packetPlayOutWorldParticles;
|
||||||
|
@ -214,7 +208,6 @@ public enum ParticleEffect {
|
||||||
private static Field playerConnection;
|
private static Field playerConnection;
|
||||||
private static Method sendPacket;
|
private static Method sendPacket;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (ParticleEffect p : values())
|
for (ParticleEffect p : values())
|
||||||
NAME_MAP.put(p.name, p);
|
NAME_MAP.put(p.name, p);
|
||||||
|
@ -228,21 +221,18 @@ public enum ParticleEffect {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name Name of this particle effect
|
* @param name Name of this particle effect
|
||||||
*/
|
*/
|
||||||
private ParticleEffect(String name) {
|
private ParticleEffect(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The name of this particle effect
|
* @return The name of this particle effect
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a particle effect from name
|
* Gets a particle effect from name
|
||||||
*
|
*
|
||||||
|
@ -256,7 +246,6 @@ public enum ParticleEffect {
|
||||||
return e.getValue();
|
return e.getValue();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of players in a certain range
|
* Gets a list of players in a certain range
|
||||||
*
|
*
|
||||||
|
@ -273,7 +262,6 @@ public enum ParticleEffect {
|
||||||
players.add(p);
|
players.add(p);
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new @PacketPlayOutWorldParticles object through reflection
|
* Instantiates a new @PacketPlayOutWorldParticles object through reflection
|
||||||
*
|
*
|
||||||
|
@ -295,65 +283,62 @@ public enum ParticleEffect {
|
||||||
throw new PacketInstantiationException("Packet instantiation failed", e);
|
throw new PacketInstantiationException("Packet instantiation failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumParticle getEnumParticle(String name)
|
public static EnumParticle getEnumParticle(String name)
|
||||||
{
|
{
|
||||||
switch(name.toUpperCase())
|
switch(name.toUpperCase())
|
||||||
{
|
{
|
||||||
case "HUGEEXPLOSION":
|
case "HUGEEXPLOSION":
|
||||||
return EnumParticle.EXPLOSION_HUGE;
|
return EnumParticle.EXPLOSION_HUGE;
|
||||||
case "BUBBLE":
|
case "BUBBLE":
|
||||||
return EnumParticle.WATER_BUBBLE;
|
return EnumParticle.WATER_BUBBLE;
|
||||||
case "SUSPEND":
|
case "SUSPEND":
|
||||||
return EnumParticle.SUSPENDED;
|
return EnumParticle.SUSPENDED;
|
||||||
case "DEPTHSUSPEND":
|
case "DEPTHSUSPEND":
|
||||||
return EnumParticle.SUSPENDED_DEPTH;
|
return EnumParticle.SUSPENDED_DEPTH;
|
||||||
case "MAGICCRIT":
|
case "MAGICCRIT":
|
||||||
return EnumParticle.CRIT_MAGIC;
|
return EnumParticle.CRIT_MAGIC;
|
||||||
case "SMOKE":
|
case "SMOKE":
|
||||||
return EnumParticle.SMOKE_NORMAL;
|
return EnumParticle.SMOKE_NORMAL;
|
||||||
case "MOBSPELL":
|
case "MOBSPELL":
|
||||||
return EnumParticle.SPELL_MOB;
|
return EnumParticle.SPELL_MOB;
|
||||||
case "MOBSPELLAMBIENT":
|
case "MOBSPELLAMBIENT":
|
||||||
return EnumParticle.SPELL_MOB_AMBIENT;
|
return EnumParticle.SPELL_MOB_AMBIENT;
|
||||||
case "INSTANTSPELL":
|
case "INSTANTSPELL":
|
||||||
return EnumParticle.SPELL_INSTANT;
|
return EnumParticle.SPELL_INSTANT;
|
||||||
case "WITCHMAGIC":
|
case "WITCHMAGIC":
|
||||||
return EnumParticle.SPELL_WITCH;
|
return EnumParticle.SPELL_WITCH;
|
||||||
case "EXPLODE":
|
case "EXPLODE":
|
||||||
return EnumParticle.EXPLOSION_NORMAL;
|
return EnumParticle.EXPLOSION_NORMAL;
|
||||||
case "SPLASH":
|
case "SPLASH":
|
||||||
return EnumParticle.WATER_SPLASH;
|
return EnumParticle.WATER_SPLASH;
|
||||||
case "WAKE":
|
case "WAKE":
|
||||||
return EnumParticle.WATER_WAKE;
|
return EnumParticle.WATER_WAKE;
|
||||||
case "LARGESMOKE":
|
case "LARGESMOKE":
|
||||||
return EnumParticle.SMOKE_LARGE;
|
return EnumParticle.SMOKE_LARGE;
|
||||||
case "REDDUST":
|
case "REDDUST":
|
||||||
return EnumParticle.REDSTONE;
|
return EnumParticle.REDSTONE;
|
||||||
case "SNOWBALLPOOF":
|
case "SNOWBALLPOOF":
|
||||||
return EnumParticle.SNOWBALL;
|
return EnumParticle.SNOWBALL;
|
||||||
case "ANGRYVILLAGER":
|
case "ANGRYVILLAGER":
|
||||||
return EnumParticle.VILLAGER_ANGRY;
|
return EnumParticle.VILLAGER_ANGRY;
|
||||||
case "HAPPYVILLAGER":
|
case "HAPPYVILLAGER":
|
||||||
return EnumParticle.VILLAGER_HAPPY;
|
return EnumParticle.VILLAGER_HAPPY;
|
||||||
case "DRIPWATER":
|
case "DRIPWATER":
|
||||||
return EnumParticle.DRIP_WATER;
|
return EnumParticle.DRIP_WATER;
|
||||||
case "DRIPLAVA":
|
case "DRIPLAVA":
|
||||||
return EnumParticle.DRIP_LAVA;
|
return EnumParticle.DRIP_LAVA;
|
||||||
case "SNOWSHOVEL":
|
case "SNOWSHOVEL":
|
||||||
return EnumParticle.SNOW_SHOVEL;
|
return EnumParticle.SNOW_SHOVEL;
|
||||||
case "ENCHANTMENTTABLE":
|
case "ENCHANTMENTTABLE":
|
||||||
return EnumParticle.ENCHANTMENT_TABLE;
|
return EnumParticle.ENCHANTMENT_TABLE;
|
||||||
case "TOWNAURA":
|
case "TOWNAURA":
|
||||||
return EnumParticle.TOWN_AURA;
|
return EnumParticle.TOWN_AURA;
|
||||||
case "FIREWORKSSPARK":
|
case "FIREWORKSSPARK":
|
||||||
return EnumParticle.FIREWORKS_SPARK;
|
return EnumParticle.FIREWORKS_SPARK;
|
||||||
default:
|
default:
|
||||||
return EnumParticle.valueOf(name.toUpperCase());
|
return EnumParticle.valueOf(name.toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "iconcrack" effect
|
* Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "iconcrack" effect
|
||||||
*
|
*
|
||||||
|
@ -370,7 +355,6 @@ public enum ParticleEffect {
|
||||||
private static Object instantiateIconCrackPacket(int id, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
private static Object instantiateIconCrackPacket(int id, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
||||||
return instantiatePacket("iconcrack_" + id, center, offsetX, offsetY, offsetZ, speed, amount);
|
return instantiatePacket("iconcrack_" + id, center, offsetX, offsetY, offsetZ, speed, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "blockcrack" effect
|
* Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "blockcrack" effect
|
||||||
*
|
*
|
||||||
|
@ -387,7 +371,6 @@ public enum ParticleEffect {
|
||||||
private static Object instantiateBlockCrackPacket(int id, byte data, Location center, float offsetX, float offsetY, float offsetZ, int amount) {
|
private static Object instantiateBlockCrackPacket(int id, byte data, Location center, float offsetX, float offsetY, float offsetZ, int amount) {
|
||||||
return instantiatePacket("blockcrack_" + id + "_" + data, center, offsetX, offsetY, offsetZ, 0, amount);
|
return instantiatePacket("blockcrack_" + id + "_" + data, center, offsetX, offsetY, offsetZ, 0, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "blockdust" effect
|
* Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "blockdust" effect
|
||||||
*
|
*
|
||||||
|
@ -405,7 +388,6 @@ public enum ParticleEffect {
|
||||||
private static Object instantiateBlockDustPacket(int id, byte data, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
private static Object instantiateBlockDustPacket(int id, byte data, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
||||||
return instantiatePacket("blockdust_" + id + "_" + data, center, offsetX, offsetY, offsetZ, speed, amount);
|
return instantiatePacket("blockdust_" + id + "_" + data, center, offsetX, offsetY, offsetZ, speed, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a packet through reflection to a player
|
* Sends a packet through reflection to a player
|
||||||
*
|
*
|
||||||
|
@ -420,7 +402,6 @@ public enum ParticleEffect {
|
||||||
throw new PacketSendingException("Failed to send a packet to player '" + p.getName() + "'", e);
|
throw new PacketSendingException("Failed to send a packet to player '" + p.getName() + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a packet through reflection to a collection of players
|
* Sends a packet through reflection to a collection of players
|
||||||
*
|
*
|
||||||
|
@ -433,7 +414,6 @@ public enum ParticleEffect {
|
||||||
for (Player p : players)
|
for (Player p : players)
|
||||||
sendPacket(p, packet);
|
sendPacket(p, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a particle effect which is only visible for the specified players
|
* Displays a particle effect which is only visible for the specified players
|
||||||
*
|
*
|
||||||
|
@ -450,7 +430,6 @@ public enum ParticleEffect {
|
||||||
public void display(Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
|
public void display(Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
|
||||||
sendPacket(Arrays.asList(players), instantiatePacket(name, center, offsetX, offsetY, offsetZ, speed, amount));
|
sendPacket(Arrays.asList(players), instantiatePacket(name, center, offsetX, offsetY, offsetZ, speed, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a particle effect which is only visible for all players within a certain range in the world of @param center
|
* Displays a particle effect which is only visible for all players within a certain range in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -471,7 +450,6 @@ public enum ParticleEffect {
|
||||||
throw new IllegalArgumentException("Range cannot exceed the maximum value of 16");
|
throw new IllegalArgumentException("Range cannot exceed the maximum value of 16");
|
||||||
sendPacket(getPlayers(center, range), instantiatePacket(name, center, offsetX, offsetY, offsetZ, speed, amount));
|
sendPacket(getPlayers(center, range), instantiatePacket(name, center, offsetX, offsetY, offsetZ, speed, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a particle effect which is only visible for all players within a range of 20 in the world of @param center
|
* Displays a particle effect which is only visible for all players within a range of 20 in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -487,7 +465,6 @@ public enum ParticleEffect {
|
||||||
public void display(Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
public void display(Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
||||||
display(center, MAX_RANGE, offsetX, offsetY, offsetZ, speed, amount);
|
display(center, MAX_RANGE, offsetX, offsetY, offsetZ, speed, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays an icon crack (item break) particle effect which is only visible for the specified players
|
* Displays an icon crack (item break) particle effect which is only visible for the specified players
|
||||||
*
|
*
|
||||||
|
@ -505,7 +482,6 @@ public enum ParticleEffect {
|
||||||
public static void displayIconCrack(Location center, int id, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
|
public static void displayIconCrack(Location center, int id, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
|
||||||
sendPacket(Arrays.asList(players), instantiateIconCrackPacket(id, center, offsetX, offsetY, offsetZ, speed, amount));
|
sendPacket(Arrays.asList(players), instantiateIconCrackPacket(id, center, offsetX, offsetY, offsetZ, speed, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays an icon crack (item break) particle effect which is only visible for all players within a certain range in the world of @param center
|
* Displays an icon crack (item break) particle effect which is only visible for all players within a certain range in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -526,7 +502,6 @@ public enum ParticleEffect {
|
||||||
throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
|
throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
|
||||||
sendPacket(getPlayers(center, range), instantiateIconCrackPacket(id, center, offsetX, offsetY, offsetZ, speed, amount));
|
sendPacket(getPlayers(center, range), instantiateIconCrackPacket(id, center, offsetX, offsetY, offsetZ, speed, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays an icon crack (item break) effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
|
* Displays an icon crack (item break) effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -542,7 +517,6 @@ public enum ParticleEffect {
|
||||||
public static void displayIconCrack(Location center, int id, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
public static void displayIconCrack(Location center, int id, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
||||||
displayIconCrack(center, MAX_RANGE, id, offsetX, offsetY, offsetZ, speed, amount);
|
displayIconCrack(center, MAX_RANGE, id, offsetX, offsetY, offsetZ, speed, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a block crack (block break) particle effect which is only visible for the specified players
|
* Displays a block crack (block break) particle effect which is only visible for the specified players
|
||||||
*
|
*
|
||||||
|
@ -560,7 +534,6 @@ public enum ParticleEffect {
|
||||||
public static void displayBlockCrack(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, int amount, Player... players) {
|
public static void displayBlockCrack(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, int amount, Player... players) {
|
||||||
sendPacket(Arrays.asList(players), instantiateBlockCrackPacket(id, data, center, offsetX, offsetY, offsetZ, amount));
|
sendPacket(Arrays.asList(players), instantiateBlockCrackPacket(id, data, center, offsetX, offsetY, offsetZ, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a block crack (block break) particle effect which is only visible for all players within a certain range in the world of @param center
|
* Displays a block crack (block break) particle effect which is only visible for all players within a certain range in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -581,7 +554,6 @@ public enum ParticleEffect {
|
||||||
throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
|
throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
|
||||||
sendPacket(getPlayers(center, range), instantiateBlockCrackPacket(id, data, center, offsetX, offsetY, offsetZ, amount));
|
sendPacket(getPlayers(center, range), instantiateBlockCrackPacket(id, data, center, offsetX, offsetY, offsetZ, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a block crack (block break) effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
|
* Displays a block crack (block break) effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -597,7 +569,6 @@ public enum ParticleEffect {
|
||||||
public static void displayBlockCrack(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, int amount) {
|
public static void displayBlockCrack(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, int amount) {
|
||||||
displayBlockCrack(center, MAX_RANGE, id, data, offsetX, offsetY, offsetZ, amount);
|
displayBlockCrack(center, MAX_RANGE, id, data, offsetX, offsetY, offsetZ, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a block dust particle effect which is only visible for the specified players
|
* Displays a block dust particle effect which is only visible for the specified players
|
||||||
*
|
*
|
||||||
|
@ -616,7 +587,6 @@ public enum ParticleEffect {
|
||||||
public static void displayBlockDust(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
|
public static void displayBlockDust(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
|
||||||
sendPacket(Arrays.asList(players), instantiateBlockDustPacket(id, data, center, offsetX, offsetY, offsetZ, speed, amount));
|
sendPacket(Arrays.asList(players), instantiateBlockDustPacket(id, data, center, offsetX, offsetY, offsetZ, speed, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a block dust particle effect which is only visible for all players within a certain range in the world of @param center
|
* Displays a block dust particle effect which is only visible for all players within a certain range in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -638,7 +608,6 @@ public enum ParticleEffect {
|
||||||
throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
|
throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
|
||||||
sendPacket(getPlayers(center, range), instantiateBlockDustPacket(id, data, center, offsetX, offsetY, offsetZ, speed, amount));
|
sendPacket(getPlayers(center, range), instantiateBlockDustPacket(id, data, center, offsetX, offsetY, offsetZ, speed, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a block dust effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
|
* Displays a block dust effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
|
||||||
*
|
*
|
||||||
|
@ -655,20 +624,17 @@ public enum ParticleEffect {
|
||||||
public static void displayBlockDust(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
public static void displayBlockDust(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
|
||||||
displayBlockDust(center, MAX_RANGE, id, data, offsetX, offsetY, offsetZ, speed, amount);
|
displayBlockDust(center, MAX_RANGE, id, data, offsetX, offsetY, offsetZ, speed, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that can be thrown upon packet instantiation
|
* Represents a runtime exception that can be thrown upon packet instantiation
|
||||||
*/
|
*/
|
||||||
private static final class PacketInstantiationException extends RuntimeException {
|
private static final class PacketInstantiationException extends RuntimeException {
|
||||||
private static final long serialVersionUID = 3203085387160737484L;
|
private static final long serialVersionUID = 3203085387160737484L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param message Message that will be logged
|
* @param message Message that will be logged
|
||||||
*/
|
*/
|
||||||
public PacketInstantiationException(String message) {
|
public PacketInstantiationException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param message Message that will be logged
|
* @param message Message that will be logged
|
||||||
* @param cause Cause of the exception
|
* @param cause Cause of the exception
|
||||||
|
@ -677,13 +643,11 @@ public enum ParticleEffect {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that can be thrown upon packet sending
|
* Represents a runtime exception that can be thrown upon packet sending
|
||||||
*/
|
*/
|
||||||
private static final class PacketSendingException extends RuntimeException {
|
private static final class PacketSendingException extends RuntimeException {
|
||||||
private static final long serialVersionUID = 3203085387160737484L;
|
private static final long serialVersionUID = 3203085387160737484L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param message Message that will be logged
|
* @param message Message that will be logged
|
||||||
* @param cause Cause of the exception
|
* @param cause Cause of the exception
|
||||||
|
|
|
@ -5,9 +5,7 @@ import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReflectionHandler v1.0
|
* ReflectionHandler v1.0
|
||||||
*
|
*
|
||||||
|
@ -23,15 +21,12 @@ import org.bukkit.Bukkit;
|
||||||
*/
|
*/
|
||||||
public final class ReflectionHandler {
|
public final class ReflectionHandler {
|
||||||
private ReflectionHandler() {}
|
private ReflectionHandler() {}
|
||||||
|
|
||||||
public static Class<?> getClass(String name, PackageType type) throws Exception {
|
public static Class<?> getClass(String name, PackageType type) throws Exception {
|
||||||
return Class.forName(type + "." + name);
|
return Class.forName(type + "." + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> getClass(String name, SubPackageType type) throws Exception {
|
public static Class<?> getClass(String name, SubPackageType type) throws Exception {
|
||||||
return Class.forName(type + "." + name);
|
return Class.forName(type + "." + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) {
|
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) {
|
||||||
Class<?>[] p = DataType.convertToPrimitive(parameterTypes);
|
Class<?>[] p = DataType.convertToPrimitive(parameterTypes);
|
||||||
for (Constructor<?> c : clazz.getConstructors())
|
for (Constructor<?> c : clazz.getConstructors())
|
||||||
|
@ -39,27 +34,21 @@ public final class ReflectionHandler {
|
||||||
return c;
|
return c;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Constructor<?> getConstructor(String className, PackageType type, Class<?>... parameterTypes) throws Exception {
|
public static Constructor<?> getConstructor(String className, PackageType type, Class<?>... parameterTypes) throws Exception {
|
||||||
return getConstructor(getClass(className, type), parameterTypes);
|
return getConstructor(getClass(className, type), parameterTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Constructor<?> getConstructor(String className, SubPackageType type, Class<?>... parameterTypes) throws Exception {
|
public static Constructor<?> getConstructor(String className, SubPackageType type, Class<?>... parameterTypes) throws Exception {
|
||||||
return getConstructor(getClass(className, type), parameterTypes);
|
return getConstructor(getClass(className, type), parameterTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object newInstance(Class<?> clazz, Object... args) throws Exception {
|
public static Object newInstance(Class<?> clazz, Object... args) throws Exception {
|
||||||
return getConstructor(clazz, DataType.convertToPrimitive(args)).newInstance(args);
|
return getConstructor(clazz, DataType.convertToPrimitive(args)).newInstance(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object newInstance(String className, PackageType type, Object... args) throws Exception {
|
public static Object newInstance(String className, PackageType type, Object... args) throws Exception {
|
||||||
return newInstance(getClass(className, type), args);
|
return newInstance(getClass(className, type), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object newInstance(String className, SubPackageType type, Object... args) throws Exception {
|
public static Object newInstance(String className, SubPackageType type, Object... args) throws Exception {
|
||||||
return newInstance(getClass(className, type), args);
|
return newInstance(getClass(className, type), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Method getMethod(Class<?> clazz, String name, Class<?>... parameterTypes) {
|
public static Method getMethod(Class<?> clazz, String name, Class<?>... parameterTypes) {
|
||||||
Class<?>[] p = DataType.convertToPrimitive(parameterTypes);
|
Class<?>[] p = DataType.convertToPrimitive(parameterTypes);
|
||||||
for (Method m : clazz.getMethods())
|
for (Method m : clazz.getMethods())
|
||||||
|
@ -67,195 +56,150 @@ public final class ReflectionHandler {
|
||||||
return m;
|
return m;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Method getMethod(String className, PackageType type, String name, Class<?>... parameterTypes) throws Exception {
|
public static Method getMethod(String className, PackageType type, String name, Class<?>... parameterTypes) throws Exception {
|
||||||
return getMethod(getClass(className, type), name, parameterTypes);
|
return getMethod(getClass(className, type), name, parameterTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Method getMethod(String className, SubPackageType type, String name, Class<?>... parameterTypes) throws Exception {
|
public static Method getMethod(String className, SubPackageType type, String name, Class<?>... parameterTypes) throws Exception {
|
||||||
return getMethod(getClass(className, type), name, parameterTypes);
|
return getMethod(getClass(className, type), name, parameterTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object invokeMethod(String name, Object instance, Object... args) throws Exception {
|
public static Object invokeMethod(String name, Object instance, Object... args) throws Exception {
|
||||||
return getMethod(instance.getClass(), name, DataType.convertToPrimitive(args)).invoke(instance, args);
|
return getMethod(instance.getClass(), name, DataType.convertToPrimitive(args)).invoke(instance, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object invokeMethod(Class<?> clazz, String name, Object instance, Object... args) throws Exception {
|
public static Object invokeMethod(Class<?> clazz, String name, Object instance, Object... args) throws Exception {
|
||||||
return getMethod(clazz, name, DataType.convertToPrimitive(args)).invoke(instance, args);
|
return getMethod(clazz, name, DataType.convertToPrimitive(args)).invoke(instance, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object invokeMethod(String className, PackageType type, String name, Object instance, Object... args) throws Exception {
|
public static Object invokeMethod(String className, PackageType type, String name, Object instance, Object... args) throws Exception {
|
||||||
return invokeMethod(getClass(className, type), name, instance, args);
|
return invokeMethod(getClass(className, type), name, instance, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object invokeMethod(String className, SubPackageType type, String name, Object instance, Object... args) throws Exception {
|
public static Object invokeMethod(String className, SubPackageType type, String name, Object instance, Object... args) throws Exception {
|
||||||
return invokeMethod(getClass(className, type), name, instance, args);
|
return invokeMethod(getClass(className, type), name, instance, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getField(Class<?> clazz, String name) throws Exception {
|
public static Field getField(Class<?> clazz, String name) throws Exception {
|
||||||
Field f = clazz.getField(name);
|
Field f = clazz.getField(name);
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getField(String className, PackageType type, String name) throws Exception {
|
public static Field getField(String className, PackageType type, String name) throws Exception {
|
||||||
return getField(getClass(className, type), name);
|
return getField(getClass(className, type), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getField(String className, SubPackageType type, String name) throws Exception {
|
public static Field getField(String className, SubPackageType type, String name) throws Exception {
|
||||||
return getField(getClass(className, type), name);
|
return getField(getClass(className, type), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getDeclaredField(Class<?> clazz, String name) throws Exception {
|
public static Field getDeclaredField(Class<?> clazz, String name) throws Exception {
|
||||||
Field f = clazz.getDeclaredField(name);
|
Field f = clazz.getDeclaredField(name);
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getDeclaredField(String className, PackageType type, String name) throws Exception {
|
public static Field getDeclaredField(String className, PackageType type, String name) throws Exception {
|
||||||
return getDeclaredField(getClass(className, type), name);
|
return getDeclaredField(getClass(className, type), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getDeclaredField(String className, SubPackageType type, String name) throws Exception {
|
public static Field getDeclaredField(String className, SubPackageType type, String name) throws Exception {
|
||||||
return getDeclaredField(getClass(className, type), name);
|
return getDeclaredField(getClass(className, type), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getValue(Object instance, String fieldName) throws Exception {
|
public static Object getValue(Object instance, String fieldName) throws Exception {
|
||||||
return getField(instance.getClass(), fieldName).get(instance);
|
return getField(instance.getClass(), fieldName).get(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getValue(Class<?> clazz, Object instance, String fieldName) throws Exception {
|
public static Object getValue(Class<?> clazz, Object instance, String fieldName) throws Exception {
|
||||||
return getField(clazz, fieldName).get(instance);
|
return getField(clazz, fieldName).get(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getValue(String className, PackageType type, Object instance, String fieldName) throws Exception {
|
public static Object getValue(String className, PackageType type, Object instance, String fieldName) throws Exception {
|
||||||
return getValue(getClass(className, type), instance, fieldName);
|
return getValue(getClass(className, type), instance, fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getValue(String className, SubPackageType type, Object instance, String fieldName) throws Exception {
|
public static Object getValue(String className, SubPackageType type, Object instance, String fieldName) throws Exception {
|
||||||
return getValue(getClass(className, type), instance, fieldName);
|
return getValue(getClass(className, type), instance, fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getDeclaredValue(Object instance, String fieldName) throws Exception {
|
public static Object getDeclaredValue(Object instance, String fieldName) throws Exception {
|
||||||
return getDeclaredField(instance.getClass(), fieldName).get(instance);
|
return getDeclaredField(instance.getClass(), fieldName).get(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getDeclaredValue(Class<?> clazz, Object instance, String fieldName) throws Exception {
|
public static Object getDeclaredValue(Class<?> clazz, Object instance, String fieldName) throws Exception {
|
||||||
return getDeclaredField(clazz, fieldName).get(instance);
|
return getDeclaredField(clazz, fieldName).get(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getDeclaredValue(String className, PackageType type, Object instance, String fieldName) throws Exception {
|
public static Object getDeclaredValue(String className, PackageType type, Object instance, String fieldName) throws Exception {
|
||||||
return getDeclaredValue(getClass(className, type), instance, fieldName);
|
return getDeclaredValue(getClass(className, type), instance, fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getDeclaredValue(String className, SubPackageType type, Object instance, String fieldName) throws Exception {
|
public static Object getDeclaredValue(String className, SubPackageType type, Object instance, String fieldName) throws Exception {
|
||||||
return getDeclaredValue(getClass(className, type), instance, fieldName);
|
return getDeclaredValue(getClass(className, type), instance, fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setValue(Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
Field f = getField(instance.getClass(), fieldName);
|
Field f = getField(instance.getClass(), fieldName);
|
||||||
f.set(instance, fieldValue);
|
f.set(instance, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(Object instance, FieldPair pair) throws Exception {
|
public static void setValue(Object instance, FieldPair pair) throws Exception {
|
||||||
setValue(instance, pair.getName(), pair.getValue());
|
setValue(instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(Class<?> clazz, Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setValue(Class<?> clazz, Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
Field f = getField(clazz, fieldName);
|
Field f = getField(clazz, fieldName);
|
||||||
f.set(instance, fieldValue);
|
f.set(instance, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(Class<?> clazz, Object instance, FieldPair pair) throws Exception {
|
public static void setValue(Class<?> clazz, Object instance, FieldPair pair) throws Exception {
|
||||||
setValue(clazz, instance, pair.getName(), pair.getValue());
|
setValue(clazz, instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(String className, PackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setValue(String className, PackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
setValue(getClass(className, type), instance, fieldName, fieldValue);
|
setValue(getClass(className, type), instance, fieldName, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(String className, PackageType type, Object instance, FieldPair pair) throws Exception {
|
public static void setValue(String className, PackageType type, Object instance, FieldPair pair) throws Exception {
|
||||||
setValue(className, type, instance, pair.getName(), pair.getValue());
|
setValue(className, type, instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(String className, SubPackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setValue(String className, SubPackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
setValue(getClass(className, type), instance, fieldName, fieldValue);
|
setValue(getClass(className, type), instance, fieldName, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(String className, SubPackageType type, Object instance, FieldPair pair) throws Exception {
|
public static void setValue(String className, SubPackageType type, Object instance, FieldPair pair) throws Exception {
|
||||||
setValue(className, type, instance, pair.getName(), pair.getValue());
|
setValue(className, type, instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValues(Object instance, FieldPair... pairs) throws Exception {
|
public static void setValues(Object instance, FieldPair... pairs) throws Exception {
|
||||||
for (FieldPair pair : pairs)
|
for (FieldPair pair : pairs)
|
||||||
setValue(instance, pair);
|
setValue(instance, pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValues(Class<?> clazz, Object instance, FieldPair... pairs) throws Exception {
|
public static void setValues(Class<?> clazz, Object instance, FieldPair... pairs) throws Exception {
|
||||||
for (FieldPair pair : pairs)
|
for (FieldPair pair : pairs)
|
||||||
setValue(clazz, instance, pair);
|
setValue(clazz, instance, pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValues(String className, PackageType type, Object instance, FieldPair... pairs) throws Exception {
|
public static void setValues(String className, PackageType type, Object instance, FieldPair... pairs) throws Exception {
|
||||||
setValues(getClass(className, type), instance, pairs);
|
setValues(getClass(className, type), instance, pairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValues(String className, SubPackageType type, Object instance, FieldPair... pairs) throws Exception {
|
public static void setValues(String className, SubPackageType type, Object instance, FieldPair... pairs) throws Exception {
|
||||||
setValues(getClass(className, type), instance, pairs);
|
setValues(getClass(className, type), instance, pairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setDeclaredValue(Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
Field f = getDeclaredField(instance.getClass(), fieldName);
|
Field f = getDeclaredField(instance.getClass(), fieldName);
|
||||||
f.set(instance, fieldValue);
|
f.set(instance, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(Object instance, FieldPair pair) throws Exception {
|
public static void setDeclaredValue(Object instance, FieldPair pair) throws Exception {
|
||||||
setDeclaredValue(instance, pair.getName(), pair.getValue());
|
setDeclaredValue(instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(Class<?> clazz, Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setDeclaredValue(Class<?> clazz, Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
Field f = getDeclaredField(clazz, fieldName);
|
Field f = getDeclaredField(clazz, fieldName);
|
||||||
f.set(instance, fieldValue);
|
f.set(instance, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(Class<?> clazz, Object instance, FieldPair pair) throws Exception {
|
public static void setDeclaredValue(Class<?> clazz, Object instance, FieldPair pair) throws Exception {
|
||||||
setDeclaredValue(clazz, instance, pair.getName(), pair.getValue());
|
setDeclaredValue(clazz, instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(String className, PackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setDeclaredValue(String className, PackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
setDeclaredValue(getClass(className, type), instance, fieldName, fieldValue);
|
setDeclaredValue(getClass(className, type), instance, fieldName, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(String className, PackageType type, Object instance, FieldPair pair) throws Exception {
|
public static void setDeclaredValue(String className, PackageType type, Object instance, FieldPair pair) throws Exception {
|
||||||
setDeclaredValue(className, type, instance, pair.getName(), pair.getValue());
|
setDeclaredValue(className, type, instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(String className, SubPackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
public static void setDeclaredValue(String className, SubPackageType type, Object instance, String fieldName, Object fieldValue) throws Exception {
|
||||||
setDeclaredValue(getClass(className, type), instance, fieldName, fieldValue);
|
setDeclaredValue(getClass(className, type), instance, fieldName, fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValue(String className, SubPackageType type, Object instance, FieldPair pair) throws Exception {
|
public static void setDeclaredValue(String className, SubPackageType type, Object instance, FieldPair pair) throws Exception {
|
||||||
setDeclaredValue(className, type, instance, pair.getName(), pair.getValue());
|
setDeclaredValue(className, type, instance, pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValues(Object instance, FieldPair... pairs) throws Exception {
|
public static void setDeclaredValues(Object instance, FieldPair... pairs) throws Exception {
|
||||||
for (FieldPair pair : pairs)
|
for (FieldPair pair : pairs)
|
||||||
setDeclaredValue(instance, pair);
|
setDeclaredValue(instance, pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValues(Class<?> clazz, Object instance, FieldPair... pairs) throws Exception {
|
public static void setDeclaredValues(Class<?> clazz, Object instance, FieldPair... pairs) throws Exception {
|
||||||
for (FieldPair pair : pairs)
|
for (FieldPair pair : pairs)
|
||||||
setDeclaredValue(clazz, instance, pair);
|
setDeclaredValue(clazz, instance, pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValues(String className, PackageType type, Object instance, FieldPair... pairs) throws Exception {
|
public static void setDeclaredValues(String className, PackageType type, Object instance, FieldPair... pairs) throws Exception {
|
||||||
setDeclaredValues(getClass(className, type), instance, pairs);
|
setDeclaredValues(getClass(className, type), instance, pairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDeclaredValues(String className, SubPackageType type, Object instance, FieldPair... pairs) throws Exception {
|
public static void setDeclaredValues(String className, SubPackageType type, Object instance, FieldPair... pairs) throws Exception {
|
||||||
setDeclaredValues(getClass(className, type), instance, pairs);
|
setDeclaredValues(getClass(className, type), instance, pairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is part of the ReflectionHandler and follows the same usage conditions
|
* This class is part of the ReflectionHandler and follows the same usage conditions
|
||||||
*
|
*
|
||||||
|
@ -270,45 +214,36 @@ public final class ReflectionHandler {
|
||||||
FLOAT(float.class, Float.class),
|
FLOAT(float.class, Float.class),
|
||||||
DOUBLE(double.class, Double.class),
|
DOUBLE(double.class, Double.class),
|
||||||
BOOLEAN(boolean.class, Boolean.class);
|
BOOLEAN(boolean.class, Boolean.class);
|
||||||
|
|
||||||
private static final Map<Class<?>, DataType> CLASS_MAP = new HashMap<Class<?>, DataType>();
|
private static final Map<Class<?>, DataType> CLASS_MAP = new HashMap<Class<?>, DataType>();
|
||||||
private final Class<?> primitive;
|
private final Class<?> primitive;
|
||||||
private final Class<?> reference;
|
private final Class<?> reference;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (DataType t : values()) {
|
for (DataType t : values()) {
|
||||||
CLASS_MAP.put(t.primitive, t);
|
CLASS_MAP.put(t.primitive, t);
|
||||||
CLASS_MAP.put(t.reference, t);
|
CLASS_MAP.put(t.reference, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataType(Class<?> primitive, Class<?> reference) {
|
private DataType(Class<?> primitive, Class<?> reference) {
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
this.reference = reference;
|
this.reference = reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?> getPrimitive() {
|
public Class<?> getPrimitive() {
|
||||||
return this.primitive;
|
return this.primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?> getReference() {
|
public Class<?> getReference() {
|
||||||
return this.reference;
|
return this.reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataType fromClass(Class<?> c) {
|
public static DataType fromClass(Class<?> c) {
|
||||||
return CLASS_MAP.get(c);
|
return CLASS_MAP.get(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> getPrimitive(Class<?> c) {
|
public static Class<?> getPrimitive(Class<?> c) {
|
||||||
DataType t = fromClass(c);
|
DataType t = fromClass(c);
|
||||||
return t == null ? c : t.getPrimitive();
|
return t == null ? c : t.getPrimitive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> getReference(Class<?> c) {
|
public static Class<?> getReference(Class<?> c) {
|
||||||
DataType t = fromClass(c);
|
DataType t = fromClass(c);
|
||||||
return t == null ? c : t.getReference();
|
return t == null ? c : t.getReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?>[] convertToPrimitive(Class<?>[] classes) {
|
public static Class<?>[] convertToPrimitive(Class<?>[] classes) {
|
||||||
int length = classes == null ? 0 : classes.length;
|
int length = classes == null ? 0 : classes.length;
|
||||||
Class<?>[] types = new Class<?>[length];
|
Class<?>[] types = new Class<?>[length];
|
||||||
|
@ -316,7 +251,6 @@ public final class ReflectionHandler {
|
||||||
types[i] = getPrimitive(classes[i]);
|
types[i] = getPrimitive(classes[i]);
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?>[] convertToPrimitive(Object[] objects) {
|
public static Class<?>[] convertToPrimitive(Object[] objects) {
|
||||||
int length = objects == null ? 0 : objects.length;
|
int length = objects == null ? 0 : objects.length;
|
||||||
Class<?>[] types = new Class<?>[length];
|
Class<?>[] types = new Class<?>[length];
|
||||||
|
@ -324,7 +258,6 @@ public final class ReflectionHandler {
|
||||||
types[i] = getPrimitive(objects[i].getClass());
|
types[i] = getPrimitive(objects[i].getClass());
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean equalsArray(Class<?>[] a1, Class<?>[] a2) {
|
public static boolean equalsArray(Class<?>[] a1, Class<?>[] a2) {
|
||||||
if (a1 == null || a2 == null || a1.length != a2.length)
|
if (a1 == null || a2 == null || a1.length != a2.length)
|
||||||
return false;
|
return false;
|
||||||
|
@ -334,7 +267,6 @@ public final class ReflectionHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is part of the ReflectionHandler and follows the same usage conditions
|
* This class is part of the ReflectionHandler and follows the same usage conditions
|
||||||
*
|
*
|
||||||
|
@ -343,21 +275,17 @@ public final class ReflectionHandler {
|
||||||
public final class FieldPair {
|
public final class FieldPair {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Object value;
|
private final Object value;
|
||||||
|
|
||||||
public FieldPair(String name, Object value) {
|
public FieldPair(String name, Object value) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is part of the ReflectionHandler and follows the same usage conditions
|
* This class is part of the ReflectionHandler and follows the same usage conditions
|
||||||
*
|
*
|
||||||
|
@ -366,23 +294,18 @@ public final class ReflectionHandler {
|
||||||
public enum PackageType {
|
public enum PackageType {
|
||||||
MINECRAFT_SERVER("net.minecraft.server." + Bukkit.getServer().getClass().getPackage().getName().substring(23)),
|
MINECRAFT_SERVER("net.minecraft.server." + Bukkit.getServer().getClass().getPackage().getName().substring(23)),
|
||||||
CRAFTBUKKIT(Bukkit.getServer().getClass().getPackage().getName());
|
CRAFTBUKKIT(Bukkit.getServer().getClass().getPackage().getName());
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
private PackageType(String name) {
|
private PackageType(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is part of the ReflectionHandler and follows the same usage conditions
|
* This class is part of the ReflectionHandler and follows the same usage conditions
|
||||||
*
|
*
|
||||||
|
@ -407,23 +330,18 @@ public final class ReflectionHandler {
|
||||||
SCOREBOARD,
|
SCOREBOARD,
|
||||||
UPDATER,
|
UPDATER,
|
||||||
UTIL;
|
UTIL;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
private SubPackageType() {
|
private SubPackageType() {
|
||||||
name = PackageType.CRAFTBUKKIT + "." + name().toLowerCase();
|
name = PackageType.CRAFTBUKKIT + "." + name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is part of the ReflectionHandler and follows the same usage conditions
|
* This class is part of the ReflectionHandler and follows the same usage conditions
|
||||||
*
|
*
|
||||||
|
@ -529,18 +447,14 @@ public final class ReflectionHandler {
|
||||||
STATUS_IN_START("PacketStatusInStart"),
|
STATUS_IN_START("PacketStatusInStart"),
|
||||||
STATUS_OUT_PONG("PacketStatusOutPong"),
|
STATUS_OUT_PONG("PacketStatusOutPong"),
|
||||||
STATUS_OUT_SERVER_INFO("PacketStatusOutServerInfo");
|
STATUS_OUT_SERVER_INFO("PacketStatusOutServerInfo");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private Class<?> packet;
|
private Class<?> packet;
|
||||||
|
|
||||||
private PacketType(String name) {
|
private PacketType(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.getName();
|
return this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?> getPacket() throws Exception {
|
public Class<?> getPacket() throws Exception {
|
||||||
return packet == null ? packet = ReflectionHandler.getClass(name, PackageType.MINECRAFT_SERVER) : packet;
|
return packet == null ? packet = ReflectionHandler.getClass(name, PackageType.MINECRAFT_SERVER) : packet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,16 @@ 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);
|
ParticleEffect.LAVA.display(loc, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
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 +246,17 @@ 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);
|
ParticleEffect.LAVA.display(loc, 0, 0, 0, 0, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +276,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))
|
||||||
{
|
{
|
||||||
|
@ -319,8 +320,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 +348,9 @@ public class LavaFlow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
testBlock.setType(REVERT_MATERIAL);
|
testBlock.setType(REVERT_MATERIAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeOnDelay()
|
public void removeOnDelay()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -366,7 +367,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 +394,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 +408,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 +479,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 +507,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++) {
|
||||||
|
|
|
@ -348,12 +348,6 @@ Abilities:
|
||||||
DoubleLootChance: 40
|
DoubleLootChance: 40
|
||||||
MetalClips:
|
MetalClips:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
LavaSurge:
|
|
||||||
Enabled: true
|
|
||||||
Description: "This ability allows an Earthbender to bend an existing Lava Source to create a large wave that deals damage and knocks back anything in its path. To use, simply tap sneak (Default: Shift) while targeting an earthbendable block. Once a source has been selected, left click to launch the wave off into the direction you are looking. This ability has a small knockback and does a fair amount of damage."
|
|
||||||
Radius: 3
|
|
||||||
HorizontalPush: 0.5
|
|
||||||
VerticalPush: 0.1
|
|
||||||
LavaFlow:
|
LavaFlow:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Description: 'This ability allows an Earthbender to create lava using the Earth
|
Description: 'This ability allows an Earthbender to create lava using the Earth
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: ProjectKorra
|
name: ProjectKorra
|
||||||
author: ProjectKorra
|
author: ProjectKorra
|
||||||
version: 1.5.0
|
version: 1.5.1
|
||||||
main: com.projectkorra.ProjectKorra.ProjectKorra
|
main: com.projectkorra.ProjectKorra.ProjectKorra
|
||||||
softdepend: [PreciousStones, WorldGuard, WorldEdit, Factions, MassiveCore, GriefPrevention, Towny, TagAPI, NoCheatPlus, LWC]
|
softdepend: [PreciousStones, WorldGuard, WorldEdit, Factions, MassiveCore, GriefPrevention, Towny, TagAPI, NoCheatPlus, LWC]
|
||||||
commands:
|
commands:
|
||||||
|
|
Loading…
Reference in a new issue