Merge branch 'develop'
This commit is contained in:
@@ -43,3 +43,4 @@ guildrolenotallowed=1
|
||||
catch=1
|
||||
guildrolelist=1
|
||||
benchmark, bench=1
|
||||
bethistory=1
|
||||
|
||||
@@ -6,6 +6,7 @@ yeet=
|
||||
role=
|
||||
guildroleremove=
|
||||
ping=
|
||||
bethistory=
|
||||
benchmark, bench=
|
||||
rating=
|
||||
roll=
|
||||
|
||||
@@ -10,11 +10,16 @@ GuildRoleNotAllowedFailure=
|
||||
GuildRoleNotAllowedSuccess=
|
||||
GuildRoleNotAllowedInfo=
|
||||
|
||||
[CommandBetHistory]
|
||||
BetHistoryOutput=Kitty has %s beans!
|
||||
BetHistoryInfo=Sees the amount of beans Kitty has earned through your bets!
|
||||
|
||||
[CommandCatch]
|
||||
CatchInfo=
|
||||
|
||||
[CommandBeansShow]
|
||||
BeansShowDisplay=You have %s beans!
|
||||
BeansShowMentioned=I looked it up and %sbeans!
|
||||
BeansShowInfo=Displays how many beans you have
|
||||
|
||||
[CommandGuildRoleList]
|
||||
|
||||
@@ -14,6 +14,16 @@ public class CommandBeansShow extends Command
|
||||
@Override
|
||||
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)
|
||||
{
|
||||
res.Call(LocStrings.Stub("BetBeansLose"));
|
||||
guild.beans.Add(bet);
|
||||
return;
|
||||
}
|
||||
|
||||
user.ChangeBeans(bet*win);
|
||||
guild.beans.Subtract(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)
|
||||
{
|
||||
if ((op1 == '*' || op1 == '/') && (op2 == '+' || op2 == '-'))
|
||||
if ((op2 == '*' || op2 == '/') && (op1 == '+' || op1 == '-'))
|
||||
return false;
|
||||
else
|
||||
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("catch"), new CommandCatch(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));
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package dataStructures;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import core.DatabaseManager;
|
||||
import core.DatabaseTrackedObject;
|
||||
import utils.AdminControl;
|
||||
|
||||
@@ -27,6 +29,12 @@ public class KittyGuild extends DatabaseTrackedObject
|
||||
|
||||
private String commandIndicator;
|
||||
|
||||
private void RegisterTrackedObjects()
|
||||
{
|
||||
DatabaseManager.instance.Register(roleList);
|
||||
DatabaseManager.instance.Register(beans);
|
||||
}
|
||||
|
||||
// Default content for a guild
|
||||
public KittyGuild(String uniqueID, AdminControl adminControl, ArrayList <String> emoji)
|
||||
{
|
||||
@@ -34,6 +42,7 @@ public class KittyGuild extends DatabaseTrackedObject
|
||||
this.uniqueID = uniqueID;
|
||||
roleList = new KittyTrackedVector(roleListName, uniqueID);
|
||||
beans = new KittyTrackedLong(beansName, uniqueID);
|
||||
RegisterTrackedObjects();
|
||||
|
||||
control = adminControl;
|
||||
this.contentRating = KittyRating.Safe;
|
||||
@@ -49,6 +58,7 @@ public class KittyGuild extends DatabaseTrackedObject
|
||||
this.uniqueID = uniqueID;
|
||||
roleList = new KittyTrackedVector(roleListName, uniqueID);
|
||||
beans = new KittyTrackedLong(beansName, uniqueID);
|
||||
RegisterTrackedObjects();
|
||||
|
||||
SetCommandIndicator(commandIndicator);
|
||||
this.contentRating = contentRating;
|
||||
|
||||
@@ -12,6 +12,7 @@ import utils.LogFilter;
|
||||
// public SomeConstructor(...)
|
||||
// {
|
||||
// myValue = new KittyTrackedLong("friendlyName", this.UniqueID);
|
||||
// DatabaseManager.instance.Register(myValue);
|
||||
// }
|
||||
//
|
||||
public class KittyTrackedLong extends DatabaseTrackedObject
|
||||
@@ -72,7 +73,7 @@ public class KittyTrackedLong extends DatabaseTrackedObject
|
||||
catch(Exception e)
|
||||
{
|
||||
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
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package utils.io;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@@ -11,8 +10,6 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
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
|
||||
// for external stability and support
|
||||
|
||||
Reference in New Issue
Block a user