Skip to content

Commit

Permalink
fix even more crashes
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio32A <antonio.anzil@gmail.com>
  • Loading branch information
Antonio32A committed Jan 1, 2021
1 parent c3837b1 commit eb25d23
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ apply plugin: "java"
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.github.johnrengelman.shadow"

version = "1.1"
version = "1.2"
group= "tech.antonio32a"
archivesBaseName = "PitPresence"

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tech/antonio32a/pitpresence/PitPresence.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@Mod(modid = PitPresence.MODID, version = PitPresence.VERSION)
public class PitPresence {
public static final String MODID = "pitpresence";
public static final String VERSION = "1.1";
public static final String VERSION = "1.2";
public static final String configLocation = "./config/pitpresence.toml";
public static final Long clientId = 793558849247641642L;

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/tech/antonio32a/pitpresence/utils/PitHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public class PitHandler {
private int tickCounter = 0;
private String pitPanda = "https://pitpanda.rocks/api/players/";
@Getter private Boolean inPit = false;
@Getter private String date;
@Getter private String lobby;
@Getter private String prestige;
@Getter private String level;
@Getter private String neededXP;
@Getter private String gold;
@Getter private String status;
@Getter private String bounty;
@Getter private String streak;
@Getter private String date = "00/00/0000";
@Getter private String lobby = "mega00A";
@Getter private String prestige = "I";
@Getter private String level = "0";
@Getter private String neededXP = "0";
@Getter private String gold = "0g";
@Getter private String status = "Idling";
@Getter private String bounty = "0g";
@Getter private String streak = "0.0";
@Getter private Integer playtime = 0;
@Getter private String xpProgress = "0/0";
@Getter private String goldProgress = "0/0";
Expand Down Expand Up @@ -75,7 +75,7 @@ public void onTick(TickEvent.ClientTickEvent event) {
date = "00/00/0000";
lobby = "mega00A";
prestige = "I";
level = "[0]";
level = "0";
neededXP = "0";
gold = "0g";
status = "Idling";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,28 @@ public static String parseText(String text) {
PitHandler pitHandler = PitPresence.getInstance().getPitHandler();
Minecraft minecraft = Minecraft.getMinecraft();

text = text.replace("${DATE}", pitHandler.getDate())
.replace("${LOBBY}", pitHandler.getLobby())
.replace("${PRESTIGE}", pitHandler.getPrestige())
.replace("${LEVEL}", pitHandler.getLevel())
.replace("${NEEDEDXP}", pitHandler.getNeededXP())
.replace("${GOLD}", pitHandler.getGold())
.replace("${STATUS}", pitHandler.getStatus())
.replace("${BOUNTY}", pitHandler.getBounty())
.replace("${STREAK}", pitHandler.getStreak())
.replace("${NAME}", minecraft.thePlayer.getName())
.replace("${PLAYTIME}", pitHandler.getPlaytime() / 60 + "h")
.replace("${XPPROGRESS}", pitHandler.getXpProgress())
.replace("${GOLDPROGRESS}", pitHandler.getGoldProgress())
.replace("${RENOWNPROGRESS}", pitHandler.getRenownProgress())
.replace("${KDR}", pitHandler.getKdr());
return text;
try {
text = text.replace("${DATE}", pitHandler.getDate())
.replace("${LOBBY}", pitHandler.getLobby())
.replace("${PRESTIGE}", pitHandler.getPrestige())
.replace("${LEVEL}", pitHandler.getLevel())
.replace("${NEEDEDXP}", pitHandler.getNeededXP())
.replace("${GOLD}", pitHandler.getGold())
.replace("${STATUS}", pitHandler.getStatus())
.replace("${BOUNTY}", pitHandler.getBounty())
.replace("${STREAK}", pitHandler.getStreak())
.replace("${NAME}", minecraft.thePlayer.getName())
.replace("${PLAYTIME}", pitHandler.getPlaytime() / 60 + "h")
.replace("${XPPROGRESS}", pitHandler.getXpProgress())
.replace("${GOLDPROGRESS}", pitHandler.getGoldProgress())
.replace("${RENOWNPROGRESS}", pitHandler.getRenownProgress())
.replace("${KDR}", pitHandler.getKdr());
return text;
} catch (NullPointerException error) {
error.printStackTrace();
ChatLib.chat("&cAn error has occurred while parsing the text.");
ChatLib.chat("&cPlease contact Antonio32A for help with the latest log file.");
return text;
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "pitpresence",
"name": "PitPresence",
"description": "Adds a cool Discord Rich Presence for the Hypixel Pit.",
"version": "1.1",
"version": "1.2",
"mcversion": "1.8.9",
"url": "https://github.com/Antonio32A/PitPresence",
"updateUrl": "",
Expand Down

0 comments on commit eb25d23

Please sign in to comment.