public class GeneralMethods
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.bukkit.Material[] |
INTERACTABLE_MATERIALS |
static java.lang.Integer[] |
NON_OPAQUE |
Constructor and Description |
---|
GeneralMethods(ProjectKorra plugin) |
Modifier and Type | Method and Description |
---|---|
static boolean |
abilityExists(java.lang.String string)
Checks to see if an AbilityExists.
|
static void |
bindAbility(org.bukkit.entity.Player player,
java.lang.String ability)
Binds a Ability to the hotbar slot that the player is on.
|
static void |
bindAbility(org.bukkit.entity.Player player,
java.lang.String ability,
int slot)
Binds a Ability to a specific hotbar slot.
|
static boolean |
blockAbilities(org.bukkit.entity.Player player,
java.util.List<java.lang.String> abilitiesToBlock,
org.bukkit.Location loc,
double radius)
Cycles through a list of ability names to check if any instances of the
abilities exist at a specific location.
|
static void |
breakBlock(org.bukkit.block.Block block)
Breaks a block and sets it to
AIR . |
static boolean |
canView(org.bukkit.entity.Player player,
java.lang.String ability) |
static void |
createBendingPlayer(java.util.UUID uuid,
java.lang.String player)
Creates a
BendingPlayer with the data from the database. |
static void |
deserializeFile()
Deserializes the configuration file "bendingPlayers.yml" of the old
BendingPlugin and creates a converted.yml ready for conversion.
|
static void |
displayColoredParticle(org.bukkit.Location loc,
ParticleEffect type,
java.lang.String hexVal,
float xOffset,
float yOffset,
float zOffset) |
static void |
displayColoredParticle(org.bukkit.Location loc,
java.lang.String hexVal) |
static void |
displayColoredParticle(org.bukkit.Location loc,
java.lang.String hexVal,
float xOffset,
float yOffset,
float zOffset) |
static void |
displayMovePreview(org.bukkit.entity.Player player,
CoreAbility ability) |
static void |
displayParticleVector(org.bukkit.Location loc,
ParticleEffect type,
float xTrans,
float yTrans,
float zTrans) |
static void |
dropItems(org.bukkit.block.Block block,
java.util.Collection<org.bukkit.inventory.ItemStack> items)
Drops a
Collection<ItemStack> of items on a specified block. |
static java.util.List<org.bukkit.block.Block> |
getBlocksAlongLine(org.bukkit.Location ploc,
org.bukkit.Location tloc,
org.bukkit.World w) |
static java.util.List<org.bukkit.block.Block> |
getBlocksAroundPoint(org.bukkit.Location location,
double radius)
Gets a
List<Blocks> within the specified radius around the
specified location. |
static org.bukkit.block.BlockFace |
getCardinalDirection(org.bukkit.util.Vector vector) |
static java.util.List<org.bukkit.Location> |
getCircle(org.bukkit.Location loc,
int radius,
int height,
boolean hollow,
boolean sphere,
int plusY) |
static java.lang.String |
getCurrentDate() |
static org.bukkit.util.Vector |
getDirection(org.bukkit.Location location,
org.bukkit.Location destination) |
static double |
getDistanceFromLine(org.bukkit.util.Vector line,
org.bukkit.Location pointonline,
org.bukkit.Location point) |
static java.util.Collection<org.bukkit.inventory.ItemStack> |
getDrops(org.bukkit.block.Block block,
org.bukkit.Material type,
byte data,
org.bukkit.inventory.ItemStack breakitem)
Gets a
Collection<ItemStack> of item drops from a single block. |
static java.util.List<org.bukkit.entity.Entity> |
getEntitiesAroundPoint(org.bukkit.Location location,
double radius)
Gets a
List<Entity> of entities around a specified radius from
the specified area |
static long |
getGlobalCooldown() |
static int |
getIntCardinalDirection(org.bukkit.util.Vector vector) |
static org.bukkit.plugin.Plugin |
getItems() |
static java.lang.String |
getLastUsedAbility(org.bukkit.entity.Player player,
boolean checkCombos)
Returns the last ability used by a player.
|
static org.bukkit.Location |
getLeftSide(org.bukkit.Location location,
double distance)
Gets a location with a specified distance away from the left side of a
location.
|
static int |
getMaxPresets(org.bukkit.entity.Player player) |
static org.bukkit.util.Vector |
getOrthogonalVector(org.bukkit.util.Vector axis,
double degrees,
double length) |
static java.util.Collection<org.bukkit.entity.Player> |
getPlayersAroundPoint(org.bukkit.Location location,
double distance) |
static org.bukkit.Location |
getPointOnLine(org.bukkit.Location origin,
org.bukkit.Location target,
double distance) |
static org.bukkit.plugin.Plugin |
getProbending() |
static org.bukkit.Location |
getRightSide(org.bukkit.Location location,
double distance)
Returns a location with a specified distance away from the right side of
a location.
|
static org.bukkit.plugin.Plugin |
getRPG() |
static org.bukkit.plugin.Plugin |
getSpirits() |
static org.bukkit.entity.Entity |
getTargetedEntity(org.bukkit.entity.Player player,
double range) |
static org.bukkit.entity.Entity |
getTargetedEntity(org.bukkit.entity.Player player,
double range,
java.util.List<org.bukkit.entity.Entity> avoid) |
static org.bukkit.Location |
getTargetedLocation(org.bukkit.entity.Player player,
double originselectrange,
java.lang.Integer... nonOpaque2) |
static org.bukkit.Location |
getTargetedLocation(org.bukkit.entity.Player player,
int range) |
static org.bukkit.block.Block |
getTopBlock(org.bukkit.Location loc,
int range) |
static org.bukkit.block.Block |
getTopBlock(org.bukkit.Location loc,
int positiveY,
int negativeY)
Returns the top block based around loc.
|
static boolean |
hasItems() |
static boolean |
hasProbending() |
static boolean |
hasRPG() |
static boolean |
hasSpirits() |
static boolean |
isAdjacentToThreeOrMoreSources(org.bukkit.block.Block block) |
static boolean |
isImportEnabled() |
static boolean |
isInteractable(org.bukkit.block.Block block) |
static boolean |
isObstructed(org.bukkit.Location location1,
org.bukkit.Location location2) |
static boolean |
isRegionProtectedFromBuild(Ability ability,
org.bukkit.Location loc) |
static boolean |
isRegionProtectedFromBuild(org.bukkit.entity.Player player,
org.bukkit.Location loc) |
static boolean |
isRegionProtectedFromBuild(org.bukkit.entity.Player player,
java.lang.String ability,
org.bukkit.Location loc)
isRegionProtectedFromBuild is one of the most server intensive methods in
the plugin.
|
static boolean |
isRegionProtectedFromBuildPostCache(org.bukkit.entity.Player player,
java.lang.String ability,
org.bukkit.Location loc) |
static boolean |
isSolid(org.bukkit.block.Block block) |
static boolean |
isUndead(org.bukkit.entity.Entity entity)
Checks if an entity is Undead
|
static boolean |
isWeapon(org.bukkit.Material mat) |
static void |
loadBendingPlayer(BendingPlayer pl) |
static void |
reloadPlugin(org.bukkit.command.CommandSender sender) |
static void |
removeBlock(org.bukkit.block.Block block) |
static void |
removeUnusableAbilities(java.lang.String player) |
static org.bukkit.util.Vector |
rotateVectorAroundVector(org.bukkit.util.Vector axis,
org.bukkit.util.Vector rotator,
double degrees) |
static org.bukkit.util.Vector |
rotateXZ(org.bukkit.util.Vector vec,
double theta)
Rotates a vector around the Y plane.
|
static void |
runDebug() |
static void |
saveAbility(BendingPlayer bPlayer,
int slot,
java.lang.String ability) |
static void |
saveElements(BendingPlayer bPlayer) |
static void |
savePermaRemoved(BendingPlayer bPlayer) |
static void |
saveSubElements(BendingPlayer bPlayer) |
static void |
setVelocity(org.bukkit.entity.Entity entity,
org.bukkit.util.Vector velocity) |
static org.bukkit.entity.FallingBlock |
spawnFallingBlock(org.bukkit.Location loc,
int type) |
static org.bukkit.entity.FallingBlock |
spawnFallingBlock(org.bukkit.Location loc,
int type,
byte data) |
static org.bukkit.entity.FallingBlock |
spawnFallingBlock(org.bukkit.Location loc,
org.bukkit.Material type) |
static org.bukkit.entity.FallingBlock |
spawnFallingBlock(org.bukkit.Location loc,
org.bukkit.Material type,
byte data) |
static void |
startCacheCleaner(double period) |
static void |
stopBending() |
static void |
stopPlugin() |
static void |
writeToDebug(java.lang.String message) |
public static final java.lang.Integer[] NON_OPAQUE
public static final org.bukkit.Material[] INTERACTABLE_MATERIALS
public GeneralMethods(ProjectKorra plugin)
public static boolean abilityExists(java.lang.String string)
#getAbility(String)
to check if it exists.string
- Ability Namepublic static void bindAbility(org.bukkit.entity.Player player, java.lang.String ability)
player
- The player to bind toability
- The ability name to BindbindAbility(Player, String, int)
public static void bindAbility(org.bukkit.entity.Player player, java.lang.String ability, int slot)
player
- The player to bind toability
- slot
- bindAbility(Player, String)
public static boolean blockAbilities(org.bukkit.entity.Player player, java.util.List<java.lang.String> abilitiesToBlock, org.bukkit.Location loc, double radius)
public static void breakBlock(org.bukkit.block.Block block)
AIR
.block
- The block to breakpublic static boolean canView(org.bukkit.entity.Player player, java.lang.String ability)
public static void createBendingPlayer(java.util.UUID uuid, java.lang.String player)
BendingPlayer
with the data from the database. This
runs when a player logs in.uuid
- The UUID of the playerplayer
- The player namejava.sql.SQLException
public static void deserializeFile()
java.io.IOException
- If the "bendingPlayers.yml" file is not foundpublic static void displayColoredParticle(org.bukkit.Location loc, ParticleEffect type, java.lang.String hexVal, float xOffset, float yOffset, float zOffset)
public static void displayColoredParticle(org.bukkit.Location loc, java.lang.String hexVal)
public static void displayColoredParticle(org.bukkit.Location loc, java.lang.String hexVal, float xOffset, float yOffset, float zOffset)
public static void displayParticleVector(org.bukkit.Location loc, ParticleEffect type, float xTrans, float yTrans, float zTrans)
public static void dropItems(org.bukkit.block.Block block, java.util.Collection<org.bukkit.inventory.ItemStack> items)
Collection<ItemStack>
of items on a specified block.block
- The block to drop items on.items
- The items to drop.public static void displayMovePreview(org.bukkit.entity.Player player, CoreAbility ability)
public static java.util.List<org.bukkit.block.Block> getBlocksAlongLine(org.bukkit.Location ploc, org.bukkit.Location tloc, org.bukkit.World w)
public static java.util.List<org.bukkit.block.Block> getBlocksAroundPoint(org.bukkit.Location location, double radius)
List<Blocks>
within the specified radius around the
specified location.location
- The base locationradius
- The block radius from location to include within the list of
blockspublic static org.bukkit.block.BlockFace getCardinalDirection(org.bukkit.util.Vector vector)
public static java.util.List<org.bukkit.Location> getCircle(org.bukkit.Location loc, int radius, int height, boolean hollow, boolean sphere, int plusY)
public static java.lang.String getCurrentDate()
public static org.bukkit.util.Vector getDirection(org.bukkit.Location location, org.bukkit.Location destination)
public static double getDistanceFromLine(org.bukkit.util.Vector line, org.bukkit.Location pointonline, org.bukkit.Location point)
public static java.util.Collection<org.bukkit.inventory.ItemStack> getDrops(org.bukkit.block.Block block, org.bukkit.Material type, byte data, org.bukkit.inventory.ItemStack breakitem)
Collection<ItemStack>
of item drops from a single block.block
- The single blocktype
- The Material type to change the block intodata
- The block data to change the block intobreakitem
- Unusedpublic static java.util.List<org.bukkit.entity.Entity> getEntitiesAroundPoint(org.bukkit.Location location, double radius)
List<Entity>
of entities around a specified radius from
the specified arealocation
- The base locationradius
- The radius of blocks to look for entities from the locationpublic static long getGlobalCooldown()
public static int getIntCardinalDirection(org.bukkit.util.Vector vector)
public static org.bukkit.plugin.Plugin getItems()
public static java.lang.String getLastUsedAbility(org.bukkit.entity.Player player, boolean checkCombos)
player
- The player to checkpublic static org.bukkit.Location getLeftSide(org.bukkit.Location location, double distance)
location
- The origin locationdistance
- The distance to the leftpublic static int getMaxPresets(org.bukkit.entity.Player player)
public static org.bukkit.util.Vector getOrthogonalVector(org.bukkit.util.Vector axis, double degrees, double length)
public static java.util.Collection<org.bukkit.entity.Player> getPlayersAroundPoint(org.bukkit.Location location, double distance)
public static org.bukkit.Location getPointOnLine(org.bukkit.Location origin, org.bukkit.Location target, double distance)
public static org.bukkit.Location getRightSide(org.bukkit.Location location, double distance)
location
- The origin locationdistance
- The distance to the rightpublic static org.bukkit.plugin.Plugin getProbending()
public static org.bukkit.plugin.Plugin getRPG()
public static org.bukkit.plugin.Plugin getSpirits()
public static org.bukkit.entity.Entity getTargetedEntity(org.bukkit.entity.Player player, double range, java.util.List<org.bukkit.entity.Entity> avoid)
public static org.bukkit.entity.Entity getTargetedEntity(org.bukkit.entity.Player player, double range)
public static org.bukkit.Location getTargetedLocation(org.bukkit.entity.Player player, double originselectrange, java.lang.Integer... nonOpaque2)
public static org.bukkit.Location getTargetedLocation(org.bukkit.entity.Player player, int range)
public static org.bukkit.block.Block getTopBlock(org.bukkit.Location loc, int range)
public static org.bukkit.block.Block getTopBlock(org.bukkit.Location loc, int positiveY, int negativeY)
public static boolean hasItems()
public static boolean hasProbending()
public static boolean hasRPG()
public static boolean hasSpirits()
public static boolean isAdjacentToThreeOrMoreSources(org.bukkit.block.Block block)
public static boolean isImportEnabled()
public static boolean isInteractable(org.bukkit.block.Block block)
public static boolean isObstructed(org.bukkit.Location location1, org.bukkit.Location location2)
public static boolean isRegionProtectedFromBuild(org.bukkit.entity.Player player, java.lang.String ability, org.bukkit.Location loc)
public static boolean isRegionProtectedFromBuild(Ability ability, org.bukkit.Location loc)
public static boolean isRegionProtectedFromBuild(org.bukkit.entity.Player player, org.bukkit.Location loc)
public static boolean isRegionProtectedFromBuildPostCache(org.bukkit.entity.Player player, java.lang.String ability, org.bukkit.Location loc)
public static boolean isSolid(org.bukkit.block.Block block)
public static boolean isUndead(org.bukkit.entity.Entity entity)
public static boolean isWeapon(org.bukkit.Material mat)
public static void loadBendingPlayer(BendingPlayer pl)
public static void reloadPlugin(org.bukkit.command.CommandSender sender)
public static void removeBlock(org.bukkit.block.Block block)
public static void removeUnusableAbilities(java.lang.String player)
public static org.bukkit.util.Vector rotateVectorAroundVector(org.bukkit.util.Vector axis, org.bukkit.util.Vector rotator, double degrees)
public static org.bukkit.util.Vector rotateXZ(org.bukkit.util.Vector vec, double theta)
public static void runDebug()
public static void saveAbility(BendingPlayer bPlayer, int slot, java.lang.String ability)
public static void saveElements(BendingPlayer bPlayer)
public static void saveSubElements(BendingPlayer bPlayer)
public static void savePermaRemoved(BendingPlayer bPlayer)
public static void setVelocity(org.bukkit.entity.Entity entity, org.bukkit.util.Vector velocity)
public static org.bukkit.entity.FallingBlock spawnFallingBlock(org.bukkit.Location loc, int type)
public static org.bukkit.entity.FallingBlock spawnFallingBlock(org.bukkit.Location loc, int type, byte data)
public static org.bukkit.entity.FallingBlock spawnFallingBlock(org.bukkit.Location loc, org.bukkit.Material type)
public static org.bukkit.entity.FallingBlock spawnFallingBlock(org.bukkit.Location loc, org.bukkit.Material type, byte data)
public static void startCacheCleaner(double period)
public static void stopBending()
public static void stopPlugin()
public static void writeToDebug(java.lang.String message)