From 091e06e4fff2f387d2eb7daf7510bc40edee5e0a Mon Sep 17 00:00:00 2001 From: Matthew Cech Date: Wed, 19 Jun 2019 23:00:21 -0700 Subject: [PATCH] = moved plugins and localization --- commands.config => assets/commands.config | 0 .../locCommands.config | 2 +- locStrings.config => assets/locStrings.config | 0 {plugins => assets/plugins}/example.lua | 0 {plugins => assets/plugins}/forbiddenword.lua | 36 +++++++++---------- src/commands/CommandTeey.java | 3 +- src/commands/CommandYeet.java | 3 +- .../benchmark/BenchmarkCommandCompare.java | 2 +- .../benchmark/BenchmarkCommandInfo.java | 2 +- src/core/ObjectBuilderFactory.java | 2 +- src/core/benchmark/BenchmarkManager.java | 3 +- 11 files changed, 28 insertions(+), 25 deletions(-) rename commands.config => assets/commands.config (100%) rename locCommands.config => assets/locCommands.config (99%) rename locStrings.config => assets/locStrings.config (100%) rename {plugins => assets/plugins}/example.lua (100%) rename {plugins => assets/plugins}/forbiddenword.lua (97%) diff --git a/commands.config b/assets/commands.config similarity index 100% rename from commands.config rename to assets/commands.config diff --git a/locCommands.config b/assets/locCommands.config similarity index 99% rename from locCommands.config rename to assets/locCommands.config index 3a35955..75cb78a 100644 --- a/locCommands.config +++ b/assets/locCommands.config @@ -58,4 +58,4 @@ fetch= crouton= invite= - + diff --git a/locStrings.config b/assets/locStrings.config similarity index 100% rename from locStrings.config rename to assets/locStrings.config diff --git a/plugins/example.lua b/assets/plugins/example.lua similarity index 100% rename from plugins/example.lua rename to assets/plugins/example.lua diff --git a/plugins/forbiddenword.lua b/assets/plugins/forbiddenword.lua similarity index 97% rename from plugins/forbiddenword.lua rename to assets/plugins/forbiddenword.lua index c6dd63c..d9417c3 100644 --- a/plugins/forbiddenword.lua +++ b/assets/plugins/forbiddenword.lua @@ -1,19 +1,19 @@ -local time = os.time(); - -function plugin(message, user) - if(string.match(string.lower(message), "purple"))then - local timedif = os.time() - time; - time = os.time(); - days = (timedif / (60*60*24)); - hours = ((timedif / (60*60)) % 24); - mins = ((timedif / (60)) % 60); - secs = timedif % 60; - return "*GASP!!!* \n" .. user.name .. " said **THE** word! It's been " .. round(days) .. " days, " .. round(hours) .. " hours, " .. round(mins) .. " minutes, and " .. round(secs) .. " seconds since the last time!"; - end - - return nil; -end - -function round(num) - return math.floor(num + 0.5) +local time = os.time(); + +function plugin(message, user) + if(string.match(string.lower(message), "purple"))then + local timedif = os.time() - time; + time = os.time(); + days = (timedif / (60*60*24)); + hours = ((timedif / (60*60)) % 24); + mins = ((timedif / (60)) % 60); + secs = timedif % 60; + return "*GASP!!!* \n" .. user.name .. " said **THE** word! It's been " .. round(days) .. " days, " .. round(hours) .. " hours, " .. round(mins) .. " minutes, and " .. round(secs) .. " seconds since the last time!"; + 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/CommandTeey.java b/src/commands/CommandTeey.java index c98d0b2..e25a9b8 100644 --- a/src/commands/CommandTeey.java +++ b/src/commands/CommandTeey.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import core.Command; +import core.Config; import core.LocStrings; import dataStructures.KittyChannel; import dataStructures.KittyGuild; @@ -53,7 +54,7 @@ public class CommandTeey extends Command return; teeyeeFile = new File(yeeteeFilename); - ImageOverlayBuilder builder = new ImageOverlayBuilder("assets/teey/frames/", "teey ", 24, 18); + ImageOverlayBuilder builder = new ImageOverlayBuilder(Config.AssetDirectory + "teey/frames/", "teey ", 24, 18); builder.overlay(ImageIO.read(teeyeeFile), name); } catch (IOException e) diff --git a/src/commands/CommandYeet.java b/src/commands/CommandYeet.java index 71c5a63..ecfc18a 100644 --- a/src/commands/CommandYeet.java +++ b/src/commands/CommandYeet.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import core.Command; +import core.Config; import core.LocStrings; import dataStructures.KittyChannel; import dataStructures.KittyGuild; @@ -53,7 +54,7 @@ public class CommandYeet extends Command return; yeeteeFile = new File(yeeteeFilename); - ImageOverlayBuilder builder = new ImageOverlayBuilder("assets/yeet/frames/", "yeet ", 24, 18); + ImageOverlayBuilder builder = new ImageOverlayBuilder(Config.AssetDirectory + "yeet/frames/", "yeet ", 24, 18); builder.overlay(ImageIO.read(yeeteeFile), name); } catch (IOException e) diff --git a/src/commands/benchmark/BenchmarkCommandCompare.java b/src/commands/benchmark/BenchmarkCommandCompare.java index 1052091..6870a87 100644 --- a/src/commands/benchmark/BenchmarkCommandCompare.java +++ b/src/commands/benchmark/BenchmarkCommandCompare.java @@ -29,7 +29,7 @@ public class BenchmarkCommandCompare extends BenchmarkCommand if(entries.size() < 1) output += "Couldn't find any models containing `" + inputSplit[i] + "`!"; - output += BenchmarkCommandInfo.FormatInfo(entries.get(0)); + output += BenchmarkCommandInfo.formatInfo(entries.get(0)); output += lineDelimiter; if(entries.size() > 1) diff --git a/src/commands/benchmark/BenchmarkCommandInfo.java b/src/commands/benchmark/BenchmarkCommandInfo.java index 676f288..62d08c9 100644 --- a/src/commands/benchmark/BenchmarkCommandInfo.java +++ b/src/commands/benchmark/BenchmarkCommandInfo.java @@ -14,7 +14,7 @@ public class BenchmarkCommandInfo extends BenchmarkCommand { static final String lineDelimiter = "\n"; - public static String FormatInfo(BenchmarkEntry entry) + public static String formatInfo(BenchmarkEntry entry) { String output = ""; diff --git a/src/core/ObjectBuilderFactory.java b/src/core/ObjectBuilderFactory.java index 640157b..986187f 100644 --- a/src/core/ObjectBuilderFactory.java +++ b/src/core/ObjectBuilderFactory.java @@ -492,7 +492,7 @@ public class ObjectBuilderFactory lazyInit(); if(pluginManager == null) - pluginManager = new PluginManager("./plugins/"); + pluginManager = new PluginManager(Config.AssetDirectory + "plugins/"); return pluginManager; } diff --git a/src/core/benchmark/BenchmarkManager.java b/src/core/benchmark/BenchmarkManager.java index 04e9909..bb9711e 100644 --- a/src/core/benchmark/BenchmarkManager.java +++ b/src/core/benchmark/BenchmarkManager.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import core.Config; import dataStructures.Pair; import utils.io.DirectoryMonitor; import utils.io.FileUtils; @@ -16,7 +17,7 @@ import utils.io.MonitoredFile; public class BenchmarkManager { // Variables - public final String directory = "assets/userbench/"; + public final String directory = Config.AssetDirectory + "userbench/"; public final String extension = ".csv"; public final String lineDelimiter = "\n";