Added SQL support, switched to JSON for configuration and language files (wip).

This commit is contained in:
Malcom Green 2017-06-04 19:00:58 -04:00
parent 752db67c6b
commit 6bbc3f80a3
48 changed files with 4683 additions and 460 deletions

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.google.code.gson:gson:2.3.1">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.3.1/ecb6e1f8e4b0e84c4b886c2f14a1500caf309757/gson-2.3.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.3.1/563dcb685903c96ce8abbd03adf7fa49e19aa8b4/gson-2.3.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.google.guava:guava:18.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/18.0/cce0823396aa693798f8882e64213b1772032b09/guava-18.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/18.0/ad97fe8faaf01a3d3faacecd58e8fa6e78a973ca/guava-18.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.googlecode.json-simple:json-simple:1.1.1">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/c9ad4a0850ab676c5c64461a05ca524cdfff59f1/json-simple-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/15bba08e3a239d54b68209c001f9c911559d2fed/json-simple-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.neovisionaries:nv-websocket-client:1.31">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.neovisionaries/nv-websocket-client/1.31/e101d5221d6315ba4165193e912c0cebe5ef50d5/nv-websocket-client-1.31.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.neovisionaries/nv-websocket-client/1.31/b3db534349f7c5dfa83003436795f7a66cb90376/nv-websocket-client-1.31-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.sedmelluq:lavaplayer:1.2.34">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.sedmelluq/lavaplayer/1.2.34/a6b9299109ad8b3d4631073fc3ca806c057b6db1/lavaplayer-1.2.34.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.sedmelluq/lavaplayer/1.2.34/ec7e2883a41db42c6d9abb91a9186328af23c2ac/lavaplayer-1.2.34-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.sedmelluq:lavaplayer-common:1.0.4">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.sedmelluq/lavaplayer-common/1.0.4/6e838fabecca28108d710a0ddadcb4228d149a59/lavaplayer-common-1.0.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.sedmelluq/lavaplayer-common/1.0.4/9e57e981e2eb49aa3052b3fa6df249862adc0a28/lavaplayer-common-1.0.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: commons-lang:commons-lang:2.6">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.6/ce1edb914c94ebc388f086c6827e8bdeec71ac2/commons-lang-2.6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.6/67313d715fbf0ea4fd0bdb69217fb77f807a8ce5/commons-lang-2.6-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: javax.persistence:persistence-api:1.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.persistence/persistence-api/1.0/5725f57873e05e068803e2bf9d5a8ea3740ffec5/persistence-api-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.persistence/persistence-api/1.0/2773a7910e8f0c7d59749dc4fcef2a4b94fcf85a/persistence-api-1.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: junit:junit:4.10">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.10/e4f1766ce7404a08f45d859fb9c226fc9e41a861/junit-4.10.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.10/6c98d6766e72d5575f96c9479d1c1d3b865c6e25/junit-4.10-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: net.dv8tion:JDA:3.0.0_165">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.dv8tion/JDA/3.0.0_165/fa03b44b0137d675dbeccc4f01f07dbfd6dfcfe3/JDA-3.0.0_165.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.dv8tion/JDA/3.0.0_165/e5676f91f8b73b435bc902bd675aea8fc8bb4ab4/JDA-3.0.0_165-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,12 +0,0 @@
<component name="libraryTable">
<library name="Gradle: net.md-5:bungeecord-chat:1.8-SNAPSHOT">
<CLASSES>
<root url="file://$PROJECT_DIR$/Could not find net.md-5:bungeecord-chat:1.8-SNAPSHOT." />
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.md-5/bungeecord-chat/1.8-SNAPSHOT/e1941628f6d2138bc3d9d5e618b2e23125f859f8/bungeecord-chat-1.8-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.md-5/bungeecord-chat/1.8-SNAPSHOT/36a0ba0630d4e2bae618271e69aa92c7da5ff8e4/bungeecord-chat-1.8-SNAPSHOT-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.avaje:ebean:2.8.1">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.avaje/ebean/2.8.1/70d2120ba676811fb6413056d4eadbdf95556a2f/ebean-2.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.avaje/ebean/2.8.1/d8daef4a7d0c8c265a89a3c063549ffbfdd1ab2a/ebean-2.8.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.bukkit/bukkit/1.8.8-R0.1-SNAPSHOT/b36a658c9d34ece787f48bbaab8dd8a9b800eccc/bukkit-1.8.8-R0.1-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.bukkit/bukkit/1.8.8-R0.1-SNAPSHOT/ef4b4dafefe4d8d9417294495034bdc0b49fed79/bukkit-1.8.8-R0.1-SNAPSHOT-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.hamcrest:hamcrest-core:1.1">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.1/860340562250678d1a344907ac75754e259cdb14/hamcrest-core-1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.1/2ccf1154d1a8936042a8a742dc3e611d02ac7213/hamcrest-core-1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.spigotmc/spigot-api/1.8.8-R0.1-SNAPSHOT/164ca9702b04d7ff5f655e507ceafd9b50e7fca7/spigot-api-1.8.8-R0.1-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.spigotmc/spigot-api/1.8.8-R0.1-SNAPSHOT/de6a0a47d74373540163c01d5984d6f9126031f7/spigot-api-1.8.8-R0.1-SNAPSHOT-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.yaml:snakeyaml:1.15">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.15/3b132bea69e8ee099f416044970997bde80f4ea6/snakeyaml-1.15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.15/7dc55271cad1cf73bb495e372164269e75d9345a/snakeyaml-1.15-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -2,16 +2,35 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="d884bc5a-63a1-4e03-b68b-617ebe9b8e2a" name="Default" comment="">
<change type="MOVED" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/mod/PurgeCommand.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/mod/PurgeMessagesCommand.java" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__com_google_code_gson_gson_2_3_1.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__com_google_guava_guava_18_0.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__com_googlecode_json_simple_json_simple_1_1_1.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__com_neovisionaries_nv_websocket_client_1_31.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__com_sedmelluq_lavaplayer_1_2_34.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__com_sedmelluq_lavaplayer_common_1_0_4.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__commons_lang_commons_lang_2_6.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__javax_persistence_persistence_api_1_0.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__junit_junit_4_10.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__net_dv8tion_JDA_3_0_0_165.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__net_md_5_bungeecord_chat_1_8_SNAPSHOT.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__org_avaje_ebean_2_8_1.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__org_bukkit_bukkit_1_8_8_R0_1_SNAPSHOT.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_1.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__org_spigotmc_spigot_api_1_8_8_R0_1_SNAPSHOT.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/Gradle__org_yaml_snakeyaml_1_15.xml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/build/resources/main/plugin.yml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/src/main/resources/config.yml" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/src/main/resources/plugin.yml" afterPath="" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/database/DatabaseManager.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/DatabaseManager.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/database/mysql/Database.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/mysql/Database.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/database/mysql/mysql/MySQL.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/mysql/mysql/MySQL.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/cache.properties.lock" afterPath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/cache.properties.lock" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/fileHashes.bin" afterPath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/fileHashes.bin" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/fileSnapshots.bin" afterPath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/fileSnapshots.bin" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/taskArtifacts.bin" afterPath="$PROJECT_DIR$/.gradle/2.13/taskArtifacts/taskArtifacts.bin" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/BatchMoveCommand.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/BatchMoveCommand.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/BotEvent.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/BotEvent.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/extras/polls/Poll.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/extras/polls/Poll.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/RixaModule.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/RixaModule.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/levels/LevelsModule.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/levels/LevelsModule.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/music/MusicModule.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/music/MusicModule.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/MessageBuilder.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/MessageBuilder.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/management/GuildSettings.java" afterPath="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/management/GuildSettings.java" />
</list>
<ignored path="Rixa.iws" />
<ignored path=".idea/workspace.xml" />
@ -39,13 +58,13 @@
<favorites_list name="Rixa" />
</component>
<component name="FileEditorManager">
<leaf />
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Enum" />
<option value="Class" />
<option value="Enum" />
</list>
</option>
</component>
@ -296,7 +315,7 @@
<option name="modificationStamps">
<map>
<entry key="$PROJECT_DIR$/../../Rixa" value="2973686032224" />
<entry key="$PROJECT_DIR$" value="2990962290098" />
<entry key="$PROJECT_DIR$" value="2992072975491" />
</map>
</option>
<option name="projectBuildClasspath">
@ -467,12 +486,8 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandHandler.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandType.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/Command.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/InfoCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/management/GuildSettings.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/reactions/react/HelpReaction.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/extras/polls/polls.java" />
@ -498,7 +513,30 @@
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/music/MusicModule.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/levels/LevelsModule.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/database/DatabaseManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/locale/manager/Language.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/locale/manager/Thunderbolt.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/locale/manager/io/ThunderFile.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/locale/manager/LanguageManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/Data.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/locale/Language.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/manager/org/json/JSONObject.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/manager/io/ThunderFile.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/manager/LanguageManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/DatabaseManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/Language.java" />
<option value="$PROJECT_DIR$/src/main/resources/config.json" />
<option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONObject.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/Thunderbolt.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/filemanager/ConfigManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/placeholder/PlaceHolder.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/filemanager/LanguageManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/DataType.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/io/ThunderFile.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/DatabaseManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/Data.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/management/GuildSettings.java" />
</list>
</option>
</component>
@ -521,7 +559,7 @@
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1924" />
<option name="width" value="1936" />
<option name="height" value="1056" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
@ -549,6 +587,10 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane">
<subPane />
</pane>
<pane id="ProjectPane">
<subPane>
<PATH>
@ -667,17 +709,81 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="polls" />
<option name="myItemId" value="guild" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="management" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="data" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="data" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="filemanager" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane">
<subPane />
</pane>
</panes>
</component>
<component name="PropertiesComponent">
@ -694,6 +800,7 @@
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\Timber\Documents\intellij-workspace\Rixa\src\main\java\me\savvy\rixa\locale\manager" />
<recent name="C:\Users\Timber\Documents\intellij-workspace\Rixa" />
</key>
<key name="CopyFile.RECENT_KEYS">
@ -701,6 +808,7 @@
<recent name="C:\Users\Timber\Documents\intellij-workspace\Rixa\src\main\java\me\savvy\rixa\database" />
</key>
<key name="CreateClassDialog.RecentsKey">
<recent name="me.savvy.rixa.data.database" />
<recent name="me.savvy.rixa.utils" />
<recent name="me.savvy.rixa.commands.handlers" />
</key>
@ -1165,12 +1273,14 @@
<workItem from="1495631917684" duration="6266000" />
<workItem from="1495817231915" duration="1710000" />
<workItem from="1495842375568" duration="1902000" />
<workItem from="1496094494787" duration="2534000" />
<workItem from="1496094494787" duration="3131000" />
<workItem from="1496249008336" duration="7193000" />
<workItem from="1496585528802" duration="22765000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="28935000" />
<option name="totallyTimeSpent" value="59490000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -1182,36 +1292,64 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1924" height="1056" extended-state="0" />
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="false" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32932165" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32932165" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32827735" sideWeight="0.50429183" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32827735" sideWeight="0.5107296" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3261105" sideWeight="0.49785408" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32827735" sideWeight="0.49570817" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32827735" sideWeight="0.4892704" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21030043" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.20895523" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32932165" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
<layout-to-restore>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32827735" sideWeight="0.5107296" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32932165" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32932165" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3261105" sideWeight="0.49785408" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32827735" sideWeight="0.4892704" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21030043" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
</layout-to-restore>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
@ -1225,7 +1363,9 @@
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<breakpoint-manager>
<option name="time" value="2" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="antWorkspaceConfiguration">
@ -1233,121 +1373,6 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/reactions/ReactionModule.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1680">
<caret line="60" column="20" selection-start-line="60" selection-start-column="20" selection-end-line="60" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/MessageEvent.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/BatchMoveCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="980">
<caret line="35" column="9" selection-start-line="35" selection-start-column="9" selection-end-line="35" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="31" selection-start-line="6" selection-start-column="31" selection-end-line="6" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/RixaMC.java" />
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandRegistrar.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="196">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/Command.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="28">
<caret line="1" column="0" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandType.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="10" selection-start-line="6" selection-start-column="10" selection-end-line="6" selection-end-column="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-176">
<caret line="18" column="56" selection-start-line="18" selection-start-column="56" selection-end-line="18" selection-end-column="56" />
</state>
</provider>
</entry>
<entry file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.neovisionaries/nv-websocket-client/2.0/9d84093a02dc8e782417935dc12bb3bd85fa2fb3/nv-websocket-client-2.0-sources.jar!/com/neovisionaries/ws/client/ReadingThread.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="107" column="0" selection-start-line="107" selection-start-column="0" selection-end-line="107" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.neovisionaries/nv-websocket-client/2.0/9d84093a02dc8e782417935dc12bb3bd85fa2fb3/nv-websocket-client-2.0-sources.jar!/com/neovisionaries/ws/client/WebSocketThread.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandExec.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="224">
<caret line="8" column="4" selection-start-line="8" selection-start-column="4" selection-end-line="8" selection-end-column="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/HelpCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="17" column="13" selection-start-line="17" selection-start-column="13" selection-end-line="17" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/RixaPermission.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="224">
<caret line="8" column="4" selection-start-line="8" selection-start-column="4" selection-end-line="8" selection-end-column="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/mod/DeleteMessagesCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="279">
<caret line="33" column="12" selection-start-line="33" selection-start-column="12" selection-end-line="33" selection-end-column="181" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/PingCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="111">
@ -1362,7 +1387,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/database/mysql/Database.java">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/mysql/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="308">
<caret line="14" column="22" selection-start-line="14" selection-start-column="22" selection-end-line="14" selection-end-column="22" />
@ -1425,20 +1450,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="617">
<caret line="46" column="79" selection-start-line="46" selection-start-column="79" selection-end-line="46" selection-end-column="79" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/management/GuildSettings.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-671">
<caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/enums/Result.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="140">
@ -1460,13 +1471,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/BatchMoveCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-160">
<caret line="41" column="69" selection-start-line="41" selection-start-column="69" selection-end-line="41" selection-end-column="69" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/BotEvent.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="370">
@ -1509,7 +1513,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/database/mysql/mysql/MySQL.java">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/mysql/mysql/MySQL.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="52" column="11" selection-start-line="52" selection-start-column="11" selection-end-line="52" selection-end-column="11" />
@ -1517,14 +1521,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/database/DatabaseManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-224">
<caret line="11" column="13" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/extras/polls/Poll.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="196">
@ -1533,11 +1529,254 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/utils/Validator.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="56">
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/ItemList.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="308">
<caret line="16" column="13" selection-start-line="16" selection-start-column="13" selection-end-line="16" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONTokener.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="40" column="13" selection-start-line="40" selection-start-column="13" selection-end-line="40" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONString.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="10" column="17" selection-start-line="10" selection-start-column="17" selection-end-line="10" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONStreamAware.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="224">
<caret line="9" column="17" selection-start-line="9" selection-start-column="17" selection-end-line="9" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONException.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONAware.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="17" selection-start-line="6" selection-start-column="17" selection-end-line="6" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONArray.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="83" column="13" selection-start-line="83" selection-start-column="13" selection-end-line="83" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/io/ThunderboltThreadPool.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="5" column="22" selection-start-line="5" selection-start-column="22" selection-end-line="5" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/exceptions/FileLoadException.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="56">
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/ServerInfoCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="118">
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/BatchMoveCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="41" column="69" selection-start-line="41" selection-start-column="69" selection-end-line="41" selection-end-column="69" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="284">
<caret line="15" column="1" selection-start-line="15" selection-start-column="1" selection-end-line="15" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_101/src.zip!/java/util/Map.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="211" column="6" selection-start-line="211" selection-start-column="6" selection-end-line="211" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONObject.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="188">
<caret line="469" column="18" selection-start-line="469" selection-start-column="18" selection-end-line="469" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/placeholder/PlaceHolder.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="140">
<caret line="5" column="26" selection-start-line="5" selection-start-column="26" selection-end-line="5" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/config.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="84">
<caret line="3" column="10" selection-start-line="3" selection-start-column="10" selection-end-line="3" selection-end-column="10" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/Language.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="202">
<caret line="8" column="82" selection-start-line="8" selection-start-column="82" selection-end-line="8" selection-end-column="82" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/HelpCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="196">
<caret line="15" column="13" selection-start-line="15" selection-start-column="13" selection-end-line="15" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/Thunderbolt.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="244">
<caret line="41" column="45" selection-start-line="41" selection-start-column="45" selection-end-line="41" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/filemanager/ConfigManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="28">
<caret line="19" column="48" selection-start-line="19" selection-start-column="48" selection-end-line="19" selection-end-column="48" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/DataType.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="224">
<caret line="8" column="14" selection-start-line="8" selection-start-column="14" selection-end-line="8" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/filemanager/LanguageManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="13" column="19" selection-start-line="13" selection-start-column="19" selection-end-line="13" selection-end-column="19" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/io/ThunderFile.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="281">
<caret line="33" column="40" selection-start-line="33" selection-start-column="40" selection-end-line="33" selection-end-column="40" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/DatabaseManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="76" column="23" selection-start-line="76" selection-start-column="23" selection-end-line="76" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="980">
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="620">
<caret line="132" column="5" selection-start-line="132" selection-start-column="5" selection-end-line="132" selection-end-column="5" />
<folding />
<state relative-caret-position="812">
<caret line="109" column="5" selection-start-line="109" selection-start-column="5" selection-end-line="109" selection-end-column="5" />
<folding>
<element signature="method#main#0;class#Rixa#0" expanded="false" />
<element signature="method#load#0;class#Rixa#0" expanded="false" />
<element signature="method#register#0;class#Rixa#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/management/GuildSettings.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-392">
<caret line="40" column="99" selection-start-line="40" selection-start-column="99" selection-end-line="40" selection-end-column="99" />
<folding>
<element signature="e#3011#3012#0" expanded="true" />
<element signature="e#3045#3046#0" expanded="true" />
<element signature="e#3099#3100#0" expanded="true" />
<element signature="e#3145#3146#0" expanded="true" />
<element signature="e#3180#3181#0" expanded="true" />
<element signature="e#3211#3212#0" expanded="true" />
<element signature="e#3260#3261#0" expanded="true" />
<element signature="e#3300#3301#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/Data.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="328">
<caret line="27" column="81" selection-start-line="27" selection-start-column="81" selection-end-line="27" selection-end-column="81" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>

View File

@ -1,4 +0,0 @@
name: RixaMC
main: me.savvy.RixaMC
author: [Savvy]
version: 1.0

View File

@ -9,7 +9,11 @@ import me.savvy.rixa.commands.handlers.CommandExec;
import me.savvy.rixa.commands.handlers.CommandHandler;
import me.savvy.rixa.commands.mod.DeleteMessagesCommand;
import me.savvy.rixa.commands.mod.PurgeMessagesCommand;
import me.savvy.rixa.database.DatabaseManager;
import me.savvy.rixa.data.database.Data;
import me.savvy.rixa.data.database.DataType;
import me.savvy.rixa.data.database.sql.DatabaseManager;
import me.savvy.rixa.data.filemanager.ConfigManager;
import me.savvy.rixa.data.filemanager.LanguageManager;
import me.savvy.rixa.events.BotEvent;
import me.savvy.rixa.events.MessageEvent;
import me.savvy.rixa.modules.reactions.handlers.ReactionManager;
@ -23,11 +27,8 @@ import net.dv8tion.jda.core.exceptions.RateLimitedException;
import net.dv8tion.jda.core.hooks.AnnotatedEventManager;
import javax.security.auth.login.LoginException;
import java.io.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
/**
@ -35,20 +36,79 @@ import java.util.logging.Logger;
*/
public class Rixa {
private static List<JDA> shardsList;
private static DatabaseManager dbManager;
private static Data data;
private static long timeUp;
private static Rixa instance; // String search = event.getMessage().getContent().substring(event.getMessage().getContent().indexOf(" ") + 1);
private static Map<String, String> config;
private static Rixa instance;
private static List<JDA> shardsList;
private static ConfigManager config;
private static DatabaseManager dbManager;
private LanguageManager languageManager;
// String search = event.getMessage().getContent().substring(event.getMessage().getContent().indexOf(" ") + 1);
public static void main(String[] args) {
instance = new Rixa();
shardsList = new LinkedList<>();
config = new HashMap<>();
populateConfiguration();
config = new ConfigManager();
load();
}
private static void load() {
dbManager = new DatabaseManager(
String.valueOf(config.getConfig().getObjectinObj("sql", "hostName")),
String.valueOf(config.getConfig().getObjectinObj("sql", "portNumber")),
String.valueOf(config.getConfig().getObjectinObj("sql", "databaseName")),
String.valueOf(config.getConfig().getObjectinObj("sql", "userName")),
String.valueOf(config.getConfig().getObjectinObj("sql", "password")));
dbManager.createTable();
getInstance().setLanguageManager(new LanguageManager());
try {
int shards = 3;
for(int i = 0; i < shards; i++) {
Logger.getLogger("Rixa").info("Loading shard #" + i);
JDABuilder jda = new JDABuilder(AccountType.BOT)
.setToken(config.getConfig().getString("secretToken"))
.setEventManager(new AnnotatedEventManager())
.addEventListener(new MessageEvent())
.addEventListener(new BotEvent())
.setGame(Game.of(config.getConfig().getString("botGame")))
.setAutoReconnect(true)
.setStatus(OnlineStatus.ONLINE)
.setAudioEnabled(true)
.useSharding(i, shards);
shardsList.add(jda.buildBlocking());
getInstance().getLogger().info("Shard #" + i + " has been loaded");
}
} catch (LoginException | InterruptedException | RateLimitedException e) {
e.printStackTrace();
}
timeUp = System.currentTimeMillis();
register(new CommandExec[] {
new InfoCommand(), new ServerInfoCommand(), new HelpCommand(),
new DeleteMessagesCommand(), new PingCommand(), new PurgeMessagesCommand(),
new BatchMoveCommand() });
ReactionManager.registerReaction(new HelpReaction());
data = new Data(DataType.SQL);
}
public Data getData() {
return data;
}
public DatabaseManager getDbManager() {
return dbManager;
}
public void setDbManager(DatabaseManager dbManager) {
Rixa.dbManager = dbManager;
}
public LanguageManager getLanguageManager() {
return languageManager;
}
private void setLanguageManager(LanguageManager languageManager) {
this.languageManager = languageManager;
}
private static void register(CommandExec commandExecs[]) {
for (CommandExec command: commandExecs) {
CommandHandler.registerCommand(command);
@ -66,69 +126,4 @@ public class Rixa {
public Logger getLogger() {
return Logger.getLogger("Rixa");
}
private static void load() {
if(!config.containsKey("TOKEN")) {
getInstance().getLogger().severe("Could not find \"TOKEN\" in config.text! Shutting down...");
System.exit(0);
}
dbManager = new DatabaseManager(config.get("SQL_HOSTNAME"), config.get("SQL_PORT"), config.get("SQL_DATABASE"), config.get("SQL_USER"), config.get("SQL_PASSWORD"));
dbManager.createTable();
try {
int shards = 3;
for(int i = 0; i < shards; i++) {
Logger.getLogger("Rixa").info("Loading shard #" + i);
JDABuilder jda = new JDABuilder(AccountType.BOT)
.setToken(config.get("TOKEN"))
.setEventManager(new AnnotatedEventManager())
.addEventListener(new MessageEvent())
.addEventListener(new BotEvent());
if(config.containsKey("GAME")) {
jda.setGame(Game.of(config.get("GAME")));
}
jda.setAutoReconnect(true)
.setStatus(OnlineStatus.ONLINE)
.setAudioEnabled(true)
.useSharding(i, shards);
shardsList.add(jda.buildBlocking());
getInstance().getLogger().info("Shard #" + i + " has been loaded");
}
} catch (LoginException | InterruptedException | RateLimitedException e) {
e.printStackTrace();
}
timeUp = System.currentTimeMillis();
register(new CommandExec[] {
new InfoCommand(), new ServerInfoCommand(), new HelpCommand(),
new DeleteMessagesCommand(), new PingCommand(), new PurgeMessagesCommand(),
new BatchMoveCommand() });
ReactionManager.registerReaction(new HelpReaction());
}
public DatabaseManager getDbManager() {
return dbManager;
}
public void setDbManager(DatabaseManager dbManager) {
this.dbManager = dbManager;
}
private static void populateConfiguration() {
FileReader fileReader = null;
try {
fileReader = new FileReader(new File("config.txt"));
} catch (FileNotFoundException e) {
getInstance().getLogger().severe("Could not find file \"config.text\"! Shutting down...");
System.exit(0);
}
BufferedReader br = new BufferedReader(fileReader);
String line = null;
try {
while ((line = br.readLine()) != null) {
String[] s = line.split(":");
config.put(s[0], s[1]);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,53 @@
package me.savvy.rixa.data.database;
import me.savvy.rixa.Rixa;
import me.savvy.rixa.data.database.sql.DatabaseManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* Created by Timber on 5/31/2017.
*
* This class will be used to grab and put data into databases (SQL, FlatFile)
*/
public class Data {
private DataType dataType;
private DatabaseManager db;
public Data(DataType dataType) {
this.dataType = dataType;
this.db = Rixa.getInstance().getDbManager();
}
public Object get(String key, String value, String objToGet, String table) throws SQLException {
switch (dataType) {
case SQL:
// SELECT guild FROM table WHERE key = value.
PreparedStatement ps =
db.getConnection().prepareStatement("SELECT `" + objToGet + "` FROM `" + table + "` WHERE `" + key + "` = ?");
ps.setString(1, value);
return db.getObject(ps).getObject(objToGet);
default:
return null;
}
}
public void put(String key, String value) {
switch (dataType) {
}
}
public void update(String key, String value) {
switch (dataType) {
}
}
public void delete(String key, String value) {
switch (dataType) {
}
}
}

View File

@ -0,0 +1,10 @@
package me.savvy.rixa.data.database;
/**
* Created by Timber on 6/4/2017.
*/
public enum DataType {
SQL,
FLAT_FILE;
}

View File

@ -1,7 +1,7 @@
package me.savvy.rixa.database;
package me.savvy.rixa.data.database.sql;
import me.savvy.rixa.Rixa;
import me.savvy.rixa.database.mysql.mysql.MySQL;
import me.savvy.rixa.data.database.sql.mysql.mysql.MySQL;
import me.savvy.rixa.enums.Result;
import java.sql.Connection;
@ -71,6 +71,15 @@ public class DatabaseManager {
}
}
public ResultSet getObject(PreparedStatement ps) throws SQLException {
checkConnection();
ResultSet rs = ps.executeQuery();
if(rs.next()) {
return rs;
}
return null;
}
public ResultSet executeQuery(String query) {
checkConnection();
try {

View File

@ -1,4 +1,4 @@
package me.savvy.rixa.database.mysql;
package me.savvy.rixa.data.database.sql.mysql;
import java.sql.Connection;
import java.sql.ResultSet;

View File

@ -1,6 +1,6 @@
package me.savvy.rixa.database.mysql.mysql;
package me.savvy.rixa.data.database.sql.mysql.mysql;
import me.savvy.rixa.database.mysql.Database;
import me.savvy.rixa.data.database.sql.mysql.Database;
import java.sql.Connection;
import java.sql.DriverManager;

View File

@ -0,0 +1,51 @@
package me.savvy.rixa.data.filemanager;
import me.savvy.rixa.data.thunderbolt.Thunderbolt;
import me.savvy.rixa.data.thunderbolt.exceptions.FileLoadException;
import me.savvy.rixa.data.thunderbolt.io.ThunderFile;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Timber on 6/4/2017.
*/
public class ConfigManager {
private ThunderFile tf;
public ConfigManager() {
tf = null;
try {
if(!Thunderbolt.load("config", "Rixa")) {
try {
tf = Thunderbolt.get("config");
addDefaults();
} catch (IOException e) {
e.printStackTrace();
}
}
tf = Thunderbolt.get("config");
} catch (FileLoadException | IOException e) {
e.printStackTrace();
}
}
private void addDefaults() throws IOException {
Map<String, String> map = new HashMap<>();
map.put("hostName", "localhost");
map.put("password", "password");
map.put("databaseName", "rixa");
map.put("userName", "rixa_users");
map.put("portNumber", "3306");
tf.set("sql", map);
tf.set("secretToken", "YOUR_TOKEN_HERE");
tf.set("botGame", "Rixa 2.0 | http://rixa.io/invite");
tf.save();
}
public ThunderFile getConfig() {
return tf;
}
}

View File

@ -0,0 +1,37 @@
package me.savvy.rixa.data.filemanager;
import me.savvy.rixa.data.locale.Language;
import me.savvy.rixa.data.thunderbolt.Thunderbolt;
import me.savvy.rixa.data.thunderbolt.exceptions.FileLoadException;
import me.savvy.rixa.data.thunderbolt.io.ThunderFile;
import java.io.IOException;
/**
* Created by Timber on 5/31/2017.
*/
public class LanguageManager {
private ThunderFile tf;
public LanguageManager() {
tf = null;
try {
if(!Thunderbolt.load("language", "Rixa/language")) {
tf = Thunderbolt.get("language");
addDefaults();
}
} catch (FileLoadException | IOException e) {
e.printStackTrace();
}
}
public ThunderFile getLanguage() {
return tf;
}
private void addDefaults() throws IOException {
for(Language language: Language.values()) {
tf.set(language.getKey(), language.getDefaultValue());
}
tf.save();
}
}

View File

@ -0,0 +1,26 @@
package me.savvy.rixa.data.locale;
/**
* Created by Timber on 5/31/2017.
*/
public enum Language {
NO_PERMISSION("noPermission", "I do not have permission for this!"),
NO_PERMISSION_FOR("noPermissionFor", "Sorry I do not have permission for {0}");
private final String key;
private final String defaultValue;
Language(String key, String defaultValue) {
this.key = key;
this.defaultValue = defaultValue;
}
public String getDefaultValue() {
return defaultValue;
}
public String getKey() {
return key;
}
}

View File

@ -0,0 +1,7 @@
package me.savvy.rixa.data.placeholder;
/**
* Created by Timber on 6/4/2017.
*/
public class PlaceHolder {
}

View File

@ -0,0 +1,165 @@
package me.savvy.rixa.data.thunderbolt;
import me.savvy.rixa.data.thunderbolt.exceptions.FileLoadException;
import me.savvy.rixa.data.thunderbolt.io.ThunderFile;
import me.savvy.rixa.data.thunderbolt.io.ThunderboltThreadPool;
import me.savvy.rixa.data.thunderbolt.utils.Validator;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
public abstract class Thunderbolt {
private final static Map<String, ThunderFile> fileMap = new HashMap<>();
/**
* Get a file by its name. Doesn't require .json extension. This method is thread-safe
*
* <p>This method returns null if the file is not loaded</p>
*
* @param name : The name of the file to get.
*/
public static ThunderFile get(String name) {
name = Validator.checkName(name);
synchronized (fileMap) {
return fileMap.get(name);
}
}
private static ThunderFile create(String name, String path) throws FileLoadException {
name = Validator.checkName(name);
synchronized (fileMap) {
if (!fileMap.containsKey(name)) {
ThunderFile tf = new ThunderFile(name, path);
fileMap.put(name, tf);
return tf;
} else {
throw new FileLoadException(name);
}
}
}
/**
* Load a file into memory.
* <p>
* NOTE: Make sure to call {@link Thunderbolt#unload(String)} when you're done using this file,
* otherwise a memory leak may occur!
*
* @param name : The name of the file to load.
* @param path : The path to the file.
* @throws IOException
* @throws FileLoadException
*/
public static boolean load(String name, String path) throws FileLoadException, IOException {
name = Validator.checkName(name);
boolean contains;
synchronized (fileMap) {
contains = fileMap.containsKey(name);
}
if (!contains) {
File f = new File(path + File.separator + name + ".json");
if (f.exists()) {
ThunderFile tf;
if (f.length() != 0) {
final String s1 = name;
final String s2 = path;
Callable<byte[]> c = () -> Files.readAllBytes(Paths.get(s2 + File.separator + s1 + ".json"));
try {
tf = new ThunderFile(name, path, new String(ThunderboltThreadPool.getPool().submit(c).get()));
} catch(InterruptedException | ExecutionException e) {
tf = new ThunderFile(name, path);
System.out.println("[Thunderbolt] Error loading '" + name + ".json'. Please check for errors and try again.");
}
} else {
tf = new ThunderFile(name, path);
}
fileMap.put(name, tf);
return true;
} else {
create(name, path);
return false;
}
} else {
throw new FileLoadException(name);
}
}
/**
* Unload a file from memory.
*
* @param name : The name of the file to unload
* @throws IllegalArgumentException
*/
public static void unload(String name) {
name = Validator.checkName(name);
ThunderFile file;
synchronized (fileMap) {
file = fileMap.remove(name);
}
if (file == null) {
new FileNotFoundException("[Thunderbolt] The file '" + name + ".json' isn't loaded and/or doesn't exist.")
.printStackTrace();
}
}
/**
* Delete a file and remove it from memory.
*
* @param name : The name of the file to delete
* @throws IOException
*/
public static void delete(String name) {
name = Validator.checkName(name);
ThunderFile tf;
synchronized (fileMap) {
tf = fileMap.remove(name);
}
if (tf == null) {
new FileNotFoundException("[Thunderbolt] The file '" + name + ".json' isn't loaded and/or doesn't exist.")
.printStackTrace();
} else {
delete(name, tf.getPath());
}
}
/**
* Delete a file on disk.
*
* @param name : The name of the file
* @param path : The path to the file
*/
private static void delete(String name, String path) {
name = Validator.checkName(name);
boolean exists;
synchronized (fileMap) {
exists = fileMap.containsKey(name);
}
if (!exists) {
try {
Files.delete(Paths.get(path + File.separator + name + ".json"));
} catch (IOException e) {
e.printStackTrace();
}
} else {
delete(name);
}
}
}

View File

@ -0,0 +1,10 @@
package me.savvy.rixa.data.thunderbolt.exceptions;
public class FileLoadException extends Exception {
private static final long serialVersionUID = 12930275846413931L;
public FileLoadException(String name){
super("[Thunderbolt] The file '" + name + ".json' is already loaded!");
}
}

View File

@ -0,0 +1,398 @@
package me.savvy.rixa.data.thunderbolt.io;
import me.savvy.rixa.data.thunderbolt.json.JSONArray;
import me.savvy.rixa.data.thunderbolt.json.JSONObject;
import me.savvy.rixa.data.thunderbolt.utils.Validator;
import java.io.*;
import java.util.*;
/**
* File class containing numerous useful methods for
* setting, saving, and retrieving information from JSON files
*
* @author Daniel S. (The Gaming Grunts)
*/
public class ThunderFile {
private final String name, path;
private JSONObject jo = new JSONObject();
private File f;
/**
* @see ThunderFile
* @param name : The name of the file, excluding the .json extension.
* @param path : The path to the file
*/
public ThunderFile(String name, String path){
this.path = path;
this.name = Validator.checkName(name);
f = new File(path + File.separator + name + ".json");
if (!f.exists()){
try {
new File(path).mkdirs();
f.createNewFile();
System.out.println("[Thunderbolt] Created new file " + name + ".json at " + path);
} catch(IOException e) {
e.printStackTrace();
}
}else{
System.out.println("[Thunderbolt] A file named '" + name + ".json' already exists at the specified path, " + path);
}
}
/**
* @see ThunderFile
* @param name : The name of the file, excluding the .json extension.
* @param path : The path to the file
* @param jsonData : JSON-formatted data
*/
public ThunderFile(String name, String path, String jsonData){
this(name, path);
jo = new JSONObject(jsonData);
}
/**
* Get the name of the file
*
* @return The name of the File
*/
public String getName(){
return name;
}
/**
* Get the path to the file
*
* @return The path to the file
*/
public String getPath(){
return path;
}
/**
* Set an object in the file's map. This works like any old Map.
*
* @param key : The key
* @param value : The value
*/
public void set(String key, Object value){
jo.put(key, value);
}
/**
* Get an object by a specified key
*
* @param key : The key associated with the object
* @return The object associated with this key
*/
public Object get(String key){
return jo.get(key);
}
/**
* Get a String by a specific key
*
* @param key : The key associated with this String
* @return The String associated with this key
*/
public String getString(String key) {
return (String)jo.get(key);
}
public Object getObjectinObj(String key, String secondKey) {
return jo.getJSONObject(key).get(secondKey);
}
/**
* Get a Byte by a specific key
*
* @param key : The key associated with this Byte
* @return The Byte associated with this key
*/
public byte getByte(String key){
return (byte)jo.get(key);
}
/**
* Get a Short by a specific key
*
* @param key : The key associated with this Short
* @return The Short associated with this key
*/
public short getShort(String key){
return (short)jo.get(key);
}
/**
* Get an Integer by a specific key
*
* @param key : The key associated with this Integer
* @return The Integer associated with this key
*/
public int getInt(String key){
return (int)jo.get(key);
}
/**
* Get a Double by a specific key
*
* @param key : The key associated with this Double
* @return The Double associated with this key
*/
public double getDouble(String key){
return (double)jo.get(key);
}
/**
* Get a Long by a specific key
*
* @param key : The key associated with this Long
* @return The Long associated with this key
*/
public long getLong(String key){
return (long)jo.get(key);
}
/**
* Get a Float by a specific key
*
* @param key : The key associated with this Float
* @return The Float associated with this key
*/
public float getFloat(String key){
return (float)jo.get(key);
}
/**
* Get a Boolean by a specific key
*
* @param key : The key associated with this Boolean
* @return The Boolean associated with this key
*/
public boolean getBoolean(String key){
return (boolean)jo.get(key);
}
private List<?> getList(String key) {
Object o = jo.get(key);
List<Object> l = new ArrayList<Object>();
JSONArray ja = new JSONArray(o.toString());
for (int i = 0; i < ja.length(); i++){
l.add(ja.get(i));
}
return l;
}
/**
* Get a List containing various Strings
*
* @param key : The key associated with this list
* @return String List
*/
public List<String> getStringList(String key){
List<?> temp = getList(key);
List<String> list = new ArrayList<String>();
for (Object o : temp){
if (o instanceof String){
list.add(String.valueOf(o));
}
}
return list;
}
/**
* Get a List containing various Bytes
*
* @param key : The key associated with this list
* @return Byte List
*/
public List<Byte> getByteList(String key){
List<?> temp = getList(key);
List<Byte> list = new ArrayList<Byte>();
for (Object o : temp){
if (o instanceof Byte){
list.add((Byte)o);
}else if (o instanceof String){
list.add(Byte.valueOf((String)o));
}
}
return list;
}
/**
* Get a List containing various Shorts
*
* @param key : The key associated with this list
* @return Short List
*/
public List<Short> getShortList(String key){
List<?> temp = getList(key);
List<Short> list = new ArrayList<Short>();
for (Object o : temp){
if (o instanceof Short){
list.add((Short)o);
}else if (o instanceof String){
list.add(Short.valueOf((String)o));
}
}
return list;
}
/**
* Get a List containing various Integers
*
* @param key : The key associated with this list
* @return Integer List
*/
public List<Integer> getIntList(String key){
List<?> temp = getList(key);
List<Integer> list = new ArrayList<Integer>();
for (Object o : temp){
if (o instanceof Integer){
list.add((Integer)o);
}else if (o instanceof String){
list.add(Integer.valueOf((String)o));
}
}
return list;
}
/**
* Get a List containing various Doubles
*
* @param key : The key associated with this list
* @return Double List
*/
public List<Double> getDoubleList(String key){
List<?> temp = getList(key);
List<Double> list = new ArrayList<Double>();
for (Object o : temp){
if (o instanceof Double){
list.add((Double)o);
}else if (o instanceof String){
list.add(Double.valueOf((String)o));
}
}
return list;
}
/**
* Get a List containing various Longs
*
* @param key : The key associated with this list
* @return Long List
*/
public List<Long> getLongList(String key){
List<?> temp = getList(key);
List<Long> list = new ArrayList<Long>();
for (Object o : temp){
if (o instanceof Long){
list.add((Long)o);
}else if (o instanceof String){
list.add(Long.valueOf((String)o));
}
}
return list;
}
/**
* Get a List containing various Floats
*
* @param key : The key associated with this list
* @return Float List
*/
public List<Float> getFloatList(String key){
List<?> temp = getList(key);
List<Float> list = new ArrayList<Float>();
for (Object o : temp){
if (o instanceof Integer){
list.add((Float)o);
}else if (o instanceof String){
list.add(Float.valueOf((String)o));
}
}
return list;
}
/**
* Get an array given a key
*
* @param key The key associated with the array
* @return A generic object array
* @throws IllegalArgumentException Value is not an array
*/
@SuppressWarnings("unchecked")
public <T> T[] getArray(String key){
Object array = jo.get(key);
if (array instanceof Object[]){
return (T[]) jo.get(key);
}else{
throw new IllegalArgumentException("Value associated with key '" + key + "' is not an Array");
}
}
/**
* Get a Map given a key
*
* @param key The key associated with the Map
* @return A Map
* @throws IllegalArgumentException Value is not a Map
*/
public Map<?, ?> getMap(String key){
Object map = jo.get(key);
if (map instanceof Map){
return (Map<?, ?>) jo.get(key);
}else{
throw new IllegalArgumentException("Value associated with key '" + key + "' is not an instance of Map");
}
}
/**
* Save this file to disk
*
* @throws IOException
*/
public void save() throws IOException{
Runnable r = new Runnable(){
public void run(){
try {
Writer writer = new PrintWriter(new FileWriter(path + File.separator + name + ".json", false));
writer.write(jo.toString(2));
writer.close();
} catch(IOException e) {
e.printStackTrace();
}
}
};
ThunderboltThreadPool.getPool().submit(r);
}
/**
* Get a Set containing all the keys in the map
*
* @return A Set containing all keys
*/
public Set<String> keySet(){
return jo.keySet();
}
/**
* Get a Set containing all the values in the map
*
* @return A Set containing all the values
*/
public Set<Object> valueSet(){
Set<Object> set = new HashSet<Object>();
Iterator<String> i = jo.keys();
while (i.hasNext()){
set.add(jo.get(i.next()));
}
return set;
}
public File getFile() {
return f;
}
}

View File

@ -0,0 +1,15 @@
package me.savvy.rixa.data.thunderbolt.io;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public abstract class ThunderboltThreadPool {
private static ExecutorService pool = Executors.newCachedThreadPool();
private ThunderboltThreadPool(){}
public static ExecutorService getPool(){
return pool;
}
}

View File

@ -0,0 +1,147 @@
/*
* $Id: ItemList.java,v 1.1 2006/04/15 14:10:48 platform Exp $
* Created on 2006-3-24
*/
package me.savvy.rixa.data.thunderbolt.json;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* |a:b:c| => |a|,|b|,|c|
* |:| => ||,||
* |a:| => |a|,||
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
public class ItemList {
private String sp=",";
List items=new ArrayList();
public ItemList(){}
public ItemList(String s){
this.split(s,sp,items);
}
public ItemList(String s,String sp){
this.sp=s;
this.split(s,sp,items);
}
public ItemList(String s,String sp,boolean isMultiToken){
split(s,sp,items,isMultiToken);
}
public List getItems(){
return this.items;
}
public String[] getArray(){
return (String[])this.items.toArray();
}
public void split(String s,String sp,List append,boolean isMultiToken){
if(s==null || sp==null)
return;
if(isMultiToken){
StringTokenizer tokens=new StringTokenizer(s,sp);
while(tokens.hasMoreTokens()){
append.add(tokens.nextToken().trim());
}
}
else{
this.split(s,sp,append);
}
}
public void split(String s,String sp,List append){
if(s==null || sp==null)
return;
int pos=0;
int prevPos=0;
do{
prevPos=pos;
pos=s.indexOf(sp,pos);
if(pos==-1)
break;
append.add(s.substring(prevPos,pos).trim());
pos+=sp.length();
}while(pos!=-1);
append.add(s.substring(prevPos).trim());
}
public void setSP(String sp){
this.sp=sp;
}
public void add(int i,String item){
if(item==null)
return;
items.add(i,item.trim());
}
public void add(String item){
if(item==null)
return;
items.add(item.trim());
}
public void addAll(ItemList list){
items.addAll(list.items);
}
public void addAll(String s){
this.split(s,sp,items);
}
public void addAll(String s,String sp){
this.split(s,sp,items);
}
public void addAll(String s,String sp,boolean isMultiToken){
this.split(s,sp,items,isMultiToken);
}
/**
* @param i 0-based
* @return
*/
public String get(int i){
return (String)items.get(i);
}
public int size(){
return items.size();
}
public String toString(){
return toString(sp);
}
public String toString(String sp){
StringBuffer sb=new StringBuffer();
for(int i=0;i<items.size();i++){
if(i==0)
sb.append(items.get(i));
else{
sb.append(sp);
sb.append(items.get(i));
}
}
return sb.toString();
}
public void clear(){
items.clear();
}
public void reset(){
sp=",";
items.clear();
}
}

View File

@ -0,0 +1,981 @@
/*
* $Id: JSONArray.java,v 1.1 2006/04/15 14:10:48 platform Exp $
* Created on 2006-4-10
*/
package me.savvy.rixa.data.thunderbolt.json;
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
/**
* A JSONArray is an ordered sequence of values. Its external text form is a
* string wrapped in square brackets with commas separating the values. The
* internal form is an object having <code>get</code> and <code>opt</code>
* methods for accessing the values by index, and <code>put</code> methods for
* adding or replacing values. The values can be any of these types:
* <code>Boolean</code>, <code>JSONArray</code>, <code>JSONObject</code>,
* <code>Number</code>, <code>String</code>, or the
* <code>JSONObject.NULL object</code>.
* <p>
* The constructor can convert a JSON text into a Java object. The
* <code>toString</code> method converts to JSON text.
* <p>
* A <code>get</code> method returns a value if one can be found, and throws an
* exception if one cannot be found. An <code>opt</code> method returns a
* default value instead of throwing an exception, and so is useful for
* obtaining optional values.
* <p>
* The generic <code>get()</code> and <code>opt()</code> methods return an
* object which you can cast or query for type. There are also typed
* <code>get</code> and <code>opt</code> methods that do type checking and type
* coercion for you.
* <p>
* The texts produced by the <code>toString</code> methods strictly conform to
* JSON syntax rules. The constructors are more forgiving in the texts they will
* accept:
* <ul>
* <li>An extra <code>,</code>&nbsp;<small>(comma)</small> may appear just
* before the closing bracket.</li>
* <li>The <code>null</code> value will be inserted when there is <code>,</code>
* &nbsp;<small>(comma)</small> elision.</li>
* <li>Strings may be quoted with <code>'</code>&nbsp;<small>(single
* quote)</small>.</li>
* <li>Strings do not need to be quoted at all if they do not begin with a quote
* or single quote, and if they do not contain leading or trailing spaces, and
* if they do not contain any of these characters:
* <code>{ } [ ] / \ : , #</code> and if they do not look like numbers and
* if they are not the reserved words <code>true</code>, <code>false</code>, or
* <code>null</code>.</li>
* </ul>
*
* @author JSON.org
* @version 2014-05-03
*/
public class JSONArray {
/**
* The arrayList where the JSONArray's properties are kept.
*/
private final ArrayList<Object> myArrayList;
/**
* Construct an empty JSONArray.
*/
public JSONArray() {
this.myArrayList = new ArrayList<Object>();
}
/**
* Construct a JSONArray from a JSONTokener.
*
* @param x
* A JSONTokener
* @throws JSONException
* If there is a syntax error.
*/
public JSONArray(JSONTokener x) throws JSONException {
this();
if (x.nextClean() != '[') {
throw x.syntaxError("A JSONArray text must start with '['");
}
if (x.nextClean() != ']') {
x.back();
for (;;) {
if (x.nextClean() == ',') {
x.back();
this.myArrayList.add(JSONObject.NULL);
} else {
x.back();
this.myArrayList.add(x.nextValue());
}
switch (x.nextClean()) {
case ',':
if (x.nextClean() == ']') {
return;
}
x.back();
break;
case ']':
return;
default:
throw x.syntaxError("Expected a ',' or ']'");
}
}
}
}
/**
* Construct a JSONArray from a source JSON text.
*
* @param source
* A string that begins with <code>[</code>&nbsp;<small>(left
* bracket)</small> and ends with <code>]</code>
* &nbsp;<small>(right bracket)</small>.
* @throws JSONException
* If there is a syntax error.
*/
public JSONArray(String source) throws JSONException {
this(new JSONTokener(source));
}
/**
* Construct a JSONArray from a Collection.
*
* @param collection
* A Collection.
*/
public JSONArray(Collection<Object> collection) {
this.myArrayList = new ArrayList<Object>();
if (collection != null) {
Iterator<Object> iter = collection.iterator();
while (iter.hasNext()) {
this.myArrayList.add(JSONObject.wrap(iter.next()));
}
}
}
/**
* Construct a JSONArray from an array
*
* @throws JSONException
* If not an array.
*/
public JSONArray(Object array) throws JSONException {
this();
if (array.getClass().isArray()) {
int length = Array.getLength(array);
for (int i = 0; i < length; i += 1) {
this.put(JSONObject.wrap(Array.get(array, i)));
}
} else {
throw new JSONException(
"JSONArray initial value should be a string or collection or array.");
}
}
/**
* Get the object value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return An object value.
* @throws JSONException
* If there is no value for the index.
*/
public Object get(int index) throws JSONException {
Object object = this.opt(index);
if (object == null) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
return object;
}
/**
* Get the boolean value associated with an index. The string values "true"
* and "false" are converted to boolean.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The truth.
* @throws JSONException
* If there is no value for the index or if the value is not
* convertible to boolean.
*/
public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("true"))) {
return true;
}
throw new JSONException("JSONArray[" + index + "] is not a boolean.");
}
/**
* Get the double value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a number.
*/
public double getDouble(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).doubleValue()
: Double.parseDouble((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
/**
* Get the int value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException
* If the key is not found or if the value is not a number.
*/
public int getInt(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).intValue()
: Integer.parseInt((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
/**
* Get the JSONArray associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A JSONArray value.
* @throws JSONException
* If there is no value for the index. or if the value is not a
* JSONArray
*/
public JSONArray getJSONArray(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof JSONArray) {
return (JSONArray) object;
}
throw new JSONException("JSONArray[" + index + "] is not a JSONArray.");
}
/**
* Get the JSONObject associated with an index.
*
* @param index
* subscript
* @return A JSONObject value.
* @throws JSONException
* If there is no value for the index or if the value is not a
* JSONObject
*/
public JSONObject getJSONObject(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof JSONObject) {
return (JSONObject) object;
}
throw new JSONException("JSONArray[" + index + "] is not a JSONObject.");
}
/**
* Get the long value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a number.
*/
public long getLong(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).longValue()
: Long.parseLong((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
/**
* Get the string associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A string value.
* @throws JSONException
* If there is no string value for the index.
*/
public String getString(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof String) {
return (String) object;
}
throw new JSONException("JSONArray[" + index + "] not a string.");
}
/**
* Determine if the value is null.
*
* @param index
* The index must be between 0 and length() - 1.
* @return true if the value at the index is null, or if there is no value.
*/
public boolean isNull(int index) {
return JSONObject.NULL.equals(this.opt(index));
}
/**
* Make a string from the contents of this JSONArray. The
* <code>separator</code> string is inserted between each element. Warning:
* This method assumes that the data structure is acyclical.
*
* @param separator
* A string that will be inserted between the elements.
* @return a string.
* @throws JSONException
* If the array contains an invalid number.
*/
public String join(String separator) throws JSONException {
int len = this.length();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(JSONObject.valueToString(this.myArrayList.get(i)));
}
return sb.toString();
}
/**
* Get the number of elements in the JSONArray, included nulls.
*
* @return The length (or size).
*/
public int length() {
return this.myArrayList.size();
}
/**
* Get the optional object value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return An object value, or null if there is no object at that index.
*/
public Object opt(int index) {
return (index < 0 || index >= this.length()) ? null : this.myArrayList
.get(index);
}
/**
* Get the optional boolean value associated with an index. It returns false
* if there is no value at that index, or if the value is not Boolean.TRUE
* or the String "true".
*
* @param index
* The index must be between 0 and length() - 1.
* @return The truth.
*/
public boolean optBoolean(int index) {
return this.optBoolean(index, false);
}
/**
* Get the optional boolean value associated with an index. It returns the
* defaultValue if there is no value at that index or if it is not a Boolean
* or the String "true" or "false" (case insensitive).
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* A boolean default.
* @return The truth.
*/
public boolean optBoolean(int index, boolean defaultValue) {
try {
return this.getBoolean(index);
} catch (Exception e) {
return defaultValue;
}
}
/**
* Get the optional double value associated with an index. NaN is returned
* if there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public double optDouble(int index) {
return this.optDouble(index, Double.NaN);
}
/**
* Get the optional double value associated with an index. The defaultValue
* is returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index
* subscript
* @param defaultValue
* The default value.
* @return The value.
*/
public double optDouble(int index, double defaultValue) {
try {
return this.getDouble(index);
} catch (Exception e) {
return defaultValue;
}
}
/**
* Get the optional int value associated with an index. Zero is returned if
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public int optInt(int index) {
return this.optInt(index, 0);
}
/**
* Get the optional int value associated with an index. The defaultValue is
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public int optInt(int index, int defaultValue) {
try {
return this.getInt(index);
} catch (Exception e) {
return defaultValue;
}
}
/**
* Get the optional JSONArray associated with an index.
*
* @param index
* subscript
* @return A JSONArray value, or null if the index has no value, or if the
* value is not a JSONArray.
*/
public JSONArray optJSONArray(int index) {
Object o = this.opt(index);
return o instanceof JSONArray ? (JSONArray) o : null;
}
/**
* Get the optional JSONObject associated with an index. Null is returned if
* the key is not found, or null if the index has no value, or if the value
* is not a JSONObject.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A JSONObject value.
*/
public JSONObject optJSONObject(int index) {
Object o = this.opt(index);
return o instanceof JSONObject ? (JSONObject) o : null;
}
/**
* Get the optional long value associated with an index. Zero is returned if
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public long optLong(int index) {
return this.optLong(index, 0);
}
/**
* Get the optional long value associated with an index. The defaultValue is
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public long optLong(int index, long defaultValue) {
try {
return this.getLong(index);
} catch (Exception e) {
return defaultValue;
}
}
/**
* Get the optional string value associated with an index. It returns an
* empty string if there is no value at that index. If the value is not a
* string and is not null, then it is coverted to a string.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A String value.
*/
public String optString(int index) {
return this.optString(index, "");
}
/**
* Get the optional string associated with an index. The defaultValue is
* returned if the key is not found.
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return A String value.
*/
public String optString(int index, String defaultValue) {
Object object = this.opt(index);
return JSONObject.NULL.equals(object) ? defaultValue : object
.toString();
}
/**
* Append a boolean value. This increases the array's length by one.
*
* @param value
* A boolean value.
* @return this.
*/
public JSONArray put(boolean value) {
this.put(value ? Boolean.TRUE : Boolean.FALSE);
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
* @param value
* A Collection value.
* @return this.
*/
public JSONArray put(Collection<Object> value) {
this.put(new JSONArray(value));
return this;
}
/**
* Append a double value. This increases the array's length by one.
*
* @param value
* A double value.
* @throws JSONException
* if the value is not finite.
* @return this.
*/
public JSONArray put(double value) throws JSONException {
Double d = new Double(value);
JSONObject.testValidity(d);
this.put(d);
return this;
}
/**
* Append an int value. This increases the array's length by one.
*
* @param value
* An int value.
* @return this.
*/
public JSONArray put(int value) {
this.put(new Integer(value));
return this;
}
/**
* Append an long value. This increases the array's length by one.
*
* @param value
* A long value.
* @return this.
*/
public JSONArray put(long value) {
this.put(new Long(value));
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONObject which
* is produced from a Map.
*
* @param value
* A Map value.
* @return this.
*/
public JSONArray put(Map<String, Object> value) {
this.put(new JSONObject(value));
return this;
}
/**
* Append an object value. This increases the array's length by one.
*
* @param value
* An object value. The value should be a Boolean, Double,
* Integer, JSONArray, JSONObject, Long, or String, or the
* JSONObject.NULL object.
* @return this.
*/
public JSONArray put(Object value) {
this.myArrayList.add(value);
return this;
}
/**
* Put or replace a boolean value in the JSONArray. If the index is greater
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
* @param index
* The subscript.
* @param value
* A boolean value.
* @return this.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, boolean value) throws JSONException {
this.put(index, value ? Boolean.TRUE : Boolean.FALSE);
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
* @param index
* The subscript.
* @param value
* A Collection value.
* @return this.
* @throws JSONException
* If the index is negative or if the value is not finite.
*/
public JSONArray put(int index, Collection<Object> value) throws JSONException {
this.put(index, new JSONArray(value));
return this;
}
/**
* Put or replace a double value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index
* The subscript.
* @param value
* A double value.
* @return this.
* @throws JSONException
* If the index is negative or if the value is not finite.
*/
public JSONArray put(int index, double value) throws JSONException {
this.put(index, new Double(value));
return this;
}
/**
* Put or replace an int value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index
* The subscript.
* @param value
* An int value.
* @return this.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, int value) throws JSONException {
this.put(index, new Integer(value));
return this;
}
/**
* Put or replace a long value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index
* The subscript.
* @param value
* A long value.
* @return this.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, long value) throws JSONException {
this.put(index, new Long(value));
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONObject that
* is produced from a Map.
*
* @param index
* The subscript.
* @param value
* The Map value.
* @return this.
* @throws JSONException
* If the index is negative or if the the value is an invalid
* number.
*/
public JSONArray put(int index, Map<String, Object> value) throws JSONException {
this.put(index, new JSONObject(value));
return this;
}
/**
* Put or replace an object value in the JSONArray. If the index is greater
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
* @param index
* The subscript.
* @param value
* The value to put into the array. The value should be a
* Boolean, Double, Integer, JSONArray, JSONObject, Long, or
* String, or the JSONObject.NULL object.
* @return this.
* @throws JSONException
* If the index is negative or if the the value is an invalid
* number.
*/
public JSONArray put(int index, Object value) throws JSONException {
JSONObject.testValidity(value);
if (index < 0) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
if (index < this.length()) {
this.myArrayList.set(index, value);
} else {
while (index != this.length()) {
this.put(JSONObject.NULL);
}
this.put(value);
}
return this;
}
/**
* Remove an index and close the hole.
*
* @param index
* The index of the element to be removed.
* @return The value that was associated with the index, or null if there
* was no value.
*/
public Object remove(int index) {
return index >= 0 && index < this.length()
? this.myArrayList.remove(index)
: null;
}
/**
* Determine if two JSONArrays are similar.
* They must contain similar sequences.
*
* @param other The other JSONArray
* @return true if they are equal
*/
public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.get(i);
Object valueOther = ((JSONArray)other).get(i);
if (valueThis instanceof JSONObject) {
if (!((JSONObject)valueThis).similar(valueOther)) {
return false;
}
} else if (valueThis instanceof JSONArray) {
if (!((JSONArray)valueThis).similar(valueOther)) {
return false;
}
} else if (!valueThis.equals(valueOther)) {
return false;
}
}
return true;
}
/**
* Produce a JSONObject by combining a JSONArray of names with the values of
* this JSONArray.
*
* @param names
* A JSONArray containing a list of key strings. These will be
* paired with the values.
* @return A JSONObject, or null if there are no names or if this JSONArray
* has no values.
* @throws JSONException
* If any of the names are null.
*/
public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.opt(i));
}
return jo;
}
/**
* Make a JSON text of this JSONArray. For compactness, no unnecessary
* whitespace is added. If it is not possible to produce a syntactically
* correct JSON text then null will be returned instead. This could occur if
* the array contains an invalid number.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @return a printable, displayable, transmittable representation of the
* array.
*/
public String toString() {
try {
return this.toString(0);
} catch (Exception e) {
return null;
}
}
/**
* Make a prettyprinted JSON text of this JSONArray. Warning: This method
* assumes that the data structure is acyclical.
*
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @return a printable, displayable, transmittable representation of the
* object, beginning with <code>[</code>&nbsp;<small>(left
* bracket)</small> and ending with <code>]</code>
* &nbsp;<small>(right bracket)</small>.
* @throws JSONException
*/
public String toString(int indentFactor) throws JSONException {
StringWriter sw = new StringWriter();
synchronized (sw.getBuffer()) {
return this.write(sw, indentFactor, 0).toString();
}
}
/**
* Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @return The writer.
* @throws JSONException
*/
public Writer write(Writer writer) throws JSONException {
return this.write(writer, 0, 0);
}
/**
* Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @param indent
* The indention of the top level.
* @return The writer.
* @throws JSONException
*/
Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean commanate = false;
int length = this.length();
writer.write('[');
if (length == 1) {
JSONObject.writeValue(writer, this.myArrayList.get(0),
indentFactor, indent);
} else if (length != 0) {
final int newindent = indent + indentFactor;
for (int i = 0; i < length; i += 1) {
if (commanate) {
writer.write(',');
}
if (indentFactor > 0) {
writer.write('\n');
}
JSONObject.indent(writer, newindent);
JSONObject.writeValue(writer, this.myArrayList.get(i),
indentFactor, newindent);
commanate = true;
}
if (indentFactor > 0) {
writer.write('\n');
}
JSONObject.indent(writer, indent);
}
writer.write(']');
return writer;
} catch (IOException e) {
throw new JSONException(e);
}
}
}

View File

@ -0,0 +1,12 @@
package me.savvy.rixa.data.thunderbolt.json;
/**
* Beans that support customized output of JSON text shall implement this interface.
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
public interface JSONAware {
/**
* @return JSON text
*/
String toJSONString();
}

View File

@ -0,0 +1,43 @@
package me.savvy.rixa.data.thunderbolt.json;
/**
* The JSONException is thrown by the JSON.org classes when things are amiss.
*
* @author JSON.org
* @version 2014-05-03
*/
public class JSONException extends RuntimeException {
private static final long serialVersionUID = 0;
private Throwable cause;
/**
* Constructs a JSONException with an explanatory message.
*
* @param message
* Detail about the reason for the exception.
*/
public JSONException(String message) {
super(message);
}
/**
* Constructs a new JSONException with the specified cause.
* @param cause The cause.
*/
public JSONException(Throwable cause) {
super(cause.getMessage());
this.cause = cause;
}
/**
* Returns the cause of this exception or null if the cause is nonexistent
* or unknown.
*
* @return the cause of this exception or null if the cause is nonexistent
* or unknown.
*/
@Override
public Throwable getCause() {
return this.cause;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
package me.savvy.rixa.data.thunderbolt.json;
import java.io.IOException;
import java.io.Writer;
/**
* Beans that support customized output of JSON text to a writer shall implement this interface.
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
public interface JSONStreamAware {
/**
* write JSON string to out.
*/
void writeJSONString(Writer out) throws IOException;
}

View File

@ -0,0 +1,19 @@
package me.savvy.rixa.data.thunderbolt.json;
/**
* The <code>JSONString</code> interface allows a <code>toJSONString()</code>
* method so that a class can change the behavior of
* <code>JSONObject.toString()</code>, <code>JSONArray.toString()</code>,
* and <code>JSONWriter.value(</code>Object<code>)</code>. The
* <code>toJSONString</code> method will be used instead of the default behavior
* of using the Object's <code>toString()</code> method and quoting the result.
*/
public interface JSONString {
/**
* The <code>toJSONString</code> method allows a class to produce its own JSON
* serialization.
*
* @return A strictly syntactically correct JSON text.
*/
public String toJSONString();
}

View File

@ -0,0 +1,446 @@
package me.savvy.rixa.data.thunderbolt.json;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* A JSONTokener takes a source string and extracts characters and tokens from
* it. It is used by the JSONObject and JSONArray constructors to parse
* JSON source strings.
* @author JSON.org
* @version 2014-05-03
*/
public class JSONTokener {
private long character;
private boolean eof;
private long index;
private long line;
private char previous;
private Reader reader;
private boolean usePrevious;
/**
* Construct a JSONTokener from a Reader.
*
* @param reader A reader.
*/
public JSONTokener(Reader reader) {
this.reader = reader.markSupported()
? reader
: new BufferedReader(reader);
this.eof = false;
this.usePrevious = false;
this.previous = 0;
this.index = 0;
this.character = 1;
this.line = 1;
}
/**
* Construct a JSONTokener from an InputStream.
* @param inputStream The source.
*/
public JSONTokener(InputStream inputStream) throws JSONException {
this(new InputStreamReader(inputStream));
}
/**
* Construct a JSONTokener from a string.
*
* @param s A source string.
*/
public JSONTokener(String s) {
this(new StringReader(s));
}
/**
* Back up one character. This provides a sort of lookahead capability,
* so that you can test for a digit or letter before attempting to parse
* the next number or identifier.
*/
public void back() throws JSONException {
if (this.usePrevious || this.index <= 0) {
throw new JSONException("Stepping back two steps is not supported");
}
this.index -= 1;
this.character -= 1;
this.usePrevious = true;
this.eof = false;
}
/**
* Get the hex value of a character (base16).
* @param c A character between '0' and '9' or between 'A' and 'F' or
* between 'a' and 'f'.
* @return An int between 0 and 15, or -1 if c was not a hex digit.
*/
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
}
public boolean end() {
return this.eof && !this.usePrevious;
}
/**
* Determine if the source string still contains characters that next()
* can consume.
* @return true if not yet at the end of the source.
*/
public boolean more() throws JSONException {
this.next();
if (this.end()) {
return false;
}
this.back();
return true;
}
/**
* Get the next character in the source string.
*
* @return The next character, or 0 if past the end of the source string.
*/
public char next() throws JSONException {
int c;
if (this.usePrevious) {
this.usePrevious = false;
c = this.previous;
} else {
try {
c = this.reader.read();
} catch (IOException exception) {
throw new JSONException(exception);
}
if (c <= 0) { // End of stream
this.eof = true;
c = 0;
}
}
this.index += 1;
if (this.previous == '\r') {
this.line += 1;
this.character = c == '\n' ? 0 : 1;
} else if (c == '\n') {
this.line += 1;
this.character = 0;
} else {
this.character += 1;
}
this.previous = (char) c;
return this.previous;
}
/**
* Consume the next character, and check that it matches a specified
* character.
* @param c The character to match.
* @return The character.
* @throws JSONException if the character does not match.
*/
public char next(char c) throws JSONException {
char n = this.next();
if (n != c) {
throw this.syntaxError("Expected '" + c + "' and instead saw '" +
n + "'");
}
return n;
}
/**
* Get the next n characters.
*
* @param n The number of characters to take.
* @return A string of n characters.
* @throws JSONException
* Substring bounds error if there are not
* n characters remaining in the source string.
*/
public String next(int n) throws JSONException {
if (n == 0) {
return "";
}
char[] chars = new char[n];
int pos = 0;
while (pos < n) {
chars[pos] = this.next();
if (this.end()) {
throw this.syntaxError("Substring bounds error");
}
pos += 1;
}
return new String(chars);
}
/**
* Get the next char in the string, skipping whitespace.
* @throws JSONException
* @return A character, or 0 if there are no more characters.
*/
public char nextClean() throws JSONException {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
}
}
}
/**
* Return the characters up to the next close quote character.
* Backslash processing is done. The formal JSON format does not
* allow strings in single quotes, but an implementation is allowed to
* accept them.
* @param quote The quoting character, either
* <code>"</code>&nbsp;<small>(double quote)</small> or
* <code>'</code>&nbsp;<small>(single quote)</small>.
* @return A String.
* @throws JSONException Unterminated string.
*/
public String nextString(char quote) throws JSONException {
char c;
StringBuilder sb = new StringBuilder();
for (;;) {
c = this.next();
switch (c) {
case 0:
case '\n':
case '\r':
throw this.syntaxError("Unterminated string");
case '\\':
c = this.next();
switch (c) {
case 'b':
sb.append('\b');
break;
case 't':
sb.append('\t');
break;
case 'n':
sb.append('\n');
break;
case 'f':
sb.append('\f');
break;
case 'r':
sb.append('\r');
break;
case 'u':
sb.append((char)Integer.parseInt(this.next(4), 16));
break;
case '"':
case '\'':
case '\\':
case '/':
sb.append(c);
break;
default:
throw this.syntaxError("Illegal escape.");
}
break;
default:
if (c == quote) {
return sb.toString();
}
sb.append(c);
}
}
}
/**
* Get the text up but not including the specified character or the
* end of line, whichever comes first.
* @param delimiter A delimiter character.
* @return A string.
*/
public String nextTo(char delimiter) throws JSONException {
StringBuilder sb = new StringBuilder();
for (;;) {
char c = this.next();
if (c == delimiter || c == 0 || c == '\n' || c == '\r') {
if (c != 0) {
this.back();
}
return sb.toString().trim();
}
sb.append(c);
}
}
/**
* Get the text up but not including one of the specified delimiter
* characters or the end of line, whichever comes first.
* @param delimiters A set of delimiter characters.
* @return A string, trimmed.
*/
public String nextTo(String delimiters) throws JSONException {
char c;
StringBuilder sb = new StringBuilder();
for (;;) {
c = this.next();
if (delimiters.indexOf(c) >= 0 || c == 0 ||
c == '\n' || c == '\r') {
if (c != 0) {
this.back();
}
return sb.toString().trim();
}
sb.append(c);
}
}
/**
* Get the next value. The value can be a Boolean, Double, Integer,
* JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
* @throws JSONException If syntax error.
*
* @return An object.
*/
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
case '[':
this.back();
return new JSONArray(this);
}
/*
* Handle unquoted text. This could be the values true, false, or
* null, or it can be a number. An implementation (such as this one)
* is allowed to also accept non-standard forms.
*
* Accumulate characters until we reach the end of the text or a
* formatting character.
*/
StringBuilder sb = new StringBuilder();
while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
sb.append(c);
c = this.next();
}
this.back();
string = sb.toString().trim();
if ("".equals(string)) {
throw this.syntaxError("Missing value");
}
return JSONObject.stringToValue(string);
}
/**
* Skip characters until the next character is the requested character.
* If the requested character is not found, no characters are skipped.
* @param to A character to skip to.
* @return The requested character, or zero if the requested character
* is not found.
*/
public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if (c == 0) {
this.reader.reset();
this.index = startIndex;
this.character = startCharacter;
this.line = startLine;
return c;
}
} while (c != to);
} catch (IOException exception) {
throw new JSONException(exception);
}
this.back();
return c;
}
/**
* Make a JSONException to signal a syntax error.
*
* @param message The error message.
* @return A JSONException object, suitable for throwing
*/
public JSONException syntaxError(String message) {
return new JSONException(message + this.toString());
}
/**
* Make a printable string of this JSONTokener.
*
* @return " at {index} [character {character} line {line}]"
*/
public String toString() {
return " at " + this.index + " [character " + this.character + " line " +
this.line + "]";
}
}

View File

@ -0,0 +1,14 @@
package me.savvy.rixa.data.thunderbolt.utils;
public class Validator {
/**
* Ensure that a file name doesn't contain an extension
*
* @param name : The name of the file
* @return A file name without an extension
*/
public static String checkName(String name){
return (name.contains(".")) ? name.split(".")[0] : name;
}
}

View File

@ -1,24 +1,44 @@
package me.savvy.rixa.guild.management;
import me.savvy.rixa.Rixa;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.TextChannel;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by Timber on 5/23/2017.
*/
public class GuildSettings {
private Guild guild;
private String prefix = ".", defaultRole, joinMessage, quitMessage, joinPrivateMessage;
private boolean enlisted;
private String prefix = ".", defaultRole, joinMessage, quitMessage, joinPrivateMessage, description;
private TextChannel joinMessageChannel, quitMessageChannel;
public GuildSettings(Guild guild) {
this.guild = guild;
load();
try {
load();
} catch (SQLException e) {
e.printStackTrace();
}
}
private void load() {
private void load() throws SQLException {
PreparedStatement ps = Rixa.getInstance().getDbManager()
.getConnection().prepareStatement("SELECT * FROM `settings` WHERE `guild_id` = ?");
ps.setString(1, guild.getId());
ResultSet set = Rixa.getInstance().getDbManager().getObject(ps);
setPrefix(set.getString("prefix"));
setDefaultRole(set.getString("defaultRole"));
setJoinMessage(set.getString("joinMessage"));
setQuitMessage(set.getString("quitMessage"));
setJoinPrivateMessage(set.getString("joinPM"));
setDescription((String)Rixa.getInstance().getData().get("guild_id", guild.getId(), "description", "core"));
setEnlisted((boolean) Rixa.getInstance().getData().get("guild_id", guild.getId(), "enlisted", "core"));
}
public void unload() {
@ -84,4 +104,20 @@ public class GuildSettings {
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isEnlisted() {
return enlisted;
}
public void setEnlisted(boolean enlisted) {
this.enlisted = enlisted;
}
}

View File

@ -1,3 +0,0 @@
bot:
token: tl2gu6rqrzZ0WotSGq_EiIVsiYnyWDOh
game: 'Minecraft'

View File

@ -1,4 +0,0 @@
name: RixaMC
main: me.savvy.RixaMC
author: [Savvy]
version: 1.0