Implemented MuteCommand, default role is now applied when user joins
This commit is contained in:
parent
cfe7ec22e2
commit
bbd09c7972
9
pom.xml
9
pom.xml
@ -14,6 +14,10 @@
|
|||||||
<name>jcenter-bintray</name>
|
<name>jcenter-bintray</name>
|
||||||
<url>http://jcenter.bintray.com</url>
|
<url>http://jcenter.bintray.com</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>onarandombox</id>
|
||||||
|
<url>http://repo.onarandombox.com/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -67,6 +71,11 @@
|
|||||||
<version>1.4.7</version>
|
<version>1.4.7</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.dumptruckman</groupId>
|
||||||
|
<artifactId>taskmin</artifactId>
|
||||||
|
<version>0.1.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -10,16 +10,18 @@ import io.rixa.bot.user.RixaUser;
|
|||||||
import io.rixa.bot.user.manager.UserManager;
|
import io.rixa.bot.user.manager.UserManager;
|
||||||
import io.rixa.bot.utils.DiscordUtils;
|
import io.rixa.bot.utils.DiscordUtils;
|
||||||
import io.rixa.bot.utils.MessageFactory;
|
import io.rixa.bot.utils.MessageFactory;
|
||||||
import net.dv8tion.jda.core.entities.*;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
|
import net.dv8tion.jda.core.entities.Role;
|
||||||
|
import net.dv8tion.jda.core.entities.TextChannel;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class ConfigCommand extends Command {
|
public class ConfigCommand extends Command {
|
||||||
|
|
||||||
private Pagination pagination;
|
private Pagination pagination;
|
||||||
|
|
||||||
public ConfigCommand(String command, RixaPermission rixaPermission, String description) {
|
public ConfigCommand(String command, RixaPermission rixaPermission, String description) {
|
||||||
super(command, rixaPermission, description);
|
super(command, rixaPermission, description);
|
||||||
|
|
||||||
@ -49,7 +51,8 @@ public class ConfigCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String commandLabel, Guild guild, Member member, TextChannel channel, String[] args) {
|
public void execute(String commandLabel, Guild guild, Member member, TextChannel channel,
|
||||||
|
String[] args) {
|
||||||
RixaGuild rixaGuild = GuildManager.getInstance().getGuild(guild);
|
RixaGuild rixaGuild = GuildManager.getInstance().getGuild(guild);
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
@ -171,13 +174,15 @@ public class ConfigCommand extends Command {
|
|||||||
case "addpermissions":
|
case "addpermissions":
|
||||||
RixaPermission permission = searchPerms(args);
|
RixaPermission permission = searchPerms(args);
|
||||||
if (permission == null) {
|
if (permission == null) {
|
||||||
MessageFactory.create("That permission does not exist!").setColor(member.getColor()).queue(channel);
|
MessageFactory.create("That permission does not exist!").setColor(member.getColor())
|
||||||
|
.queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args[1].equalsIgnoreCase("role")) {
|
if (args[1].equalsIgnoreCase("role")) {
|
||||||
role = DiscordUtils.searchFirstRole(guild, string);
|
role = DiscordUtils.searchFirstRole(guild, string);
|
||||||
if (role == null) {
|
if (role == null) {
|
||||||
MessageFactory.create("That role does not exist!").setColor(member.getColor()).queue(channel);
|
MessageFactory.create("That role does not exist!").setColor(member.getColor())
|
||||||
|
.queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rixaGuild.addPermission(role.getId(), permission);
|
rixaGuild.addPermission(role.getId(), permission);
|
||||||
@ -189,7 +194,8 @@ public class ConfigCommand extends Command {
|
|||||||
if (args[1].equalsIgnoreCase("user")) {
|
if (args[1].equalsIgnoreCase("user")) {
|
||||||
List<Member> targets = DiscordUtils.memberSearch(guild, string, false);
|
List<Member> targets = DiscordUtils.memberSearch(guild, string, false);
|
||||||
if (targets.isEmpty()) {
|
if (targets.isEmpty()) {
|
||||||
MessageFactory.create("Could not find that user!").setColor(member.getColor()).queue(channel);
|
MessageFactory.create("Could not find that user!").setColor(member.getColor())
|
||||||
|
.queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RixaUser targetUser = UserManager.getInstance().getUser(targets.get(0).getUser());
|
RixaUser targetUser = UserManager.getInstance().getUser(targets.get(0).getUser());
|
||||||
@ -199,7 +205,9 @@ public class ConfigCommand extends Command {
|
|||||||
guild.getIconUrl()).setColor(member.getColor()).queue(channel);
|
guild.getIconUrl()).setColor(member.getColor()).queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessageFactory.create("Incorrect Usage! Try " + commandLabel + " addPerm <user/role> <permission>!").setColor(member.getColor())
|
MessageFactory
|
||||||
|
.create("Incorrect Usage! Try " + commandLabel + " addPerm <user/role> <permission>!")
|
||||||
|
.setColor(member.getColor())
|
||||||
.queue(channel);
|
.queue(channel);
|
||||||
break;
|
break;
|
||||||
case "removeperm":
|
case "removeperm":
|
||||||
@ -208,13 +216,15 @@ public class ConfigCommand extends Command {
|
|||||||
case "removeperms":
|
case "removeperms":
|
||||||
permission = searchPerms(args);
|
permission = searchPerms(args);
|
||||||
if (permission == null) {
|
if (permission == null) {
|
||||||
MessageFactory.create("That permission does not exist!").setColor(member.getColor()).queue(channel);
|
MessageFactory.create("That permission does not exist!").setColor(member.getColor())
|
||||||
|
.queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args[1].equalsIgnoreCase("role")) {
|
if (args[1].equalsIgnoreCase("role")) {
|
||||||
role = DiscordUtils.searchFirstRole(guild, string);
|
role = DiscordUtils.searchFirstRole(guild, string);
|
||||||
if (role == null) {
|
if (role == null) {
|
||||||
MessageFactory.create("That role does not exist!").setColor(member.getColor()).queue(channel);
|
MessageFactory.create("That role does not exist!").setColor(member.getColor())
|
||||||
|
.queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rixaGuild.removePermission(role.getId(), permission);
|
rixaGuild.removePermission(role.getId(), permission);
|
||||||
@ -226,7 +236,8 @@ public class ConfigCommand extends Command {
|
|||||||
if (args[1].equalsIgnoreCase("user")) {
|
if (args[1].equalsIgnoreCase("user")) {
|
||||||
List<Member> targets = DiscordUtils.memberSearch(guild, string, false);
|
List<Member> targets = DiscordUtils.memberSearch(guild, string, false);
|
||||||
if (targets.isEmpty()) {
|
if (targets.isEmpty()) {
|
||||||
MessageFactory.create("Could not find that user!").setColor(member.getColor()).queue(channel);
|
MessageFactory.create("Could not find that user!").setColor(member.getColor())
|
||||||
|
.queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RixaUser targetUser = UserManager.getInstance().getUser(targets.get(0).getUser());
|
RixaUser targetUser = UserManager.getInstance().getUser(targets.get(0).getUser());
|
||||||
@ -236,7 +247,9 @@ public class ConfigCommand extends Command {
|
|||||||
guild.getIconUrl()).setColor(member.getColor()).queue(channel);
|
guild.getIconUrl()).setColor(member.getColor()).queue(channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessageFactory.create("Incorrect Usage! Try " + commandLabel + " addPerm <user/role> <permission>!").setColor(member.getColor())
|
MessageFactory
|
||||||
|
.create("Incorrect Usage! Try " + commandLabel + " addPerm <user/role> <permission>!")
|
||||||
|
.setColor(member.getColor())
|
||||||
.queue(channel);
|
.queue(channel);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -255,7 +268,8 @@ public class ConfigCommand extends Command {
|
|||||||
messageFactory.addField(object.split(" ; ")[0].replace("%p", prefix),
|
messageFactory.addField(object.split(" ; ")[0].replace("%p", prefix),
|
||||||
object.split(" ; ")[1], false);
|
object.split(" ; ")[1], false);
|
||||||
});
|
});
|
||||||
messageFactory.footer("Page: (" + page + " / " + (pagination.getMaxPage()) + ")", member.getGuild().getIconUrl())
|
messageFactory.footer("Page: (" + page + " / " + (pagination.getMaxPage()) + ")",
|
||||||
|
member.getGuild().getIconUrl())
|
||||||
.setColor(member.getColor()).selfDestruct(0).send(member.getUser(), success ->
|
.setColor(member.getColor()).selfDestruct(0).send(member.getUser(), success ->
|
||||||
success.addReaction("\u2B05").queue(v -> success.addReaction("\u27A1").queue()));
|
success.addReaction("\u2B05").queue(v -> success.addReaction("\u27A1").queue()));
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,36 @@
|
|||||||
package io.rixa.bot.commands.cmds.moderator;
|
package io.rixa.bot.commands.cmds.moderator;
|
||||||
|
|
||||||
|
import com.dumptruckman.taskmin.Task;
|
||||||
|
import com.dumptruckman.taskmin.TaskManager;
|
||||||
import io.rixa.bot.commands.Command;
|
import io.rixa.bot.commands.Command;
|
||||||
import io.rixa.bot.commands.perms.RixaPermission;
|
import io.rixa.bot.commands.perms.RixaPermission;
|
||||||
|
import io.rixa.bot.guild.RixaGuild;
|
||||||
|
import io.rixa.bot.guild.manager.GuildManager;
|
||||||
import io.rixa.bot.utils.DiscordUtils;
|
import io.rixa.bot.utils.DiscordUtils;
|
||||||
import io.rixa.bot.utils.MessageFactory;
|
import io.rixa.bot.utils.MessageFactory;
|
||||||
import io.rixa.bot.utils.Utils;
|
import io.rixa.bot.utils.Utils;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import net.dv8tion.jda.core.entities.Guild;
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
import net.dv8tion.jda.core.entities.Member;
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
import net.dv8tion.jda.core.entities.TextChannel;
|
import net.dv8tion.jda.core.entities.TextChannel;
|
||||||
|
import net.dv8tion.jda.core.entities.User;
|
||||||
|
|
||||||
public class MuteCommand extends Command {
|
public class MuteCommand extends Command {
|
||||||
|
|
||||||
private RixaPermission rixaPermission;
|
private RixaPermission rixaPermission;
|
||||||
|
private TaskManager taskManager;
|
||||||
|
|
||||||
public MuteCommand(String command, RixaPermission rixaPermission, String description) {
|
public MuteCommand(String command, RixaPermission rixaPermission, String description) {
|
||||||
super(command, rixaPermission, description);
|
super(command, rixaPermission, description);
|
||||||
this.rixaPermission = rixaPermission;
|
this.rixaPermission = rixaPermission;
|
||||||
|
this.taskManager = TaskManager.createBasicTaskManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String commandLabel, Guild guild, Member member, TextChannel channel, String[] args) {
|
public void execute(String commandLabel, Guild guild, Member member, TextChannel channel,
|
||||||
// RixaGuild rixaGuild = GuildManager.getInstance().getGuild(guild);
|
String[] args) {
|
||||||
|
RixaGuild rixaGuild = GuildManager.getInstance().getGuild(guild);
|
||||||
String argumentString = String.join(" ", args);
|
String argumentString = String.join(" ", args);
|
||||||
Object[] objArray = DiscordUtils.memberSearchArray(guild, argumentString, false);
|
Object[] objArray = DiscordUtils.memberSearchArray(guild, argumentString, false);
|
||||||
if (objArray.length == 0) {
|
if (objArray.length == 0) {
|
||||||
@ -40,8 +51,48 @@ public class MuteCommand extends Command {
|
|||||||
}
|
}
|
||||||
String time = args[0].trim();
|
String time = args[0].trim();
|
||||||
argumentString = String.join(" ", args).replaceFirst(time, "");
|
argumentString = String.join(" ", args).replaceFirst(time, "");
|
||||||
|
|
||||||
|
if (argumentString.length() > 255) {
|
||||||
|
MessageFactory.create(
|
||||||
|
"Sorry your `reason` exceeds the maximum character length of 255!")
|
||||||
|
.setColor(member.getColor()).queue(channel);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
long milliseconds = Utils.toMilliSec(time);
|
long milliseconds = Utils.toMilliSec(time);
|
||||||
MessageFactory.create("Duration: " + time + "\nReason: " + argumentString + "\nDuration in Milliseconds: " + milliseconds)
|
String reason = argumentString;
|
||||||
.queue(channel);
|
guild.getController().addRolesToMember(targetMember, rixaGuild.getSettings().getMuteRole())
|
||||||
|
.queue(onSuccess -> MessageFactory.create(String.format(
|
||||||
|
"Temporarily muted %s for %s\n Reason: %s",
|
||||||
|
this.getUser(targetMember.getUser()),
|
||||||
|
this.getTime(milliseconds),
|
||||||
|
reason))
|
||||||
|
.setColor(member.getColor()).setTimestamp().queue(channel),
|
||||||
|
onFailure -> MessageFactory.create(
|
||||||
|
"Could not successfully mute user `" + targetMember.getUser().getName() + "#"
|
||||||
|
+ targetMember.getUser()
|
||||||
|
.getDiscriminator() + "`. Reason: " + onFailure.getMessage())
|
||||||
|
.setColor(member.getColor()).setTimestamp().queue(channel));
|
||||||
|
this.taskManager
|
||||||
|
.addTask(Task.builder(() ->
|
||||||
|
guild.getController()
|
||||||
|
.removeRolesFromMember(targetMember, rixaGuild.getSettings().getMuteRole()).queue())
|
||||||
|
.executeAt(LocalDateTime.now().plus(milliseconds, ChronoUnit.MILLIS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTime(long milliseconds) {
|
||||||
|
long seconds, minutes, hours, days;
|
||||||
|
seconds = milliseconds / 1000;
|
||||||
|
minutes = seconds / 60;
|
||||||
|
seconds = seconds % 60;
|
||||||
|
hours = minutes / 60;
|
||||||
|
days = hours / 24;
|
||||||
|
minutes = minutes % 60;
|
||||||
|
|
||||||
|
return(String.format("%s days, %s hours, %s minutes, %s seconds", days, hours, minutes, seconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUser(User member) {
|
||||||
|
return member.getName() + "#" + member.getDiscriminator();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,6 +27,10 @@ public class UserListener {
|
|||||||
.selfDestruct(0).queue(rixaGuild.getSettings().getGreetings());
|
.selfDestruct(0).queue(rixaGuild.getSettings().getGreetings());
|
||||||
}
|
}
|
||||||
if (!rixaGuild.getSettings().isJoinVerification()) {
|
if (!rixaGuild.getSettings().isJoinVerification()) {
|
||||||
|
if (rixaGuild.getSettings().getDefaultRole() != null) {
|
||||||
|
event.getGuild().getController()
|
||||||
|
.addRolesToMember(event.getMember(), rixaGuild.getSettings().getDefaultRole()).queue();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!rixaGuild.getConfirmationUsers().contains(event.getUser().getId())) {
|
if (!rixaGuild.getConfirmationUsers().contains(event.getUser().getId())) {
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package io.rixa.bot.utils;
|
package io.rixa.bot.utils;
|
||||||
|
|
||||||
import net.dv8tion.jda.core.entities.Guild;
|
|
||||||
import net.dv8tion.jda.core.entities.Member;
|
|
||||||
import net.dv8tion.jda.core.entities.Role;
|
|
||||||
import net.dv8tion.jda.core.entities.VoiceChannel;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
|
import net.dv8tion.jda.core.entities.Role;
|
||||||
|
import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||||
|
|
||||||
public class DiscordUtils {
|
public class DiscordUtils {
|
||||||
|
|
||||||
@ -16,16 +14,20 @@ public class DiscordUtils {
|
|||||||
List<Member> members = new ArrayList<>();
|
List<Member> members = new ArrayList<>();
|
||||||
String finalString = string.toLowerCase();
|
String finalString = string.toLowerCase();
|
||||||
for (Member member : guild.getMembers()) {
|
for (Member member : guild.getMembers()) {
|
||||||
if ((member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator()).contains(finalString)
|
if ((member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator())
|
||||||
|
.contains(finalString)
|
||||||
|| (member.getEffectiveName().toLowerCase().contains(finalString))
|
|| (member.getEffectiveName().toLowerCase().contains(finalString))
|
||||||
|| finalString.contains(member.getUser().getId())
|
|| finalString.contains(member.getUser().getId())
|
||||||
|| finalString.contains(member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator())
|
|| finalString.contains(
|
||||||
|
member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator())
|
||||||
|| finalString.contains(member.getEffectiveName().toLowerCase())
|
|| finalString.contains(member.getEffectiveName().toLowerCase())
|
||||||
|| finalString.contains(member.getUser().getName().toLowerCase())
|
|| finalString.contains(member.getUser().getName().toLowerCase())
|
||||||
|| finalString.equalsIgnoreCase(member.getEffectiveName().toLowerCase())
|
|| finalString.equalsIgnoreCase(member.getEffectiveName().toLowerCase())
|
||||||
|| finalString.equalsIgnoreCase(member.getUser().getName().toLowerCase())) {
|
|| finalString.equalsIgnoreCase(member.getUser().getName().toLowerCase())) {
|
||||||
|
|
||||||
if (!bots && member.getUser().isBot()) continue;
|
if (!bots && member.getUser().isBot()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
members.add(member);
|
members.add(member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +40,8 @@ public class DiscordUtils {
|
|||||||
String finalString = string.toLowerCase().trim();
|
String finalString = string.toLowerCase().trim();
|
||||||
for (Member member : guild.getMembers()) {
|
for (Member member : guild.getMembers()) {
|
||||||
//String nameDescrim = member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator().toLowerCase();
|
//String nameDescrim = member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator().toLowerCase();
|
||||||
if (finalString.contains(member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator())) {
|
if (finalString.contains(
|
||||||
|
member.getUser().getName().toLowerCase() + "#" + member.getUser().getDiscriminator())) {
|
||||||
array[0] = member.getEffectiveName();
|
array[0] = member.getEffectiveName();
|
||||||
array[1] = member;
|
array[1] = member;
|
||||||
break;
|
break;
|
||||||
@ -66,10 +69,12 @@ public class DiscordUtils {
|
|||||||
public static List<Role> roleSearch(Guild guild, String string) {
|
public static List<Role> roleSearch(Guild guild, String string) {
|
||||||
List<Role> roles = new ArrayList<>();
|
List<Role> roles = new ArrayList<>();
|
||||||
guild.getRoles().forEach(role -> {
|
guild.getRoles().forEach(role -> {
|
||||||
if (role.getName().toLowerCase().contains(string.toLowerCase())
|
if (role.getName().equalsIgnoreCase(string)
|
||||||
|
|| role.getName().toLowerCase().contains(string.toLowerCase())
|
||||||
|| string.contains(role.getId())
|
|| string.contains(role.getId())
|
||||||
|| string.toLowerCase().contains(role.getName().toLowerCase()))
|
|| string.toLowerCase().contains(role.getName().toLowerCase())) {
|
||||||
roles.add(role);
|
roles.add(role);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
@ -90,14 +95,14 @@ public class DiscordUtils {
|
|||||||
if (!voiceChannels.isEmpty()) {
|
if (!voiceChannels.isEmpty()) {
|
||||||
return voiceChannels.get(0);
|
return voiceChannels.get(0);
|
||||||
}
|
}
|
||||||
Optional<VoiceChannel> optional = guild.getVoiceChannels().stream().sorted().filter(voiceChannel -> voiceChannel.getId().equalsIgnoreCase(string) ||
|
Optional<VoiceChannel> optional = guild.getVoiceChannels().stream().sorted()
|
||||||
|
.filter(voiceChannel -> voiceChannel.getId().equalsIgnoreCase(string) ||
|
||||||
voiceChannel.getName().equalsIgnoreCase(string) ||
|
voiceChannel.getName().equalsIgnoreCase(string) ||
|
||||||
voiceChannel.getName().contains(string)).findFirst();
|
voiceChannel.getName().contains(string)).findFirst();
|
||||||
return optional.orElse(null);
|
return optional.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int getLevelFromExperience(int xp) {
|
public static int getLevelFromExperience(int xp) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
while (xp >= getNeededXP(level)) {
|
while (xp >= getNeededXP(level)) {
|
||||||
@ -108,7 +113,9 @@ public class DiscordUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Double getNeededXP(double n) {
|
public static Double getNeededXP(double n) {
|
||||||
if (n < 0) return 0.0;
|
if (n < 0) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
return (6 * Math.pow(n, 3) + 119 * n + 100);
|
return (6 * Math.pow(n, 3) + 119 * n + 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user