Merge branch 'develop'
This commit is contained in:
@@ -43,3 +43,4 @@ guildrolenotallowed=1
|
|||||||
catch=1
|
catch=1
|
||||||
guildrolelist=1
|
guildrolelist=1
|
||||||
benchmark, bench=1
|
benchmark, bench=1
|
||||||
|
bethistory=1
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ yeet=
|
|||||||
role=
|
role=
|
||||||
guildroleremove=
|
guildroleremove=
|
||||||
ping=
|
ping=
|
||||||
|
bethistory=
|
||||||
benchmark, bench=
|
benchmark, bench=
|
||||||
rating=
|
rating=
|
||||||
roll=
|
roll=
|
||||||
|
|||||||
@@ -10,11 +10,16 @@ GuildRoleNotAllowedFailure=
|
|||||||
GuildRoleNotAllowedSuccess=
|
GuildRoleNotAllowedSuccess=
|
||||||
GuildRoleNotAllowedInfo=
|
GuildRoleNotAllowedInfo=
|
||||||
|
|
||||||
|
[CommandBetHistory]
|
||||||
|
BetHistoryOutput=Kitty has %s beans!
|
||||||
|
BetHistoryInfo=Sees the amount of beans Kitty has earned through your bets!
|
||||||
|
|
||||||
[CommandCatch]
|
[CommandCatch]
|
||||||
CatchInfo=
|
CatchInfo=
|
||||||
|
|
||||||
[CommandBeansShow]
|
[CommandBeansShow]
|
||||||
BeansShowDisplay=You have %s beans!
|
BeansShowDisplay=You have %s beans!
|
||||||
|
BeansShowMentioned=I looked it up and %sbeans!
|
||||||
BeansShowInfo=Displays how many beans you have
|
BeansShowInfo=Displays how many beans you have
|
||||||
|
|
||||||
[CommandGuildRoleList]
|
[CommandGuildRoleList]
|
||||||
|
|||||||
@@ -14,6 +14,16 @@ public class CommandBeansShow extends Command
|
|||||||
@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(LocStrings.Stub("BeansShowDisplay"), user.GetBeans()));
|
if(input.mentions == null)
|
||||||
|
res.Call(String.format(LocStrings.Stub("BeansShowDisplay"), user.GetBeans()));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String mentionedBeans = "";
|
||||||
|
for(KittyUser mentioned:input.mentions)
|
||||||
|
{
|
||||||
|
mentionedBeans += mentioned.name + " has " + mentioned.GetBeans() + " ";
|
||||||
|
}
|
||||||
|
res.Call(String.format(LocStrings.Stub("BeansShowMentioned"), mentionedBeans));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,10 +52,12 @@ public class CommandBetBeans extends Command
|
|||||||
if(win == 0)
|
if(win == 0)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.Stub("BetBeansLose"));
|
res.Call(LocStrings.Stub("BetBeansLose"));
|
||||||
|
guild.beans.Add(bet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.ChangeBeans(bet*win);
|
user.ChangeBeans(bet*win);
|
||||||
|
guild.beans.Subtract(bet*win);
|
||||||
res.Call(String.format(LocStrings.Stub("BetBeansWin"), "" + (bet*win)));
|
res.Call(String.format(LocStrings.Stub("BetBeansWin"), "" + (bet*win)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package commands;
|
||||||
|
|
||||||
|
import core.Command;
|
||||||
|
import core.LocStrings;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.Response;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class CommandBetHistory extends Command
|
||||||
|
{
|
||||||
|
public CommandBetHistory(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String HelpText() { return LocStrings.Stub("BetHistoryInfo"); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
|
{
|
||||||
|
res.Call(String.format(LocStrings.Stub("BetHistoryOutput"), guild.beans.Get()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -166,7 +166,7 @@ public class CommandRoll extends Command
|
|||||||
|
|
||||||
private boolean hasPrecendence(char op1, char op2)
|
private boolean hasPrecendence(char op1, char op2)
|
||||||
{
|
{
|
||||||
if ((op1 == '*' || op1 == '/') && (op2 == '+' || op2 == '-'))
|
if ((op2 == '*' || op2 == '/') && (op1 == '+' || op1 == '-'))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
if ((op2 == 'd') && (op1 == '+' || op1 == '-' || op1 == '*' || op1 == '/'))
|
if ((op2 == 'd') && (op1 == '+' || op1 == '-' || op1 == '*' || op1 == '/'))
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ public class ObjectBuilderFactory
|
|||||||
manager.Register(LocCommands.Stub("eightball, 8ball"), new CommandEightBall(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("eightball, 8ball"), new CommandEightBall(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register(LocCommands.Stub("catch"), new CommandCatch(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("catch"), new CommandCatch(KittyRole.General, KittyRating.Safe));
|
||||||
manager.Register(LocCommands.Stub("guildrolelist"), new CommandGuildRoleList(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("guildrolelist"), new CommandGuildRoleList(KittyRole.General, KittyRating.Safe));
|
||||||
|
manager.Register(LocCommands.Stub("bethistory"), new CommandBetHistory(KittyRole.General, KittyRating.Safe));
|
||||||
|
|
||||||
manager.Register(LocCommands.Stub("benchmark, bench"), new CommandBenchmark(KittyRole.General, KittyRating.Safe));
|
manager.Register(LocCommands.Stub("benchmark, bench"), new CommandBenchmark(KittyRole.General, KittyRating.Safe));
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package dataStructures;
|
package dataStructures;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import core.DatabaseManager;
|
||||||
import core.DatabaseTrackedObject;
|
import core.DatabaseTrackedObject;
|
||||||
import utils.AdminControl;
|
import utils.AdminControl;
|
||||||
|
|
||||||
@@ -27,6 +29,12 @@ public class KittyGuild extends DatabaseTrackedObject
|
|||||||
|
|
||||||
private String commandIndicator;
|
private String commandIndicator;
|
||||||
|
|
||||||
|
private void RegisterTrackedObjects()
|
||||||
|
{
|
||||||
|
DatabaseManager.instance.Register(roleList);
|
||||||
|
DatabaseManager.instance.Register(beans);
|
||||||
|
}
|
||||||
|
|
||||||
// Default content for a guild
|
// Default content for a guild
|
||||||
public KittyGuild(String uniqueID, AdminControl adminControl, ArrayList <String> emoji)
|
public KittyGuild(String uniqueID, AdminControl adminControl, ArrayList <String> emoji)
|
||||||
{
|
{
|
||||||
@@ -34,6 +42,7 @@ public class KittyGuild extends DatabaseTrackedObject
|
|||||||
this.uniqueID = uniqueID;
|
this.uniqueID = uniqueID;
|
||||||
roleList = new KittyTrackedVector(roleListName, uniqueID);
|
roleList = new KittyTrackedVector(roleListName, uniqueID);
|
||||||
beans = new KittyTrackedLong(beansName, uniqueID);
|
beans = new KittyTrackedLong(beansName, uniqueID);
|
||||||
|
RegisterTrackedObjects();
|
||||||
|
|
||||||
control = adminControl;
|
control = adminControl;
|
||||||
this.contentRating = KittyRating.Safe;
|
this.contentRating = KittyRating.Safe;
|
||||||
@@ -49,6 +58,7 @@ public class KittyGuild extends DatabaseTrackedObject
|
|||||||
this.uniqueID = uniqueID;
|
this.uniqueID = uniqueID;
|
||||||
roleList = new KittyTrackedVector(roleListName, uniqueID);
|
roleList = new KittyTrackedVector(roleListName, uniqueID);
|
||||||
beans = new KittyTrackedLong(beansName, uniqueID);
|
beans = new KittyTrackedLong(beansName, uniqueID);
|
||||||
|
RegisterTrackedObjects();
|
||||||
|
|
||||||
SetCommandIndicator(commandIndicator);
|
SetCommandIndicator(commandIndicator);
|
||||||
this.contentRating = contentRating;
|
this.contentRating = contentRating;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import utils.LogFilter;
|
|||||||
// public SomeConstructor(...)
|
// public SomeConstructor(...)
|
||||||
// {
|
// {
|
||||||
// myValue = new KittyTrackedLong("friendlyName", this.UniqueID);
|
// myValue = new KittyTrackedLong("friendlyName", this.UniqueID);
|
||||||
|
// DatabaseManager.instance.Register(myValue);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
public class KittyTrackedLong extends DatabaseTrackedObject
|
public class KittyTrackedLong extends DatabaseTrackedObject
|
||||||
@@ -72,7 +73,7 @@ public class KittyTrackedLong extends DatabaseTrackedObject
|
|||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
tracked = 0;
|
tracked = 0;
|
||||||
GlobalLog.Error(LogFilter.Core, "Failed to deserialize long with database ID " + databaseID);
|
GlobalLog.Error(LogFilter.Core, "Falling back to default of 0 due to failure to deserialize long with database ID " + databaseID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package utils.io;
|
package utils.io;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.file.Files;
|
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;
|
||||||
@@ -11,8 +10,6 @@ import java.util.function.Consumer;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import utils.FileUtils;
|
import utils.FileUtils;
|
||||||
import utils.GlobalLog;
|
|
||||||
import utils.LogFilter;
|
|
||||||
|
|
||||||
// NOTE: Consider shifting internal behavior to https://docs.oracle.com/javase/tutorial/essential/io/notification.html
|
// NOTE: Consider shifting internal behavior to https://docs.oracle.com/javase/tutorial/essential/io/notification.html
|
||||||
// for external stability and support
|
// for external stability and support
|
||||||
|
|||||||
Reference in New Issue
Block a user