Skip to content

Commit

Permalink
Dungeon Score
Browse files Browse the repository at this point in the history
Logger Name
  • Loading branch information
kevinthegreat1 committed Feb 13, 2022
1 parent 00c1f17 commit 8d4a4cf
Show file tree
Hide file tree
Showing 12 changed files with 299 additions and 93 deletions.
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Skyblock Mod Fabric

Helpful features for Hypixel Skyblock ([Fabric](https://fabricmc.net/) 1.17.1)
Helpful features for Hypixel Skyblock ([Fabric](https://fabricmc.net/) 1.17+)

##Features

Expand All @@ -12,26 +12,46 @@ Notifies you to reel in
###Dungeon

####Configurable dungeon map

- /sbm map: show current state (on or off)
- /sbm map on/off: turn dungeon map on or off
- /sbm map scale: show current scale
- /sbm map scale \[number]
- /sbm map scale -> show current scale
- /sbm map offset: show current offset
- /sbm map offset \[number] \[number]
- /sbm map offset -> show current offset


####Dungeon Score

- send 300 score in chat
- /sbm score: show current state (on or off)
- /sbm score on/off: turn dungeon score on or off
- /sbm score \[message before] "\[score]" \[message after]
- Ex: /sbm score \[score] score: 300 score

####Livid color

- send livid color in chat
- /sbm livid: show current state (on or off)
- /sbm livid on/off: turn livid color on or off
- /sbm livid \[message before] "\[color]" \[message after]
- Ex: /sbm livid \[color] is sus -> red is sus
- Ex: /sbm livid \[color] is sus: red is sus

###Party

- /pa \[Player\] -> /p accept \[Player\]
- /pv -> /p leave
- /pd -> /p disband

####Reparty

- /pr, /rp -> Reparty: disbands the party and invites everyone back
- Auto join reparty
- /sbm reparty: show current state (on or off)
- /sbm reparty on/off: turn reparty on or off

###Warp

- /sk, /sky -> /skyblock
- /i -> /is
- /h, /hu -> /hub
Expand Down Expand Up @@ -63,20 +83,26 @@ Notifies you to reel in
- /howl -> /warp howl

###Chat

- /ca -> /chat all
- /cp -> /chat party
- /cg -> /chat guild
- /co -> /chat officer
- /cc -> /chat coop

###Message

- /m \[player\] -> /msg \[Player\]

###Visit

- /v \[Player\] -> /visit \[Player\]
- /vp, /visit p -> /visit portalhub

###Misc
- /sbm reload -> reload config file

- /sbm reload: reload config file
- Useful when you accidentally override something

Configuration file is in minecraft run directory
Configuration will be printed to the log if writing to the configuration file fails.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.2

# Mod Properties
mod_version = 1.0.0
mod_version = 1.5.0
maven_group = com.kevinthegreat.skyblockmod
archives_base_name = SkyblockMod

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/kevinthegreat/skyblockmod/SkyblockMod.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
package com.kevinthegreat.skyblockmod;

import com.kevinthegreat.skyblockmod.dungeons.DungeonMap;
import com.kevinthegreat.skyblockmod.dungeons.DungeonScore;
import com.kevinthegreat.skyblockmod.dungeons.LividColor;
import com.kevinthegreat.skyblockmod.dungeons.Reparty;
import com.kevinthegreat.skyblockmod.util.Config;
import com.kevinthegreat.skyblockmod.util.Message;
import com.kevinthegreat.skyblockmod.util.Util;
import net.fabricmc.api.ModInitializer;
import org.apache.logging.log4j.LogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SkyblockMod implements ModInitializer {

public static final String MOD_ID = "skyblockmod";
public static final String MOD_NAME = "SkyblockMod";
public static SkyblockMod skyblockMod;
public final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public int tick = 0;

public final Config config = new Config();
public final Message message = new Message();
public final Util util = new Util();

public final DungeonScore dungeonScore = new DungeonScore();
public final DungeonMap dungeonMap = new DungeonMap();
public final Fishing fishing = new Fishing();
public final LividColor lividColor = new LividColor();
Expand All @@ -30,7 +34,7 @@ public class SkyblockMod implements ModInitializer {
public void onInitialize() {
skyblockMod = this;
config.load();
LogManager.getLogger().info(MOD_NAME + " initialized.");
LOGGER.info(MOD_NAME + " initialized.");
}

public void tick() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

//from skyfabric
public class DungeonMap {
public boolean on = true;
public float mapScale = 1;
public int mapOffsetx = 0;
public int mapOffsety = 0;

public DungeonMap() {
HudRenderCallback.EVENT.register((matrixStack, tickDelta) -> {
if (SkyblockMod.skyblockMod.util.catacombs) {
if (on && SkyblockMod.skyblockMod.util.catacombs) {
MinecraftClient minecraftClient = MinecraftClient.getInstance();
if (minecraftClient == null || minecraftClient.player == null || minecraftClient.world == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.kevinthegreat.skyblockmod.dungeons;

import com.kevinthegreat.skyblockmod.SkyblockMod;

public class DungeonScore {
public boolean on270 = true;
public String text270 = "270 score";
private long last270 = 0;
public boolean on300 = true;
public String text300 = "300 score";
private long last300 = 0;

public boolean onChatMessage(String message) {
if (on270 && SkyblockMod.skyblockMod.util.catacombs && (message.endsWith("Skytils > 270 score") || message.endsWith("270 Score Reached!")) && last270 + 2000 < System.currentTimeMillis()) {
SkyblockMod.skyblockMod.message.sendMessage(text270);
last270 = System.currentTimeMillis();
return true;
}
if (on300 && SkyblockMod.skyblockMod.util.catacombs && (message.endsWith("Skytils > 300 score") || message.endsWith("300 Score Reached!")) && last300 + 2000 < System.currentTimeMillis()) {
SkyblockMod.skyblockMod.message.sendMessage(text300);
last300 = System.currentTimeMillis();
return true;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.util.math.BlockPos;

public class LividColor {
public boolean on = true;
public String[] text = {"", ""};
private int ticks = 0;

Expand All @@ -15,7 +16,7 @@ public void start() {
}

public void tick() {
if (SkyblockMod.skyblockMod.util.catacombs && MinecraftClient.getInstance().world != null) {
if (on && SkyblockMod.skyblockMod.util.catacombs && MinecraftClient.getInstance().world != null) {
if (ticks == 1) {
SkyblockMod.skyblockMod.message.sendMessage(text[0] + "red" + text[1]);
ticks = 0;
Expand Down
94 changes: 52 additions & 42 deletions src/main/java/com/kevinthegreat/skyblockmod/dungeons/Reparty.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.List;

public class Reparty {
public boolean on = true;
private boolean reparty = false;
private int memberCount = 0;
private final List<String> members = new ArrayList<>();
Expand All @@ -17,54 +18,63 @@ public void start(){
reparty = true;
}

public void onChatMessage(String message) {
if (reparty) {
if (message.startsWith("Party Members (")) {
memberCount = Integer.parseInt(message.substring(15, message.length() - 1)) - 1;
if (memberCount == 0) {
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(Text.of("The Party is empty."));
reparty = false;
}
} else if (message.startsWith("Party Leader")) {
String[] messageContents = message.split(" ");
MinecraftClient minecraftClient = MinecraftClient.getInstance();
assert minecraftClient.player != null;
if (!messageContents[2].equals(minecraftClient.player.getEntityName()) && !messageContents[3].equals(minecraftClient.player.getEntityName())) {
minecraftClient.inGameHud.getChatHud().addMessage(Text.of("You are not the party leader."));
public boolean onChatMessage(String message) {
if(on && SkyblockMod.skyblockMod.util.hypixel) {
if (reparty) {
if (message.startsWith("Party Members (")) {
memberCount = Integer.parseInt(message.substring(15, message.length() - 1)) - 1;
if (memberCount == 0) {
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(Text.of("The Party is empty."));
reparty = false;
}
return true;
} else if (message.startsWith("Party Leader")) {
String[] messageContents = message.split(" ");
MinecraftClient minecraftClient = MinecraftClient.getInstance();
assert minecraftClient.player != null;
if (!messageContents[2].equals(minecraftClient.player.getEntityName()) && !messageContents[3].equals(minecraftClient.player.getEntityName())) {
minecraftClient.inGameHud.getChatHud().addMessage(Text.of("You are not the party leader."));
reparty = false;
}
return true;
} else if (message.startsWith("Party M")) {
String[] messageContents = message.split(" ");
for (int i = 2; i < messageContents.length - 1; i++) {
if (!messageContents[i].contains("[") && !messageContents[i].contains("●")) {
members.add(messageContents[i]);
i++;
}
}
if (members.size() == memberCount) {
SkyblockMod.skyblockMod.message.queueMessage("/p disband", 4);
for (String player : members) {
SkyblockMod.skyblockMod.message.queueMessage("/p invite " + player, 6);
}
members.clear();
reparty = false;
}
return true;
} else if (message.startsWith("You are not currently in a party.")) {
reparty = false;
return true;
}
} else if (message.startsWith("Party M")) {
} else if (message.endsWith("has disbanded the party!")) {
String[] messageContents = message.split(" ");
for (int i = 2; i < messageContents.length - 1; i++) {
if (!messageContents[i].contains("[") && !messageContents[i].contains("●")) {
members.add(messageContents[i]);
i++;
}
if (messageContents[0].contains("[")) {
leader = messageContents[1];
} else {
leader = messageContents[0];
}
if (members.size() == memberCount) {
SkyblockMod.skyblockMod.message.queueMessage("/p disband", 4);
for (String player : members) {
SkyblockMod.skyblockMod.message.queueMessage("/p invite " + player, 6);
}
members.clear();
reparty = false;
return true;
} else if (!leader.isEmpty() && message.contains(leader + " has invited you to join their party!")) {
assert MinecraftClient.getInstance().player != null;
if (!leader.equals(MinecraftClient.getInstance().player.getEntityName())) {
SkyblockMod.skyblockMod.message.sendMessage("/p accept " + leader);
leader = "";
}
} else if (message.startsWith("You are not currently in a party.")) {
reparty = false;
}
} else if (message.endsWith("has disbanded the party!")) {
String[] messageContents = message.split(" ");
if (messageContents[0].contains("[")) {
leader = messageContents[1];
} else {
leader = messageContents[0];
}
} else if (!leader.isEmpty() && message.contains(leader + " has invited you to join their party!")) {
assert MinecraftClient.getInstance().player != null;
if (!leader.equals(MinecraftClient.getInstance().player.getEntityName())) {
SkyblockMod.skyblockMod.message.sendMessage("/p accept " + leader);
leader = "";
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ public class ChatHudListenerMixin {
@Inject(method = "onChatMessage(Lnet/minecraft/network/MessageType;Lnet/minecraft/text/Text;Ljava/util/UUID;)V", at = @At(value = "HEAD"))
private void onChatMessage(MessageType messageType, Text text, UUID sender, CallbackInfo ci) {
String message = text.getString();
if(message.equals("[BOSS] Livid: I respect you for making it to here, but I'll be your undoing.")){
if(SkyblockMod.skyblockMod.lividColor.on && message.equals("[BOSS] Livid: I respect you for making it to here, but I'll be your undoing.")){
SkyblockMod.skyblockMod.lividColor.start();
return;
}
if(SkyblockMod.skyblockMod.reparty.onChatMessage(message)){
return;
}
if(SkyblockMod.skyblockMod.dungeonScore.onChatMessage(message)){
return;
}
SkyblockMod.skyblockMod.reparty.onChatMessage(message);
}
}
Loading

0 comments on commit 8d4a4cf

Please sign in to comment.