From b5ad3541b86ade93c77fe13783a1573d18ba550b Mon Sep 17 00:00:00 2001 From: Carm Date: Tue, 7 Jun 2022 18:08:07 +0800 Subject: [PATCH] [skip ci] docs(code): move wrong codes --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 903dcdb..7d18657 100644 --- a/README.md +++ b/README.md @@ -16,23 +16,23 @@ A JSON serialize/deserialize util for bukkit's ConfigurationSerialization. First, we should get the serializer instance or create a new one. ```java - BukkitJSONSerializer serializer=BukkitJSONSerializer.get(); +BukkitJSONSerializer serializer = BukkitJSONSerializer.get(); ``` -Then, we cloud use `BukkitJSONSerializer#serializeToJSON(ConfigurationSerializable)` to serialize a object to JSON. +Then, we cloud use `serializeToJSON(ConfigurationSerializable)` to serialize a object to JSON. ```jave - Location location = new Location(Bukkit.getWorlds().get(0), -100.5, 100, 105.5); - String serialized = BukkitJSONSerializer.serializeToJSON(location); - // serialized -> {"world":"world","x":-100.5,"y":100,"z":105.5,"yaw":0.0,"pitch":0.0} +Location location = new Location(Bukkit.getWorlds().get(0), -100.5, 100, 105.5); +String serialized = BukkitJSONSerializer.serializeToJSON(location); +// -> {"world":"world","x":-100.5,"y":100,"z":105.5,"yaw":0.0,"pitch":0.0} ``` -When we need to read the object, just use `BukkitJSONSerializer#deserializeSON(json,typeClass)` to deserialize the JSON +When we need to read the object, just use `deserializeJSON(json,typeClass)` to deserialize the JSON string. ```java - Location location = serializer.deserializeSON(json, Location.class); - // deserialized -> Location{world=world, x=-100.5, y=100, z=105.5, pitch=0.0, yaw=0.0} +Location location = serializer.deserializeSON(json, Location.class); +// Location{world=world, x=-100.5, y=100, z=105.5, pitch=0.0, yaw=0.0} ``` Or use `BukkitJSONSerializer#deserializeSON(json,typeClass,defaultValue)` if we need a default value. @@ -114,4 +114,4 @@ dependencies { ## Open Source License. -The project using [GNU LESSER GENERAL PUBLIC LICENSE](https://www.gnu.org/licenses/lgpl-3.0.html) . \ No newline at end of file +The project using [GNU LESSER GENERAL PUBLIC LICENSE](https://www.gnu.org/licenses/lgpl-3.0.html) .