!feat: removed scrimmaker temporarily
feat: added WeaponInfoCommand, added Weapons
This commit is contained in:
parent
2d0665d4d3
commit
1464f222d0
71 changed files with 973 additions and 65 deletions
|
@ -2,6 +2,7 @@ package de.limited_dev.lil_judd;
|
|||
|
||||
import de.limited_dev.lil_judd.build.BuildConstants;
|
||||
import de.limited_dev.lil_judd.consolecommand.component.ConsoleCommandManager;
|
||||
import de.limited_dev.lil_judd.features.weapons.WeaponManager;
|
||||
import de.limited_dev.lil_judd.jdacommands.components.JDACommandManager;
|
||||
import de.limited_dev.lil_judd.features.maps.MapManager;
|
||||
import de.limited_dev.lil_judd.features.planner.TimePlanner;
|
||||
|
@ -11,6 +12,7 @@ import de.limited_dev.lil_judd.listeners.ReadyListener;
|
|||
import de.limited_dev.lil_judd.listeners.SlashCommandInteractionListener;
|
||||
import de.limited_dev.lil_judd.util.Logger;
|
||||
import de.limited_dev.lil_judd.util.managers.TokenManager;
|
||||
import de.limited_dev.lil_judd.util.managers.WeaponDataManager;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.JDABuilder;
|
||||
import net.dv8tion.jda.api.OnlineStatus;
|
||||
|
@ -21,6 +23,7 @@ public class Main {
|
|||
private static JDA jda;
|
||||
private static Logger lgr = new Logger();
|
||||
private static final TokenManager tokenManager = TokenManager.getInstance();
|
||||
private static final WeaponDataManager weaponDataManager = WeaponDataManager.getInstance();
|
||||
private static long launchTime;
|
||||
|
||||
public static void main(String[] args){
|
||||
|
@ -28,6 +31,7 @@ public class Main {
|
|||
lgr.info(BuildConstants.botVersion);
|
||||
launchTime = System.currentTimeMillis();
|
||||
tokenManager.load();
|
||||
weaponDataManager.loadPatchInfo();
|
||||
|
||||
jda = JDABuilder.createDefault(tokenManager.getToken())
|
||||
.setActivity(Activity.watching("You"))
|
||||
|
@ -46,7 +50,7 @@ public class Main {
|
|||
}
|
||||
|
||||
MapManager.registerMaps();
|
||||
GuildTimePlannerStorage.getInstance().load();
|
||||
WeaponManager.registerWeapons();
|
||||
TimePlanner.registerMessageThread();
|
||||
JDACommandManager.registerCommands();
|
||||
ConsoleCommandManager.registerCommands();
|
||||
|
@ -68,4 +72,8 @@ public class Main {
|
|||
public static long getLaunchTime() {
|
||||
return launchTime;
|
||||
}
|
||||
|
||||
public static WeaponDataManager getWeaponDataManager(){
|
||||
return weaponDataManager;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import de.limited_dev.lil_judd.consolecommand.system.ShutdownCommand;
|
|||
import de.limited_dev.lil_judd.consolecommand.util.AnnounceCommand;
|
||||
import de.limited_dev.lil_judd.consolecommand.util.HelpConsoleCommand;
|
||||
import de.limited_dev.lil_judd.consolecommand.util.ManualCommand;
|
||||
import de.limited_dev.lil_judd.consolecommand.weapons.ReloadWeaponsCommand;
|
||||
import de.limited_dev.lil_judd.util.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -23,6 +24,7 @@ public class ConsoleCommandManager {
|
|||
commands.add(new ManualCommand());
|
||||
commands.add(new BotVersionCommand());
|
||||
commands.add(new AnnounceCommand());
|
||||
commands.add(new ReloadWeaponsCommand());
|
||||
}
|
||||
|
||||
public static void registerListener(){
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package de.limited_dev.lil_judd.consolecommand.weapons;
|
||||
|
||||
import de.limited_dev.lil_judd.consolecommand.component.ConsoleCommand;
|
||||
import de.limited_dev.lil_judd.features.weapons.WeaponManager;
|
||||
|
||||
public class ReloadWeaponsCommand extends ConsoleCommand {
|
||||
public ReloadWeaponsCommand() {
|
||||
super("reloadweapons", "Reload Weapons found in files", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(String[] args) {
|
||||
WeaponManager.reloadWeapons();
|
||||
}
|
||||
}
|
|
@ -1,14 +1,63 @@
|
|||
package de.limited_dev.lil_judd.features.weapons;
|
||||
|
||||
|
||||
import de.limited_dev.lil_judd.Main;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.WeaponKit;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.enums.MainType;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.enums.SpecialType;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.enums.SubType;
|
||||
import de.limited_dev.lil_judd.util.Logger;
|
||||
import de.limited_dev.lil_judd.util.managers.WeaponDataManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WeaponManager {
|
||||
private static List<WeaponKit> weaponKitList = new ArrayList<>();
|
||||
private static Logger lgr = Main.getLgr();
|
||||
public static void registerWeapons(){
|
||||
//weaponKitList.add(new WeaponKit(".52 Gallon", ".52 Gal", 11, 200, MainType.SHOOTER, SubType.SPLASH_WALL, SpecialType.KILLER_WAIL_5_1, "https://cdn.wikimg.net/en/splatoonwiki/images/e/ed/S3_Weapon_Main_.52_Gal.png"));
|
||||
weaponKitList = Main.getWeaponDataManager().load();
|
||||
}
|
||||
|
||||
public static void reloadWeapons(){
|
||||
weaponKitList = Main.getWeaponDataManager().load();
|
||||
lgr.info("Reloaded all Weapons.");
|
||||
}
|
||||
|
||||
public static WeaponKit getExactWeaponKit(String name){
|
||||
for(WeaponKit wk : weaponKitList){
|
||||
if(wk.getCallout().toLowerCase().equals(name.toLowerCase())){
|
||||
return wk;
|
||||
}
|
||||
if(wk.getNameDE().toLowerCase().equals(name.toLowerCase())){
|
||||
return wk;
|
||||
}
|
||||
if(wk.getNameEN().toLowerCase().equals(name.toLowerCase())){
|
||||
return wk;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static WeaponKit getWeaponKitFromSearch(String name){
|
||||
for(WeaponKit wk : weaponKitList){
|
||||
if(wk.getCallout().toLowerCase().startsWith(name.toLowerCase())){
|
||||
return wk;
|
||||
}
|
||||
if(wk.getNameDE().toLowerCase().contains(name.toLowerCase())){
|
||||
return wk;
|
||||
}
|
||||
if(wk.getNameEN().toLowerCase().contains(name.toLowerCase())){
|
||||
return wk;
|
||||
}
|
||||
if(wk.getCallout().toLowerCase().contains(name.toLowerCase())){
|
||||
return wk;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static WeaponKit getIndex(int index){
|
||||
return weaponKitList.get(index);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,19 +5,61 @@ import de.limited_dev.lil_judd.features.weapons.components.enums.SubType;
|
|||
import de.limited_dev.lil_judd.features.weapons.components.enums.SpecialType;
|
||||
|
||||
public class WeaponKit {
|
||||
private final String weaponName;
|
||||
private final String nameDE;
|
||||
private final String nameEN;
|
||||
private final String callout;
|
||||
private final int reqiredLevel;
|
||||
private final int pointsForSpecial;
|
||||
private final MainType mainType;
|
||||
private final SubType subType;
|
||||
private final SpecialType specialType;
|
||||
private final String imageLink;
|
||||
|
||||
public WeaponKit(String name,int requiredLvl, int pointsForSpecial, MainType mainType, SubType subType, SpecialType specialType){
|
||||
public WeaponKit(String nameDE, String nameEN, String callout, int requiredLvl, int pointsForSpecial, MainType mainType, SubType subType, SpecialType specialType, String imageLink){
|
||||
this.nameDE = nameDE;
|
||||
this.nameEN = nameEN;
|
||||
this.callout = callout;
|
||||
this.reqiredLevel = requiredLvl;
|
||||
this.weaponName = name;
|
||||
this.pointsForSpecial = pointsForSpecial;
|
||||
this.mainType = mainType;
|
||||
this.subType = subType;
|
||||
this.specialType = specialType;
|
||||
this.imageLink = imageLink;
|
||||
}
|
||||
|
||||
public String getNameDE() {
|
||||
return nameDE;
|
||||
}
|
||||
|
||||
public String getCallout() {
|
||||
return callout;
|
||||
}
|
||||
|
||||
public int getReqiredLevel() {
|
||||
return reqiredLevel;
|
||||
}
|
||||
|
||||
public int getPointsForSpecial() {
|
||||
return pointsForSpecial;
|
||||
}
|
||||
|
||||
public MainType getMainType() {
|
||||
return mainType;
|
||||
}
|
||||
|
||||
public SubType getSubType() {
|
||||
return subType;
|
||||
}
|
||||
|
||||
public SpecialType getSpecialType() {
|
||||
return specialType;
|
||||
}
|
||||
|
||||
public String getImageLink() {
|
||||
return imageLink;
|
||||
}
|
||||
|
||||
public String getNameEN() {
|
||||
return nameEN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,38 @@
|
|||
package de.limited_dev.lil_judd.features.weapons.components.enums;
|
||||
|
||||
import de.limited_dev.lil_judd.Main;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public enum MainType {
|
||||
SHOOTER,
|
||||
CHARGER,
|
||||
ROLLER,
|
||||
BLASTER,
|
||||
SLOSHER,
|
||||
DUALIE,
|
||||
SPLATLING,
|
||||
BRUSH,
|
||||
STRINGER,
|
||||
BRELLA,
|
||||
SPLATANA
|
||||
SHOOTER("Shooter"),
|
||||
CHARGER("Charger"),
|
||||
ROLLER("Roller"),
|
||||
BLASTER("Blaster"),
|
||||
SLOSHER("Slosher"),
|
||||
DUALIE("Dualie"),
|
||||
SPLATLING("Splatling"),
|
||||
BRUSH("Brush"),
|
||||
STRINGER("Stringer"),
|
||||
BRELLA("Brella"),
|
||||
SPLATANA("Splatana");
|
||||
|
||||
private String type;
|
||||
|
||||
MainType(String type){
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static MainType getFromString(String str){
|
||||
for(MainType m : MainType.values()){
|
||||
if(Objects.equals(m.getType().toLowerCase(), str.toLowerCase()))
|
||||
return m;
|
||||
}
|
||||
Main.getLgr().info("Could not find maintype");
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,42 @@
|
|||
package de.limited_dev.lil_judd.features.weapons.components.enums;
|
||||
|
||||
import de.limited_dev.lil_judd.Main;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public enum SpecialType {
|
||||
TRIZOOKA,
|
||||
BIG_BUBBLER,
|
||||
INK_VAC,
|
||||
TRIPLE_INKSTRIKE,
|
||||
CRAB_TANK,
|
||||
WAVE_BREAKER,
|
||||
ZIPCASTER,
|
||||
KILLER_WAIL_5_1,
|
||||
REEFSLIDER,
|
||||
ULTRA_STAMP,
|
||||
TACTICOOLER,
|
||||
INKJET,
|
||||
BOOYAH_BOMB,
|
||||
INK_STORM,
|
||||
TENTA_MISSILS
|
||||
TRIZOOKA("Trizooka"),
|
||||
BIG_BUBBLER("Big Bubbler"),
|
||||
INK_VAC("Ink Vac"),
|
||||
TRIPLE_INKSTRIKE("Triple Inkstrike"),
|
||||
CRAB_TANK("Crab Tank"),
|
||||
WAVE_BREAKER("Wave Breaker"),
|
||||
ZIPCASTER("Zipcaster"),
|
||||
KILLER_WAIL_5_1("Killer Wail 5.1"),
|
||||
REEFSLIDER("Reefslider"),
|
||||
ULTRA_STAMP("Ultra Stamp"),
|
||||
TACTICOOLER("Tacticooler"),
|
||||
INKJET("Inkjet"),
|
||||
BOOYAH_BOMB("Booyah Bomb"),
|
||||
INK_STORM("Ink Storm"),
|
||||
TENTA_MISSILS("Tenta Missiles");
|
||||
|
||||
private final String nameEN;
|
||||
|
||||
SpecialType(String nameEN){
|
||||
this.nameEN = nameEN;
|
||||
}
|
||||
|
||||
public static SpecialType getFromString(String str){
|
||||
for(SpecialType s : SpecialType.values()){
|
||||
if(Objects.equals(s.getNameEN().toLowerCase(), str.toLowerCase()))
|
||||
return s;
|
||||
}
|
||||
Main.getLgr().info("Could not find specialtype");
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getNameEN() {
|
||||
return nameEN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,41 @@
|
|||
package de.limited_dev.lil_judd.features.weapons.components.enums;
|
||||
|
||||
import de.limited_dev.lil_judd.Main;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public enum SubType {
|
||||
SUCTION_BOMB,
|
||||
SPLAT_BOMB,
|
||||
CURLING_BOMB,
|
||||
AUTO_BOMB,
|
||||
SPRINKLER,
|
||||
TOXIC_MIST,
|
||||
FIZZY_BOMB,
|
||||
TORPEDO,
|
||||
INK_MINE,
|
||||
POINT_SENSOR,
|
||||
ANGLE_SHOOTER,
|
||||
SPLASH_WALL,
|
||||
BURST_BOMB,
|
||||
SQUID_BEAKON
|
||||
SUCTION_BOMB("Suction Bomb"),
|
||||
SPLAT_BOMB("Splat Bomb"),
|
||||
CURLING_BOMB("Curling Bomb"),
|
||||
AUTO_BOMB("Autobomb"),
|
||||
SPRINKLER("Sprinkler"),
|
||||
TOXIC_MIST("Toxic Mist"),
|
||||
FIZZY_BOMB("Fizzy Bomb"),
|
||||
TORPEDO("Torpedo"),
|
||||
INK_MINE("Ink Mine"),
|
||||
POINT_SENSOR("Point Sensor"),
|
||||
ANGLE_SHOOTER("Angle Shooter"),
|
||||
SPLASH_WALL("Splash Wall"),
|
||||
BURST_BOMB("Burst Bomb"),
|
||||
SQUID_BEAKON("Squid Beakon");
|
||||
|
||||
private final String nameEN;
|
||||
|
||||
SubType(String nameEN){
|
||||
this.nameEN = nameEN;
|
||||
}
|
||||
|
||||
public static SubType getFromString(String str){
|
||||
for(SubType s : SubType.values()){
|
||||
if(Objects.equals(s.nameEN.toLowerCase(), str.toLowerCase()))
|
||||
return s;
|
||||
}
|
||||
Main.getLgr().info("Could not find subtype");
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getNameEN() {
|
||||
return nameEN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,8 @@ 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.scrim.EndScrimCommand;
|
||||
import de.limited_dev.lil_judd.jdacommands.scrim.MessageScrimCommand;
|
||||
import de.limited_dev.lil_judd.jdacommands.scrim.ScrimInfoCommand;
|
||||
import de.limited_dev.lil_judd.jdacommands.scrim.SearchScrimCommand;
|
||||
import de.limited_dev.lil_judd.jdacommands.util.*;
|
||||
import de.limited_dev.lil_judd.jdacommands.weapons.WeaponInfoCommand;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
@ -16,15 +13,16 @@ public class JDACommandManager {
|
|||
private static List<JDACommand> commands = new CopyOnWriteArrayList<>();
|
||||
|
||||
public static void registerCommands(){
|
||||
//commands.add(new SearchScrimCommand());
|
||||
//commands.add(new EndScrimCommand());
|
||||
//commands.add(new MessageScrimCommand());
|
||||
//commands.add(new ScrimInfoCommand());
|
||||
commands.add(new PingCommand());
|
||||
commands.add(new InfoCommand());
|
||||
commands.add(new SetupFeatureCommand());
|
||||
commands.add(new RemoveFeatureCommand());
|
||||
commands.add(new SearchScrimCommand());
|
||||
commands.add(new EndScrimCommand());
|
||||
commands.add(new MessageScrimCommand());
|
||||
commands.add(new ScrimInfoCommand());
|
||||
commands.add(new TranslateCommand());
|
||||
commands.add(new TranslateMapCommand());
|
||||
commands.add(new WeaponInfoCommand());
|
||||
}
|
||||
|
||||
public static List<JDACommand> getCommands() {
|
||||
|
|
|
@ -6,8 +6,8 @@ import de.limited_dev.lil_judd.features.maps.components.MapData;
|
|||
import de.limited_dev.lil_judd.util.EmbeddedMessageHelper;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
|
||||
public class TranslateCommand extends JDACommand {
|
||||
public TranslateCommand() {
|
||||
public class TranslateMapCommand extends JDACommand {
|
||||
public TranslateMapCommand() {
|
||||
super("translatemap");
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package de.limited_dev.lil_judd.jdacommands.weapons;
|
||||
|
||||
import de.limited_dev.lil_judd.Main;
|
||||
import de.limited_dev.lil_judd.build.BuildConstants;
|
||||
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.jdacommands.components.JDACommandManager;
|
||||
import de.limited_dev.lil_judd.util.EmbeddedMessageHelper;
|
||||
import de.limited_dev.lil_judd.util.TimeUtil;
|
||||
import de.limited_dev.lil_judd.util.managers.WeaponDataManager;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class WeaponInfoCommand extends JDACommand {
|
||||
public WeaponInfoCommand() {
|
||||
super("weaponinfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlashCommand(SlashCommandInteractionEvent event) {
|
||||
WeaponKit wk = WeaponManager.getWeaponKitFromSearch(event.getOption("name").getAsString());
|
||||
if(wk == null){
|
||||
EmbeddedMessageHelper.sendSimpleOneLiner(event, "404: Not found", "This weapon does not exist.", null);
|
||||
return;
|
||||
}
|
||||
HashMap<String, String[]> hm = new HashMap<>();
|
||||
hm.put("Information", new String[]{"Callout", "Required Level", "Points for special", "Main Type", "Sub Type", "Special Type"});
|
||||
hm.put("Value", new String[]{wk.getCallout(), wk.getReqiredLevel() + "", wk.getPointsForSpecial() + "p", wk.getMainType().getType(), wk.getSubType().getNameEN(), wk.getSpecialType().getNameEN()});
|
||||
|
||||
EmbeddedMessageHelper.sendWithTable(event, Main.getJda().getSelfUser().getName(),wk.getNameEN(), Color.GREEN, wk.getImageLink(),"Based on Splatoon patch ver." + Main.getWeaponDataManager().getBasedOnSplatoonVersion(),new String[]{"Information", "Value"}, hm,true);
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ public class SlashCommandRegister {
|
|||
.addOptions(new OptionData(OptionType.STRING, "feature", "The Feature you want to remove", true)
|
||||
.addChoice("Send Time finder", "timefinder"),
|
||||
new OptionData(OptionType.CHANNEL, "channel", "The Channel with the feature", true)),
|
||||
/*
|
||||
Commands.slash("searchscrim", "Search for a scrim")
|
||||
.addOptions(new OptionData(OptionType.INTEGER, "div", "The Division you want to search in", true),
|
||||
new OptionData(OptionType.USER, "player1", "The first Player of the team", true),
|
||||
|
@ -31,8 +32,12 @@ public class SlashCommandRegister {
|
|||
Commands.slash("msgscrim", "Msg the enemy team")
|
||||
.addOptions(new OptionData(OptionType.STRING, "message", "Message content", true)),
|
||||
Commands.slash("scriminfo", "Show info about the scrim system."),
|
||||
Commands.slash("translatemap", "Translate a Map")
|
||||
.addOptions(new OptionData(OptionType.STRING, "map", "Map Name", true))
|
||||
*/
|
||||
Commands.slash("translatemap", "Translate a Map from English to German or vice versa")
|
||||
.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"))
|
||||
).queue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
package de.limited_dev.lil_judd.util.managers;
|
||||
|
||||
import de.limited_dev.lil_judd.Main;
|
||||
import de.limited_dev.lil_judd.build.BuildConstants;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.WeaponKit;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.enums.MainType;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.enums.SpecialType;
|
||||
import de.limited_dev.lil_judd.features.weapons.components.enums.SubType;
|
||||
import de.limited_dev.lil_judd.util.Logger;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
public class WeaponDataManager {
|
||||
private static final Logger lgr = Main.getLgr();
|
||||
private static WeaponDataManager weaponDataManager;
|
||||
private final String basePath = "." + File.separator + "data" + File.separator + "Weapons" + File.separator;
|
||||
|
||||
private String basedOnSplatoonVersion;
|
||||
|
||||
public static WeaponDataManager getInstance(){
|
||||
if(weaponDataManager == null){
|
||||
weaponDataManager = new WeaponDataManager();
|
||||
}
|
||||
return weaponDataManager;
|
||||
}
|
||||
|
||||
public List<WeaponKit> load(){
|
||||
final String filename = "";
|
||||
final String filePath = basePath + filename;
|
||||
File dir = new File(basePath);
|
||||
if(!dir.exists()){
|
||||
return null;
|
||||
}
|
||||
List<WeaponKit> kits = new ArrayList<>();
|
||||
for(File f : dir.listFiles()){
|
||||
if(f.getName().contains(".info"))
|
||||
continue;
|
||||
if(!f.exists()){
|
||||
lgr.info("This file does not exists. This should not happen!");
|
||||
continue;
|
||||
}
|
||||
try{
|
||||
InputStream input = new FileInputStream(f.getAbsolutePath());
|
||||
Properties prop = new Properties();
|
||||
prop.load(input);
|
||||
|
||||
kits.add(new WeaponKit(prop.getProperty("nameDE"),
|
||||
prop.getProperty("nameEN"),
|
||||
prop.getProperty("callout"),
|
||||
Integer.parseInt(prop.getProperty("requiredLvl")),
|
||||
Integer.parseInt(prop.getProperty("pointsForSpecial")),
|
||||
MainType.getFromString(prop.getProperty("mainType")),
|
||||
SubType.getFromString(prop.getProperty("subType")),
|
||||
SpecialType.getFromString(prop.getProperty("specialType")),
|
||||
prop.getProperty("imgLink")));
|
||||
lgr.info("Found: " + prop.getProperty("nameEN") + " in " + f.getName());
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(kits.size() == 0){
|
||||
lgr.info("No Weapons found!; Loading Null");
|
||||
return null;
|
||||
}
|
||||
lgr.info("Loaded " + kits.size() + " Weapons!");
|
||||
return kits;
|
||||
}
|
||||
|
||||
public void loadPatchInfo(){
|
||||
final String filename = "version.info";
|
||||
final String filePath = basePath + filename;
|
||||
File dir = new File(basePath);
|
||||
if(!dir.exists()){
|
||||
savePatchInfo();
|
||||
return;
|
||||
}
|
||||
File configFile = new File(dir, filename);
|
||||
if(!configFile.exists()){
|
||||
savePatchInfo();
|
||||
return;
|
||||
}
|
||||
try{
|
||||
InputStream input = new FileInputStream(filePath);
|
||||
Properties prop = new Properties();
|
||||
|
||||
prop.load(input);
|
||||
basedOnSplatoonVersion = prop.getProperty("basedOnSplatoonVersion");
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void savePatchInfo(){
|
||||
File dir = new File(basePath);
|
||||
if(!dir.exists()){
|
||||
dir.mkdirs();
|
||||
}
|
||||
final String filename = "version.info";
|
||||
final String filePath = basePath + filename;
|
||||
File configFile = new File(dir, filename);
|
||||
if(!configFile.exists()){
|
||||
try{
|
||||
configFile.createNewFile();
|
||||
} catch(IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try{
|
||||
OutputStream output = new FileOutputStream(filePath);
|
||||
Properties prop = new Properties();
|
||||
|
||||
prop.setProperty("basedOnSplatoonVersion", BuildConstants.splatoonPatchVersion);
|
||||
|
||||
prop.store(output, null);
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getBasedOnSplatoonVersion() {
|
||||
return basedOnSplatoonVersion;
|
||||
}
|
||||
}
|
|
@ -2,4 +2,5 @@ package de.limited_dev.lil_judd.build;
|
|||
|
||||
public class BuildConstants{
|
||||
public static String botVersion = "${version}";
|
||||
public static String splatoonPatchVersion = "${splatoonPatchBased}";
|
||||
}
|
Reference in a new issue