MCPcopy Index your code
hub / github.com/PaperMC/Paper / deserialize

Method deserialize

paper-api/src/main/java/org/bukkit/Location.java:1214–1233  ·  view source on GitHub ↗

Required method for deserialization @param args map to deserialize @return deserialized location @throws IllegalArgumentException if the world don't exists @see ConfigurationSerializable

(@NotNull Map<String, Object> args)

Source from the content-addressed store, hash-verified

1212 * @see ConfigurationSerializable
1213 */
1214 @NotNull
1215 public static Location deserialize(@NotNull Map<String, Object> args) {
1216 World world = null;
1217 boolean requiresWorld = false;
1218 if (args.containsKey("world")) {
1219 world = Bukkit.getWorld((String) args.get("world"));
1220 requiresWorld = true;
1221 }
1222 if (args.containsKey("world_key")) {
1223 NamespacedKey key = NamespacedKey.fromString((String) args.get("world_key"));
1224 world = key == null ? null : Bukkit.getWorld(key);
1225 requiresWorld = true;
1226 }
1227
1228 if (requiresWorld && world == null) {
1229 throw new IllegalArgumentException("unknown world");
1230 }
1231
1232 return new Location(world, NumberConversions.toDouble(args.get("x")), NumberConversions.toDouble(args.get("y")), NumberConversions.toDouble(args.get("z")), NumberConversions.toFloat(args.get("yaw")), NumberConversions.toFloat(args.get("pitch")));
1233 }
1234
1235 /**
1236 * Normalizes the given yaw angle to a value between <code>+/-180</code>

Callers

nothing calls this directly

Calls 6

getWorldMethod · 0.95
fromStringMethod · 0.95
toDoubleMethod · 0.95
toFloatMethod · 0.95
getMethod · 0.65
containsKeyMethod · 0.45

Tested by

no test coverage detected