-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit v5: DiscordRPC and rewrote MixinGuiScreen.java
- Loading branch information
Snoworange420
committed
Feb 24, 2023
1 parent
8237cbe
commit 4e356db
Showing
27 changed files
with
216 additions
and
351 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 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
77 changes: 77 additions & 0 deletions
77
src/main/java/nl/snoworange/cranberry/features/module/modules/misc/DiscordRPC.java
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,77 @@ | ||
package nl.snoworange.cranberry.features.module.modules.misc; | ||
|
||
import nl.snoworange.cranberry.features.module.Category; | ||
import nl.snoworange.cranberry.features.module.Module; | ||
import nl.snoworange.cranberry.features.setting.Setting; | ||
import nl.snoworange.cranberry.misc.java.discord.Discord; | ||
import nl.snoworange.cranberry.util.FileUtils; | ||
import nl.snoworange.cranberry.util.minecraft.ChatUtils; | ||
|
||
import java.io.File; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.util.List; | ||
|
||
public class DiscordRPC extends Module { | ||
|
||
private static DiscordRPC instance; | ||
|
||
public DiscordRPC() { | ||
super("DiscordRPC", | ||
"shows in discord you're playing on Cranberry", | ||
Category.MISC | ||
); | ||
|
||
instance = this; | ||
} | ||
|
||
public static DiscordRPC getInstance() { | ||
return instance != null ? instance : new DiscordRPC(); | ||
} | ||
|
||
public static String rptext = "Enjoying $clientname$ $version$"; | ||
|
||
@Override | ||
public void onEnable() { | ||
super.onEnable(); | ||
|
||
loadRPCText(); | ||
Discord.startRPC(); | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
super.onDisable(); | ||
Discord.stopRPC(); | ||
} | ||
|
||
public void loadRPCText() { | ||
try { | ||
File file = new File(FileUtils.cranberry, "discordrpc.txt"); | ||
|
||
if (!file.exists()) { | ||
file.createNewFile(); | ||
|
||
if (!n()) { | ||
ChatUtils.sendMessage("No discordrpc.txt found in Cranberry folder! Creating one..."); | ||
return; | ||
} | ||
} | ||
|
||
FileReader fileReader = new FileReader(file); | ||
List<String> linezz = Files.readAllLines(file.toPath()); | ||
|
||
if (linezz.size() <= 0) { | ||
ChatUtils.sendMessage("Empty discordrpc.txt found in Cranberry folder!"); | ||
} else { | ||
rptext = linezz.get(0); | ||
} | ||
|
||
fileReader.close(); | ||
|
||
} catch (IOException ioException) { | ||
ioException.printStackTrace(); | ||
} | ||
} | ||
} |
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
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
38 changes: 0 additions & 38 deletions
38
src/main/java/nl/snoworange/cranberry/misc/java/animal/Animal.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
src/main/java/nl/snoworange/cranberry/misc/java/animal/AnimalManager.java
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
src/main/java/nl/snoworange/cranberry/misc/java/animal/AnimalUtils.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.