feat: added RandomWeaponCommand

This commit is contained in:
limited_dev 2022-11-02 23:15:48 +01:00
parent 1464f222d0
commit b50cc56188
5 changed files with 32 additions and 1 deletions

View file

@ -6,7 +6,7 @@ plugins {
group = "de.limited_dev"
version = "v1.3.0"
var splatoonPatchBased = "1.3.0"
var splatoonPatchBased = "1.4.1"
repositories {
mavenCentral()

View file

@ -60,4 +60,8 @@ public class WeaponManager {
public static WeaponKit getIndex(int index){
return weaponKitList.get(index);
}
public static int getSize(){
return weaponKitList.size();
}
}

View file

@ -3,6 +3,7 @@ package de.limited_dev.lil_judd.jdacommands.components;
import de.limited_dev.lil_judd.jdacommands.management.RemoveFeatureCommand;
import de.limited_dev.lil_judd.jdacommands.management.SetupFeatureCommand;
import de.limited_dev.lil_judd.jdacommands.util.*;
import de.limited_dev.lil_judd.jdacommands.weapons.RandomWeaponCommand;
import de.limited_dev.lil_judd.jdacommands.weapons.WeaponInfoCommand;
import java.util.List;
@ -23,6 +24,7 @@ public class JDACommandManager {
commands.add(new RemoveFeatureCommand());
commands.add(new TranslateMapCommand());
commands.add(new WeaponInfoCommand());
commands.add(new RandomWeaponCommand());
}
public static List<JDACommand> getCommands() {

View file

@ -0,0 +1,23 @@
package de.limited_dev.lil_judd.jdacommands.weapons;
import de.limited_dev.lil_judd.Main;
import de.limited_dev.lil_judd.features.weapons.WeaponManager;
import de.limited_dev.lil_judd.features.weapons.components.WeaponKit;
import de.limited_dev.lil_judd.jdacommands.components.JDACommand;
import de.limited_dev.lil_judd.util.EmbeddedMessageHelper;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import java.awt.*;
import java.util.HashMap;
public class RandomWeaponCommand extends JDACommand {
public RandomWeaponCommand() {
super("randomweapon");
}
@Override
public void onSlashCommand(SlashCommandInteractionEvent event) {
WeaponKit wk = WeaponManager.getIndex((int)(Math.random()*((WeaponManager.getSize() - 1)-0+1)+0));
EmbeddedMessageHelper.sendSimpleOneLiner(event, "Random Weapon", "Your random Weapon is\n**" + wk.getNameEN() + "**", wk.getImageLink());
}
}

View file

@ -37,6 +37,8 @@ public class SlashCommandRegister {
.addOptions(new OptionData(OptionType.STRING, "map", "Map Name", true)),
Commands.slash("weaponinfo", "Get infos about a weapon")
.addOptions(new OptionData(OptionType.STRING, "name", "Weapon name in English or German", true))
.addOptions(new OptionData(OptionType.BOOLEAN, "mobileformatting", "Format the reply for mobile devices")),
Commands.slash("randomweapon", "Get a random weapon")
.addOptions(new OptionData(OptionType.BOOLEAN, "mobileformatting", "Format the reply for mobile devices"))
).queue();
}