-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
173 additions
and
623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,7 @@ public enum Key { | |
GET_VISIT_CONVERT, | ||
GET_ALL, | ||
GET_NAME_CONFLICT, | ||
ERR, | ||
TRUE, | ||
FALSE, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package aplini.ipacwhitelist.hook; | ||
|
||
import org.geysermc.geyser.api.GeyserApi; | ||
|
||
import java.util.UUID; | ||
|
||
public class geyser { | ||
|
||
public static boolean isGeyserPlayer(UUID uuid){ | ||
return GeyserApi.api().connectionByUuid(uuid) != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package aplini.ipacwhitelist.utils; | ||
|
||
import aplini.ipacwhitelist.enums.Key; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.Request; | ||
import okhttp3.Response; | ||
|
||
import java.io.IOException; | ||
|
||
import static aplini.ipacwhitelist.IpacWhitelist.plugin; | ||
|
||
public class netReq { | ||
|
||
static public String fetch(String url){ | ||
OkHttpClient.Builder client = new OkHttpClient.Builder(); | ||
Request.Builder request = new Request.Builder() | ||
.url(url); | ||
|
||
try (Response response = client.build().newCall(request.build()).execute()) { | ||
if (!response.isSuccessful()) { | ||
return null; | ||
} | ||
return response.body().string(); | ||
} catch (IOException e) { | ||
plugin.getLogger().warning("[HTTP Client] 无法访问 URL: "+ url); | ||
plugin.getLogger().warning(e.getMessage()); | ||
} | ||
return null; | ||
} | ||
|
||
static public Key isPremiumPlayer(String name, String uuid){ | ||
String data = fetch("https://api.mojang.com/users/profiles/minecraft/"+ name); | ||
if(data == null){ | ||
return Key.ERR; | ||
} | ||
|
||
String uuidProbe = "\"id\" : \""+ uuid.replaceAll("-", "") +"\","; | ||
String nameProbe = "\"name\" : \""+ name +"\""; | ||
|
||
if(data.contains(uuidProbe) && data.contains(nameProbe)){ | ||
return Key.TRUE; | ||
} | ||
return Key.FALSE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.