Compare commits
57 Commits
1.0.3-SNAP
...
1.3.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d5d281fe4 | ||
|
|
5699b9445f | ||
|
|
053bb04918 | ||
|
|
2140cd67ff | ||
|
|
e9ae0bd50b | ||
|
|
6ea120a85a | ||
|
|
01525e4d63 | ||
|
|
c63495e201 | ||
|
|
265dbfa84d | ||
|
|
6f600cc96e | ||
|
|
1b151dfbbe | ||
|
|
afdb0c3e59 | ||
|
|
ca64ec19db | ||
|
|
c0bd63e3cd | ||
|
|
705ce16f5d | ||
|
|
5a4943bd9d | ||
|
|
211a45ee52 | ||
|
|
1e85072e34 | ||
|
|
a60cae72e3 | ||
|
|
d4461f09c8 | ||
|
|
dd6b9b6ee6 | ||
|
|
2ee28a5450 | ||
|
|
26b9e0e1d8 | ||
|
|
933b85b2d5 | ||
|
|
824cf3664c | ||
|
|
d02cac7c5d | ||
|
|
a520ba6496 | ||
|
|
4d265cbf61 | ||
|
|
7849efd866 | ||
|
|
f80d9b36e7 | ||
|
|
0c20becfa1 | ||
|
|
089fdfd1f3 | ||
|
|
c4426a692e | ||
|
|
ed3ea7b2c7 | ||
|
|
2b00f0908e | ||
|
|
f6c4bbcdce | ||
|
|
ba48fdc564 | ||
|
|
ce47af29f4 | ||
|
|
b93624bc49 | ||
|
|
6c5d580b16 | ||
|
|
a08ecd93b7 | ||
|
|
c720433c60 | ||
|
|
12ce69d68f | ||
|
|
efab085c47 | ||
|
|
31db51fce6 | ||
|
|
776ebc9780 | ||
|
|
1ef35dfb60 | ||
|
|
2049616f64 | ||
|
|
97aa663bfd | ||
|
|
4afd5a2dbc | ||
|
|
92d89ec76d | ||
|
|
0ca8712a1a | ||
|
|
216b2635b3 | ||
|
|
df8608802d | ||
|
|
157e2b08c7 | ||
|
|
5f4600546e | ||
|
|
f4ab43bcb8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,3 @@ target
|
|||||||
out
|
out
|
||||||
.idea
|
.idea
|
||||||
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$/../../Govindo/testserver/plugins</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>
|
||||||
40
.idea/jarRepositories.xml
generated
Normal file
40
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="PaperMC" />
|
||||||
|
<option name="name" value="PaperMC" />
|
||||||
|
<option name="url" value="https://repo.destroystokyo.com/repository/maven-public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<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="sk89q" />
|
||||||
|
<option name="name" value="sk89q" />
|
||||||
|
<option name="url" value="http://maven.sk89q.com/repo" />
|
||||||
|
</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>
|
||||||
74
README.md
74
README.md
@@ -1,2 +1,72 @@
|
|||||||
# SkLimework
|
RediSkript allows you to communicate between your servers with use of Redis, it's very fast and easy to use.
|
||||||
Private addon
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Redis Message:
|
||||||
|
```
|
||||||
|
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"
|
||||||
|
```
|
||||||
|
Managing variables:
|
||||||
|
```
|
||||||
|
set variables "test::1", "test::2", "test::3" in channel "global" to 100
|
||||||
|
#then use this in any server that listens to "global" redis channel and was online when the above line was executed:
|
||||||
|
send "%{test::*}%" #outputs 100, 100 and 100
|
||||||
|
|
||||||
|
delete variables "test::*" in channel "global"
|
||||||
|
|
||||||
|
set variable "test::%uuid of player%" in channel "playerdata" to tool of player
|
||||||
|
#then you can in any server that is listening to "playerdata" channel and was online when the above line was executed:
|
||||||
|
give {test::%uuid of player%} to player
|
||||||
|
```
|
||||||
|
Syntax:
|
||||||
|
```
|
||||||
|
variable[s] %strings% in [redis] [channel] %string%
|
||||||
|
```
|
||||||
|
|
||||||
|
There is only one command: /reloadredis it fully reloads the configuration, you can reload IP, password, channels and everything else.
|
||||||
|
|
||||||
|
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"
|
||||||
|
```
|
||||||
|
|||||||
66
RediSkript.iml
Normal file
66
RediSkript.iml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?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: com.destroystokyo.paper:paper-api:1.15-R0.1-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:7.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:7.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:7.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:7.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jdt:org.eclipse.jdt.annotation:1.1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:findbugs:3.0.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.jcip:jcip-annotations:1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:bcel-findbugs:6.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jFormatString:2.0.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: dom4j:dom4j:1.6.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-debug-all:5.0.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.apple:AppleJavaExtensions:1.4" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: jaxen:jaxen:1.1.6" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:7.0.0-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.0.0-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.8.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.8.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-core:7.0.0-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.intake:intake:4.2-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:squirrelid:0.2.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.khelekore:prtree:1.5.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.4" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.marcelo-mason:PreciousStones:24e3d4bf67b7240ae36b32be10e99d4091938c5c" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: ant-contrib:ant-contrib:1.0b3" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:Vault:1.7.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" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: redis.clients:jedis:3.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" 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" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jetbrains:annotations:19.0.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
75
pom.xml
75
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>LimeworkSpigotCore</artifactId>
|
<artifactId>RediSkript</artifactId>
|
||||||
<version>1.0.3-SNAPSHOT</version>
|
<version>1.3.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -27,95 +27,62 @@
|
|||||||
<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>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>PaperMC</id>
|
<id>commons-pool2</id>
|
||||||
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
|
<url>https://mvnrepository.com/artifact/org.apache.commons/commons-pool2</url>
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>sk89q</id>
|
|
||||||
<url>http://maven.sk89q.com/repo</url>
|
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<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>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
<version>1.16.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>2.8.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<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>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
<version>2.6.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<version>19.0.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mongodb</groupId>
|
|
||||||
<artifactId>mongodb-driver-sync</artifactId>
|
|
||||||
<version>4.0.4</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: net.limework.rediskript.RediSkript
|
||||||
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package net.limework.core;
|
|
||||||
|
|
||||||
import net.limework.core.guis.ControlGui;
|
|
||||||
import net.limework.core.hooks.SkriptHook;
|
|
||||||
import net.limework.core.managers.DataSourcesManager;
|
|
||||||
import net.limework.core.managers.RedisManager;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class LimeworkSpigotCore extends JavaPlugin {
|
|
||||||
|
|
||||||
//Redis manager
|
|
||||||
private RedisManager rm;
|
|
||||||
|
|
||||||
//data
|
|
||||||
private DataSourcesManager dsm;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
saveDefaultConfig();
|
|
||||||
rm = new RedisManager(this);
|
|
||||||
getServer().getPluginCommand("reloadredis").setExecutor(rm);
|
|
||||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
|
||||||
new SkriptHook(this);
|
|
||||||
} else {
|
|
||||||
getLogger().info("Skript wasn't found.");
|
|
||||||
}
|
|
||||||
rm.start();
|
|
||||||
try {
|
|
||||||
ControlGui controlGui = new ControlGui(this);
|
|
||||||
this.getServer().getPluginManager().registerEvents(controlGui, this);
|
|
||||||
this.getCommand("control").setExecutor(controlGui);
|
|
||||||
} catch (NoSuchFieldError e) {
|
|
||||||
getLogger().info("SOMETHING WENT WRONG WHEN LOADING control gui.");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
dsm = new DataSourcesManager(this);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
rm.shutdown();
|
|
||||||
dsm.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public RedisManager getRm() {
|
|
||||||
return rm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataSourcesManager getDsm() {
|
|
||||||
return dsm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,70 +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.LimeworkSpigotCore;
|
|
||||||
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 {
|
|
||||||
//"hi"
|
|
||||||
static {
|
|
||||||
Skript.registerEffect(EffSendMessage.class, "send redis message to channel %string% with message %string%");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Expression<String> channel;
|
|
||||||
private Expression<String> message;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void execute(Event event) {
|
|
||||||
LimeworkSpigotCore plugin = (LimeworkSpigotCore) Bukkit.getPluginManager().getPlugin("LimeworkSpigotCore");
|
|
||||||
String message = this.message.getSingle(event);
|
|
||||||
String channel = this.channel.getSingle(event);
|
|
||||||
if (message == null) {//checks if message equals null if true does not execute.
|
|
||||||
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aGBot&a] &cMessage Was empty Please check your code."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assert plugin != null;
|
|
||||||
plugin.getRm().getRedisService().execute(() -> {
|
|
||||||
BinaryJedis j = plugin.getRm().getJedisPool().getResource();
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("Message", message);
|
|
||||||
json.put("Type", "Skript");
|
|
||||||
json.put("Date", System.nanoTime()); //for unique string every time & PING calculations
|
|
||||||
byte[] msg;
|
|
||||||
if (plugin.getRm().getEncryption().isEncryptionEnabled()) {
|
|
||||||
msg = plugin.getRm().getEncryption().encrypt(json.toString());
|
|
||||||
} else {
|
|
||||||
msg = message.getBytes(StandardCharsets.UTF_8);
|
|
||||||
}
|
|
||||||
j.publish(channel.getBytes(), msg);
|
|
||||||
//System.out.println("SkriptSide sent MESSAGE: ["+ message + "] to channel: " + channel + " and json: \n" + json.toString());
|
|
||||||
j.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(Event event, boolean b) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
|
||||||
this.channel = (Expression<String>) expressions[0];
|
|
||||||
this.message = (Expression<String>) expressions[1];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
package net.limework.core.abstraction;
|
|
||||||
|
|
||||||
import ch.njol.skript.Skript;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.bukkit.ChatColor.translateAlternateColorCodes;
|
|
||||||
|
|
||||||
public abstract class Gui {
|
|
||||||
protected Inventory gui;
|
|
||||||
private int rows;
|
|
||||||
private boolean loaded = false;
|
|
||||||
protected String name;
|
|
||||||
|
|
||||||
|
|
||||||
protected void setup(String name, int rows) {
|
|
||||||
if (loaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loaded = true;
|
|
||||||
this.rows = 9 * rows;
|
|
||||||
this.name = ChatColor.translateAlternateColorCodes('&', name);
|
|
||||||
gui = Bukkit.createInventory(null, this.rows, this.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void makeItem(Material material, int howMany, int slot, String name) {
|
|
||||||
ItemStack item = new ItemStack(material, 1);
|
|
||||||
ItemMeta item_meta = item.getItemMeta();
|
|
||||||
item_meta.setDisplayName(translateAlternateColorCodes('&', name));
|
|
||||||
item.setItemMeta(item_meta);
|
|
||||||
item.setAmount(howMany);
|
|
||||||
this.gui.clear(slot);
|
|
||||||
this.gui.setItem(slot, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void makeItem(Material material, int howMany, int slot, String name, String... Lore) {
|
|
||||||
ItemStack item = new ItemStack(material, 1);
|
|
||||||
ItemMeta item_meta = item.getItemMeta();
|
|
||||||
item_meta.setDisplayName(translateAlternateColorCodes('&', name));
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
for (String s : Lore) {
|
|
||||||
lore.add(translateAlternateColorCodes('&', s));
|
|
||||||
}
|
|
||||||
item_meta.setLore(lore);
|
|
||||||
item.setItemMeta(item_meta);
|
|
||||||
item.setAmount(howMany);
|
|
||||||
this.gui.clear(slot);
|
|
||||||
this.gui.setItem(slot, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fillGUI(Material material) {
|
|
||||||
int slot = -1;
|
|
||||||
while (slot <= (this.rows - 2)) {
|
|
||||||
slot++;
|
|
||||||
makeItem(material, 1, slot , "&1.", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
package net.limework.core.guis;
|
|
||||||
|
|
||||||
import net.limework.core.LimeworkSpigotCore;
|
|
||||||
import net.limework.core.abstraction.Gui;
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class ControlGui extends Gui implements Listener, CommandExecutor {
|
|
||||||
private LimeworkSpigotCore plugin;
|
|
||||||
|
|
||||||
public ControlGui(LimeworkSpigotCore plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
setup("&cServer Control", 6);
|
|
||||||
//fillGUI(Material.LIME_STAINED_GLASS_PANE);
|
|
||||||
makeItem(Material.CRAFTING_TABLE, 1, 10, "&eCreative mode", "&cClick this for creative mode.");
|
|
||||||
makeItem(Material.DIAMOND_SWORD, 1, 12, "&eSurvival Mode", "&bClick this for Survival mode.");
|
|
||||||
makeItem(Material.DIAMOND, 1, 14, "&eSpectator Mode", "&eClick this for Spectator mode.");
|
|
||||||
makeItem(Material.PUFFERFISH, 1, 16, "&eAdventure Mode", "&aClick this for Adventure mode.");
|
|
||||||
plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
|
|
||||||
makeItem(Material.OAK_SIGN, 1, 37, "&eRam: " + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000000) + "MB/" + (Runtime.getRuntime().totalMemory() / 1000000) + "MB");
|
|
||||||
makeItem(Material.PLAYER_HEAD, 1, 40, "&eOnline Players: " + plugin.getServer().getOnlinePlayers().size() + "/" + plugin.getServer().getMaxPlayers());
|
|
||||||
}, 0, 20);
|
|
||||||
makeItem(Material.RED_WOOL, 1, 53, "&c&lShutdown the server");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
Player p = ((Player) sender);
|
|
||||||
p.openInventory(gui);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInventory(InventoryClickEvent e) {
|
|
||||||
if (e.getInventory() == gui) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
Player p = (Player) e.getWhoClicked();
|
|
||||||
switch (e.getSlot()) {
|
|
||||||
case 10: {
|
|
||||||
p.setGameMode(GameMode.CREATIVE);
|
|
||||||
p.closeInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 12: {
|
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
|
||||||
p.closeInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 14: {
|
|
||||||
p.setGameMode(GameMode.SPECTATOR);
|
|
||||||
p.closeInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 16: {
|
|
||||||
p.setGameMode(GameMode.ADVENTURE);
|
|
||||||
p.closeInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 53: {
|
|
||||||
p.closeInventory();
|
|
||||||
plugin.getServer().shutdown();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 0.0f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package net.limework.core.hooks;
|
|
||||||
|
|
||||||
import ch.njol.skript.Skript;
|
|
||||||
import ch.njol.skript.SkriptAddon;
|
|
||||||
import ch.njol.skript.lang.ExpressionType;
|
|
||||||
import ch.njol.skript.registrations.EventValues;
|
|
||||||
import ch.njol.skript.util.Getter;
|
|
||||||
import net.limework.core.LimeworkSpigotCore;
|
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
|
||||||
import net.limework.core.skript.elements.EvtRedis;
|
|
||||||
import net.limework.core.skript.elements.ExprChannel;
|
|
||||||
import net.limework.core.skript.elements.ExprMessage;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class SkriptHook {
|
|
||||||
|
|
||||||
private SkriptAddon addon;
|
|
||||||
public SkriptHook(LimeworkSpigotCore plugin) {
|
|
||||||
addon = Skript.registerAddon(plugin);
|
|
||||||
try {
|
|
||||||
addon.loadClasses("net.limework.core.skript", "elements");
|
|
||||||
Skript.registerEvent("redis message", EvtRedis.class, RedisMessageEvent.class, "redis message");
|
|
||||||
Skript.registerExpression(ExprChannel.class, String.class, ExpressionType.SIMPLE, "redis channel");
|
|
||||||
EventValues.registerEventValue(RedisMessageEvent.class, String.class, new Getter<String, RedisMessageEvent>() {
|
|
||||||
@Override
|
|
||||||
public String get(RedisMessageEvent e) {
|
|
||||||
return e.getChannelName();
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
Skript.registerExpression(ExprMessage.class, String.class, ExpressionType.SIMPLE, "redis message");
|
|
||||||
EventValues.registerEventValue(RedisMessageEvent.class, String.class, new Getter<String, RedisMessageEvent>() {
|
|
||||||
@Override
|
|
||||||
public String get(RedisMessageEvent e) {
|
|
||||||
return e.getMessage();
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public SkriptAddon getAddon() {
|
|
||||||
return addon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package net.limework.core.managers;
|
|
||||||
|
|
||||||
import com.mongodb.client.MongoClient;
|
|
||||||
import com.mongodb.client.MongoClients;
|
|
||||||
import net.limework.core.LimeworkSpigotCore;
|
|
||||||
import org.bukkit.configuration.Configuration;
|
|
||||||
|
|
||||||
public class DataSourcesManager {
|
|
||||||
|
|
||||||
private MongoClient mongoClient;
|
|
||||||
|
|
||||||
|
|
||||||
public DataSourcesManager(LimeworkSpigotCore plugin) {
|
|
||||||
Configuration config = plugin .getConfig();
|
|
||||||
if (config.getBoolean("Mongodb.enabled")){
|
|
||||||
mongoClient = MongoClients.create(config.getString("Mongodb.url"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdown(){
|
|
||||||
mongoClient.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MongoClient getMongoClient() {
|
|
||||||
return mongoClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
package net.limework.core.managers;
|
|
||||||
|
|
||||||
import net.limework.Data.Encryption;
|
|
||||||
import net.limework.core.LimeworkSpigotCore;
|
|
||||||
import net.limework.core.events.RedisMessageEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.Configuration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.cryptomator.siv.UnauthenticCiphertextException;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import redis.clients.jedis.BinaryJedis;
|
|
||||||
import redis.clients.jedis.BinaryJedisPubSub;
|
|
||||||
import redis.clients.jedis.JedisPool;
|
|
||||||
import redis.clients.jedis.JedisPoolConfig;
|
|
||||||
|
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class RedisManager extends BinaryJedisPubSub implements Runnable, CommandExecutor {
|
|
||||||
|
|
||||||
private LimeworkSpigotCore plugin;
|
|
||||||
|
|
||||||
private JedisPool jedisPool;
|
|
||||||
private ExecutorService RedisService;
|
|
||||||
|
|
||||||
|
|
||||||
//sub
|
|
||||||
private BinaryJedis subscribeJedis;
|
|
||||||
private List<String> channels;
|
|
||||||
private AtomicBoolean isShuttingDown = new AtomicBoolean(false);
|
|
||||||
private AtomicBoolean isRedisOnline = new AtomicBoolean();
|
|
||||||
private Encryption encryption;
|
|
||||||
|
|
||||||
|
|
||||||
public RedisManager(LimeworkSpigotCore plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
Configuration config = this.plugin.getConfig();
|
|
||||||
JedisPoolConfig JConfig = new JedisPoolConfig();
|
|
||||||
JConfig.setMaxTotal(config.getInt("Redis.MaxConnections"));
|
|
||||||
JConfig.setMaxIdle(config.getInt("Redis.MaxConnections"));
|
|
||||||
JConfig.setMinIdle(1);
|
|
||||||
JConfig.setBlockWhenExhausted(true);
|
|
||||||
this.jedisPool = new JedisPool(JConfig,
|
|
||||||
config.getString("Redis.Host"),
|
|
||||||
config.getInt("Redis.Port"),
|
|
||||||
config.getInt("Redis.TimeOut"),
|
|
||||||
config.getString("Redis.Password"),
|
|
||||||
config.getBoolean("Redis.useSSL"));
|
|
||||||
RedisService = Executors.newFixedThreadPool(config.getInt("Redis.Threads"));
|
|
||||||
try {
|
|
||||||
this.subscribeJedis = this.jedisPool.getResource();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
this.channels = config.getStringList("Channels");
|
|
||||||
encryption = new Encryption(config);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start() {
|
|
||||||
this.RedisService.execute(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
while (!isShuttingDown.get()) {
|
|
||||||
try {
|
|
||||||
message("&e[Jedis] &cConnecting to redis...........");
|
|
||||||
if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource();
|
|
||||||
isRedisOnline.set(true);
|
|
||||||
message("&e[Jedis] &aRedis Connected");
|
|
||||||
int byteArr2dSize = 1;
|
|
||||||
byte[][] channelsInByte = new byte[channels.size()][byteArr2dSize];
|
|
||||||
boolean reInitializeByteArray;
|
|
||||||
|
|
||||||
// Loop that reInitialize array IF array size is not enough
|
|
||||||
do {
|
|
||||||
reInitializeByteArray = false;
|
|
||||||
try {
|
|
||||||
/* Data Initialization for channelsInByte array from List<String> channels */
|
|
||||||
for (int x = 0; x < channels.size(); x++) {
|
|
||||||
channelsInByte[x] = channels.get(x).getBytes();
|
|
||||||
}
|
|
||||||
} catch (ArrayIndexOutOfBoundsException ex) {
|
|
||||||
reInitializeByteArray = true;
|
|
||||||
/* Increase the current 2d array size to increase 1 and reinitialize the array*/
|
|
||||||
byteArr2dSize += 1;
|
|
||||||
channelsInByte = new byte[channels.size()][byteArr2dSize];
|
|
||||||
}
|
|
||||||
} while (reInitializeByteArray);
|
|
||||||
this.subscribeJedis.subscribe(this, channelsInByte);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
message("&e[Jedis] &cConnection to redis has failed! &ereconnecting...");
|
|
||||||
if (this.subscribeJedis != null) {
|
|
||||||
this.subscribeJedis.close();
|
|
||||||
}
|
|
||||||
isRedisOnline.set(false);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void message(String message) {
|
|
||||||
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', message));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(byte[] channel, byte[] message) {
|
|
||||||
String channelString = new String(channel);
|
|
||||||
try {
|
|
||||||
String decrypted = null;
|
|
||||||
try {
|
|
||||||
decrypted = encryption.decrypt(message);
|
|
||||||
} catch (UnauthenticCiphertextException | IllegalBlockSizeException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
assert decrypted != null;
|
|
||||||
JSONObject j = new JSONObject(decrypted);
|
|
||||||
//System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString());
|
|
||||||
plugin.getServer().getPluginManager().callEvent(new RedisMessageEvent(channelString, j.getString("Message")));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aGBot&a] &cI Got a Message that Was empty from channel " + channel + " Please check your code that you used to send the message. ^ ignore the error."));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdown() {
|
|
||||||
this.isShuttingDown.set(true);
|
|
||||||
if (this.subscribeJedis != null) {
|
|
||||||
this.unsubscribe();
|
|
||||||
this.subscribeJedis.close();
|
|
||||||
}
|
|
||||||
this.RedisService.shutdown();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean IsRedisOnline() {
|
|
||||||
return isRedisOnline.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JedisPool getJedisPool() {
|
|
||||||
return jedisPool;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExecutorService getRedisService() {
|
|
||||||
return RedisService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomicBoolean getIsShuttingDown() {
|
|
||||||
return isShuttingDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomicBoolean getIsRedisOnline() {
|
|
||||||
return isRedisOnline;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Encryption getEncryption() {
|
|
||||||
return encryption;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String lable, String[] args) {
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&'
|
|
||||||
, "&c&lYou can not execute this command!!!!!!")));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
start();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
75
src/main/java/net/limework/rediskript/RediSkript.java
Normal file
75
src/main/java/net/limework/rediskript/RediSkript.java
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package net.limework.rediskript;
|
||||||
|
|
||||||
|
import ch.njol.skript.Skript;
|
||||||
|
import ch.njol.skript.SkriptAddon;
|
||||||
|
import ch.njol.skript.lang.ExpressionType;
|
||||||
|
import ch.njol.skript.registrations.EventValues;
|
||||||
|
import ch.njol.skript.util.Date;
|
||||||
|
import ch.njol.skript.util.Getter;
|
||||||
|
import net.limework.rediskript.commands.CommandReloadRedis;
|
||||||
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
|
import net.limework.rediskript.managers.RedisManager;
|
||||||
|
import net.limework.rediskript.skript.elements.*;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class RediSkript extends JavaPlugin {
|
||||||
|
|
||||||
|
//Redis manager
|
||||||
|
private RedisManager rm;
|
||||||
|
|
||||||
|
public void startRedis(boolean reload) {
|
||||||
|
if (reload) { reloadConfig(); }
|
||||||
|
rm = new RedisManager(this);
|
||||||
|
rm.start();
|
||||||
|
}
|
||||||
|
public void registerSyntax() {
|
||||||
|
SkriptAddon addon = Skript.registerAddon(this);
|
||||||
|
try {
|
||||||
|
addon.loadClasses("net.limework.rediskript.skript", "elements");
|
||||||
|
Skript.registerEvent("redis message", EvtRedis.class, RedisMessageEvent.class, "redis message");
|
||||||
|
Skript.registerExpression(ExprVariableInChannel.class, Object.class, ExpressionType.PROPERTY, "variable[s] %strings% in [redis] [channel] %string%");
|
||||||
|
|
||||||
|
Skript.registerExpression(ExprChannel.class, String.class, ExpressionType.SIMPLE, "redis channel");
|
||||||
|
EventValues.registerEventValue(RedisMessageEvent.class, String.class, new Getter<String, RedisMessageEvent>() {
|
||||||
|
@Override
|
||||||
|
public String get(RedisMessageEvent e) {
|
||||||
|
return e.getChannelName();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
Skript.registerExpression(ExprMessage.class, String.class, ExpressionType.SIMPLE, "redis message");
|
||||||
|
EventValues.registerEventValue(RedisMessageEvent.class, String.class, new Getter<String, RedisMessageEvent>() {
|
||||||
|
@Override
|
||||||
|
public String get(RedisMessageEvent e) {
|
||||||
|
return e.getMessage();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
Skript.registerExpression(ExprMessageDate.class, Date.class, ExpressionType.SIMPLE, "redis message date");
|
||||||
|
EventValues.registerEventValue(RedisMessageEvent.class, Date.class, new Getter<Date, RedisMessageEvent>() {
|
||||||
|
@Override
|
||||||
|
public Date get(RedisMessageEvent e) {
|
||||||
|
return new Date(e.getDate());
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
saveDefaultConfig();
|
||||||
|
startRedis(false);
|
||||||
|
getServer().getPluginCommand("reloadredis").setExecutor(new CommandReloadRedis(this));
|
||||||
|
registerSyntax();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
if (rm != null) rm.shutdown();
|
||||||
|
}
|
||||||
|
public RedisManager getRedisManager() {
|
||||||
|
return rm;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package net.limework.rediskript.commands;
|
||||||
|
|
||||||
|
import net.limework.rediskript.RediSkript;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
public class CommandReloadRedis implements CommandExecutor {
|
||||||
|
private RediSkript plugin;
|
||||||
|
public CommandReloadRedis(RediSkript plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
//not using bungee TextComponent because it is not present in 1.8.8
|
||||||
|
sender.sendMessage((ChatColor.translateAlternateColorCodes('&'
|
||||||
|
, "&2[&aRediSkript&2] &cThis command can only be executed in console.")));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
plugin.getRedisManager().reload();
|
||||||
|
//not sending to sender, because this command can only be executed via console
|
||||||
|
Bukkit.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&eReloaded channels, encryption and login details!"));
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -26,11 +26,11 @@ public class Encryption {
|
|||||||
public boolean isEncryptionEnabled() { return encryptionEnabled; }
|
public boolean isEncryptionEnabled() { return encryptionEnabled; }
|
||||||
|
|
||||||
public String decrypt(byte[] message) throws UnauthenticCiphertextException, IllegalBlockSizeException {
|
public String decrypt(byte[] message) throws UnauthenticCiphertextException, IllegalBlockSizeException {
|
||||||
return new String(AES_SIV.decrypt(encryptionKey.getBytes(), macKey.getBytes(), message), StandardCharsets.UTF_8);
|
return new String(AES_SIV.decrypt(encryptionKey.getBytes(StandardCharsets.UTF_8), macKey.getBytes(StandardCharsets.UTF_8), message), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] encrypt(String message) {
|
public byte[] encrypt(String message) {
|
||||||
return AES_SIV.encrypt(encryptionKey.getBytes(), macKey.getBytes(), message.getBytes());
|
return AES_SIV.encrypt(encryptionKey.getBytes(StandardCharsets.UTF_8), macKey.getBytes(StandardCharsets.UTF_8), message.getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.limework.core.events;
|
package net.limework.rediskript.events;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@@ -10,11 +9,13 @@ public class RedisMessageEvent extends Event {
|
|||||||
|
|
||||||
private String channelName;
|
private String channelName;
|
||||||
private String message;
|
private String message;
|
||||||
|
private long date;
|
||||||
|
|
||||||
public RedisMessageEvent(String channelName , String message) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -35,6 +36,8 @@ public class RedisMessageEvent extends Event {
|
|||||||
return channelName;
|
return channelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getDate() { return date;}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
270
src/main/java/net/limework/rediskript/managers/RedisManager.java
Normal file
270
src/main/java/net/limework/rediskript/managers/RedisManager.java
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
package net.limework.rediskript.managers;
|
||||||
|
|
||||||
|
import ch.njol.skript.registrations.Classes;
|
||||||
|
import ch.njol.skript.variables.Variables;
|
||||||
|
import net.limework.rediskript.RediSkript;
|
||||||
|
import net.limework.rediskript.data.Encryption;
|
||||||
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.configuration.Configuration;
|
||||||
|
import org.cryptomator.siv.UnauthenticCiphertextException;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import redis.clients.jedis.BinaryJedis;
|
||||||
|
import redis.clients.jedis.BinaryJedisPubSub;
|
||||||
|
import redis.clients.jedis.JedisPool;
|
||||||
|
import redis.clients.jedis.JedisPoolConfig;
|
||||||
|
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||||
|
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
public class RedisManager extends BinaryJedisPubSub implements Runnable {
|
||||||
|
|
||||||
|
private ExecutorService RedisReconnector;
|
||||||
|
private RediSkript plugin;
|
||||||
|
|
||||||
|
private JedisPool jedisPool;
|
||||||
|
private ExecutorService RedisService;
|
||||||
|
|
||||||
|
|
||||||
|
//sub
|
||||||
|
private BinaryJedis subscribeJedis;
|
||||||
|
private List<String> channels;
|
||||||
|
private AtomicBoolean isShuttingDown = new AtomicBoolean(false);
|
||||||
|
private Encryption encryption;
|
||||||
|
|
||||||
|
|
||||||
|
public RedisManager(RediSkript plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
Configuration config = this.plugin.getConfig();
|
||||||
|
JedisPoolConfig JConfig = new JedisPoolConfig();
|
||||||
|
int maxConnections = config.getInt("Redis.MaxConnections");
|
||||||
|
if (maxConnections < 2) { maxConnections = 2; }
|
||||||
|
|
||||||
|
JConfig.setMaxTotal(maxConnections);
|
||||||
|
JConfig.setMaxIdle(maxConnections);
|
||||||
|
JConfig.setMinIdle(1);
|
||||||
|
JConfig.setBlockWhenExhausted(true);
|
||||||
|
this.jedisPool = new JedisPool(JConfig,
|
||||||
|
config.getString("Redis.Host"),
|
||||||
|
config.getInt("Redis.Port"),
|
||||||
|
config.getInt("Redis.TimeOut"),
|
||||||
|
config.getString("Redis.Password"),
|
||||||
|
config.getBoolean("Redis.useTLS"));
|
||||||
|
RedisReconnector = Executors.newSingleThreadExecutor();
|
||||||
|
RedisService = Executors.newSingleThreadExecutor();
|
||||||
|
try {
|
||||||
|
this.subscribeJedis = this.jedisPool.getResource();
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
|
||||||
|
this.channels = config.getStringList("Channels");
|
||||||
|
encryption = new Encryption(config);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
this.RedisReconnector.execute(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
while (!isShuttingDown.get() && plugin.isEnabled()) {
|
||||||
|
try {
|
||||||
|
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&cConnecting to redis..."));
|
||||||
|
if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource();
|
||||||
|
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&aRedis connected!"));
|
||||||
|
byte[][] channelsInByte = new byte[channels.size()][1];
|
||||||
|
for (int x = 0; x < channels.size(); x++) {
|
||||||
|
channelsInByte[x] = channels.get(x).getBytes(StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
this.subscribeJedis.subscribe(this, channelsInByte);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (isShuttingDown.get() || !plugin.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
plugin.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&cConnection to redis has failed! &cReconnecting..."));
|
||||||
|
if (this.subscribeJedis != null) {
|
||||||
|
this.subscribeJedis.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(byte[] channel, byte[] message) {
|
||||||
|
String channelString = new String(channel, StandardCharsets.UTF_8);
|
||||||
|
String receivedMessage = null;
|
||||||
|
try {
|
||||||
|
//if encryption is enabled, decrypt the message, else just convert binary to string
|
||||||
|
if (this.encryption.isEncryptionEnabled()) {
|
||||||
|
try {
|
||||||
|
receivedMessage = encryption.decrypt(message);
|
||||||
|
} catch (UnauthenticCiphertextException | IllegalBlockSizeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//encryption is disabled, so let's just get the string
|
||||||
|
receivedMessage = new String(message, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
if (receivedMessage != null) {
|
||||||
|
JSONObject j = new JSONObject(receivedMessage);
|
||||||
|
if (j.get("Type").equals("Skript")) {
|
||||||
|
JSONArray messages = j.getJSONArray("Messages");
|
||||||
|
RedisMessageEvent event;
|
||||||
|
for (int i = 0; i < messages.length(); i++) {
|
||||||
|
event = new RedisMessageEvent(channelString, messages.get(i).toString(), j.getLong("Date"));
|
||||||
|
//if plugin is disabling, don't call events anymore
|
||||||
|
if (plugin.isEnabled()) {
|
||||||
|
RedisMessageEvent finalEvent = event;
|
||||||
|
Bukkit.getScheduler().runTask(plugin, () -> plugin.getServer().getPluginManager().callEvent(finalEvent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (j.get("Type").equals("SkriptVariables")) {
|
||||||
|
|
||||||
|
//Transfer variables between servers
|
||||||
|
|
||||||
|
JSONArray variableNames = j.getJSONArray("Names");
|
||||||
|
Object inputValue;
|
||||||
|
String changeValue = null;
|
||||||
|
JSONArray variableValues = null;
|
||||||
|
if (!j.isNull("Values")) {
|
||||||
|
variableValues = j.getJSONArray("Values");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < variableNames.length(); i++) {
|
||||||
|
|
||||||
|
if (j.isNull("Values")) {
|
||||||
|
//only check for SET here, because null has to be ignored in all other cases
|
||||||
|
|
||||||
|
if (j.getString("Operation").equals("SET")) {
|
||||||
|
Variables.setVariable(variableNames.get(i).toString(), null, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (!variableValues.isNull(i)) {
|
||||||
|
changeValue = variableValues.get(i).toString();
|
||||||
|
}
|
||||||
|
String[] inputs = changeValue.split("\\^", 2);
|
||||||
|
inputValue = Classes.deserialize(inputs[0], Base64.getDecoder().decode(inputs[1]));
|
||||||
|
switch (j.getString("Operation")) {
|
||||||
|
case "ADD":
|
||||||
|
//I will add this once someone tells me how to remove from Skript variable
|
||||||
|
//because using SET operation has issues with inconvertible types (Double and Long)
|
||||||
|
//variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
|
||||||
|
// variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
|
||||||
|
case "REMOVE":
|
||||||
|
//I will add this once someone tells me how to remove from Skript variable
|
||||||
|
//because using SET operation has issues with inconvertible types (Double and Long)
|
||||||
|
//variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
|
||||||
|
// variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
|
||||||
|
break;
|
||||||
|
case "SET":
|
||||||
|
Variables.setVariable(variableNames.get(i).toString(), inputValue, null, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void sendMessage(String[] message, String channel) {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("Messages", new JSONArray(message));
|
||||||
|
json.put("Type", "Skript");
|
||||||
|
json.put("Date", System.currentTimeMillis()); //for unique string every time & PING calculations
|
||||||
|
finishSendMessage(json, channel);
|
||||||
|
}
|
||||||
|
public void sendVariables(String[] variableNames, String[] variableValues, String channel, String operation) {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("Names", new JSONArray(variableNames));
|
||||||
|
if (variableValues != null) {
|
||||||
|
json.put("Values", new JSONArray(variableValues));
|
||||||
|
}
|
||||||
|
|
||||||
|
json.put("Type", "SkriptVariables");
|
||||||
|
json.put("Date", System.currentTimeMillis()); //for unique string every time & PING calculations
|
||||||
|
json.put("Operation", operation);
|
||||||
|
finishSendMessage(json, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishSendMessage(JSONObject json, String channel) {
|
||||||
|
try {
|
||||||
|
byte[] message;
|
||||||
|
if (this.getEncryption().isEncryptionEnabled()) {
|
||||||
|
message = this.getEncryption().encrypt(json.toString());
|
||||||
|
} else {
|
||||||
|
message = json.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
//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()) {
|
||||||
|
this.getRedisService().execute(() -> {
|
||||||
|
BinaryJedis j = this.getJedisPool().getResource();
|
||||||
|
j.publish(channel.getBytes(StandardCharsets.UTF_8), message);
|
||||||
|
j.close();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//execute sending of redis message on the main thread if plugin is disabling
|
||||||
|
//so it can still process the sending
|
||||||
|
BinaryJedis j = this.getJedisPool().getResource();
|
||||||
|
j.publish(channel.getBytes(StandardCharsets.UTF_8), message);
|
||||||
|
j.close();
|
||||||
|
}
|
||||||
|
} catch (JedisConnectionException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
this.isShuttingDown.set(true);
|
||||||
|
if (this.subscribeJedis != null) {
|
||||||
|
this.unsubscribe();
|
||||||
|
this.subscribeJedis.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.jedisPool != null) {
|
||||||
|
jedisPool.close();
|
||||||
|
jedisPool = null;
|
||||||
|
}
|
||||||
|
this.RedisReconnector.shutdown();
|
||||||
|
this.RedisService.shutdown();
|
||||||
|
this.RedisService = null;
|
||||||
|
this.RedisReconnector = null;
|
||||||
|
encryption = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
public void reload() {
|
||||||
|
this.shutdown();
|
||||||
|
plugin.startRedis(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JedisPool getJedisPool() {
|
||||||
|
return jedisPool;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Encryption getEncryption() {
|
||||||
|
return encryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExecutorService getRedisService() { return RedisService; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
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 org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
public class EffSendMessage extends Effect {
|
||||||
|
static {
|
||||||
|
Skript.registerEffect(EffSendMessage.class, "send redis message[s] %strings% 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.getAll(event);
|
||||||
|
String channel = this.channel.getSingle(event);
|
||||||
|
if (message[0] == 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;
|
||||||
|
}
|
||||||
|
plugin.getRedisManager().sendMessage(message, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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,27 +1,24 @@
|
|||||||
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.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check(Event event) {
|
public boolean check(Event event) {
|
||||||
return true;
|
return (event instanceof RedisMessageEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Event event, boolean b) {
|
public String toString(Event event, boolean debug) {
|
||||||
return "redis message";
|
return "redis message";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
package net.limework.core.skript.elements;
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
|
||||||
|
import ch.njol.skript.ScriptLoader;
|
||||||
|
import ch.njol.skript.Skript;
|
||||||
import ch.njol.skript.lang.Expression;
|
import ch.njol.skript.lang.Expression;
|
||||||
import ch.njol.skript.lang.SkriptParser;
|
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.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> {
|
||||||
@@ -27,7 +30,11 @@ public class ExprChannel extends SimpleExpression<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
|
public boolean init(final Expression<?>[] expressions, final int matchedPattern, final Kleenean isDelayed, final SkriptParser.ParseResult parseResult) {
|
||||||
|
if (!ScriptLoader.isCurrentEvent(RedisMessageEvent.class)) {
|
||||||
|
Skript.error("Cannot use 'redis channel' outside of a redis message event", ErrorQuality.SEMANTIC_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
package net.limework.core.skript.elements;
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
|
||||||
|
import ch.njol.skript.ScriptLoader;
|
||||||
|
import ch.njol.skript.Skript;
|
||||||
import ch.njol.skript.lang.Expression;
|
import ch.njol.skript.lang.Expression;
|
||||||
import ch.njol.skript.lang.SkriptParser;
|
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.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> {
|
||||||
@@ -22,12 +25,16 @@ public class ExprMessage extends SimpleExpression<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Event event, boolean b) {
|
public String toString(Event event, boolean debug) {
|
||||||
return "redis message";
|
return "redis message";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
|
public boolean init(final Expression<?>[] expressions, final int matchedPattern, final Kleenean isDelayed, final SkriptParser.ParseResult parseResult) {
|
||||||
|
if (!ScriptLoader.isCurrentEvent(RedisMessageEvent.class)) {
|
||||||
|
Skript.error("Cannot use 'redis message' outside of a redis message event", ErrorQuality.SEMANTIC_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
|
||||||
|
import ch.njol.skript.ScriptLoader;
|
||||||
|
import ch.njol.skript.Skript;
|
||||||
|
import ch.njol.skript.lang.Expression;
|
||||||
|
import ch.njol.skript.lang.SkriptParser;
|
||||||
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
|
import ch.njol.skript.log.ErrorQuality;
|
||||||
|
import ch.njol.skript.util.Date;
|
||||||
|
import ch.njol.util.Kleenean;
|
||||||
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
public class ExprMessageDate extends SimpleExpression<Date> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Date> getReturnType() {
|
||||||
|
return Date.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Event event, boolean b) {
|
||||||
|
return "redis message date";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(final Expression<?>[] expressions, final int matchedPattern, final Kleenean isDelayed, final SkriptParser.ParseResult parseResult) {
|
||||||
|
if (!ScriptLoader.isCurrentEvent(RedisMessageEvent.class)) {
|
||||||
|
Skript.error("Cannot use 'redis message date' outside of a redis message event", ErrorQuality.SEMANTIC_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected Date[] get(Event e) {
|
||||||
|
if (e instanceof RedisMessageEvent){
|
||||||
|
long date = ((RedisMessageEvent) e).getDate();
|
||||||
|
return new Date[]{new Date(date)};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package net.limework.rediskript.skript.elements;
|
||||||
|
|
||||||
|
import ch.njol.skript.Skript;
|
||||||
|
import ch.njol.skript.classes.Changer;
|
||||||
|
import ch.njol.skript.lang.Expression;
|
||||||
|
import ch.njol.skript.lang.SkriptParser;
|
||||||
|
import ch.njol.skript.lang.Variable;
|
||||||
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
|
import ch.njol.skript.log.ErrorQuality;
|
||||||
|
import ch.njol.skript.registrations.Classes;
|
||||||
|
import ch.njol.skript.variables.SerializedVariable;
|
||||||
|
import ch.njol.util.Kleenean;
|
||||||
|
import ch.njol.util.coll.CollectionUtils;
|
||||||
|
import net.limework.rediskript.RediSkript;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class ExprVariableInChannel extends SimpleExpression<Object> {
|
||||||
|
private Expression<String> name;
|
||||||
|
private Expression<String> channel;
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
||||||
|
name = (Expression<String>) expressions[0];
|
||||||
|
channel = (Expression<String>) expressions[1];
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object[] get(Event event) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Object> getReturnType() {
|
||||||
|
return Object.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Event event, boolean debug) {
|
||||||
|
return "variable " + name.toString(event,debug) + " in redis channel " + channel.toString(event, debug);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void change(Event e, Object[] changer, Changer.ChangeMode mode) {
|
||||||
|
RediSkript plugin = (RediSkript) Bukkit.getPluginManager().getPlugin("RediSkript");
|
||||||
|
switch (mode) {
|
||||||
|
case ADD:
|
||||||
|
case SET:
|
||||||
|
case REMOVE:
|
||||||
|
SerializedVariable.Value serialized;
|
||||||
|
String encoded;
|
||||||
|
String[] values = new String[changer.length+1];
|
||||||
|
for( int i = 0; i < changer.length; i++) {
|
||||||
|
if (changer[i] != null) {
|
||||||
|
serialized = Classes.serialize(changer[i]);
|
||||||
|
encoded = Base64.getEncoder().encodeToString(serialized.data);
|
||||||
|
encoded = serialized.type + "^" + encoded;
|
||||||
|
values[i] = encoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String operation = mode.toString();
|
||||||
|
plugin.getRedisManager().sendVariables(name.getAll(e), values, channel.getSingle(e), operation);
|
||||||
|
break;
|
||||||
|
case DELETE:
|
||||||
|
plugin.getRedisManager().sendVariables(name.getAll(e), null, channel.getSingle(e), "SET");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
|
||||||
|
//if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.SET || mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.REMOVE)
|
||||||
|
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.SET)
|
||||||
|
return CollectionUtils.array(Object.class);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,29 @@
|
|||||||
Redis:
|
Redis:
|
||||||
Password: "yHy0d2zdBlRmaSPj3CiBwEv5V3XxBTLTrCsGW7ntBnzhfxPxXJS6Q1aTtR6DSfAtCZr2VxWnsungXHTcF94a4bsWEpGAvjL6XMU"
|
#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"
|
Host: "127.0.0.1"
|
||||||
MaxConnections: 20
|
#must be 2 or higher, if you set to lower, the addon will automatically use 2 as a minimum
|
||||||
Threads: 10
|
MaxConnections: 2
|
||||||
|
#the default Redis port
|
||||||
Port: 6379
|
Port: 6379
|
||||||
TimeOut: 40000
|
#time out in milliseconds, how long it should take before it decides that it is unable to connect when sending a message
|
||||||
useSSL: false
|
#90000 = 90 seconds
|
||||||
#useful if SSL is disabled
|
TimeOut: 90000
|
||||||
EncryptMessages: false
|
#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"
|
EncryptionKey: "16CHARACTERS KEY"
|
||||||
MacKey: "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:
|
Channels:
|
||||||
- "Channel1"
|
- "Channel1"
|
||||||
- "Channel2"
|
- "Channel2"
|
||||||
- "Channel3"
|
- "Channel3"
|
||||||
|
|
||||||
Mongodb:
|
|
||||||
enabled: false
|
|
||||||
url: ""
|
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
main: net.limework.core.LimeworkSpigotCore
|
main: net.limework.rediskript.RediSkript
|
||||||
name: LimeworkSpigotCore
|
name: RediSkript
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
author: limework.net
|
authors: [Govindas, ham1255, DaemonicKing]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend:
|
depend: [Skript]
|
||||||
- Skript
|
|
||||||
commands:
|
commands:
|
||||||
control:
|
|
||||||
description: "server control"
|
|
||||||
permission: "admin.use"
|
|
||||||
reloadredis:
|
reloadredis:
|
||||||
description: "server control"
|
description: "Reload redis configuration & restart the connection."
|
||||||
permission: "admin.use"
|
|
||||||
Reference in New Issue
Block a user