mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-02-24 03:01:20 +01:00
Save some memory
Remove gson and switch over to json simple to save some memory.
This commit is contained in:
parent
4276af6938
commit
3922fbdf97
29
pom.xml
29
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>at.pcgamingfreaks</groupId>
|
<groupId>at.pcgamingfreaks</groupId>
|
||||||
<artifactId>MinePacks</artifactId>
|
<artifactId>MinePacks</artifactId>
|
||||||
<version>1.2.2</version>
|
<version>1.2.3</version>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>in-project</id>
|
<id>in-project</id>
|
||||||
@ -35,36 +35,9 @@
|
|||||||
<target>1.7</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>2.3</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
|
||||||
<minimizeJar>true</minimizeJar>
|
|
||||||
<artifactSet>
|
|
||||||
<includes>
|
|
||||||
<include>com.google.code.gson:gson</include>
|
|
||||||
</includes>
|
|
||||||
</artifactSet>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>2.3.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
public class UUIDConverter
|
public class UUIDConverter
|
||||||
{
|
{
|
||||||
@ -37,7 +38,7 @@ public static String getNameFromUUID(String uuid)
|
|||||||
URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid.replaceAll("-", ""));
|
URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid.replaceAll("-", ""));
|
||||||
Scanner jsonScanner = new Scanner(url.openConnection().getInputStream(), "UTF-8");
|
Scanner jsonScanner = new Scanner(url.openConnection().getInputStream(), "UTF-8");
|
||||||
String json = jsonScanner.next();
|
String json = jsonScanner.next();
|
||||||
name = (((JsonObject)new JsonParser().parse(json)).get("name")).toString();
|
name = (((JSONObject)new JSONParser().parse(json)).get("name")).toString();
|
||||||
jsonScanner.close();
|
jsonScanner.close();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -60,7 +61,7 @@ public static String getUUIDFromName(String name, boolean onlinemode, boolean wi
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(new URL("https://api.mojang.com/users/profiles/minecraft/" + name).openStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(new URL("https://api.mojang.com/users/profiles/minecraft/" + name).openStream()));
|
||||||
uuid = (((JsonObject)new JsonParser().parse(in)).get("id")).toString().replaceAll("\"", "");
|
uuid = (((JSONObject)new JSONParser().parse(in)).get("id")).toString().replaceAll("\"", "");
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Loading…
Reference in New Issue
Block a user