public class MGUtil
extends java.lang.Object
Constructor and Description |
---|
MGUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
callEvent(MGLibEvent event)
Calls an event, but sends it only to the appropriate plugin.
|
static void |
deleteFolder(java.io.File folder)
Deletes a folder recursively.
|
static Location3D |
fromBukkitLocation(org.bukkit.Location location)
Converts a Bukkit
Location to a Location3D . |
static Location3D |
fromBukkitLocation(org.bukkit.Location location,
boolean copyOrientation)
Converts a Bukkit
Location to a Location3D . |
static org.bukkit.block.Block |
getAttachedSign(org.bukkit.block.Block block)
Retrieves the sign attached to a given block, or null if ones does not
exist.
|
static org.bukkit.World.Environment |
getEnvironment(java.lang.String world)
Determines the environment of the given world based on its folder
structure.
|
static Main |
getPlugin()
Returns the
JavaPlugin instance for MGLib. |
static boolean |
isInteger(java.lang.String s)
Determines whether the provided string can be parsed to an integer.
|
static MGYamlConfiguration |
loadArenaYaml(java.lang.String plugin)
Loads and returns the given plugin's arenas.yml file.
|
static void |
log(java.lang.String message,
java.lang.String prefix,
LogLevel level)
Logs the given message if verbose logging is enabled.
|
static void |
saveArenaYaml(java.lang.String plugin,
org.bukkit.configuration.file.YamlConfiguration y)
Saves the given plugin's arenas.yml file.
|
static org.bukkit.Location |
toBukkitLocation(Location3D location)
Converts a
Location3D to a Bukkit Location . |
static void |
verifyDisablingStatus()
Throws an
UnsupportedOperationException if MGLib is not
disabling. |
public static Main getPlugin()
JavaPlugin
instance for MGLib.
This should not be called from a hooking plugin under any circumstance.
JavaPlugin
instance for MGLib.public static MGYamlConfiguration loadArenaYaml(java.lang.String plugin)
plugin
- The plugin to load the YAML file from.YamlConfiguration
object.public static void saveArenaYaml(java.lang.String plugin, org.bukkit.configuration.file.YamlConfiguration y)
plugin
- the plugin to save the given YamlConfiguration
toy
- the YamlConfiguration
to savepublic static boolean isInteger(java.lang.String s)
s
- the string to checkpublic static void log(java.lang.String message, java.lang.String prefix, LogLevel level)
message
- the message to logprefix
- the prefix to place in front of the message. This will
automatically be placed within bracketslevel
- the level
at which to log the messagepublic static void callEvent(MGLibEvent event)
event
- the event to callpublic static org.bukkit.block.Block getAttachedSign(org.bukkit.block.Block block)
block
- the block to check for an attached signpublic static org.bukkit.World.Environment getEnvironment(java.lang.String world)
world
- the name of the world to determine the environment ofpublic static void deleteFolder(java.io.File folder)
folder
- the folder to deletepublic static void verifyDisablingStatus() throws java.lang.UnsupportedOperationException
UnsupportedOperationException
if MGLib is not
disabling.java.lang.UnsupportedOperationException
- if MGLib is not currently
disablingpublic static Location3D fromBukkitLocation(org.bukkit.Location location)
Location
to a Location3D
.location
- the Location
to convertLocation3D
public static Location3D fromBukkitLocation(org.bukkit.Location location, boolean copyOrientation)
Location
to a Location3D
.location
- the Location
to convertcopyOrientation
- whether the pitch and yaw of location
will be stored in the new Location3D
(defaults to false
if omitted).Location3D
public static org.bukkit.Location toBukkitLocation(Location3D location)
Location3D
to a Bukkit Location
.location
- the Location3D
to convert
(defaults to false
if omitted).Location