forked from Limework/RediSkript
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
705ce16f5d | ||
|
|
5a4943bd9d | ||
|
|
211a45ee52 | ||
|
|
1e85072e34 | ||
|
|
a60cae72e3 | ||
|
|
d4461f09c8 | ||
|
|
dd6b9b6ee6 | ||
|
|
2ee28a5450 | ||
|
|
26b9e0e1d8 | ||
|
|
933b85b2d5 | ||
|
|
824cf3664c | ||
|
|
d02cac7c5d | ||
|
|
a520ba6496 | ||
|
|
4d265cbf61 | ||
|
|
7849efd866 | ||
|
|
f80d9b36e7 | ||
|
|
0c20becfa1 | ||
|
|
089fdfd1f3 | ||
|
|
c4426a692e |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +1,4 @@
|
|||||||
target
|
target
|
||||||
out
|
out
|
||||||
.idea
|
.idea/workspace.xml
|
||||||
compile
|
compile
|
||||||
*.iml
|
|
||||||
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
|||||||
|
RediSkript
|
||||||
12
.idea/artifacts/RediSkript_jar.xml
generated
Normal file
12
.idea/artifacts/RediSkript_jar.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<component name="ArtifactManager">
|
||||||
|
<artifact type="jar" build-on-make="true" name="RediSkript:jar">
|
||||||
|
<output-path>$PROJECT_DIR$/out/artifacts/RediSkript_jar</output-path>
|
||||||
|
<root id="archive" name="RediSkript.jar">
|
||||||
|
<element id="module-output" name="RediSkript" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/cryptomator/siv-mode/1.4.0/siv-mode-1.4.0.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/redis/clients/jedis/3.3.0/jedis-3.3.0.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/commons/commons-pool2/2.6.2/commons-pool2-2.6.2.jar" path-in-jar="/" />
|
||||||
|
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/json/json/20190722/json-20190722.jar" path-in-jar="/" />
|
||||||
|
</root>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
16
.idea/compiler.xml
generated
Normal file
16
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="RediSkript" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
<bytecodeTargetLevel>
|
||||||
|
<module name="RediSkript" target="1.8" />
|
||||||
|
</bytecodeTargetLevel>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/discord.xml
generated
Normal file
6
.idea/discord.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT_FILES" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
30
.idea/jarRepositories.xml
generated
Normal file
30
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jitpack.io" />
|
||||||
|
<option name="name" value="jitpack.io" />
|
||||||
|
<option name="url" value="https://jitpack.io" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="commons-pool2" />
|
||||||
|
<option name="name" value="commons-pool2" />
|
||||||
|
<option name="url" value="https://mvnrepository.com/artifact/org.apache.commons/commons-pool2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="spigot-repo" />
|
||||||
|
<option name="name" value="spigot-repo" />
|
||||||
|
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
13
.idea/libraries/Maven__com_github_skriptlang_Skript_2_4_1.xml
generated
Normal file
13
.idea/libraries/Maven__com_github_skriptlang_Skript_2_4_1.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.github.skriptlang:Skript:2.4.1">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/skriptlang/Skript/2.4.1/Skript-2.4.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/skriptlang/Skript/2.4.1/Skript-2.4.1-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/skriptlang/Skript/2.4.1/Skript-2.4.1-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__org_apache_commons_commons_pool2_2_6_2.xml
generated
Normal file
13
.idea/libraries/Maven__org_apache_commons_commons_pool2_2_6_2.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.apache.commons:commons-pool2:2.6.2">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-pool2/2.6.2/commons-pool2-2.6.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-pool2/2.6.2/commons-pool2-2.6.2-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-pool2/2.6.2/commons-pool2-2.6.2-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__org_cryptomator_siv_mode_1_4_0.xml
generated
Normal file
13
.idea/libraries/Maven__org_cryptomator_siv_mode_1_4_0.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.cryptomator:siv-mode:1.4.0">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/cryptomator/siv-mode/1.4.0/siv-mode-1.4.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/cryptomator/siv-mode/1.4.0/siv-mode-1.4.0-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/cryptomator/siv-mode/1.4.0/siv-mode-1.4.0-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__org_json_json_20190722.xml
generated
Normal file
13
.idea/libraries/Maven__org_json_json_20190722.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.json:json:20190722">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20190722/json-20190722.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20190722/json-20190722-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20190722/json-20190722-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__org_spigotmc_spigot_api_1_16_2_R0_1_SNAPSHOT.xml
generated
Normal file
13
.idea/libraries/Maven__org_spigotmc_spigot_api_1_16_2_R0_1_SNAPSHOT.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.2-R0.1-SNAPSHOT/spigot-api-1.16.2-R0.1-20200910.205520-57.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.2-R0.1-SNAPSHOT/spigot-api-1.16.2-R0.1-20200910.205520-57-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.2-R0.1-SNAPSHOT/spigot-api-1.16.2-R0.1-20200910.205520-57-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
.idea/libraries/Maven__redis_clients_jedis_3_3_0.xml
generated
Normal file
13
.idea/libraries/Maven__redis_clients_jedis_3_3_0.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: redis.clients:jedis:3.3.0">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/redis/clients/jedis/3.3.0/jedis-3.3.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/redis/clients/jedis/3.3.0/jedis-3.3.0-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/redis/clients/jedis/3.3.0/jedis-3.3.0-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
11
.idea/misc.xml
generated
Normal file
11
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/RediSkript.iml" filepath="$PROJECT_DIR$/RediSkript.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
56
README.md
56
README.md
@@ -1 +1,57 @@
|
|||||||
|
**To-do List**
|
||||||
|
1. Fix memory leak of /reloadredis (Not yet known how to fix it, it can be easily noticed by changing IP addresses and using NetworkInterceptor plugin, it'll show connections still being done to old IP address, aswell as the new one, even if it doesn't use old IP address for anything.)
|
||||||
|
|
||||||
|
|
||||||
|
RediSkript allows you to communicate between your servers with use of Redis, it's very fast and easy to use.
|
||||||
|
|
||||||
|
You can transfer any data in the form of text between your servers, you can program it to execute a set of instructions on the server depending on the redis message, etc. This can be used for making scripts that sync data between all servers and much more!
|
||||||
|
|
||||||
|
|
||||||
|
It is originally developed by the team of Govindas Limework developers and is now maintained only by Govindas.
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
on redis message:
|
||||||
|
if redis channel is "world":
|
||||||
|
broadcast "%redis message% %redis channel% %redis message date%"
|
||||||
|
|
||||||
|
command /sendredis <text> <text>:
|
||||||
|
usage: /sendredis <message> <channel>
|
||||||
|
trigger:
|
||||||
|
send redis message arg 1 to channel arg 2
|
||||||
|
send redis message "hello world!" to channel "world"
|
||||||
|
```
|
||||||
|
|
||||||
|
and that's all there is to this addon! You only need to have matching configuration in every server for communication and a Redis server to connect to. I recommend using VPS for hosting redis server, I personally use VPS from humbleservers.com.
|
||||||
|
|
||||||
|
Configuration:
|
||||||
|
```
|
||||||
|
Redis:
|
||||||
|
#a secure password that cannot be cracked, please change it!
|
||||||
|
#it is also recommended to firewall your redis server with iptables so it can only be accessed by specific IP addresses
|
||||||
|
Password: "yHy0d2zdBlRmaSPj3CiBwEv5V3XxBTLTrCsGW7ntBnzhfxPxXJS6Q1aTtR6DSfAtCZr2VxWnsungXHTcF94a4bsWEpGAvjL9XMU"
|
||||||
|
Host: "127.0.0.1"
|
||||||
|
#must be 2 or higher, if you set to lower, the addon will automatically use 2 as a minimum
|
||||||
|
MaxConnections: 2
|
||||||
|
#the default Redis port
|
||||||
|
Port: 6379
|
||||||
|
#time out in milliseconds, how long it should take before it decides that it is unable to connect when sending a message
|
||||||
|
#90000 = 90 seconds
|
||||||
|
TimeOut: 90000
|
||||||
|
#also known as SSL, only use this if you're running Redis 6.0.6 or higher, older versions will not work correctly
|
||||||
|
#it encrypts your traffic and makes data exchange between distant servers completely secure
|
||||||
|
useTLS: false
|
||||||
|
#may be useful if you cannot use TLS due to use of older version of Redis
|
||||||
|
#however this will not encrypt the initial authentication password, only the messages sent
|
||||||
|
#it uses AES-128 SIV encryption which is secure enough for this
|
||||||
|
EncryptMessages: true
|
||||||
|
EncryptionKey: "16CHARACTERS KEY"
|
||||||
|
MacKey: "16CHARACTERS KEY"
|
||||||
|
|
||||||
|
#the channels from which this server can receive messages
|
||||||
|
#you can always send messages to all channels!
|
||||||
|
#you can add as many channels as you wish!
|
||||||
|
Channels:
|
||||||
|
- "Channel1"
|
||||||
|
- "Channel2"
|
||||||
|
- "Channel3"
|
||||||
|
```
|
||||||
|
|||||||
20
RediSkript.iml
Normal file
20
RediSkript.iml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.skriptlang:Skript:2.4.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: redis.clients:jedis:3.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.6.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.json:json:20190722" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.cryptomator:siv-mode:1.4.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
38
pom.xml
38
pom.xml
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>net.limework.core</groupId>
|
<groupId>net.limework.rediskript</groupId>
|
||||||
<artifactId>RediSkript</artifactId>
|
<artifactId>RediSkript</artifactId>
|
||||||
<version>1.1.2</version>
|
<version>1.2.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -27,37 +27,13 @@
|
|||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.2.3</version>
|
|
||||||
<configuration>
|
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<version>3.2.0</version>
|
|
||||||
<configuration>
|
|
||||||
<outputDirectory>${project.basedir}/compile</outputDirectory>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
@@ -72,9 +48,9 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.skriptlang</groupId>
|
<groupId>com.github.SkriptLang</groupId>
|
||||||
<artifactId>Skript</artifactId>
|
<artifactId>Skript</artifactId>
|
||||||
<version>2.4.1</version>
|
<version>2.5.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -87,22 +63,26 @@
|
|||||||
<groupId>redis.clients</groupId>
|
<groupId>redis.clients</groupId>
|
||||||
<artifactId>jedis</artifactId>
|
<artifactId>jedis</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.3.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20190722</version>
|
<version>20190722</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.cryptomator</groupId>
|
<groupId>org.cryptomator</groupId>
|
||||||
<artifactId>siv-mode</artifactId>
|
<artifactId>siv-mode</artifactId>
|
||||||
<version>1.4.0</version>
|
<version>1.4.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-pool2</artifactId>
|
<artifactId>commons-pool2</artifactId>
|
||||||
<version>2.6.2</version>
|
<version>2.6.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
Main-Class: net.limework.core.RediSkript
|
Main-Class: net.limework.rediskript.RediSkript
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
package net.limework.core;
|
|
||||||
import net.limework.core.commands.ReloadRedis;
|
|
||||||
import net.limework.core.hooks.SkriptHook;
|
|
||||||
import net.limework.core.managers.RedisManager;
|
|
||||||
import org.bukkit.command.PluginCommand;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class RediSkript extends JavaPlugin {
|
|
||||||
|
|
||||||
//Redis manager
|
|
||||||
private RedisManager rm;
|
|
||||||
|
|
||||||
public void startRedis(boolean reload) {
|
|
||||||
if (reload) { reloadConfig(); }
|
|
||||||
rm = new RedisManager(this);
|
|
||||||
rm.start();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
saveDefaultConfig();
|
|
||||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
|
||||||
startRedis(false);
|
|
||||||
|
|
||||||
PluginCommand command = getServer().getPluginCommand("reloadredis");
|
|
||||||
assert command != null;
|
|
||||||
command.setExecutor(new ReloadRedis(this));
|
|
||||||
|
|
||||||
new SkriptHook(this);
|
|
||||||
} else {
|
|
||||||
getLogger().info("Skript wasn't found.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
if (rm != null) {
|
|
||||||
rm.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public RedisManager getRm() {
|
|
||||||
return rm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
package net.limework.core.skript.elements;
|
|
||||||
|
|
||||||
import ch.njol.skript.Skript;
|
|
||||||
import ch.njol.skript.lang.Effect;
|
|
||||||
import ch.njol.skript.lang.Expression;
|
|
||||||
import ch.njol.skript.lang.SkriptParser;
|
|
||||||
import ch.njol.util.Kleenean;
|
|
||||||
import net.limework.core.RediSkript;
|
|
||||||
import net.limework.core.managers.RedisManager;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import redis.clients.jedis.BinaryJedis;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
public class EffSendMessage extends Effect {
|
|
||||||
static {
|
|
||||||
Skript.registerEffect(EffSendMessage.class, "send redis message %string% to [channel] %string%");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Expression<String> channel;
|
|
||||||
private Expression<String> message;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void execute(Event event) {
|
|
||||||
|
|
||||||
RediSkript plugin = (RediSkript) Bukkit.getPluginManager().getPlugin("RediSkript");
|
|
||||||
|
|
||||||
String message = this.message.getSingle(event);
|
|
||||||
String channel = this.channel.getSingle(event);
|
|
||||||
|
|
||||||
if (message == null) {
|
|
||||||
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &cRedis message was empty. Please check your code."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (channel == null) {
|
|
||||||
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &cChannel was empty. Please check your code."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assert plugin != null;
|
|
||||||
RedisManager manager = plugin.getRm();
|
|
||||||
//manager.getRedisService().execute(() -> {
|
|
||||||
BinaryJedis j = manager.getJedisPool().getResource();
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("Message", message);
|
|
||||||
json.put("Type", "Skript");
|
|
||||||
json.put("Date", System.currentTimeMillis()); //for unique string every time & PING calculations
|
|
||||||
byte[] msg;
|
|
||||||
if (manager.getEncryption().isEncryptionEnabled()) {
|
|
||||||
msg = manager.getEncryption().encrypt(json.toString());
|
|
||||||
} else {
|
|
||||||
msg = json.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
}
|
|
||||||
j.publish(channel.getBytes(StandardCharsets.UTF_8), msg);
|
|
||||||
j.close();
|
|
||||||
//});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(Event event, boolean b) {
|
|
||||||
return "send redis message " + message.getSingle(event) + " to channel " + channel.getSingle(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
|
||||||
this.message = (Expression<String>) expressions[0];
|
|
||||||
this.channel = (Expression<String>) expressions[1];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
46
src/main/java/net/limework/rediskript/RediSkript.java
Normal file
46
src/main/java/net/limework/rediskript/RediSkript.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package net.limework.rediskript;
|
||||||
|
import net.limework.rediskript.commands.CommandReloadRedis;
|
||||||
|
import net.limework.rediskript.skript.SkriptHook;
|
||||||
|
import net.limework.rediskript.managers.RedisManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.PluginCommand;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class RediSkript extends JavaPlugin {
|
||||||
|
|
||||||
|
//Redis manager
|
||||||
|
private RedisManager rm;
|
||||||
|
|
||||||
|
public void startRedis(boolean reload) {
|
||||||
|
if (reload) { reloadConfig(); }
|
||||||
|
rm = new RedisManager(this);
|
||||||
|
rm.start();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
saveDefaultConfig();
|
||||||
|
startRedis(false);
|
||||||
|
|
||||||
|
PluginCommand command = getServer().getPluginCommand("reloadredis");
|
||||||
|
assert command != null;
|
||||||
|
command.setExecutor(new CommandReloadRedis(this));
|
||||||
|
|
||||||
|
new SkriptHook(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//using HIGHEST event priority so it shuts down last and code can still execute well in "on script unload" and "on skript unload" events
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onDisable() {
|
||||||
|
if (rm != null) {
|
||||||
|
rm.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public RedisManager getRm() {
|
||||||
|
return rm;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.limework.core.commands;
|
package net.limework.rediskript.commands;
|
||||||
|
|
||||||
import net.limework.core.RediSkript;
|
import net.limework.rediskript.RediSkript;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@@ -8,9 +8,9 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ReloadRedis implements CommandExecutor {
|
public class CommandReloadRedis implements CommandExecutor {
|
||||||
private RediSkript plugin;
|
private RediSkript plugin;
|
||||||
public ReloadRedis(RediSkript plugin) {
|
public CommandReloadRedis(RediSkript plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@@ -23,7 +23,7 @@ public class ReloadRedis implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
plugin.getRm().reload();
|
plugin.getRm().reload();
|
||||||
//not sending to sender, because this command can only be executed via console
|
//not sending to sender, because this command can only be executed via console
|
||||||
Bukkit.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &eReloaded via command! Note this command is not stable, it should only be used in urgent cases where you absolutely need to change config details without restarting the server."));
|
Bukkit.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&eReloaded via command! Note this command is not stable, it should only be used in urgent cases where you absolutely need to change config details without restarting the server."));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.limework.data;
|
package net.limework.rediskript.data;
|
||||||
|
|
||||||
import org.bukkit.configuration.Configuration;
|
import org.bukkit.configuration.Configuration;
|
||||||
import org.cryptomator.siv.SivMode;
|
import org.cryptomator.siv.SivMode;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.limework.core.events;
|
package net.limework.rediskript.events;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -12,7 +12,7 @@ public class RedisMessageEvent extends Event {
|
|||||||
private long date;
|
private long date;
|
||||||
|
|
||||||
public RedisMessageEvent(String channelName , String message, long date) {
|
public RedisMessageEvent(String channelName , String message, long date) {
|
||||||
super(true);
|
super(false);
|
||||||
this.channelName = channelName;
|
this.channelName = channelName;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package net.limework.core.managers;
|
package net.limework.rediskript.managers;
|
||||||
|
|
||||||
import net.limework.core.RediSkript;
|
import net.limework.rediskript.RediSkript;
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
import net.limework.data.Encryption;
|
import net.limework.rediskript.data.Encryption;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.Configuration;
|
import org.bukkit.configuration.Configuration;
|
||||||
@@ -18,10 +18,12 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
||||||
|
|
||||||
|
private final ExecutorService RedisReconnector;
|
||||||
private RediSkript plugin;
|
private RediSkript plugin;
|
||||||
|
|
||||||
private JedisPool jedisPool;
|
private JedisPool jedisPool;
|
||||||
@@ -52,6 +54,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
|||||||
config.getInt("Redis.TimeOut"),
|
config.getInt("Redis.TimeOut"),
|
||||||
config.getString("Redis.Password"),
|
config.getString("Redis.Password"),
|
||||||
config.getBoolean("Redis.useTLS"));
|
config.getBoolean("Redis.useTLS"));
|
||||||
|
RedisReconnector = Executors.newSingleThreadExecutor();
|
||||||
RedisService = Executors.newSingleThreadExecutor();
|
RedisService = Executors.newSingleThreadExecutor();
|
||||||
try {
|
try {
|
||||||
this.subscribeJedis = this.jedisPool.getResource();
|
this.subscribeJedis = this.jedisPool.getResource();
|
||||||
@@ -63,16 +66,16 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
this.RedisService.execute(this);
|
this.RedisReconnector.execute(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (!isShuttingDown.get()) {
|
while (!isShuttingDown.get()) {
|
||||||
try {
|
try {
|
||||||
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &cConnecting to redis..."));
|
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&cConnecting to redis..."));
|
||||||
if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource();
|
if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource();
|
||||||
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &aRedis connected!"));
|
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&aRedis connected!"));
|
||||||
int byteArr2dSize = 1;
|
int byteArr2dSize = 1;
|
||||||
byte[][] channelsInByte = new byte[channels.size()][byteArr2dSize];
|
byte[][] channelsInByte = new byte[channels.size()][byteArr2dSize];
|
||||||
boolean reInitializeByteArray;
|
boolean reInitializeByteArray;
|
||||||
@@ -95,7 +98,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
|||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plugin.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &cConnection to redis has failed! &ereconnecting..."));
|
plugin.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&cConnection to redis has failed! &cReconnecting..."));
|
||||||
if (this.subscribeJedis != null) {
|
if (this.subscribeJedis != null) {
|
||||||
this.subscribeJedis.close();
|
this.subscribeJedis.close();
|
||||||
}
|
}
|
||||||
@@ -131,23 +134,34 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
|||||||
//System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString());
|
//System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString());
|
||||||
RedisMessageEvent event = new RedisMessageEvent(channelString, j.getString("Message"), j.getLong("Date"));
|
RedisMessageEvent event = new RedisMessageEvent(channelString, j.getString("Message"), j.getLong("Date"));
|
||||||
|
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
//if plugin is disabling, don't call events anymore
|
||||||
|
|
||||||
|
if (plugin.isEnabled()) {
|
||||||
|
Bukkit.getScheduler().runTask(plugin, () -> plugin.getServer().getPluginManager().callEvent(event));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &cI got a message that was empty from channel " + channelString + " please check your code that you used to send the message. Message content:"));
|
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&cI got a message that was empty from channel " + channelString + " please check your code that you used to send the message. Message content:"));
|
||||||
Bukkit.getLogger().warning(receivedMessage);
|
Bukkit.getLogger().warning(receivedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
|
try {
|
||||||
|
this.RedisService.awaitTermination(1, TimeUnit.SECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
this.isShuttingDown.set(true);
|
this.isShuttingDown.set(true);
|
||||||
if (this.subscribeJedis != null) {
|
if (this.subscribeJedis != null) {
|
||||||
this.unsubscribe();
|
this.unsubscribe();
|
||||||
this.subscribeJedis.close();
|
this.subscribeJedis.close();
|
||||||
|
this.subscribeJedis.getClient().close();
|
||||||
this.jedisPool.getResource().close();
|
this.jedisPool.getResource().close();
|
||||||
}
|
}
|
||||||
|
this.RedisReconnector.shutdown();
|
||||||
this.RedisService.shutdown();
|
this.RedisService.shutdown();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -163,4 +177,6 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
|||||||
public Encryption getEncryption() {
|
public Encryption getEncryption() {
|
||||||
return encryption;
|
return encryption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExecutorService getRedisService() { return RedisService; }
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.limework.core.hooks;
|
package net.limework.rediskript.skript;
|
||||||
|
|
||||||
import ch.njol.skript.Skript;
|
import ch.njol.skript.Skript;
|
||||||
import ch.njol.skript.SkriptAddon;
|
import ch.njol.skript.SkriptAddon;
|
||||||
@@ -6,22 +6,20 @@ import ch.njol.skript.lang.ExpressionType;
|
|||||||
import ch.njol.skript.registrations.EventValues;
|
import ch.njol.skript.registrations.EventValues;
|
||||||
import ch.njol.skript.util.Date;
|
import ch.njol.skript.util.Date;
|
||||||
import ch.njol.skript.util.Getter;
|
import ch.njol.skript.util.Getter;
|
||||||
import net.limework.core.RediSkript;
|
import net.limework.rediskript.RediSkript;
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
import net.limework.core.skript.elements.EvtRedis;
|
import net.limework.rediskript.skript.elements.EvtRedis;
|
||||||
import net.limework.core.skript.elements.ExprChannel;
|
import net.limework.rediskript.skript.elements.ExprChannel;
|
||||||
import net.limework.core.skript.elements.ExprMessage;
|
import net.limework.rediskript.skript.elements.ExprMessage;
|
||||||
import net.limework.core.skript.elements.ExprMessageDate;
|
import net.limework.rediskript.skript.elements.ExprMessageDate;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class SkriptHook {
|
public class SkriptHook {
|
||||||
|
|
||||||
private SkriptAddon addon;
|
|
||||||
public SkriptHook(RediSkript plugin) {
|
public SkriptHook(RediSkript plugin) {
|
||||||
addon = Skript.registerAddon(plugin);
|
SkriptAddon addon = Skript.registerAddon(plugin);
|
||||||
try {
|
try {
|
||||||
addon.loadClasses("net.limework.core.skript", "elements");
|
addon.loadClasses("net.limework.rediskript.skript", "elements");
|
||||||
Skript.registerEvent("redis message", EvtRedis.class, RedisMessageEvent.class, "redis message");
|
Skript.registerEvent("redis message", EvtRedis.class, RedisMessageEvent.class, "redis message");
|
||||||
Skript.registerExpression(ExprChannel.class, String.class, ExpressionType.SIMPLE, "redis channel");
|
Skript.registerExpression(ExprChannel.class, String.class, ExpressionType.SIMPLE, "redis channel");
|
||||||
EventValues.registerEventValue(RedisMessageEvent.class, String.class, new Getter<String, RedisMessageEvent>() {
|
EventValues.registerEventValue(RedisMessageEvent.class, String.class, new Getter<String, RedisMessageEvent>() {
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
import ch.njol.skript.Skript;
|
||||||
|
import ch.njol.skript.lang.Effect;
|
||||||
|
import ch.njol.skript.lang.Expression;
|
||||||
|
import ch.njol.skript.lang.SkriptParser;
|
||||||
|
import ch.njol.util.Kleenean;
|
||||||
|
import net.limework.rediskript.RediSkript;
|
||||||
|
import net.limework.rediskript.managers.RedisManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import redis.clients.jedis.BinaryJedis;
|
||||||
|
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
public class EffSendMessage extends Effect {
|
||||||
|
static {
|
||||||
|
Skript.registerEffect(EffSendMessage.class, "send redis message %string% to [channel] %string%");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Expression<String> channel;
|
||||||
|
private Expression<String> message;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void execute(Event event) {
|
||||||
|
|
||||||
|
RediSkript plugin = (RediSkript) Bukkit.getPluginManager().getPlugin("RediSkript");
|
||||||
|
|
||||||
|
String message = this.message.getSingle(event);
|
||||||
|
String channel = this.channel.getSingle(event);
|
||||||
|
|
||||||
|
if (message == null) {
|
||||||
|
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &cRedis message was empty. Please check your code."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (channel == null) {
|
||||||
|
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aRediSkript&a] &cChannel was empty. Please check your code."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert plugin != null;
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("Message", message);
|
||||||
|
json.put("Type", "Skript");
|
||||||
|
json.put("Date", System.currentTimeMillis()); //for unique string every time & PING calculations
|
||||||
|
byte[] msg;
|
||||||
|
RedisManager manager = plugin.getRm();
|
||||||
|
if (manager.getEncryption().isEncryptionEnabled()) {
|
||||||
|
msg = manager.getEncryption().encrypt(json.toString());
|
||||||
|
} else {
|
||||||
|
msg = json.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
|
||||||
|
//execute sending of redis message on the main thread if plugin is disabling
|
||||||
|
//so it can still process the sending
|
||||||
|
|
||||||
|
//sending a redis message blocks main thread if there's no more connections available
|
||||||
|
//so to avoid issues, it's best to do it always on separate thread
|
||||||
|
if (plugin.isEnabled()) {
|
||||||
|
manager.getRedisService().execute(() -> {
|
||||||
|
BinaryJedis j = manager.getJedisPool().getResource();
|
||||||
|
j.publish(channel.getBytes(StandardCharsets.UTF_8), msg);
|
||||||
|
j.close();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
BinaryJedis j = manager.getJedisPool().getResource();
|
||||||
|
j.publish(channel.getBytes(StandardCharsets.UTF_8), msg);
|
||||||
|
j.close();
|
||||||
|
}
|
||||||
|
} catch (JedisConnectionException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Event event, boolean debug) {
|
||||||
|
return "send redis message " + message.toString(event, debug) + " to channel " + channel.toString(event, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean init(final Expression<?>[] expressions, final int matchedPattern, final Kleenean isDelayed, final SkriptParser.ParseResult parser) {
|
||||||
|
this.message = (Expression<String>) expressions[0];
|
||||||
|
this.channel = (Expression<String>) expressions[1];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package net.limework.core.skript.elements;
|
package net.limework.rediskript.skript.elements;
|
||||||
import ch.njol.skript.lang.Literal;
|
import ch.njol.skript.lang.Literal;
|
||||||
import ch.njol.skript.lang.SkriptEvent;
|
import ch.njol.skript.lang.SkriptEvent;
|
||||||
import ch.njol.skript.lang.SkriptParser;
|
import ch.njol.skript.lang.SkriptParser;
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
public class EvtRedis extends SkriptEvent {
|
public class EvtRedis extends SkriptEvent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Literal<?>[] literals, int i, SkriptParser.ParseResult parseResult) {
|
public boolean init(final Literal<?>[] literals, final int i, final SkriptParser.ParseResult parseResult) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.limework.core.skript.elements;
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
|
||||||
import ch.njol.skript.ScriptLoader;
|
import ch.njol.skript.ScriptLoader;
|
||||||
@@ -8,7 +8,7 @@ import ch.njol.skript.lang.SkriptParser;
|
|||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
import ch.njol.skript.log.ErrorQuality;
|
import ch.njol.skript.log.ErrorQuality;
|
||||||
import ch.njol.util.Kleenean;
|
import ch.njol.util.Kleenean;
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
public class ExprChannel extends SimpleExpression<String> {
|
public class ExprChannel extends SimpleExpression<String> {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.limework.core.skript.elements;
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
|
||||||
import ch.njol.skript.ScriptLoader;
|
import ch.njol.skript.ScriptLoader;
|
||||||
@@ -8,7 +8,7 @@ import ch.njol.skript.lang.SkriptParser;
|
|||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
import ch.njol.skript.log.ErrorQuality;
|
import ch.njol.skript.log.ErrorQuality;
|
||||||
import ch.njol.util.Kleenean;
|
import ch.njol.util.Kleenean;
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
public class ExprMessage extends SimpleExpression<String> {
|
public class ExprMessage extends SimpleExpression<String> {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.limework.core.skript.elements;
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
|
||||||
import ch.njol.skript.ScriptLoader;
|
import ch.njol.skript.ScriptLoader;
|
||||||
@@ -9,7 +9,7 @@ import ch.njol.skript.lang.util.SimpleExpression;
|
|||||||
import ch.njol.skript.log.ErrorQuality;
|
import ch.njol.skript.log.ErrorQuality;
|
||||||
import ch.njol.skript.util.Date;
|
import ch.njol.skript.util.Date;
|
||||||
import ch.njol.util.Kleenean;
|
import ch.njol.util.Kleenean;
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
public class ExprMessageDate extends SimpleExpression<Date> {
|
public class ExprMessageDate extends SimpleExpression<Date> {
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
main: net.limework.core.RediSkript
|
main: net.limework.rediskript.RediSkript
|
||||||
name: RediSkript
|
name: RediSkript
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
authors: [Govindas, ham1255, DaemonicKing]
|
authors: [Govindas, ham1255, DaemonicKing]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
depend:
|
depend: [Skript]
|
||||||
- Skript
|
|
||||||
commands:
|
commands:
|
||||||
reloadredis:
|
reloadredis:
|
||||||
description: "Reload redis configuration & restart the connection."
|
description: "Reload redis configuration & restart the connection."
|
||||||
Reference in New Issue
Block a user