diff --git a/.gitignore b/.gitignore index cabdf8d..a79a764 100644 --- a/.gitignore +++ b/.gitignore @@ -62,4 +62,6 @@ db/ RP\.txt rp\.txt Rp\.txt -rP\.txt \ No newline at end of file +rP\.txt + +.log \ No newline at end of file diff --git a/OutputLog.txt b/OutputLog.txt index 2d1b8f4..939bf86 100644 --- a/OutputLog.txt +++ b/OutputLog.txt @@ -226,8 +226,3 @@ [Log] [Core] Command registered under key blur [Log] [Core] Command registered under key eightball [Log] [Core] Command registered under key 8ball -[Log] [Plugin] Created new PluginLoader lua environment -[Log] [Database] CreateGeyKey: key-392895005024452620 -[Log] [Database] CreateGeyKey: key-392895005024452620147407528874082304 -[Log] [Database] CreateSetKey: Key-392895005024452620 value-! -[Log] [Database] CreateSetKey: Key-392895005024452620147407528874082304 value-273,4 diff --git a/commands.config b/commands.config index 257a7e9..a74d196 100644 --- a/commands.config +++ b/commands.config @@ -39,3 +39,4 @@ guildroleremove=1 guildroleadd=1 guildroleallowed=1 fetch=1 +guildrolenotallowed=1 diff --git a/locCommands.config b/locCommands.config index 93af80c..6bd349a 100644 --- a/locCommands.config +++ b/locCommands.config @@ -12,6 +12,7 @@ blur= choose= poll= rpstart= +guildrolenotallowed= bet= perish, thenperish= teey= diff --git a/locStrings.config b/locStrings.config index b6e48f9..78593ee 100644 --- a/locStrings.config +++ b/locStrings.config @@ -1,6 +1,11 @@ [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 +[CommandGuildRoleNotAllowed] +GuildRoleNotAllowedFailure= +GuildRoleNotAllowedSuccess= +GuildRoleNotAllowedInfo= + [CommandBeansShow] BeansShowDisplay=You have %s beans! BeansShowInfo=Displays how many beans you have @@ -33,8 +38,8 @@ GuildRoleAddInfo=Add a role to yourself! [CommandRole] RoleInfo=Will show the current role you have, Admins can change others roles with input of 'role x @y' with x being blacklist, general, mod, or admin. Blacklist will not allow the user to interact with kitty anymore, general mod and admin will give the user access to those commands. -RoleStandardResponse=Your role is -RoleError=You aren't allowed to do that! You must have the KittyRole '%' or higher! +RoleStandardResponse=Your role is %s +RoleError=You aren't allowed to do that! You must have the KittyRole '%s' or higher! RoleChanged=Changed %s to role `%s`! RoleNeededRole=Please enter `general`, `mod`, or `admin`! diff --git a/plugins/forbiddenword.lua b/plugins/forbiddenword.lua index 8d81326..ebdbb46 100644 --- a/plugins/forbiddenword.lua +++ b/plugins/forbiddenword.lua @@ -2,10 +2,18 @@ local time = os.time(); function plugin(message) if(string.match(message, "purple"))then - local response = os.time() - time; + local timedif = os.time() - time; time = os.time(); - return response; + days = (timedif / (60*60*24)); + hours = ((timedif / (60*60)) % 24); + mins = ((timedif / (60)) % 60); + secs = timedif % 60; + return round(days) .. " " .. round(hours) .. " " .. round(mins) .. " " .. round(secs); end return nil; +end + +function round(num) + return math.floor(num + 0.5) end \ No newline at end of file diff --git a/src/commands/CommandGuildRoleNotAllowed.java b/src/commands/CommandGuildRoleNotAllowed.java new file mode 100644 index 0000000..3d12593 --- /dev/null +++ b/src/commands/CommandGuildRoleNotAllowed.java @@ -0,0 +1,39 @@ +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 CommandGuildRoleNotAllowed extends Command +{ + public CommandGuildRoleNotAllowed(KittyRole level, KittyRating rating) { super(level, rating); } + + @Override + public String HelpText() { return LocStrings.Stub("GuildRoleNotAllowedInfo"); } + + @Override + public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) + { + String [] roles = input.args.split(","); + String role; + for(int i = 0; i < roles.length; i++) + { + role = roles[i].trim(); + if(guild.allowedRole.contains(role)) + { + guild.allowedRole.remove(role); + res.Call(LocStrings.Stub("GuildRoleNotAllowedSuccess")); + } + else + { + res.Call(String.format(LocStrings.Stub("GuildRoleNotAllowedFailure"), role)); + } + } + } +} \ No newline at end of file diff --git a/src/core/ObjectBuilderFactory.java b/src/core/ObjectBuilderFactory.java index ada6602..484cca9 100644 --- a/src/core/ObjectBuilderFactory.java +++ b/src/core/ObjectBuilderFactory.java @@ -342,6 +342,7 @@ public class ObjectBuilderFactory manager.Register(LocCommands.Stub("rating"), new CommandRating(KittyRole.Admin, KittyRating.Safe)); manager.Register(LocCommands.Stub("indicator"), new CommandChangeIndicator(KittyRole.Admin, KittyRating.Safe)); manager.Register(LocCommands.Stub("guildroleallowed"), new CommandGuildRoleAllowed(KittyRole.Admin, KittyRating.Safe)); + manager.Register(LocCommands.Stub("guildrolenotallowed"), new CommandGuildRoleNotAllowed(KittyRole.Admin, KittyRating.Safe)); manager.Register(LocCommands.Stub("poll"), new CommandPollManage(KittyRole.Mod, KittyRating.Safe)); manager.Register(LocCommands.Stub("givebeans"), new CommandGiveBeans(KittyRole.Mod, KittyRating.Safe)); diff --git a/src/core/lua/Plugin.java b/src/core/lua/Plugin.java index 67c97d9..c9f3808 100644 --- a/src/core/lua/Plugin.java +++ b/src/core/lua/Plugin.java @@ -36,11 +36,9 @@ public class Plugin contents = contentBuilder.toString(); globals = JsePlatform.standardGlobals(); - + globals.load(contents).call(); func_plugin = globals.get("plugin"); - - String output = null; } catch (IOException e) { diff --git a/src/utils/GlobalLog.java b/src/utils/GlobalLog.java index 81777c9..5914d59 100644 --- a/src/utils/GlobalLog.java +++ b/src/utils/GlobalLog.java @@ -3,6 +3,9 @@ package utils; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; public class GlobalLog { @@ -14,7 +17,9 @@ public class GlobalLog public static void initialize() throws FileNotFoundException, UnsupportedEncodingException { - outputLog = new PrintWriter("OutputLog.txt", "UTF-8"); + DateFormat dF = new SimpleDateFormat("yyyy_MM_dd_HH-mm"); + Date today = new Date(); + outputLog = new PrintWriter((dF.format(today) + ".log"), "UTF-8"); } private static void Write(String status, LogFilter filter, String body)