Skip to content

Commit 15af617

Browse files
b2-test-2
1 parent d20e0ce commit 15af617

File tree

14 files changed

+102
-34
lines changed

14 files changed

+102
-34
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
1111
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
1212

1313

14-
version = "b1"
14+
version = "b2"
1515
group = "dev.hause" // https://maven.apache.org/guides/mini/guide-naming-conventions.html
1616
archivesBaseName = "squeakerbot"
1717

src/main/java/dev/hause/squeakerbot/SqueakerBot.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public class SqueakerBot
1616
{
1717
public static final String MODID = "squeakerbot";
1818
public static final String NAME = "SqueakerBot";
19-
public static final String VERSION = "b1";
19+
public static final String VERSION = "b2";
2020
public static CommandManager cm = new CommandManager();
21-
public static Logger LOGGER = LogManager.getLogger(SqueakerBot.class);
21+
public static Logger LOGGER = LogManager.getLogger("SqueakerBot");
2222

2323
@EventHandler
2424
public void preInit(FMLPreInitializationEvent event)

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
package dev.hause.squeakerbot.command;
22

3+
import java.lang.annotation.*;
34
import net.minecraft.client.Minecraft;
45

56
public class Command {
6-
7-
String command;
8-
String[] aliases;
7+
98
public Minecraft mc = Minecraft.getMinecraft();
109

11-
public Command(String command, String[] aliases) {
12-
this.command = command;
13-
this.aliases = aliases;
10+
String command = getRegister().name();
11+
String[] aliases = getRegister().aliases();
12+
13+
@Retention(RetentionPolicy.RUNTIME)
14+
@Target(ElementType.TYPE)
15+
public @interface Register {
16+
17+
String name();
18+
19+
String[] aliases();
20+
1421
}
1522

23+
private Register getRegister() {
24+
return getClass().getAnnotation(Register.class);
25+
}
26+
27+
1628
public void onRun() {
1729

1830
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public void registerCommands() {
1313
commands.add(new AskGod());
1414
commands.add(new TallyHall());
1515
commands.add(new Toggle());
16+
commands.add(new About());
17+
commands.add(new Geolocate());
1618
}
1719

1820
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package dev.hause.squeakerbot.command.commands;
2+
3+
import dev.hause.squeakerbot.SqueakerBot;
4+
import dev.hause.squeakerbot.command.Command;
5+
import dev.hause.squeakerbot.util.ChatUtil;
6+
7+
@Command.Register(name = "About", aliases = {"About", "Credits"})
8+
public class About extends Command {
9+
10+
@Override
11+
public void onRun() {
12+
ChatUtil.sendChatMessage("SqueakerBot " + SqueakerBot.VERSION + " by HausemasterIssue. GitHub: https://github.com/HausemasterIssue/SqueakerBot.");
13+
}
14+
15+
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import dev.hause.squeakerbot.command.Command;
55
import dev.hause.squeakerbot.util.ChatUtil;
66

7+
@Command.Register(name = "AskGod", aliases = {"AskGod", "Ask", "God"})
78
public class AskGod extends Command {
89

910
private static String[] replies = {"It is certain.", "My sources say no.", "Absolutley.",
@@ -13,10 +14,6 @@ public class AskGod extends Command {
1314
"For sure.", "No."};
1415

1516

16-
public AskGod() {
17-
super("AskGod", new String[] {"AskGod", "Ask"});
18-
}
19-
2017
@Override
2118
public void onRun() {
2219
Random random = new Random();

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
import dev.hause.squeakerbot.command.Command;
55
import dev.hause.squeakerbot.util.ChatUtil;
66

7+
@Command.Register(name = "CoinFlip", aliases = {"Coin", "Flip", "Tails", "Heads"})
78
public class CoinFlip extends Command {
89

910
private static String[] outcomes = {"The coin flip results in Heads!", "The coin flip results in Tails!"};
1011

11-
public CoinFlip() {
12-
super("CoinFlip", new String[] {"CoinFlip", "Coin", "Flip"});
13-
}
14-
1512
@Override
1613
public void onRun() {
1714
Random random = new Random();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.listener.ChatListener;
6+
import dev.hause.squeakerbot.util.ChatUtil;
7+
import dev.hause.squeakerbot.util.QueryUtil;
8+
9+
@Command.Register(name = "Geolocate", aliases = {"Find", "Locate"})
10+
public class Geolocate extends Command {
11+
12+
private static QueryUtil queryUtil = new QueryUtil();
13+
14+
@Override
15+
public void onRun() {
16+
Random random = new Random();
17+
ChatUtil.sendChatMessage(queryUtil.getQuery(ChatListener.parsedCommand) + "'s exact coordinates are " + "X: " + 1 + (20 - 1) * + random.nextDouble() + " Y: " + + 1 + (20 - 1) * + random.nextDouble());
18+
}
19+
20+
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
import dev.hause.squeakerbot.command.Command;
44
import dev.hause.squeakerbot.util.ChatUtil;
55

6+
@Command.Register(name = "Help", aliases = {"Commands"})
67
public class Help extends Command {
78

8-
public Help() {
9-
super("Help", new String[] {"Help", "Commands"});
10-
}
11-
129
@Override
1310
public void onRun() {
14-
ChatUtil.sendChatMessage("> [SqueakerBot] Commands (4): Help, CoinFlip, AskGod, TallyHall");
11+
ChatUtil.sendChatMessage("> [SqueakerBot] Commands (4): Help, CoinFlip, AskGod, TallyHall, About, Geolocate");
1512
}
1613

1714
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
import dev.hause.squeakerbot.command.Command;
55
import dev.hause.squeakerbot.util.ChatUtil;
66

7+
@Command.Register(name = "TallyHall", aliases = {"Based", "Music", "Songs", "TheHall", "Hall", "Tally"})
78
public class TallyHall extends Command {
89

9-
public TallyHall() {
10-
super("TallyHall", new String[] {"Based", "Music", "Songs", "TheHall", "Hall", "Tally"});
11-
}
12-
1310
private static String[] links = {"https://www.youtube.com/watch?v=ipYafcHd0jA", "https://www.youtube.com/watch?v=I8sUC-dsW8A",
1411
"https://www.youtube.com/watch?v=A-ZUo62N7Kc", "https://www.youtube.com/watch?v=-krA-ubCQqg", "https://www.youtube.com/watch?v=TIt4i8AmryQ",
1512
"https://www.youtube.com/watch?v=HnwemKW9H3s", "https://www.youtube.com/watch?v=xLirITfSCVY", "https://www.youtube.com/watch?v=Q-4IXcKkK1U",

0 commit comments

Comments
 (0)