Skip to content

Commit 61cb3ba

Browse files
committed
[v1.2] fix some dumb bullshit
1 parent bcef669 commit 61cb3ba

File tree

6 files changed

+18
-26
lines changed

6 files changed

+18
-26
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
target

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>online.monkegame</groupId>
88
<artifactId>monkemodmail</artifactId>
9-
<version>1.0</version>
9+
<version>1.2</version>
1010

1111
<properties>
1212
<maven.compiler.source>11</maven.compiler.source>

src/main/java/online/monkegame/monkemodmail/Main.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ public Main() {
2626
@Override
2727
public void onEnable() {
2828

29-
saveDefaultConfig();
29+
if (!getDataFolder().exists()) {
30+
saveDefaultConfig();
31+
}
32+
3033
configuration = getConfig();
3134
getLogger().info("Config loaded!");
3235
getLogger().info(" _ __ __ _ __ __ _ _");

src/main/java/online/monkegame/monkemodmail/commands/ReportCommand.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public ReportCommand(FileConfiguration config, JDA jda, Main plugin) {
5050
@Override
5151
public boolean onCommand(CommandSender s, Command c, String a, String[] args) {
5252
int cooldownTime = co.getInt("command-cooldowns.report-cooldown");
53-
List<String> l = getReasons(co);
53+
List<Object> l = getReasons(co);
5454
if (s instanceof Player && args != null && !s.getName().equals(args[0])) {
5555
MessageChannel ch = j.getTextChannelById(co.getString("discord.logging-channel"));
5656
long secondsLeft = 0;
@@ -108,12 +108,9 @@ public boolean onCommand(CommandSender s, Command c, String a, String[] args) {
108108
}
109109

110110
//gets the report categories from the configuration file
111-
public List<String> getReasons(FileConfiguration conf) {
111+
public List<Object> getReasons(FileConfiguration conf) {
112+
113+
return new ArrayList<>(conf.getList("report-reasons"));
112114

113-
List<String> l = new ArrayList<>();
114-
for (Object r : conf.getList("report-reasons")) {
115-
l.add((String) r);
116-
}
117-
return l;
118115
}
119116
}
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
package online.monkegame.monkemodmail.utils;
22

3-
import net.kyori.adventure.util.HSVLike;
4-
5-
import java.awt.*;
3+
import java.awt.Color;
64

75
public class ColorGenerator {
8-
96
//generates a random color
107
public Color randomColor() {
11-
int r = (int) (Math.random() * 257) - 1;
12-
int g = (int) (Math.random() * 257) - 1;
13-
int b = (int) (Math.random() * 257) - 1;
8+
int r = (int) (Math.random() * 256);
9+
int g = (int) (Math.random() * 256);
10+
int b = (int) (Math.random() * 256);
1411
return new Color(r, g ,b);
1512
}
16-
17-
public HSVLike randomKyoriColor() {
18-
int r = (int) (Math.random() * 257) - 1;
19-
int g = (int) (Math.random() * 257) - 1;
20-
int b = (int) (Math.random() * 257) - 1;
21-
return HSVLike.of(r, g, b);
22-
}
2313
}

src/main/java/online/monkegame/monkemodmail/utils/PlayerboundMessages.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ public PlayerboundMessages(Main plugin) {
2121
}
2222

2323
//sends the report categories and the IDs you can use
24-
public void sendReasons(CommandSender s, List<String> l) {
24+
public void sendReasons(CommandSender s, List<Object> l) {
2525

2626
BukkitScheduler b = Bukkit.getScheduler();
2727
b.runTaskAsynchronously(m, ()-> {
2828
TextComponent c = Component.text()
29-
.content("Valid categories:")
29+
.content("Valid reasons:")
3030
.color(NamedTextColor.RED)
3131
.decoration(TextDecoration.ITALIC, false).build();
3232
s.sendMessage(c);
33-
for (String a : l) {
33+
for (Object a : l) {
3434
s.sendMessage(Component.text((l.indexOf(a) + 1) + ": " + a).decoration(TextDecoration.ITALIC, false).color(NamedTextColor.YELLOW));
3535
}
3636
});

0 commit comments

Comments
 (0)