Skip to content

Commit

Permalink
update to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
not-coded committed Feb 1, 2024
1 parent 2e44930 commit 58309d1
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NameFabric

![Fabric](https://raw.githubusercontent.com/intergrav/devins-badges/1a0c6742ac5929b4597b417a74a124a30cf3461f/assets/cozy/supported/fabric_vector.svg) ![Minecraft](https://notcoded.needs.rest/r/badge_minecraft_1.16+.svg)
![Fabric](https://raw.githubusercontent.com/intergrav/devins-badges/1a0c6742ac5929b4597b417a74a124a30cf3461f/assets/cozy/supported/fabric_vector.svg) ![Minecraft](https://notcoded.needs.rest/r/badge_minecraft_1.16plus.svg)
---------------------------------------

NameFabric, the mod that shows you public player data like past usernames, current skin, and more using LabyNet's and Mojang's API.
Expand Down
15 changes: 3 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,13 @@ plugins {
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version + "+" + project.minecraft_version
group = project.maven_group

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
jcenter()
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
Expand All @@ -39,7 +30,7 @@ processResources {

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 11
it.options.release = 17
}

java {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.14.21


Expand All @@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx1G
archives_base_name = namefabric

# Dependencies
fabric_version=0.89.0+1.20.2
fabric_version=0.95.4+1.20.4
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private static String identifyCape(@NotNull String url) {
String cape;
for (int i = 0; i < capes.size(); i++){
cape = capes.get(url);
if(cape != null && cape.trim().length() != 0) return cape;
if(cape != null && !cape.trim().isEmpty()) return cape;
}
return "No";
}
Expand Down Expand Up @@ -84,7 +84,7 @@ private static int getCapesUUID(@NotNull FabricClientCommandSource source, @NotN
source.sendError(Text.translatable("command.all.error"));
}
try{
if(capeurl.trim().length() != 0){
if(!capeurl.trim().isEmpty()){
JsonElement result2 = JsonParser.parseString(capeurl);
capeurl = result2.getAsJsonObject().get("textures").getAsJsonObject().get("CAPE").getAsJsonObject().get("url").getAsString();
}
Expand Down Expand Up @@ -145,6 +145,7 @@ public static int getCapesPlayer(FabricClientCommandSource source, @NotNull Stri
capes.put("http://textures.minecraft.net/texture/2e002d5e1758e79ba51d08d92a0f3a95119f2f435ae7704916507b6c565a7da8", "Spade");
capes.put("http://textures.minecraft.net/texture/ca29f5dd9e94fb1748203b92e36b66fda80750c87ebc18d6eafdb0e28cc1d05f", "Translator (Japanese)");
capes.put("http://textures.minecraft.net/texture/f9a76537647989f9a0b6d001e320dac591c359e9e61a31f4ce11c88f207f0ad4", "Vanilla");
capes.put("http://textures.minecraft.net/texture/afd553b39358a24edfe3b8a9a939fa5fa4faa4d9a9c3d6af8eafb377fa05c2bb", "Cherry Blossom");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static int getSkinsUUID(FabricClientCommandSource source, String uuid) {
source.sendError(Text.translatable("command.all.error"));
}
try{
if(skinurl != null && skinurl.trim().length() != 0){
if(skinurl != null && !skinurl.trim().isEmpty()){
JsonElement result2 = JsonParser.parseString(skinurl);
skinurl = result2.getAsJsonObject().get("textures").getAsJsonObject().get("SKIN").getAsJsonObject().get("url").getAsString();
}
Expand All @@ -88,7 +88,7 @@ private static int getSkinsUUID(FabricClientCommandSource source, String uuid) {
String finalSkinurl = skinurl;
Text skinText = Text.literal(finalSkinurl).styled(style -> style
.withUnderline(true)
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.translatable("Click to open the link!")))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("Click to open the link!")))
.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, finalSkinurl))
);
source.sendFeedback(Text.translatable("command.getskin.success", PlayerName, skinText));
Expand All @@ -105,7 +105,7 @@ private static int getSkinsUUID(FabricClientCommandSource source, String uuid) {
}
public static int getSkinsPlayer(FabricClientCommandSource source, String name) {
String uuid = MinecraftAPI.getUUID(name);
if(uuid != null && uuid.trim().length() != 0){
if(uuid != null && !uuid.trim().isEmpty()){
try {
PlayerName = name;
isUsingPlayerName = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc

private static int getNamesUUID(FabricClientCommandSource source, @NotNull String uuid) {
String name = MinecraftAPI.getName(uuid);
if (name != null && name.trim().length() != 0) {
if (name != null && !name.trim().isEmpty()) {
try {
Text uuidText = Text.literal(uuid).styled(style -> style
.withUnderline(true)
Expand All @@ -84,11 +84,11 @@ private static int getNamesUUID(FabricClientCommandSource source, @NotNull Strin

public static int getUuidName(FabricClientCommandSource source, String name) {
String uuid = MinecraftAPI.getUUID(name);
if (uuid != null && uuid.trim().length() != 0) {
if (uuid != null && !uuid.trim().isEmpty()) {
try {
Text uuidText = Text.literal(uuid).styled(style -> style
.withUnderline(true)
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.translatable("Click to copy the uuid!")))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("Click to copy the uuid!")))
.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, uuid))
);
source.sendFeedback(Text.translatable("command.getuuid.name.success", name, uuidText));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private static int getNamesUUID(FabricClientCommandSource source, String uuid) {

public static int getNamesPlayer(FabricClientCommandSource source, String name){
String uuid = MinecraftAPI.getUUID(name);
if(uuid != null && uuid.trim().length() != 0){
if(uuid != null && !uuid.trim().isEmpty()){
try {
isUsingPlayerName = true;
getNamesUUID(source, uuid);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/notcoded/namefabric/utils/MinecraftAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public static String getUUID(String name) {
response = HttpAPI.get(String.format("https://api.mojang.com/users/profiles/minecraft/%s", name));
} catch(Exception ignored) { }

if(response != null && response.trim().length() != 0) {
if(response != null && !response.trim().isEmpty()) {
JsonElement result = JsonParser.parseString(response);

String uuid = result.getAsJsonObject().get("id").getAsString();

if (uuid != null && uuid.trim().length() != 0 && (uuid.length() == 32 || uuid.length() == 36)) {
if (uuid != null && !uuid.trim().isEmpty() && (uuid.length() == 32 || uuid.length() == 36)) {
return uuid;
}
}
Expand All @@ -35,7 +35,7 @@ public static String getName(String uuid){

String name = result.getAsJsonObject().get("name").getAsString();

if (name != null && name.trim().length() != 0) {
if (name != null && !name.trim().isEmpty()) {
return name;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"fabric-command-api-v2": "*",
"fabric-api-base": "*",
"fabric-resource-loader-v0": "*",
"minecraft": ">=1.20.2",
"minecraft": ">=1.20.4",
"java": ">=11"
}
}

0 comments on commit 58309d1

Please sign in to comment.