Package org.sgrewritten.stargate.util
Class LegacyDataHandler
java.lang.Object
org.sgrewritten.stargate.util.LegacyDataHandler
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable String
findConfigKey
(String[] possibleKeys, Map<String, Object> oldConfig) Utility method to find any of the given possible keys in the configstatic org.bukkit.block.BlockFace
getFacing
(double rotation) Gets the facing direction from the given rotationstatic org.bukkit.block.BlockFace
getFacing
(int modX, int modZ) Gets the facing direction from the given x and z valuesstatic UUID
getPlayerUUID
(String ownerString) Gets the UUID from an owner stringstatic org.bukkit.Location
loadLocation
(org.bukkit.World world, String input) Loads a location from the given input stringstatic Set
<PortalFlag> parseFlags
(String[] splitLine) Parses the flags found in a portal file
-
Method Details
-
getFacing
public static org.bukkit.block.BlockFace getFacing(int modX, int modZ) Gets the facing direction from the given x and z values- Parameters:
modX
-The x modifier used in legacy
modZ
-The z modifier used in legacy
- Returns:
The corresponding block face, or null if on a fork without modX, modZ
-
getFacing
public static org.bukkit.block.BlockFace getFacing(double rotation) Gets the facing direction from the given rotation- Parameters:
rotation
-The rotation to get the direction from
- Returns:
The corresponding block face
-
getPlayerUUID
Gets the UUID from an owner stringAn owner string might be a UUID or a username.
- Parameters:
ownerString
-The owner string to get a UUID from
- Returns:
A UUID
-
loadLocation
Loads a location from the given input string- Parameters:
world
-The world the location belongs to
input
-The input string to parse to coordinates
- Returns:
The loaded location
-
parseFlags
Parses the flags found in a portal file- Parameters:
splitLine
-The split portal save line
- Returns:
The parsed flags
-
findConfigKey
@Nullable public static @Nullable String findConfigKey(String[] possibleKeys, Map<String, Object> oldConfig) Utility method to find any of the given possible keys in the config- Parameters:
possibleKeys
-name variations of possible keys
oldConfig
-The config to fetch data from
- Returns:
The key that had a value in the config, or null if none matched
-