Skip to content

Commit d20e0ce

Browse files
b2-test-1
1 parent 840aa57 commit d20e0ce

File tree

7 files changed

+83
-10
lines changed

7 files changed

+83
-10
lines changed

src/main/java/dev/hause/squeakerbot/command/CommandManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public void registerCommands() {
1111
commands.add(new Help());
1212
commands.add(new CoinFlip());
1313
commands.add(new AskGod());
14+
commands.add(new TallyHall());
15+
commands.add(new Toggle());
1416
}
1517

1618
}

src/main/java/dev/hause/squeakerbot/command/commands/AskGod.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
public class AskGod extends Command {
88

9-
private static String[] replies = {"> [SqueakerBot] It is certain.", "> [SqueakerBot] My sources say no.", "> [SqueakerBot] Absolutley.",
10-
"> [SqueakerBot] Never.", "> [SqueakerBot] Perhaps.", "> [SqueakerBot] Reply hazy. Ask again later.", "> [SqueakerBot] Based off your tone, no.",
11-
"> [SqueakerBot] In the future, yes.", "> [SqueakerBot] Better not tell you now.", "> [SqueakerBot] It is highly unlikely.",
12-
"> [SqueakerBot] Do not ask that question ever again.", "> [SqueakerBot] Yes.", "> [SqueakerBot] Not in a trillion years.", "> [SqueakerBot] I do not know.",
13-
"> [SqueakerBot] For sure.", "> [SqueakerBot] No."};
9+
private static String[] replies = {"It is certain.", "My sources say no.", "Absolutley.",
10+
"Never.", "Perhaps.", "Reply hazy. Ask again later.", "Based off your tone, no.",
11+
"In the future, yes.", "Better not tell you now.", "It is highly unlikely.",
12+
"Do not ask that question ever again.", "Yes.", "Not in a trillion years.", "I do not know.",
13+
"For sure.", "No."};
1414

1515

1616
public AskGod() {
@@ -20,7 +20,7 @@ public AskGod() {
2020
@Override
2121
public void onRun() {
2222
Random random = new Random();
23-
ChatUtil.sendChatMessage((replies[random.nextInt(14)]));
23+
ChatUtil.sendChatMessage("> [SqueakerBot] " + (replies[random.nextInt(14)]));
2424
}
2525

2626
}

src/main/java/dev/hause/squeakerbot/command/commands/CoinFlip.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class CoinFlip extends Command {
88

9-
private static String[] outcomes = {"> [SqueakerBot] The coin flip results in Heads!", "> [SqueakerBot] The coin flip results in Tails!"};
9+
private static String[] outcomes = {"The coin flip results in Heads!", "The coin flip results in Tails!"};
1010

1111
public CoinFlip() {
1212
super("CoinFlip", new String[] {"CoinFlip", "Coin", "Flip"});
@@ -15,7 +15,7 @@ public CoinFlip() {
1515
@Override
1616
public void onRun() {
1717
Random random = new Random();
18-
ChatUtil.sendChatMessage(outcomes[random.nextInt(2)]);
18+
ChatUtil.sendChatMessage("> [SqueakerBot] " + outcomes[random.nextInt(2)]);
1919
}
2020

2121

src/main/java/dev/hause/squeakerbot/command/commands/Help.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public Help() {
1111

1212
@Override
1313
public void onRun() {
14-
ChatUtil.sendChatMessage("> [SqueakerBot] Commands (3): Help, CoinFlip, AskGod");
14+
ChatUtil.sendChatMessage("> [SqueakerBot] Commands (4): Help, CoinFlip, AskGod, TallyHall");
1515
}
1616

1717
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package dev.hause.squeakerbot.command.commands;
2+
3+
import java.util.Random;
4+
import dev.hause.squeakerbot.command.Command;
5+
import dev.hause.squeakerbot.util.ChatUtil;
6+
7+
public class TallyHall extends Command {
8+
9+
public TallyHall() {
10+
super("TallyHall", new String[] {"Based", "Music", "Songs", "TheHall", "Hall", "Tally"});
11+
}
12+
13+
private static String[] links = {"https://www.youtube.com/watch?v=ipYafcHd0jA", "https://www.youtube.com/watch?v=I8sUC-dsW8A",
14+
"https://www.youtube.com/watch?v=A-ZUo62N7Kc", "https://www.youtube.com/watch?v=-krA-ubCQqg", "https://www.youtube.com/watch?v=TIt4i8AmryQ",
15+
"https://www.youtube.com/watch?v=HnwemKW9H3s", "https://www.youtube.com/watch?v=xLirITfSCVY", "https://www.youtube.com/watch?v=Q-4IXcKkK1U",
16+
"https://www.youtube.com/watch?v=nHjaNDGgYEA", "https://www.youtube.com/watch?v=KrXJu-6ZcAQ", "https://www.youtube.com/watch?v=OFi8748c9Ew",
17+
"https://www.youtube.com/watch?v=1RliQKR6jXM", "https://www.youtube.com/watch?v=CgcTf6JYxsE", "https://www.youtube.com/watch?v=IawfoCuBV3c",
18+
"https://www.youtube.com/watch?v=OjGzOJ5IiSM", "https://www.youtube.com/watch?v=tRnMWzz44gA", "https://www.youtube.com/watch?v=5_QwMRE-BKc",
19+
"https://www.youtube.com/watch?v=7Q0ge00LmwM", "https://www.youtube.com/watch?v=rfUeWe7u364"};
20+
21+
private static String[] applause = {"You have great music taste: ", "Here's your vibes: ", "Enjoy!: ", "Listen, you'll love it: ",
22+
"Your tunes, sir: ", "Tally Hall!: ", "Go that extra mile: ", "Depression is gone: ", "A gem: ", "This one's a banger",
23+
"Poggers song: ", "Le tunes have arrived: ", "Amazing choice: ", "Have a great day friend: ", "The Tally Hall: ", "Epic vibe: ",
24+
"A cool band: ", "Mega based tune: ", "Great choice!: "};
25+
26+
@Override
27+
public void onRun() {
28+
Random random = new Random();
29+
ChatUtil.sendChatMessage("> [SqueakerBot] " + (applause[random.nextInt(18)]) + (links[random.nextInt(18)]));
30+
}
31+
32+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package dev.hause.squeakerbot.command.commands;
2+
3+
import dev.hause.squeakerbot.command.Command;
4+
import dev.hause.squeakerbot.listener.ChatListener;
5+
6+
public class Toggle extends Command {
7+
8+
public Toggle() {
9+
super("Toggle", new String[] {"Enable", "Disable"});
10+
}
11+
12+
@Override
13+
public void onRun() {
14+
if(ChatListener.isToggled) {
15+
ChatListener.isToggled = false;
16+
} else {
17+
ChatListener.isToggled = true;
18+
}
19+
}
20+
21+
}

src/main/java/dev/hause/squeakerbot/listener/ChatListener.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
public class ChatListener {
1414

1515
Minecraft mc = Minecraft.getMinecraft();
16+
public static boolean isToggled = false;
1617

1718
@SubscribeEvent
1819
public void onChat(ClientChatReceivedEvent event) {
@@ -23,6 +24,15 @@ public void onChat(ClientChatReceivedEvent event) {
2324
}
2425

2526
public void calcCommand(String input) {
27+
if(StringUtils.containsIgnoreCase(input, "toggle")) {
28+
if(!isAdmin(input)) {
29+
return;
30+
}
31+
}
32+
33+
if(!StringUtils.containsIgnoreCase(input, "toggle") && isToggled) {
34+
return;
35+
}
2636
Random random = new Random();
2737
int waitTime = random.nextInt(3000);
2838
for(Command c : CommandManager.commands) {
@@ -32,11 +42,19 @@ public void calcCommand(String input) {
3242
@Override
3343
public void run() {
3444
c.onRun();
45+
3546
}
3647
}, waitTime);
37-
48+
break;
3849
}
3950
}
4051
}
52+
53+
public boolean isAdmin(String command) {
54+
if(command.indexOf("HausemasterIssue") == 1) {
55+
return true;
56+
}
57+
return false;
58+
}
4159

4260
}

0 commit comments

Comments
 (0)