Merge branch 'feature/command_config' into develop
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
indicator=1
|
||||||
|
boop=1
|
||||||
|
tony, stark, dontfeelgood, dontfeelsogood=1
|
||||||
|
yeet=1
|
||||||
|
role=1
|
||||||
|
ping=1
|
||||||
|
rating=1
|
||||||
|
roll=1
|
||||||
|
blur=1
|
||||||
|
choose=1
|
||||||
|
poll=1
|
||||||
|
rpstart=1
|
||||||
|
bet=1
|
||||||
|
perish, thenperish=1
|
||||||
|
teey=1
|
||||||
|
stats=1
|
||||||
|
beans=1
|
||||||
|
eightball, 8ball=1
|
||||||
|
vote=1
|
||||||
|
results=1
|
||||||
|
wolfram=1
|
||||||
|
map=1
|
||||||
|
info, about=1
|
||||||
|
givebeans=1
|
||||||
|
c++, g++, cplus, cpp=1
|
||||||
|
work=1
|
||||||
|
showpoll=1
|
||||||
|
rpend=1
|
||||||
|
rpg=1
|
||||||
|
tweet=1
|
||||||
|
java, jdoodle=1
|
||||||
|
help=1
|
||||||
|
buildHelp=1
|
||||||
|
invite=1
|
||||||
|
shutdown=1
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
[ObjectBuilderFactory]
|
||||||
|
indicator=
|
||||||
|
boop=
|
||||||
|
tony, stark, dontfeelgood, dontfeelsogood=
|
||||||
|
yeet=
|
||||||
|
role=
|
||||||
|
ping=
|
||||||
|
rating=
|
||||||
|
roll=
|
||||||
|
blur=
|
||||||
|
choose=
|
||||||
|
poll=
|
||||||
|
rpstart=
|
||||||
|
bet=
|
||||||
|
perish, thenperish=
|
||||||
|
teey=
|
||||||
|
stats=
|
||||||
|
beans=
|
||||||
|
eightball, 8ball=
|
||||||
|
vote=
|
||||||
|
results=
|
||||||
|
wolfram=
|
||||||
|
map=
|
||||||
|
info, about=
|
||||||
|
givebeans=
|
||||||
|
c++, g++, cplus, cpp=
|
||||||
|
work=
|
||||||
|
showpoll=
|
||||||
|
rpend=
|
||||||
|
rpg=
|
||||||
|
tweet=
|
||||||
|
java, jdoodle=
|
||||||
|
help=
|
||||||
|
buildHelp=
|
||||||
|
invite=
|
||||||
|
shutdown=
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
[CommandPollManage]
|
[CommandPollManage]
|
||||||
PollManageInfo='start' will start a new poll with the query of the line you put after, 'choice' will add a choice to the poll, 'stop' will end the poll
|
PollManageInfo='start' will start a new poll with the query of the line you put after, 'choice' will add a choice to the poll, 'stop' will end the poll
|
||||||
PollMangeInfo=
|
|
||||||
|
|
||||||
[CommandBeansShow]
|
[CommandBeansShow]
|
||||||
BeansShowDisplay=You have %s beans!
|
BeansShowDisplay=You have %s beans!
|
||||||
@@ -113,104 +112,66 @@ RPEndInfo=Ends RP in channel and gives you a .txt file!
|
|||||||
RPEndFileOut=Here's your file!
|
RPEndFileOut=Here's your file!
|
||||||
|
|
||||||
[CommandRPG]
|
[CommandRPG]
|
||||||
RPGInfo=Admin+ command only right now - experimental text RPG! Format is !rpg <rpg command="">
|
RPGInfo=Admin+ command only right now - experimental text RPG! Format is !rpg <rpg command>
|
||||||
RPGInvalid=Invalid RPG Command!
|
RPGInvalid=Invalid RPG Command!
|
||||||
|
|
||||||
[CommandBoop]
|
[CommandBoop]
|
||||||
BoopPerson=
|
|
||||||
BoopInfo=
|
|
||||||
BoopMultiple=%s booped several others - %s!
|
|
||||||
BoopPerson=%s booped %s!
|
BoopPerson=%s booped %s!
|
||||||
BoopInfo=Kitty will react with a counter
|
BoopInfo=Kitty will react with a counter
|
||||||
BoopStandard=Woah! %s booped me! That's %s total!
|
BoopStandard=Woah! %s booped me! That's %s total!
|
||||||
BoopStandard=
|
BoopMultiple=%s booped several others - %s!
|
||||||
BoopMultiple=
|
|
||||||
|
|
||||||
[CommandInfo]
|
[CommandInfo]
|
||||||
InfoInfo=Provides author info and a link to Kitty's website
|
|
||||||
InfoResponse=
|
|
||||||
InfoResponse=I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/
|
InfoResponse=I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/
|
||||||
InfoInfo=
|
InfoInfo=Provides author info and a link to Kitty's website
|
||||||
|
|
||||||
[CommandPing]
|
[CommandPing]
|
||||||
PingResponse=Pong!
|
PingResponse=Pong!
|
||||||
PingResponse=
|
|
||||||
PingInfo=Will respond with Pong!
|
PingInfo=Will respond with Pong!
|
||||||
PingInfo=
|
|
||||||
|
|
||||||
[CommandChoose]
|
[CommandChoose]
|
||||||
ChooseChoice=
|
|
||||||
ChooseInfo=With an input of x,y,z where x y and z are all choices, kitty will choose one
|
|
||||||
ChooseOne=I can't choose from *one* thing!
|
|
||||||
ChooseChoice=I chooooooose %s!
|
ChooseChoice=I chooooooose %s!
|
||||||
ChooseOne=
|
ChooseOne=I can't choose from *one* thing!
|
||||||
ChooseInfo=
|
ChooseInfo=With an input of x,y,z where x y and z are all choices, kitty will choose one
|
||||||
|
|
||||||
[CommandEightBall]
|
[CommandEightBall]
|
||||||
EightBallYes9=Yes.
|
|
||||||
EightBallInfo=Answers a yes or no question! Warning: Kitty can not actually tell the future, she claims no responsibility for any lion mauling, lack of lottery wins, or felony charges.
|
|
||||||
EightBallYes10=Signs point to yes.
|
|
||||||
EightBallError=
|
|
||||||
EightBallNo1=Don't count on it.
|
|
||||||
EightBallNo2=My reply is no.
|
|
||||||
EightBallNo3=My sources say no.
|
|
||||||
EightBallNo4=Outlook not so good.
|
|
||||||
EightBallNo5=Very doubtful.
|
|
||||||
EightBallYes9=
|
|
||||||
EightBallYes4=
|
|
||||||
EightBallYes3=
|
|
||||||
EightBallYes2=
|
|
||||||
EightBallYes1=
|
|
||||||
EightBallYes8=
|
|
||||||
EightBallYes7=
|
|
||||||
EightBallError=Hmm? You'll need to ask a question!
|
|
||||||
EightBallYes6=
|
|
||||||
EightBallYes5=
|
|
||||||
EightBallMaybe1=
|
|
||||||
EightBallMaybe2=
|
|
||||||
EightBallMaybe3=
|
|
||||||
EightBallMaybe4=
|
|
||||||
EightBallMaybe5=
|
|
||||||
EightBallInfo=
|
|
||||||
EightBallMaybe2=Ask again later.
|
|
||||||
EightBallNo5=
|
|
||||||
EightBallMaybe3=Better not tell you now.
|
|
||||||
EightBallMaybe4=Cannot predict now.
|
|
||||||
EightBallNo3=
|
|
||||||
EightBallMaybe5=Concentrate and ask again.
|
|
||||||
EightBallNo4=
|
|
||||||
EightBallNo1=
|
|
||||||
EightBallNo2=
|
|
||||||
EightBallYes2=It is decidedly so.
|
|
||||||
EightBallYes1=It is certain.
|
|
||||||
EightBallYes4=Yes - definitely.
|
EightBallYes4=Yes - definitely.
|
||||||
EightBallYes3=Without a doubt.
|
EightBallYes3=Without a doubt.
|
||||||
EightBallYes6=As I see it, yes.
|
EightBallYes2=It is decidedly so.
|
||||||
EightBallYes5=You may rely on it.
|
EightBallYes1=It is certain.
|
||||||
EightBallYes8=Outlook good.
|
EightBallYes8=Outlook good.
|
||||||
EightBallYes7=Most likely.
|
EightBallYes7=Most likely.
|
||||||
|
EightBallYes6=As I see it, yes.
|
||||||
|
EightBallYes5=You may rely on it.
|
||||||
EightBallMaybe1=Reply hazy, try again.
|
EightBallMaybe1=Reply hazy, try again.
|
||||||
EightBallYes10=
|
EightBallMaybe2=Ask again later.
|
||||||
|
EightBallError=Hmm? You'll need to ask a question!
|
||||||
|
EightBallMaybe3=Better not tell you now.
|
||||||
|
EightBallMaybe4=Cannot predict now.
|
||||||
|
EightBallMaybe5=Concentrate and ask again.
|
||||||
|
EightBallInfo=Answers a yes or no question! Warning: Kitty can not actually tell the future, she claims no responsibility for any lion mauling, lack of lottery wins, or felony charges.
|
||||||
|
EightBallNo5=Very doubtful.
|
||||||
|
EightBallNo3=My sources say no.
|
||||||
|
EightBallNo4=Outlook not so good.
|
||||||
|
EightBallNo1=Don't count on it.
|
||||||
|
EightBallNo2=My reply is no.
|
||||||
|
EightBallYes9=Yes.
|
||||||
|
EightBallYes10=Signs point to yes.
|
||||||
|
|
||||||
[CommandInvite]
|
[CommandInvite]
|
||||||
InviteInfo=
|
|
||||||
InviteInfo=Provides a direct invite link for KittyBot
|
InviteInfo=Provides a direct invite link for KittyBot
|
||||||
|
|
||||||
[CommandWolfram]
|
[CommandWolfram]
|
||||||
WolframNoArgs=You need to provide some arguments!
|
|
||||||
WolframError=
|
|
||||||
WolframInfo=Will query wolframalpha with your question and give a full image output of the answer
|
|
||||||
WolframError=Something went wrong!
|
WolframError=Something went wrong!
|
||||||
WolframInfo=
|
WolframInfo=Will query wolframalpha with your question and give a full image output of the answer
|
||||||
WolframNoArgs=
|
WolframNoArgs=You need to provide some arguments!
|
||||||
|
|
||||||
[CommandMap]
|
[CommandMap]
|
||||||
MapInfo=
|
MapInfo=Generates a map! You can pass additional information if you want with the flags `-s<seed>-w<width>-h<height>`. If one of the fields isn't provided, its default will be used. Note that adjusting the width and height impacts the map outcomes.\n\nDefault seed: Random,\nDefault Width: 35(max %s),\nDefault Height: 25(max %s)
|
||||||
MapSeed=Seed
|
MapSeed=Seed
|
||||||
MapInvalid=Invalid arguments provided!
|
MapInvalid=Invalid arguments provided!
|
||||||
MapVersion=Using mapgen v0.1
|
MapVersion=Using mapgen v0.1
|
||||||
MapWidth=Width
|
MapWidth=Width
|
||||||
MapInfo=Generates a map! You can pass additional information if you want with the flags `-s<seed>
|
|
||||||
MapHeight=Height
|
MapHeight=Height
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
public class CommandBeansShow extends Command
|
public class CommandBeansShow extends Command
|
||||||
@@ -9,11 +9,11 @@ public class CommandBeansShow extends Command
|
|||||||
public CommandBeansShow(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandBeansShow(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("BeansShowInfo"); };
|
public String HelpText() { return LocStrings.Stub("BeansShowInfo"); };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
res.Call(String.format(Localizer.Stub("BeansShowDisplay"), user.GetBeans()));
|
res.Call(String.format(LocStrings.Stub("BeansShowDisplay"), user.GetBeans()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package commands;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
public class CommandBetBeans extends Command
|
public class CommandBetBeans extends Command
|
||||||
@@ -11,7 +11,7 @@ public class CommandBetBeans extends Command
|
|||||||
public CommandBetBeans(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandBetBeans(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("BetBeansInfo"); }
|
public String HelpText() { return LocStrings.Stub("BetBeansInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -24,19 +24,19 @@ public class CommandBetBeans extends Command
|
|||||||
bet = Integer.parseInt(input.args);
|
bet = Integer.parseInt(input.args);
|
||||||
if(bet < 50)
|
if(bet < 50)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("BetBeansLowBet"));
|
res.Call(LocStrings.Stub("BetBeansLowBet"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("BetBeansNotValid"));
|
res.Call(LocStrings.Stub("BetBeansNotValid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.GetBeans() < bet)
|
if(user.GetBeans() < bet)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("BetBeansNotEnough"));
|
res.Call(LocStrings.Stub("BetBeansNotEnough"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,12 +51,12 @@ public class CommandBetBeans extends Command
|
|||||||
|
|
||||||
if(win == 0)
|
if(win == 0)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("BetBeansLose"));
|
res.Call(LocStrings.Stub("BetBeansLose"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.ChangeBeans(bet*win);
|
user.ChangeBeans(bet*win);
|
||||||
res.Call(String.format(Localizer.Stub("BetBeansWin"), "" + (bet*win)));
|
res.Call(String.format(LocStrings.Stub("BetBeansWin"), "" + (bet*win)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getWinning(int [] slots)
|
private int getWinning(int [] slots)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import java.io.IOException;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import utils.ImageUtils;
|
import utils.ImageUtils;
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ public class CommandBlurry extends Command
|
|||||||
public CommandBlurry(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandBlurry(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("BlurryInfo"); };
|
public String HelpText() { return LocStrings.Stub("BlurryInfo"); };
|
||||||
|
|
||||||
private static Long num = 0l;
|
private static Long num = 0l;
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class CommandBoop extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("BoopInfo"); }
|
public String HelpText() { return LocStrings.Stub("BoopInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
@@ -69,14 +69,14 @@ public class CommandBoop extends Command
|
|||||||
if(input.mentions == null)
|
if(input.mentions == null)
|
||||||
{
|
{
|
||||||
boopTracker.ApplyBoop();
|
boopTracker.ApplyBoop();
|
||||||
res.Call(String.format(Localizer.Stub("BoopStandard"), user.name, boopTracker.HowMany()));
|
res.Call(String.format(LocStrings.Stub("BoopStandard"), user.name, boopTracker.HowMany()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(input.mentions.length == 1)
|
if(input.mentions.length == 1)
|
||||||
{
|
{
|
||||||
boopTracker.ApplyBoop();
|
boopTracker.ApplyBoop();
|
||||||
res.Call(String.format(Localizer.Stub("BoopPerson"), user.name, input.mentions[0].name));
|
res.Call(String.format(LocStrings.Stub("BoopPerson"), user.name, input.mentions[0].name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public class CommandBoop extends Command
|
|||||||
booped += "and " + input.mentions[i].name;
|
booped += "and " + input.mentions[i].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(String.format(Localizer.Stub("BoopMultiple"), user.name, booped));
|
res.Call(String.format(LocStrings.Stub("BoopMultiple"), user.name, booped));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
public class CommandChangeIndicator extends Command
|
public class CommandChangeIndicator extends Command
|
||||||
@@ -9,7 +9,7 @@ public class CommandChangeIndicator extends Command
|
|||||||
public CommandChangeIndicator(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandChangeIndicator(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("ChangeIndicatorInfo"); }
|
public String HelpText() { return LocStrings.Stub("ChangeIndicatorInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -17,11 +17,11 @@ public class CommandChangeIndicator extends Command
|
|||||||
String arg = input.args.trim();
|
String arg = input.args.trim();
|
||||||
if(arg.length() == 0)
|
if(arg.length() == 0)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("ChangeIndicatorError"));
|
res.Call(LocStrings.Stub("ChangeIndicatorError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
guild.SetCommandIndicator(arg.substring(0, 1));
|
guild.SetCommandIndicator(arg.substring(0, 1));
|
||||||
res.Call(String.format(Localizer.Stub("ChangeIndicatorChanged"), guild.GetCommandIndicator()));
|
res.Call(String.format(LocStrings.Stub("ChangeIndicatorChanged"), guild.GetCommandIndicator()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class CommandChoose extends Command
|
|||||||
public CommandChoose(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandChoose(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("ChooseInfo"); }
|
public String HelpText() { return LocStrings.Stub("ChooseInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -22,10 +22,10 @@ public class CommandChoose extends Command
|
|||||||
String [] choices = input.args.split(",");
|
String [] choices = input.args.split(",");
|
||||||
if(choices.length == 1)
|
if(choices.length == 1)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("ChooseOne"));
|
res.Call(LocStrings.Stub("ChooseOne"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(String.format(Localizer.Stub("ChooseChoice"), (choices[(int) (Math.random()*choices.length)]).toString()));
|
res.Call(String.format(LocStrings.Stub("ChooseChoice"), (choices[(int) (Math.random()*choices.length)]).toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import network.NetworkColiru;
|
import network.NetworkColiru;
|
||||||
|
|
||||||
@@ -12,14 +12,14 @@ public class CommandColiru extends Command
|
|||||||
public CommandColiru(KittyRole level, KittyRating rating) { super(level, rating);}
|
public CommandColiru(KittyRole level, KittyRating rating) { super(level, rating);}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("ColiruInfo"); }
|
public String HelpText() { return LocStrings.Stub("ColiruInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.args.trim().length() < 1)
|
if(input.args.trim().length() < 1)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("ColiruError"));
|
res.Call(LocStrings.Stub("ColiruError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class CommandDoWork extends Command
|
|||||||
public CommandDoWork(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandDoWork(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("DoWorkInfo"); }
|
public String HelpText() { return LocStrings.Stub("DoWorkInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
@@ -28,6 +28,6 @@ public class CommandDoWork extends Command
|
|||||||
thispieceofshit += Math.log((double)i);
|
thispieceofshit += Math.log((double)i);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(Localizer.Stub("DoWorkFinished"));
|
res.Call(LocStrings.Stub("DoWorkFinished"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,47 +1,47 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
public class CommandEightBall extends Command
|
public class CommandEightBall extends Command
|
||||||
{
|
{
|
||||||
String [] answers =
|
String [] answers =
|
||||||
{
|
{
|
||||||
Localizer.Stub("EightBallYes1")
|
LocStrings.Stub("EightBallYes1")
|
||||||
, Localizer.Stub("EightBallYes2")
|
, LocStrings.Stub("EightBallYes2")
|
||||||
, Localizer.Stub("EightBallYes3")
|
, LocStrings.Stub("EightBallYes3")
|
||||||
, Localizer.Stub("EightBallYes4")
|
, LocStrings.Stub("EightBallYes4")
|
||||||
, Localizer.Stub("EightBallYes5")
|
, LocStrings.Stub("EightBallYes5")
|
||||||
, Localizer.Stub("EightBallYes6")
|
, LocStrings.Stub("EightBallYes6")
|
||||||
, Localizer.Stub("EightBallYes7")
|
, LocStrings.Stub("EightBallYes7")
|
||||||
, Localizer.Stub("EightBallYes8")
|
, LocStrings.Stub("EightBallYes8")
|
||||||
, Localizer.Stub("EightBallYes9")
|
, LocStrings.Stub("EightBallYes9")
|
||||||
, Localizer.Stub("EightBallYes10")
|
, LocStrings.Stub("EightBallYes10")
|
||||||
|
|
||||||
, Localizer.Stub("EightBallMaybe1")
|
, LocStrings.Stub("EightBallMaybe1")
|
||||||
, Localizer.Stub("EightBallMaybe2")
|
, LocStrings.Stub("EightBallMaybe2")
|
||||||
, Localizer.Stub("EightBallMaybe3")
|
, LocStrings.Stub("EightBallMaybe3")
|
||||||
, Localizer.Stub("EightBallMaybe4")
|
, LocStrings.Stub("EightBallMaybe4")
|
||||||
, Localizer.Stub("EightBallMaybe5")
|
, LocStrings.Stub("EightBallMaybe5")
|
||||||
|
|
||||||
, Localizer.Stub("EightBallNo1")
|
, LocStrings.Stub("EightBallNo1")
|
||||||
, Localizer.Stub("EightBallNo2")
|
, LocStrings.Stub("EightBallNo2")
|
||||||
, Localizer.Stub("EightBallNo3")
|
, LocStrings.Stub("EightBallNo3")
|
||||||
, Localizer.Stub("EightBallNo4")
|
, LocStrings.Stub("EightBallNo4")
|
||||||
, Localizer.Stub("EightBallNo5")
|
, LocStrings.Stub("EightBallNo5")
|
||||||
};
|
};
|
||||||
|
|
||||||
public CommandEightBall(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandEightBall(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("EightBallInfo"); }
|
public String HelpText() { return LocStrings.Stub("EightBallInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.args.trim().length() < 1)
|
if(input.args.trim().length() < 1)
|
||||||
res.Call(Localizer.Stub("EightBallError"));
|
res.Call(LocStrings.Stub("EightBallError"));
|
||||||
|
|
||||||
res.Call(answers[(int) (Math.random()*answers.length)]);
|
res.Call(answers[(int) (Math.random()*answers.length)]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
public class CommandGiveBeans extends Command
|
public class CommandGiveBeans extends Command
|
||||||
@@ -9,7 +9,7 @@ public class CommandGiveBeans extends Command
|
|||||||
public CommandGiveBeans (KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandGiveBeans (KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("GiveBeansInfo"); }
|
public String HelpText() { return LocStrings.Stub("GiveBeansInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -20,20 +20,20 @@ public class CommandGiveBeans extends Command
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("GiveBeansInvalid"));
|
res.Call(LocStrings.Stub("GiveBeansInvalid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(input.mentions == null)
|
if(input.mentions == null)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("GiveBeansNoneMentioned"));
|
res.Call(LocStrings.Stub("GiveBeansNoneMentioned"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < input.mentions.length; i++)
|
for(int i = 0; i < input.mentions.length; i++)
|
||||||
{
|
{
|
||||||
input.mentions[i].ChangeBeans(beans);
|
input.mentions[i].ChangeBeans(beans);
|
||||||
res.Call(String.format(Localizer.Stub("GiveBeansSuccess"), input.mentions[i].name, "" + beans));
|
res.Call(String.format(LocStrings.Stub("GiveBeansSuccess"), input.mentions[i].name, "" + beans));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class CommandHelp extends Command
|
|||||||
public CommandHelp(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandHelp(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("HelpInfo"); }
|
public String HelpText() { return LocStrings.Stub("HelpInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -24,7 +24,7 @@ public class CommandHelp extends Command
|
|||||||
|
|
||||||
if(help == null)
|
if(help == null)
|
||||||
{
|
{
|
||||||
help = Localizer.Stub("HelpDisplay");
|
help = LocStrings.Stub("HelpDisplay");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import core.Stats;
|
import core.Stats;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
@@ -26,7 +26,7 @@ public class CommandHelpBuilder extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("HelpBuilderInfo"); }
|
public String HelpText() { return LocStrings.Stub("HelpBuilderInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
@@ -15,11 +15,11 @@ public class CommandInfo extends Command
|
|||||||
public CommandInfo(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandInfo(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("InfoInfo"); }
|
public String HelpText() { return LocStrings.Stub("InfoInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("InfoResponse"));
|
res.Call(LocStrings.Stub("InfoResponse"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import offline.Ref;
|
import offline.Ref;
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ public class CommandInvite extends Command
|
|||||||
public CommandInvite(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandInvite(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("InviteInfo"); }
|
public String HelpText() { return LocStrings.Stub("InviteInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import network.NetworkJDoodle;
|
import network.NetworkJDoodle;
|
||||||
|
|
||||||
@@ -12,14 +12,14 @@ public class CommandJDoodle extends Command
|
|||||||
public CommandJDoodle(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandJDoodle(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("JDoodleInfo"); }
|
public String HelpText() { return LocStrings.Stub("JDoodleInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.args.trim().length() < 1)
|
if(input.args.trim().length() < 1)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("JDoodleError"));
|
res.Call(LocStrings.Stub("JDoodleError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package commands;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
@@ -23,7 +23,7 @@ public class CommandMap extends Command
|
|||||||
public CommandMap(KittyRole roleLevel, KittyRating contentRating) { super(roleLevel, contentRating); }
|
public CommandMap(KittyRole roleLevel, KittyRating contentRating) { super(roleLevel, contentRating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return String.format(Localizer.Stub("MapInfo"), "" + MaxWidth, "" + MaxHeight); }
|
public String HelpText() { return String.format(LocStrings.Stub("MapInfo"), "" + MaxWidth, "" + MaxHeight); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -60,7 +60,7 @@ public class CommandMap extends Command
|
|||||||
}
|
}
|
||||||
catch(NumberFormatException e)
|
catch(NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("MapInvalid"));
|
res.Call(LocStrings.Stub("MapInvalid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,10 +76,10 @@ public class CommandMap extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Response header creation
|
// Response header creation
|
||||||
header += Localizer.Stub("MapVersion") + "\n";
|
header += LocStrings.Stub("MapVersion") + "\n";
|
||||||
header += Localizer.Stub("MapSeed") + ": `" + seed + "`, ";
|
header += LocStrings.Stub("MapSeed") + ": `" + seed + "`, ";
|
||||||
header += Localizer.Stub("MapWidth") + "`"+ width +"`, ";
|
header += LocStrings.Stub("MapWidth") + "`"+ width +"`, ";
|
||||||
header += Localizer.Stub("MapHeight") + ": `"+ height + "`\n";
|
header += LocStrings.Stub("MapHeight") + ": `"+ height + "`\n";
|
||||||
|
|
||||||
// Response body creation
|
// Response body creation
|
||||||
body += "```\n";
|
body += "```\n";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import java.io.IOException;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
@@ -23,7 +23,7 @@ public class CommandPerish extends Command
|
|||||||
public CommandPerish(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandPerish(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("PerishInfo"); };
|
public String HelpText() { return LocStrings.Stub("PerishInfo"); };
|
||||||
|
|
||||||
private static Long num = 0l;
|
private static Long num = 0l;
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ public class CommandPing extends Command
|
|||||||
public CommandPing(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandPing(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("PingInfo"); }
|
public String HelpText() { return LocStrings.Stub("PingInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("PingResponse"));
|
res.Call(LocStrings.Stub("PingResponse"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class CommandPollManage extends Command
|
|||||||
public CommandPollManage(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandPollManage(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("PollMangeInfo"); }
|
public String HelpText() { return LocStrings.Stub("PollManageInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class CommandPollResults extends Command
|
|||||||
public CommandPollResults(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandPollResults(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("PollResultsInfo"); }
|
public String HelpText() { return LocStrings.Stub("PollResultsInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -28,7 +28,7 @@ public class CommandPollResults extends Command
|
|||||||
|
|
||||||
for(int i = 0; i < votes.size(); i++)
|
for(int i = 0; i < votes.size(); i++)
|
||||||
{
|
{
|
||||||
results += String.format(Localizer.Stub("PollResultsResponse"), votes.get(i).votes, votes.get(i).choice, (int)(((double)votes.get(i).votes) / ((double)totalVotes) * 100));
|
results += String.format(LocStrings.Stub("PollResultsResponse"), votes.get(i).votes, votes.get(i).choice, (int)(((double)votes.get(i).votes) / ((double)totalVotes) * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(results);
|
res.Call(results);
|
||||||
|
|||||||
@@ -8,18 +8,18 @@ public class CommandPollShow extends Command
|
|||||||
public CommandPollShow(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandPollShow(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("PollShowInfo"); }
|
public String HelpText() { return LocStrings.Stub("PollShowInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(!guild.polling)
|
if(!guild.polling)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("PollShowNoPoll"));
|
res.Call(LocStrings.Stub("PollShowNoPoll"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String poll = String.format(Localizer.Stub("PollShowPoll"), guild.poll);
|
String poll = String.format(LocStrings.Stub("PollShowPoll"), guild.poll);
|
||||||
poll += Localizer.Stub("PollShowChoices");
|
poll += LocStrings.Stub("PollShowChoices");
|
||||||
for(int i = 0; i < guild.choices.size(); i++)
|
for(int i = 0; i < guild.choices.size(); i++)
|
||||||
{
|
{
|
||||||
poll += (i+1) + ": `" + guild.choices.get(i).choice + "`\n";
|
poll += (i+1) + ": `" + guild.choices.get(i).choice + "`\n";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class CommandPollVote extends Command
|
|||||||
public CommandPollVote(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandPollVote(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("PollVoteInfo"); }
|
public String HelpText() { return LocStrings.Stub("PollVoteInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -17,7 +17,7 @@ public class CommandPollVote extends Command
|
|||||||
{
|
{
|
||||||
if(guild.hasVoted.contains(user.uniqueID))
|
if(guild.hasVoted.contains(user.uniqueID))
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("PollVoteAlreadyVoted"));
|
res.Call(LocStrings.Stub("PollVoteAlreadyVoted"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@@ -25,23 +25,23 @@ public class CommandPollVote extends Command
|
|||||||
int voteNum = Integer.parseInt(input.args)-1;
|
int voteNum = Integer.parseInt(input.args)-1;
|
||||||
if(voteNum >= guild.choices.size() || voteNum < 0)
|
if(voteNum >= guild.choices.size() || voteNum < 0)
|
||||||
{
|
{
|
||||||
res.Call(String.format(Localizer.Stub("PollVoteNotValidVote"), voteNum));
|
res.Call(String.format(LocStrings.Stub("PollVoteNotValidVote"), voteNum));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KittyPoll polled = guild.choices.get(voteNum);
|
KittyPoll polled = guild.choices.get(voteNum);
|
||||||
polled.votes++;
|
polled.votes++;
|
||||||
guild.hasVoted.add(user.uniqueID);
|
guild.hasVoted.add(user.uniqueID);
|
||||||
res.Call(Localizer.Stub("PollVoteSuccess") + " `" + polled.choice + "`!");
|
res.Call(LocStrings.Stub("PollVoteSuccess") + " `" + polled.choice + "`!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("PollVoteNotValidNumber"));
|
res.Call(LocStrings.Stub("PollVoteNotValidNumber"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(Localizer.Stub("PollVoteNoPoll"));
|
res.Call(LocStrings.Stub("PollVoteNoPoll"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import core.RPManager;
|
import core.RPManager;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class CommandRPEnd extends Command
|
|||||||
public CommandRPEnd (KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandRPEnd (KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("RPEndInfo"); }
|
public String HelpText() { return LocStrings.Stub("RPEndInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -33,11 +33,11 @@ public class CommandRPEnd extends Command
|
|||||||
if(sending != null)
|
if(sending != null)
|
||||||
{
|
{
|
||||||
res.CallFile(sending, "txt");
|
res.CallFile(sending, "txt");
|
||||||
res.Call(Localizer.Stub("RPEndFileOut"));
|
res.Call(LocStrings.Stub("RPEndFileOut"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("RPEndError"));
|
res.Call(LocStrings.Stub("RPEndError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import core.rpg.RPGFramework;
|
import core.rpg.RPGFramework;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
@@ -23,7 +23,7 @@ public class CommandRPG extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("RPGInfo"); };
|
public String HelpText() { return LocStrings.Stub("RPGInfo"); };
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +45,7 @@ public class CommandRPG extends Command
|
|||||||
|
|
||||||
if(result == null)
|
if(result == null)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("RPGInvalid"));
|
res.Call(LocStrings.Stub("RPGInvalid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package commands;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import core.RPManager;
|
import core.RPManager;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ public class CommandRPStart extends Command
|
|||||||
public CommandRPStart (KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandRPStart (KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("RPStartInfo"); }
|
public String HelpText() { return LocStrings.Stub("RPStartInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
@@ -15,7 +15,7 @@ public class CommandRating extends Command
|
|||||||
public CommandRating(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandRating(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("RatingInfo"); }
|
public String HelpText() { return LocStrings.Stub("RatingInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
@@ -55,11 +55,11 @@ public class CommandRating extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(newRating != null)
|
if(newRating != null)
|
||||||
res.Call(Localizer.Stub("RatingChanged") + " " + newRating);
|
res.Call(LocStrings.Stub("RatingChanged") + " " + newRating);
|
||||||
else
|
else
|
||||||
res.Call(Localizer.Stub("RatingInvalid") + " `" + input.args + "`");
|
res.Call(LocStrings.Stub("RatingInvalid") + " `" + input.args + "`");
|
||||||
|
|
||||||
if(newRating.equals("Filtered"))
|
if(newRating.equals("Filtered"))
|
||||||
res.Call(Localizer.Stub("RatingWarning"));
|
res.Call(LocStrings.Stub("RatingWarning"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
public class CommandRole extends Command
|
public class CommandRole extends Command
|
||||||
@@ -9,20 +9,20 @@ public class CommandRole extends Command
|
|||||||
public CommandRole (KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandRole (KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("RoleInfo"); }
|
public String HelpText() { return LocStrings.Stub("RoleInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.args.isEmpty())
|
if(input.args.isEmpty())
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("RoleStandardResponse") + " " + user.GetRole().name() + "!");
|
res.Call(LocStrings.Stub("RoleStandardResponse") + " " + user.GetRole().name() + "!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.GetRole().getValue() < KittyRole.Admin.getValue())
|
if(user.GetRole().getValue() < KittyRole.Admin.getValue())
|
||||||
{
|
{
|
||||||
res.Call(String.format(Localizer.Stub("RoleError"), KittyRole.Admin.toString()));
|
res.Call(String.format(LocStrings.Stub("RoleError"), KittyRole.Admin.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class CommandRole extends Command
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
res.Call(Localizer.Stub("RoleNeededRole"));
|
res.Call(LocStrings.Stub("RoleNeededRole"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String users = "";
|
String users = "";
|
||||||
@@ -56,6 +56,6 @@ public class CommandRole extends Command
|
|||||||
users += input.mentions[i].name + " ";
|
users += input.mentions[i].name + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(String.format(Localizer.Stub("RoleChanged"), users, newRole.name()));
|
res.Call(String.format(LocStrings.Stub("RoleChanged"), users, newRole.name()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class CommandRoll extends Command
|
|||||||
public CommandRoll(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandRoll(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("RollInfo"); }
|
public String HelpText() { return LocStrings.Stub("RollInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -27,7 +27,7 @@ public class CommandRoll extends Command
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("RollError"));
|
res.Call(LocStrings.Stub("RollError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package commands;
|
|||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.DatabaseManager;
|
import core.DatabaseManager;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import core.Stats;
|
import core.Stats;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
@@ -20,7 +20,7 @@ public class CommandShutdown extends Command
|
|||||||
public CommandShutdown(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandShutdown(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("ShutdownInfo"); }
|
public String HelpText() { return LocStrings.Stub("ShutdownInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import java.io.IOException;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import utils.ImageUtils;
|
import utils.ImageUtils;
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ public class CommandStark extends Command
|
|||||||
public CommandStark(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandStark(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("StarkInfo"); };
|
public String HelpText() { return LocStrings.Stub("StarkInfo"); };
|
||||||
|
|
||||||
private static Long num = 0l;
|
private static Long num = 0l;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import core.CommandManager.ThreadData;
|
import core.CommandManager.ThreadData;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
@@ -17,7 +17,7 @@ public class CommandStats extends Command
|
|||||||
public CommandStats(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandStats(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("StatsInfo"); }
|
public String HelpText() { return LocStrings.Stub("StatsInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
@@ -23,7 +23,7 @@ public class CommandTeey extends Command
|
|||||||
private static Long num = 0l;
|
private static Long num = 0l;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("TeeyInfo"); }
|
public String HelpText() { return LocStrings.Stub("TeeyInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import network.NetworkTwitter;
|
import network.NetworkTwitter;
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ public class CommandTweet extends Command
|
|||||||
public CommandTweet(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandTweet(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("TweetInfo"); }
|
public String HelpText() { return LocStrings.Stub("TweetInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -20,7 +20,7 @@ public class CommandTweet extends Command
|
|||||||
try {
|
try {
|
||||||
res.Call(tweet.tweet(input.args));
|
res.Call(tweet.tweet(input.args));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
res.Call(Localizer.Stub("TweetError"));
|
res.Call(LocStrings.Stub("TweetError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package commands;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import network.*;
|
import network.*;
|
||||||
import utils.ImageUtils;
|
import utils.ImageUtils;
|
||||||
@@ -15,13 +15,13 @@ public class CommandWolfram extends Command
|
|||||||
public CommandWolfram(KittyRole level, KittyRating rating) { super(level, rating);}
|
public CommandWolfram(KittyRole level, KittyRating rating) { super(level, rating);}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("WolframInfo"); }
|
public String HelpText() { return LocStrings.Stub("WolframInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.args == null || input.args.trim().length() == 0)
|
if(input.args == null || input.args.trim().length() == 0)
|
||||||
res.Call(Localizer.Stub("WolframNoArgs"));
|
res.Call(LocStrings.Stub("WolframNoArgs"));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@ public class CommandWolfram extends Command
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
res.Call(Localizer.Stub("WolframError"));
|
res.Call(LocStrings.Stub("WolframError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Localizer;
|
import core.LocStrings;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
@@ -23,7 +23,7 @@ public class CommandYeet extends Command
|
|||||||
private static Long num = 0l;
|
private static Long num = 0l;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String HelpText() { return Localizer.Stub("YeetInfo"); }
|
public String HelpText() { return LocStrings.Stub("YeetInfo"); }
|
||||||
|
|
||||||
// Called when the command is run!
|
// Called when the command is run!
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package core;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import utils.FileUtils;
|
||||||
|
import utils.GlobalLog;
|
||||||
|
import utils.LogFilter;
|
||||||
|
|
||||||
|
// While some of the patterns in this file are similar to the localization files,
|
||||||
|
// commands that are being looked up will behave slightly differently so trimming
|
||||||
|
// rules for this file are different than the localization ones - this is more
|
||||||
|
// aggresive with whitespace removal.
|
||||||
|
public class CommandEnabler
|
||||||
|
{
|
||||||
|
// Config/const variables
|
||||||
|
public static final String filename = "commands.config";
|
||||||
|
public static final String pairSplit = "=";
|
||||||
|
public static final char pairSeparator = '\n';
|
||||||
|
public static final String enabled = "1";
|
||||||
|
public static final String disabled = "0";
|
||||||
|
public static final boolean defaultEnabledState = true;
|
||||||
|
|
||||||
|
// Local variables
|
||||||
|
private HashMap<String, Boolean> enabledMap; // Quick lookup
|
||||||
|
private ArrayList<String> keyList; // Tracking ordering for later
|
||||||
|
|
||||||
|
public CommandEnabler()
|
||||||
|
{
|
||||||
|
GlobalLog.Log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName());
|
||||||
|
enabledMap = new HashMap<>();
|
||||||
|
keyList = new ArrayList<>();
|
||||||
|
|
||||||
|
ReadIn();
|
||||||
|
GetTrackedCommands();
|
||||||
|
WriteOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reads in the config file and parses it, keeping tabs on the order it read things
|
||||||
|
private void ReadIn()
|
||||||
|
{
|
||||||
|
File f = new File(filename);
|
||||||
|
if(f.isFile() && f.canRead())
|
||||||
|
{
|
||||||
|
String content = FileUtils.ReadContent(f).trim();
|
||||||
|
String[] lines = content.split("" + pairSeparator);
|
||||||
|
|
||||||
|
for(int i = 0; i < lines.length; ++i)
|
||||||
|
{
|
||||||
|
String[] pair = lines[i].split(pairSplit);
|
||||||
|
|
||||||
|
if(pair.length < 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
String key = pair[0].trim();
|
||||||
|
String value = pair[1].trim().toLowerCase();
|
||||||
|
|
||||||
|
keyList.add(key);
|
||||||
|
|
||||||
|
if(value.equalsIgnoreCase(enabled))
|
||||||
|
enabledMap.putIfAbsent(key, true);
|
||||||
|
else
|
||||||
|
enabledMap.putIfAbsent(key, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look up the already scraped values from the localizer and store them if they
|
||||||
|
// don't already exist in the lookup. Defaults to defaultEnabledState.
|
||||||
|
private void GetTrackedCommands()
|
||||||
|
{
|
||||||
|
ArrayList<String> unloc = LocCommands.GetUnlocalizedCommands();
|
||||||
|
|
||||||
|
for(int i = 0; i < unloc.size(); ++i)
|
||||||
|
{
|
||||||
|
String command = unloc.get(i);
|
||||||
|
if(enabledMap.putIfAbsent(command, defaultEnabledState) == null)
|
||||||
|
{
|
||||||
|
GlobalLog.Log(LogFilter.Strings, "Identified new toggleable raw command: " + command);
|
||||||
|
keyList.add(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write out enabled/disabled file info.
|
||||||
|
private void WriteOut()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String outString = "";
|
||||||
|
for(int i = 0; i < keyList.size(); ++i)
|
||||||
|
{
|
||||||
|
String key = keyList.get(i);
|
||||||
|
String value = enabled;
|
||||||
|
|
||||||
|
if(enabledMap.get(key) == false)
|
||||||
|
value = disabled;
|
||||||
|
|
||||||
|
outString += key + pairSplit + value + pairSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
|
||||||
|
writer.write(outString);
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
GlobalLog.Error(LogFilter.Core, "Command enabler issue writing file! " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Looks up a key to see if it's enabled or not
|
||||||
|
public boolean IsEnabled(String key)
|
||||||
|
{
|
||||||
|
if(enabledMap.containsKey(key))
|
||||||
|
return enabledMap.get(key);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import java.util.Map.Entry;
|
|||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.Pair;
|
||||||
import dataStructures.Response;
|
import dataStructures.Response;
|
||||||
import dataStructures.UserInput;
|
import dataStructures.UserInput;
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
@@ -16,23 +17,41 @@ public class CommandManager
|
|||||||
// Variables
|
// Variables
|
||||||
private HashMap<String, Command> commands;
|
private HashMap<String, Command> commands;
|
||||||
private ArrayList<CommandThread> threadAccumulator;
|
private ArrayList<CommandThread> threadAccumulator;
|
||||||
|
private CommandEnabler commandEnabler;
|
||||||
private long invokeCount;
|
private long invokeCount;
|
||||||
|
|
||||||
|
|
||||||
// Default Constructor
|
// Default Constructor
|
||||||
public CommandManager()
|
public CommandManager(CommandEnabler commandEnabler)
|
||||||
{
|
{
|
||||||
commands = new HashMap<String, Command>();
|
this.commands = new HashMap<String, Command>();
|
||||||
threadAccumulator = new ArrayList<CommandThread>();
|
this.threadAccumulator = new ArrayList<CommandThread>();
|
||||||
invokeCount = 0;
|
this.invokeCount = 0;
|
||||||
|
this.commandEnabler = commandEnabler;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allows the command manager to keep track of a command.
|
// Allows the command manager to keep track of a command. Takes a pair (the un-localized and localzied commands)
|
||||||
public void Register(String key, Command command)
|
// and the command associated with the localized commands.
|
||||||
|
public void Register(Pair<String, String> pair, Command command)
|
||||||
{
|
{
|
||||||
if(key == null)
|
if(pair == null || pair.Second == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// If we haven't already split a multisplit command (or even assessed that),
|
||||||
|
// then verify if we even need to register the commands at all. If it's
|
||||||
|
// not enabled, don't register it.
|
||||||
|
if(pair.First != null && !commandEnabler.IsEnabled(pair.First))
|
||||||
|
return;
|
||||||
|
|
||||||
|
String key = pair.Second;
|
||||||
|
|
||||||
|
if(key.contains(","))
|
||||||
|
{
|
||||||
|
|
||||||
|
String[] keys = key.split(",");
|
||||||
|
Register(keys, command);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
key = key.toLowerCase();
|
key = key.toLowerCase();
|
||||||
command.registeredNames.add(key);
|
command.registeredNames.add(key);
|
||||||
|
|
||||||
@@ -51,7 +70,7 @@ public class CommandManager
|
|||||||
public void Register(String[] keys, Command command)
|
public void Register(String[] keys, Command command)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < keys.length; ++i)
|
for(int i = 0; i < keys.length; ++i)
|
||||||
Register(keys[i], command);
|
Register(new Pair<String, String>(null, keys[i].trim()), command);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calls the command but on a whole new thread!
|
// Calls the command but on a whole new thread!
|
||||||
|
|||||||
@@ -8,32 +8,40 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import dataStructures.SectionedKeyValueStore;
|
import dataStructures.TaggedPairStore;
|
||||||
import utils.FileUtils;
|
import utils.FileUtils;
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
import utils.LogFilter;
|
import utils.LogFilter;
|
||||||
|
|
||||||
// A quick-and-dirty localization tool that scrapes the project for calls to itself, then
|
// A quick-and-dirty localization tool that scrapes the project for calls to itself, then
|
||||||
// generates/updates a file externally (phrases.config) with all the stub values as keys that
|
// generates/updates a file externally with all the stub values as keys that are localized.
|
||||||
// can then be localized.
|
public abstract class LocBase
|
||||||
public class Localizer
|
|
||||||
{
|
{
|
||||||
|
// Pre-defined values
|
||||||
|
public static final String KittySourceDirectory = "./src";
|
||||||
|
|
||||||
// Filename
|
// Filename
|
||||||
public final static String filename = "localization.config";
|
public final String filename; // Example: "localization.config";
|
||||||
public final static String functionName = "Localizer.Stub";
|
public final String functionName; // Example: "Localizer.Stub";
|
||||||
|
|
||||||
// Local translation storage
|
// Local translation storage
|
||||||
private static SectionedKeyValueStore stringStore;
|
protected TaggedPairStore stringStore;
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
private static void Log(String str) { GlobalLog.Log(LogFilter.Strings, str); }
|
private void Log(String str) { GlobalLog.Log(LogFilter.Strings, str); }
|
||||||
private static void Warn(String str) { GlobalLog.Warn(LogFilter.Strings, str); }
|
private void Warn(String str) { GlobalLog.Warn(LogFilter.Strings, str); }
|
||||||
private static void Error(String str) { GlobalLog.Error(LogFilter.Strings, str); }
|
private void Error(String str) { GlobalLog.Error(LogFilter.Strings, str); }
|
||||||
|
|
||||||
|
// Ok... so this is an array because if it's not an array, the parser will parse the string
|
||||||
|
public LocBase(String filename, String functionName)
|
||||||
|
{
|
||||||
|
this.filename = filename;
|
||||||
|
this.functionName = functionName;
|
||||||
|
}
|
||||||
|
|
||||||
// Structure used for holding a pair of strings and any other info we need
|
// Structure used for holding a pair of strings and any other info we need
|
||||||
// about localized information that is being looked up.
|
// about localized information that is being looked up.
|
||||||
private static class LocInfo
|
private class LocInfo
|
||||||
{
|
{
|
||||||
public String file;
|
public String file;
|
||||||
public String phrase;
|
public String phrase;
|
||||||
@@ -46,7 +54,7 @@ public class Localizer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do processing on each path in the scraped directory here, assuming it's .java
|
// Do processing on each path in the scraped directory here, assuming it's .java
|
||||||
public static void StripForContents(Path path, ArrayList<LocInfo> strings)
|
public void StripForContents(Path path, ArrayList<LocInfo> strings)
|
||||||
{
|
{
|
||||||
String filename = path.getFileName().toString();
|
String filename = path.getFileName().toString();
|
||||||
if(filename.contains(".java"))
|
if(filename.contains(".java"))
|
||||||
@@ -58,10 +66,11 @@ public class Localizer
|
|||||||
for(int i = 1; i < split.length; ++i)
|
for(int i = 1; i < split.length; ++i)
|
||||||
{
|
{
|
||||||
int loc = split[i].indexOf(")");
|
int loc = split[i].indexOf(")");
|
||||||
|
String noWhitespace = split[i].replaceAll("\\s+","");
|
||||||
|
|
||||||
if(loc != -1)
|
if(loc != -1)
|
||||||
{
|
{
|
||||||
if(split[i].charAt(loc - 1) == '"' && split[i].charAt(loc - 2) != '\\')
|
if(noWhitespace.charAt(noWhitespace.indexOf(")") - 1) == '"' && split[i].charAt(loc - 2) != '\\')
|
||||||
{
|
{
|
||||||
// At this point, we find the first ), then verify there's a ") behind it, and that
|
// At this point, we find the first ), then verify there's a ") behind it, and that
|
||||||
// the " is not an escaped character.
|
// the " is not an escaped character.
|
||||||
@@ -71,7 +80,7 @@ public class Localizer
|
|||||||
|
|
||||||
strings.add(new LocInfo(filename.substring(0, filename.lastIndexOf('.')), toLocalize));
|
strings.add(new LocInfo(filename.substring(0, filename.lastIndexOf('.')), toLocalize));
|
||||||
|
|
||||||
Log("Found stubbed phrase in " + path + " : " + toLocalize);
|
Log("Found lookup call in " + path + ": " + toLocalize);
|
||||||
}
|
}
|
||||||
catch(IndexOutOfBoundsException e)
|
catch(IndexOutOfBoundsException e)
|
||||||
{
|
{
|
||||||
@@ -86,7 +95,7 @@ public class Localizer
|
|||||||
// Nothing for now, but in the future will return a parsed and localized version of
|
// Nothing for now, but in the future will return a parsed and localized version of
|
||||||
// the string in question if one can be found. If the localized string is empty,
|
// the string in question if one can be found. If the localized string is empty,
|
||||||
// returns a the key instead which is the default phrase.
|
// returns a the key instead which is the default phrase.
|
||||||
public static String Stub(String input)
|
public String GetKey(String input)
|
||||||
{
|
{
|
||||||
if(stringStore == null)
|
if(stringStore == null)
|
||||||
return input;
|
return input;
|
||||||
@@ -99,7 +108,7 @@ public class Localizer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reads a file to string, adapted from https://stackoverflow.com/a/326440/5383198
|
// Reads a file to string, adapted from https://stackoverflow.com/a/326440/5383198
|
||||||
static String ReadFileAsString(String path, Charset encoding)
|
private String ReadFileAsString(String path, Charset encoding)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -116,14 +125,13 @@ public class Localizer
|
|||||||
|
|
||||||
// Update localization from the disk on file. Creates the file if it doesn't exist.
|
// Update localization from the disk on file. Creates the file if it doesn't exist.
|
||||||
// This file is internally formatted as an ini file.
|
// This file is internally formatted as an ini file.
|
||||||
public static void UpdateLocFromDisk()
|
public void UpdateLocFromDisk()
|
||||||
{
|
{
|
||||||
Log("Attempting to read localization file");
|
Log("Attempting to read localization file: " + filename);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String fileContents = ReadFileAsString(filename, Charset.defaultCharset());
|
String fileContents = ReadFileAsString(filename, Charset.defaultCharset());
|
||||||
System.out.println("File contents: " + fileContents);
|
|
||||||
|
|
||||||
if(fileContents == null)
|
if(fileContents == null)
|
||||||
{
|
{
|
||||||
@@ -131,7 +139,7 @@ public class Localizer
|
|||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
stringStore = new SectionedKeyValueStore(fileContents);
|
stringStore = new TaggedPairStore(fileContents);
|
||||||
}
|
}
|
||||||
catch(IOException e)
|
catch(IOException e)
|
||||||
{
|
{
|
||||||
@@ -141,7 +149,7 @@ public class Localizer
|
|||||||
|
|
||||||
// Rewrites out at the specified filename with existing stubs.
|
// Rewrites out at the specified filename with existing stubs.
|
||||||
// This preserves existing localized phrases.
|
// This preserves existing localized phrases.
|
||||||
public static void SaveLocToDisk()
|
public void SaveLocToDisk()
|
||||||
{
|
{
|
||||||
Log("Attempting to write updated localization file");
|
Log("Attempting to write updated localization file");
|
||||||
|
|
||||||
@@ -157,12 +165,24 @@ public class Localizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TryStripSpecified(Path path, ArrayList<LocInfo> toFill)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StripForContents(path, toFill);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
Error("issue with file: " + path.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Scrape the project and generate all the possible localizeable phrases.
|
// Scrape the project and generate all the possible localizeable phrases.
|
||||||
// This stubs out phrases to be localized.
|
// This stubs out phrases to be localized.
|
||||||
public static void ScrapeAll()
|
public void ScrapeAll()
|
||||||
{
|
{
|
||||||
ArrayList<LocInfo> localizeList = new ArrayList<LocInfo>();
|
ArrayList<LocInfo> localizeList = new ArrayList<LocInfo>();
|
||||||
FileUtils.AcquireAllFiles(".\\src").forEach((path) -> StripForContents(path, localizeList));
|
FileUtils.AcquireAllFiles(KittySourceDirectory).forEach((path) -> TryStripSpecified(path, localizeList));
|
||||||
|
|
||||||
for(LocInfo toStub : localizeList)
|
for(LocInfo toStub : localizeList)
|
||||||
stringStore.AddKeyValue(toStub.file, toStub.phrase, toStub.phrase);
|
stringStore.AddKeyValue(toStub.file, toStub.phrase, toStub.phrase);
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package core;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import utils.GlobalLog;
|
||||||
|
import utils.LogFilter;
|
||||||
|
import dataStructures.Pair;
|
||||||
|
|
||||||
|
// Performs the same localization for the strings associated with command names as
|
||||||
|
// is performed with general strings in the application
|
||||||
|
public class LocCommands extends LocBase
|
||||||
|
{
|
||||||
|
public static final String fileName = "locCommands.config";
|
||||||
|
public static final String function = "LocCommands.Stub";
|
||||||
|
|
||||||
|
private static LocCommands instance;
|
||||||
|
|
||||||
|
public LocCommands()
|
||||||
|
{
|
||||||
|
super(fileName, function);
|
||||||
|
|
||||||
|
GlobalLog.Log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName());
|
||||||
|
|
||||||
|
if(instance == null)
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
UpdateLocFromDisk();
|
||||||
|
ScrapeAll();
|
||||||
|
SaveLocToDisk();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GlobalLog.Error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a pair, the raw key and the stub key
|
||||||
|
public static Pair<String, String> Stub(String toStub)
|
||||||
|
{
|
||||||
|
return new Pair<String, String>(toStub, instance.GetKey(toStub));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets all of the un-translated defaults in the commands list.
|
||||||
|
public static ArrayList<String> GetUnlocalizedCommands()
|
||||||
|
{
|
||||||
|
ArrayList<String> raw = new ArrayList<>();
|
||||||
|
instance.stringStore.ForEach((pair) -> raw.add((String)((Pair<?, ?>)pair).First ));
|
||||||
|
return raw;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package core;
|
||||||
|
|
||||||
|
import utils.GlobalLog;
|
||||||
|
import utils.LogFilter;
|
||||||
|
|
||||||
|
// A quick-and-dirty localization tool that scrapes the project for calls to itself, then
|
||||||
|
// generates/updates a file externally (phrases.config) with all the stub values as keys that
|
||||||
|
// can then be localized.
|
||||||
|
public class LocStrings extends LocBase
|
||||||
|
{
|
||||||
|
public static final String fileName = "locStrings.config";
|
||||||
|
public static final String function = "LocStrings.Stub";
|
||||||
|
|
||||||
|
private static LocStrings instance;
|
||||||
|
|
||||||
|
public LocStrings()
|
||||||
|
{
|
||||||
|
super(fileName, function);
|
||||||
|
|
||||||
|
GlobalLog.Log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName());
|
||||||
|
|
||||||
|
if(instance == null)
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
UpdateLocFromDisk();
|
||||||
|
ScrapeAll();
|
||||||
|
SaveLocToDisk();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GlobalLog.Error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String Stub(String toStub)
|
||||||
|
{
|
||||||
|
return instance.GetKey(toStub);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,9 +34,20 @@ public class ObjectBuilderFactory
|
|||||||
// RPManger for tracking RP system
|
// RPManger for tracking RP system
|
||||||
private static RPManager rpManager;
|
private static RPManager rpManager;
|
||||||
|
|
||||||
// Lazy initialization style for
|
// Localization classes - these are singletons, but should be initialized before almost all other
|
||||||
|
// things so their inclusion in the factory is to ensure they're started at the correct time.
|
||||||
|
@SuppressWarnings("unused") private static LocStrings locStrings;
|
||||||
|
@SuppressWarnings("unused") private static LocCommands locCommands;
|
||||||
|
|
||||||
|
// Handles if we can or can't use specific commands, parsing a config file based on loc data to do so.
|
||||||
|
private static CommandEnabler commandEnabler;
|
||||||
|
|
||||||
|
// Lazy initialization multithreaded mutex stuff to prevent explosions.
|
||||||
|
// TODO: Investigate using 'synchronized' instead potentially
|
||||||
private static boolean hasInitialized;
|
private static boolean hasInitialized;
|
||||||
private static Semaphore initMutex = new Semaphore(1);
|
private static Semaphore initMutex = new Semaphore(1);
|
||||||
|
|
||||||
|
// This is it, this is how the lazy init starts!
|
||||||
private static void LazyInit()
|
private static void LazyInit()
|
||||||
{
|
{
|
||||||
if(hasInitialized)
|
if(hasInitialized)
|
||||||
@@ -47,26 +58,31 @@ public class ObjectBuilderFactory
|
|||||||
initMutex.acquire();
|
initMutex.acquire();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Initialization here. This is where we could read from something external.
|
// structure initialization
|
||||||
|
// Construct necessary data structures.
|
||||||
guildCache = new HashMap<String, KittyGuild>();
|
guildCache = new HashMap<String, KittyGuild>();
|
||||||
userCache = new HashMap<String, KittyUser>();
|
userCache = new HashMap<String, KittyUser>();
|
||||||
channelCache = new HashMap<String, KittyChannel>();
|
channelCache = new HashMap<String, KittyChannel>();
|
||||||
database = null;
|
database = null;
|
||||||
stats = null;
|
stats = null;
|
||||||
|
|
||||||
|
// Start by reading from things that are external. Because
|
||||||
|
// we require these things to be resolved before the rest of the application,
|
||||||
|
// we place them here.
|
||||||
|
locStrings = new LocStrings();
|
||||||
|
locCommands = new LocCommands();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
initMutex.release();
|
initMutex.release();
|
||||||
|
hasInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(InterruptedException ie)
|
catch(InterruptedException ie)
|
||||||
{
|
{
|
||||||
GlobalLog.Error(LogFilter.Core, "Issue during object builder lazy initialization."
|
GlobalLog.Error(LogFilter.Core, "Issue during object builder lazy initialization."
|
||||||
+ " The factory was not initialized, "
|
+ " The factory was not initialized, and kitty will not be able to continue functionally.");
|
||||||
+ "and kitty will not be able to continue functionally.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hasInitialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly locks: guildCache
|
// Explicitly locks: guildCache
|
||||||
@@ -276,59 +292,70 @@ public class ObjectBuilderFactory
|
|||||||
user.avatarID = member.getUser().getAvatarUrl();
|
user.avatarID = member.getUser().getAvatarUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default construction of the command manager.
|
// Constructs a CommandEnabler if it doesn't exist, and gets the existing one if it does.
|
||||||
// TODO(wisp): We want to be able to keep all this data
|
public static CommandEnabler ConstructCommandEnabler()
|
||||||
// stored off in a file at some point, so we can reflect it onto the
|
|
||||||
// project and build it per-guild. That's for later now tho.
|
|
||||||
public static CommandManager ConstructCommandManager()
|
|
||||||
{
|
{
|
||||||
LazyInit();
|
LazyInit();
|
||||||
|
|
||||||
CommandManager manager = new CommandManager();
|
if(commandEnabler == null)
|
||||||
|
commandEnabler = new CommandEnabler();
|
||||||
|
|
||||||
manager.Register("work", new CommandDoWork(KittyRole.Dev, KittyRating.Safe));
|
return commandEnabler;
|
||||||
manager.Register("shutdown", new CommandShutdown(KittyRole.Dev, KittyRating.Safe));
|
}
|
||||||
manager.Register("stats", new CommandStats(KittyRole.Dev, KittyRating.Safe));
|
|
||||||
manager.Register("invite", new CommandInvite(KittyRole.Dev, KittyRating.Safe));
|
|
||||||
manager.Register("buildHelp", new CommandHelpBuilder(KittyRole.Dev, KittyRating.Safe));
|
|
||||||
manager.Register("tweet", new CommandTweet(KittyRole.Dev, KittyRating.Safe));
|
|
||||||
|
|
||||||
manager.Register("rating", new CommandRating(KittyRole.Admin, KittyRating.Safe));
|
// Default construction of the command manager. In order to remotely resolve command enabling
|
||||||
manager.Register("indicator", new CommandChangeIndicator(KittyRole.Admin, KittyRating.Safe));
|
// and disabling, what we do is construct the commands with a localized pair that is checked against
|
||||||
|
// the CommandEnabler object passed in. In theory, we could have multiple CommandManagers, tho we can
|
||||||
|
// only have one CommandEnabler.
|
||||||
|
public static CommandManager ConstructCommandManager(CommandEnabler commandEnabler)
|
||||||
|
{
|
||||||
|
LazyInit();
|
||||||
|
|
||||||
manager.Register("poll", new CommandPollManage(KittyRole.Mod, KittyRating.Safe));
|
CommandManager manager = new CommandManager(commandEnabler);
|
||||||
manager.Register("givebeans", new CommandGiveBeans(KittyRole.Mod, KittyRating.Safe));
|
|
||||||
manager.Register("rpg", new CommandRPG(KittyRole.Mod, KittyRating.Safe));
|
|
||||||
|
|
||||||
manager.Register("teey", new CommandTeey(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("work"), new CommandDoWork(KittyRole.Dev, KittyRating.Safe));
|
||||||
manager.Register(new String[]{"perish", "thenperish"}, new CommandPerish(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("shutdown"), new CommandShutdown(KittyRole.Dev, KittyRating.Safe));
|
||||||
manager.Register("yeet", new CommandYeet(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("stats"), new CommandStats(KittyRole.Dev, KittyRating.Safe));
|
||||||
manager.Register("ping", new CommandPing(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("invite"), new CommandInvite(KittyRole.Dev, KittyRating.Safe));
|
||||||
manager.Register("boop", new CommandBoop(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("buildHelp"), new CommandHelpBuilder(KittyRole.Dev, KittyRating.Safe));
|
||||||
manager.Register("roll", new CommandRoll(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("tweet"), new CommandTweet(KittyRole.Dev, KittyRating.Safe));
|
||||||
manager.Register("choose", new CommandChoose(KittyRole.General, KittyRating.Safe));
|
|
||||||
manager.Register("help", new CommandHelp(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("rating"), new CommandRating(KittyRole.Admin, KittyRating.Safe));
|
||||||
manager.Register(new String[] {"info", "about"}, new CommandInfo(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("indicator"), new CommandChangeIndicator(KittyRole.Admin, KittyRating.Safe));
|
||||||
manager.Register("vote", new CommandPollVote(KittyRole.General, KittyRating.Safe));
|
|
||||||
manager.Register("results", new CommandPollResults(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("poll"), new CommandPollManage(KittyRole.Mod, KittyRating.Safe));
|
||||||
manager.Register("showpoll", new CommandPollShow(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("givebeans"), new CommandGiveBeans(KittyRole.Mod, KittyRating.Safe));
|
||||||
manager.Register("wolfram", new CommandWolfram(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("rpg"), new CommandRPG(KittyRole.Mod, KittyRating.Safe));
|
||||||
manager.Register(new String[] {"c++", "g++", "cplus","cpp"}, new CommandColiru(KittyRole.General, KittyRating.Safe));
|
|
||||||
manager.Register(new String[] {"java", "jdoodle" }, new CommandJDoodle(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("teey"), new CommandTeey(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register("beans", new CommandBeansShow(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("perish, thenperish"), new CommandPerish(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register("role", new CommandRole(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("yeet"), new CommandYeet(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register("bet", new CommandBetBeans(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("ping"), new CommandPing(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register("map", new CommandMap(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("boop"), new CommandBoop(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register("rpstart", new CommandRPStart(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("roll"), new CommandRoll(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register("rpend", new CommandRPEnd(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("choose"), new CommandChoose(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register(new String[] {"tony", "stark", "dontfeelgood", "dontfeelsogood"}, new CommandStark(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("help"), new CommandHelp(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register("blur", new CommandBlurry(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("info, about"), new CommandInfo(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register(new String [] {"eightball", "8ball"}, new CommandEightBall(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("vote"), new CommandPollVote(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("results"), new CommandPollResults(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("showpoll"), new CommandPollShow(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("wolfram"), new CommandWolfram(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("c++, g++, cplus, cpp"), new CommandColiru(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("java, jdoodle"), new CommandJDoodle(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("beans"), new CommandBeansShow(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("role"), new CommandRole(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("bet"), new CommandBetBeans(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("map"), new CommandMap(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("rpstart"), new CommandRPStart(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("rpend"), new CommandRPEnd(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("tony, stark, dontfeelgood, dontfeelsogood"), new CommandStark(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("blur"), new CommandBlurry(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("eightball, 8ball"), new CommandEightBall(KittyRole.General, KittyRating.Safe));
|
||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(wisp): Default database manager construction. It can be constructed
|
// Default database manager construction. It can be constructed
|
||||||
// in different ways, and so we construct it outside of the constructor for
|
// in different ways, and so we construct it outside of the constructor for
|
||||||
// the factory since it doesn't have to be present / can be elsewhere.
|
// the factory since it doesn't have to be present / can be elsewhere.
|
||||||
// Effectively we cache the database here.
|
// Effectively we cache the database here.
|
||||||
|
|||||||
+26
-26
@@ -18,25 +18,25 @@ import java.util.function.Consumer;
|
|||||||
// Note that the sections are NOT designed to allow for duplicate keys across them.
|
// Note that the sections are NOT designed to allow for duplicate keys across them.
|
||||||
// This is a restriction of the structure, but can be changed later potentially.
|
// This is a restriction of the structure, but can be changed later potentially.
|
||||||
// The only value not allowed in a key or value is the KeyValueSplit.
|
// The only value not allowed in a key or value is the KeyValueSplit.
|
||||||
public class SectionedKeyValueStore
|
public class TaggedPairStore
|
||||||
{
|
{
|
||||||
// Variables
|
// Variables
|
||||||
public final char SectionStart = '[';
|
public final char SectionStart = '[';
|
||||||
public final char SectionEnd = ']';
|
public final char SectionEnd = ']';
|
||||||
public final char KeyValueLineSeparator = '\n';
|
public final char PairLineSeparator = '\n';
|
||||||
public final String KeyValueSplit = "=";
|
public final String PairSplit = "=";
|
||||||
|
|
||||||
// [Key: SectionName, [Key: KeyString, Value: ValueString]]
|
// [Key: SectionName, [Key: KeyString, Value: ValueString]]
|
||||||
private HashMap<String, HashMap<String, String>> sectionKeyValue;
|
private HashMap<String, HashMap<String, String>> taggedPairs;
|
||||||
|
|
||||||
// [Key: KeyString, Value: ValueString]]
|
// [Key: KeyString, Value: ValueString]]
|
||||||
private HashMap<String, String> keyValue;
|
private HashMap<String, String> allPairs;
|
||||||
|
|
||||||
// String constructor that parses the input string into the object
|
// String constructor that parses the input string into the object
|
||||||
public SectionedKeyValueStore(String input)
|
public TaggedPairStore(String input)
|
||||||
{
|
{
|
||||||
sectionKeyValue = new HashMap<String, HashMap<String, String>>();
|
taggedPairs = new HashMap<String, HashMap<String, String>>();
|
||||||
keyValue = new HashMap<String, String>();
|
allPairs = new HashMap<String, String>();
|
||||||
Parse(input);
|
Parse(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class SectionedKeyValueStore
|
|||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public void ForEach(BiConsumer<? super String, Pair<? super String, ? super String>> action)
|
public void ForEach(BiConsumer<? super String, Pair<? super String, ? super String>> action)
|
||||||
{
|
{
|
||||||
Iterator it = sectionKeyValue.entrySet().iterator();
|
Iterator it = taggedPairs.entrySet().iterator();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
Map.Entry pair = (Map.Entry)it.next();
|
Map.Entry pair = (Map.Entry)it.next();
|
||||||
@@ -62,7 +62,7 @@ public class SectionedKeyValueStore
|
|||||||
@SuppressWarnings({"rawtypes"})
|
@SuppressWarnings({"rawtypes"})
|
||||||
public void ForEach(Consumer<Pair<? super String, ? super String>> action)
|
public void ForEach(Consumer<Pair<? super String, ? super String>> action)
|
||||||
{
|
{
|
||||||
Iterator it = keyValue.entrySet().iterator();
|
Iterator it = allPairs.entrySet().iterator();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
Map.Entry pair = (Map.Entry)it.next();
|
Map.Entry pair = (Map.Entry)it.next();
|
||||||
@@ -79,11 +79,11 @@ public class SectionedKeyValueStore
|
|||||||
String out = "";
|
String out = "";
|
||||||
|
|
||||||
// Iterates over the sections and
|
// Iterates over the sections and
|
||||||
Iterator it = sectionKeyValue.entrySet().iterator();
|
Iterator it = taggedPairs.entrySet().iterator();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
Map.Entry pair = (Map.Entry)it.next();
|
Map.Entry pair = (Map.Entry)it.next();
|
||||||
out += ("" + SectionStart + pair.getKey() + SectionEnd + KeyValueLineSeparator);
|
out += ("" + SectionStart + pair.getKey() + SectionEnd + PairLineSeparator);
|
||||||
|
|
||||||
Iterator internal = ((HashMap<String, String>)pair.getValue()).entrySet().iterator();
|
Iterator internal = ((HashMap<String, String>)pair.getValue()).entrySet().iterator();
|
||||||
while(internal.hasNext())
|
while(internal.hasNext())
|
||||||
@@ -93,12 +93,12 @@ public class SectionedKeyValueStore
|
|||||||
String value = (String)internalPair.getValue();
|
String value = (String)internalPair.getValue();
|
||||||
|
|
||||||
if(key == value)
|
if(key == value)
|
||||||
out += (key + KeyValueSplit) + KeyValueLineSeparator;
|
out += (key + PairSplit) + PairLineSeparator;
|
||||||
else
|
else
|
||||||
out += (key + KeyValueSplit + value) + KeyValueLineSeparator;
|
out += (key + PairSplit + value) + PairLineSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
out += KeyValueLineSeparator;
|
out += PairLineSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
@@ -131,21 +131,21 @@ public class SectionedKeyValueStore
|
|||||||
|
|
||||||
// Parse out the pairs within the section, split them all out.
|
// Parse out the pairs within the section, split them all out.
|
||||||
String unparsedPairs = section.substring(pos + 1);
|
String unparsedPairs = section.substring(pos + 1);
|
||||||
String[] pairs = unparsedPairs.split("\\" + KeyValueLineSeparator);
|
String[] pairs = unparsedPairs.split("\\" + PairLineSeparator);
|
||||||
|
|
||||||
// Parse out valid key-value pairs, and store them in the specified section.
|
// Parse out valid key-value pairs, and store them in the specified section.
|
||||||
// At this point, we can be guarenteed that sectionName is in the Hashmap.
|
// At this point, we can be guarenteed that sectionName is in the Hashmap.
|
||||||
for(int pair = 0; pair < pairs.length; ++pair)
|
for(int pair = 0; pair < pairs.length; ++pair)
|
||||||
{
|
{
|
||||||
String line = pairs[pair];
|
String line = pairs[pair];
|
||||||
int splitPos = line.indexOf(KeyValueSplit);
|
int splitPos = line.indexOf(PairSplit);
|
||||||
if(splitPos < 0)
|
if(splitPos < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String key = line.substring(0, splitPos);
|
String key = line.substring(0, splitPos);
|
||||||
String value = line.substring(splitPos + KeyValueSplit.length());
|
String value = line.substring(splitPos + PairSplit.length());
|
||||||
sectionKeyValue.get(sectionName).putIfAbsent(key, value);
|
taggedPairs.get(sectionName).putIfAbsent(key, value);
|
||||||
keyValue.putIfAbsent(key, value);
|
allPairs.putIfAbsent(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,28 +165,28 @@ public class SectionedKeyValueStore
|
|||||||
public void AddKeyValue(String sectionName, String key, String value)
|
public void AddKeyValue(String sectionName, String key, String value)
|
||||||
{
|
{
|
||||||
AddSection(sectionName);
|
AddSection(sectionName);
|
||||||
sectionKeyValue.get(sectionName).putIfAbsent(key, value);
|
taggedPairs.get(sectionName).putIfAbsent(key, value);
|
||||||
keyValue.putIfAbsent(key, value);
|
allPairs.putIfAbsent(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds a given section to the hashmap if it's not already present
|
// Adds a given section to the hashmap if it's not already present
|
||||||
public void AddSection(String sectionName)
|
public void AddSection(String sectionName)
|
||||||
{
|
{
|
||||||
sectionKeyValue.putIfAbsent(sectionName, new HashMap<String, String>());
|
taggedPairs.putIfAbsent(sectionName, new HashMap<String, String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a HashMap of Keys to Values for a given section
|
// Returns a HashMap of Keys to Values for a given section
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public HashMap<String, String> GetSection(String sectionName)
|
public HashMap<String, String> GetSection(String sectionName)
|
||||||
{
|
{
|
||||||
return (HashMap<String, String>) sectionKeyValue.get(sectionName).clone();
|
return (HashMap<String, String>) taggedPairs.get(sectionName).clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look up a global key
|
// Look up a global key
|
||||||
public String GetKey(String key)
|
public String GetKey(String key)
|
||||||
{
|
{
|
||||||
if(keyValue.containsKey(key))
|
if(allPairs.containsKey(key))
|
||||||
return keyValue.get(key);
|
return allPairs.get(key);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
+4
-8
@@ -13,7 +13,6 @@ import net.dv8tion.jda.core.entities.*;
|
|||||||
import net.dv8tion.jda.core.events.message.guild.*;
|
import net.dv8tion.jda.core.events.message.guild.*;
|
||||||
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
||||||
import offline.*;
|
import offline.*;
|
||||||
import core.Localizer;
|
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
import net.dv8tion.jda.core.*;
|
import net.dv8tion.jda.core.*;
|
||||||
|
|
||||||
@@ -26,6 +25,7 @@ public class Main extends ListenerAdapter
|
|||||||
// Variables and stuff
|
// Variables and stuff
|
||||||
private static JDA kitty;
|
private static JDA kitty;
|
||||||
private static CommandManager commandManager;
|
private static CommandManager commandManager;
|
||||||
|
private static CommandEnabler commandEnabler;
|
||||||
private static DatabaseManager databaseManager;
|
private static DatabaseManager databaseManager;
|
||||||
private static Stats stats;
|
private static Stats stats;
|
||||||
private static RPManager rpManager;
|
private static RPManager rpManager;
|
||||||
@@ -33,14 +33,10 @@ public class Main extends ListenerAdapter
|
|||||||
// Main test location
|
// Main test location
|
||||||
public static void main(String[] args) throws InterruptedException, LoginException, Exception
|
public static void main(String[] args) throws InterruptedException, LoginException, Exception
|
||||||
{
|
{
|
||||||
// Localizer startup - Potentially integrate with the factory. Needs to happen first tho.
|
// Factory startup. The ordering is intentional.
|
||||||
Localizer.UpdateLocFromDisk();
|
|
||||||
Localizer.ScrapeAll();
|
|
||||||
Localizer.SaveLocToDisk();
|
|
||||||
|
|
||||||
// Factory startup
|
|
||||||
databaseManager = ObjectBuilderFactory.ConstructDatabaseManager();
|
databaseManager = ObjectBuilderFactory.ConstructDatabaseManager();
|
||||||
commandManager = ObjectBuilderFactory.ConstructCommandManager();
|
commandEnabler = ObjectBuilderFactory.ConstructCommandEnabler();
|
||||||
|
commandManager = ObjectBuilderFactory.ConstructCommandManager(commandEnabler);
|
||||||
rpManager = ObjectBuilderFactory.ConstructRPManager();
|
rpManager = ObjectBuilderFactory.ConstructRPManager();
|
||||||
stats = ObjectBuilderFactory.ConstructStats(commandManager);
|
stats = ObjectBuilderFactory.ConstructStats(commandManager);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package utils;
|
package utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -11,6 +12,7 @@ import java.util.stream.Stream;
|
|||||||
public class FileUtils
|
public class FileUtils
|
||||||
{
|
{
|
||||||
// Reads all lines from a file as a string
|
// Reads all lines from a file as a string
|
||||||
|
public static String ReadContent(File file) { return ReadContent(file.toPath()); }
|
||||||
public static String ReadContent(Path filePath)
|
public static String ReadContent(Path filePath)
|
||||||
{
|
{
|
||||||
StringBuilder contentBuilder = new StringBuilder();
|
StringBuilder contentBuilder = new StringBuilder();
|
||||||
@@ -24,7 +26,7 @@ public class FileUtils
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
GlobalLog.Error(LogFilter.Util, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return contentBuilder.toString();
|
return contentBuilder.toString();
|
||||||
@@ -35,13 +37,18 @@ public class FileUtils
|
|||||||
{
|
{
|
||||||
ArrayList<Path> items = new ArrayList<Path>();
|
ArrayList<Path> items = new ArrayList<Path>();
|
||||||
|
|
||||||
|
File tmpDir = new File(startingDir);
|
||||||
|
if(!tmpDir.exists())
|
||||||
|
return new ArrayList<Path>();
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Files.find(Paths.get(startingDir), 999, (path, attributes) -> attributes.isRegularFile()).forEach(items::add);
|
Files.find(Paths.get(startingDir), 999, (path, attributes) -> attributes.isRegularFile()).forEach(items::add);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
GlobalLog.Error(LogFilter.Util, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
|||||||
Reference in New Issue
Block a user