mirror of
https://github.com/arcadiadevs/hubcore.git
synced 2025-02-16 18:11:18 +01:00
Initial commit
This commit is contained in:
commit
af85dab320
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
12
.idea/artifacts/PlayerServersHubCore_jar.xml
Normal file
12
.idea/artifacts/PlayerServersHubCore_jar.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="PlayerServersHubCore:jar">
|
||||
<output-path>$USER_HOME$/OneDrive/Data/Builds</output-path>
|
||||
<root id="archive" name="PlayerServersHubCore.jar">
|
||||
<element id="module-output" name="PlayerServersHubCore" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/github/cryptomorin/XSeries/5.3.1/XSeries-5.3.1.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
16
.idea/compiler.xml
Normal file
16
.idea/compiler.xml
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="PlayerServersHubCore" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="PlayerServersHubCore" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
25
.idea/jarRepositories.xml
Normal file
25
.idea/jarRepositories.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.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="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
10
.idea/libraries/HikariCP_3_4_1.xml
Normal file
10
.idea/libraries/HikariCP_3_4_1.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="HikariCP-3.4.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/OneDrive/Data/Libs/HikariCP-3.4.1.jar!/" />
|
||||
<root url="jar://$USER_HOME$/OneDrive/Data/Libs/slf4j-api-2.0.0-alpha1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.github.cryptomorin:XSeries:5.3.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/cryptomorin/XSeries/5.3.1/XSeries-5.3.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/cryptomorin/XSeries/5.3.1/XSeries-5.3.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/cryptomorin/XSeries/5.3.1/XSeries-5.3.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__com_zaxxer_HikariCP_3_4_5.xml
Normal file
13
.idea/libraries/Maven__com_zaxxer_HikariCP_3_4_5.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.zaxxer:HikariCP:3.4.5">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_5.xml
Normal file
13
.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_5.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.slf4j:slf4j-api:1.7.5">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__org_slf4j_slf4j_simple_1_6_4.xml
Normal file
13
.idea/libraries/Maven__org_slf4j_slf4j_simple_1_6_4.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.slf4j:slf4j-simple:1.6.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
9
.idea/libraries/PlaceholderAPI_2_10_4.xml
Normal file
9
.idea/libraries/PlaceholderAPI_2_10_4.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="PlaceholderAPI-2.10.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/OneDrive/Data/Libs/PlaceholderAPI-2.10.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
11
.idea/libraries/spigot_1_15_2.xml
Normal file
11
.idea/libraries/spigot_1_15_2.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="spigot-1.15.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/OneDrive/Data/Libs/spigot-1.15.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/OneDrive/Data/Libs/spigot-1.15.2.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
18
.idea/misc.xml
Normal file
18
.idea/misc.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
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$/PlayerServersHubCore.iml" filepath="$PROJECT_DIR$/PlayerServersHubCore.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
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>
|
22
PlayerServersHubCore.iml
Normal file
22
PlayerServersHubCore.iml
Normal file
@ -0,0 +1,22 @@
|
||||
<?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" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="spigot-1.15.2" level="project" />
|
||||
<orderEntry type="library" name="HikariCP-3.4.1" level="project" />
|
||||
<orderEntry type="library" name="PlaceholderAPI-2.10.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.6.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.cryptomorin:XSeries:5.3.1" level="project" />
|
||||
</component>
|
||||
</module>
|
Binary file not shown.
5
out/production/PlayerServersHubCore/config.yml
Normal file
5
out/production/PlayerServersHubCore/config.yml
Normal file
@ -0,0 +1,5 @@
|
||||
mysql:
|
||||
hostname: 127.0.0.1
|
||||
username: web
|
||||
password: webmaster
|
||||
database: playerservers
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6
out/production/PlayerServersHubCore/plugin.yml
Normal file
6
out/production/PlayerServersHubCore/plugin.yml
Normal file
@ -0,0 +1,6 @@
|
||||
name: PSHubCore
|
||||
main: os.arcadiadevs.playerservers.hubcore.PSHubCore
|
||||
version: 1.0.0
|
||||
author: OpenSource
|
||||
|
||||
softdepend: [PlaceholderAPI]
|
55
pom.xml
Normal file
55
pom.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
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>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.cryptomorin</groupId>
|
||||
<artifactId>XSeries</artifactId>
|
||||
<version>5.3.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<groupId>PlayerServersHubCore</groupId>
|
||||
<artifactId>PlayerServersHubCore</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,49 @@
|
||||
package os.arcadiadevs.playerservers.hubcore;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import os.arcadiadevs.playerservers.hubcore.commands.CommandManager;
|
||||
import os.arcadiadevs.playerservers.hubcore.database.DataSource;
|
||||
import os.arcadiadevs.playerservers.hubcore.events.ClickEvent;
|
||||
import os.arcadiadevs.playerservers.hubcore.events.HubEvents;
|
||||
import os.arcadiadevs.playerservers.hubcore.events.JoinEvent;
|
||||
import os.arcadiadevs.playerservers.hubcore.placeholders.PlayerCount;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class PSHubCore extends JavaPlugin {
|
||||
|
||||
public static Plugin PSH;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
PSH = this;
|
||||
getConfig().options().copyDefaults(true);
|
||||
saveConfig();
|
||||
|
||||
DataSource ds = new DataSource();
|
||||
ds.registerDataSource();
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
/*
|
||||
* We register the EventListeneres here, when PlaceholderAPI is installed.
|
||||
* Since all events are in the main class (this class), we simply use "this"
|
||||
*/
|
||||
new PlayerCount(this).register();
|
||||
}
|
||||
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
Bukkit.getPluginManager().registerEvents(new ClickEvent(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new JoinEvent(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new HubEvents(), this);
|
||||
|
||||
Objects.requireNonNull(getCommand("servers")).setExecutor(new CommandManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import os.arcadiadevs.playerservers.hubcore.utils.GUIUtils;
|
||||
|
||||
public class CommandManager implements CommandExecutor {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||
if (commandSender instanceof Player) {
|
||||
if (command.getName().equalsIgnoreCase("servers") || command.getName().equalsIgnoreCase("menu") || command.getName().equalsIgnoreCase("opengui")) {
|
||||
Player player = (Player) commandSender;
|
||||
GUIUtils gu = new GUIUtils();
|
||||
gu.openSelector(player);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.database;
|
||||
|
||||
import os.arcadiadevs.playerservers.hubcore.database.structures.DBInfoStructure;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DataBase {
|
||||
|
||||
public boolean containsPort(String port) {
|
||||
try (Connection connection = DataSource.getConnection()) {
|
||||
PreparedStatement stmt = connection.prepareStatement("SELECT * FROM PLAYERSERVERS");
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while(rs.next()) {
|
||||
if (rs.getString("PORT").equals(port))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<DBInfoStructure> getServersInfo() {
|
||||
|
||||
ArrayList<DBInfoStructure> output = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DataSource.getConnection()) {
|
||||
PreparedStatement stmt = connection.prepareStatement("SELECT * FROM PLAYERSERVERS");
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while(rs.next()) {
|
||||
output.add(new DBInfoStructure(
|
||||
rs.getString("UUID"),
|
||||
rs.getString("SERVERID"),
|
||||
rs.getString("PORT"),
|
||||
rs.getString("NAME"),
|
||||
rs.getString("PLAYERNAME"))
|
||||
);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getPortByUUID(String UUID) {
|
||||
try (Connection connection = DataSource.getConnection()) {
|
||||
PreparedStatement stmt = connection.prepareStatement("SELECT * FROM PLAYERSERVERS WHERE UUID='" + UUID + "'");
|
||||
ResultSet rs = stmt.executeQuery(); rs.next();
|
||||
return rs.getString("PORT");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getServerByUUID(String UUID) {
|
||||
try (Connection connection = DataSource.getConnection()) {
|
||||
PreparedStatement stmt = connection.prepareStatement("SELECT * FROM PLAYERSERVERS WHERE UUID='" + UUID + "'");
|
||||
ResultSet rs = stmt.executeQuery(); rs.next();
|
||||
return rs.getString("SERVERID");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.database;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class DataSource
|
||||
{
|
||||
|
||||
public static HikariDataSource hikari;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public void registerDataSource() {
|
||||
|
||||
Plugin pl = Bukkit.getPluginManager().getPlugin("PSHubCore");
|
||||
|
||||
String address = pl.getConfig().getString("mysql.hostname");
|
||||
String name = pl.getConfig().getString("mysql.database");
|
||||
String username = pl.getConfig().getString("mysql.username");
|
||||
String password = pl.getConfig().getString("mysql.password");
|
||||
|
||||
hikari = new HikariDataSource();
|
||||
hikari.setMaximumPoolSize(10);
|
||||
hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
|
||||
hikari.addDataSourceProperty("serverName", address);
|
||||
hikari.addDataSourceProperty("port", "3306");
|
||||
hikari.addDataSourceProperty("databaseName", name);
|
||||
hikari.addDataSourceProperty("user", username);
|
||||
hikari.addDataSourceProperty("password", password);
|
||||
}
|
||||
|
||||
public static Connection getConnection() throws SQLException {
|
||||
return hikari.getConnection();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.database.structures;
|
||||
|
||||
public class DBInfoStructure {
|
||||
|
||||
private String UUID;
|
||||
private String ServerID;
|
||||
private String Port;
|
||||
private String ServerName;
|
||||
private String PlayerName;
|
||||
|
||||
public DBInfoStructure(String UUID, String ServerID, String Port, String ServerName, String PlayerName) {
|
||||
this.UUID = UUID;
|
||||
this.ServerID = ServerID;
|
||||
this.Port = Port;
|
||||
this.ServerName = ServerName;
|
||||
this.PlayerName = PlayerName;
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
return PlayerName;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return Port;
|
||||
}
|
||||
|
||||
public String getServerID() {
|
||||
return ServerID;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return ServerName;
|
||||
}
|
||||
|
||||
public String getUUID() {
|
||||
return UUID;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.database.structures;
|
||||
|
||||
public class PingInfoStructure {
|
||||
|
||||
private final int online;
|
||||
private final int max;
|
||||
private final String MOTD;
|
||||
|
||||
public PingInfoStructure(int online, int max, String MOTD) {
|
||||
this.online = online;
|
||||
this.max = max;
|
||||
this.MOTD = MOTD;
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public int getOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public String getMOTD() {
|
||||
return MOTD;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.events;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import os.arcadiadevs.playerservers.hubcore.utils.ColorUtils;
|
||||
import os.arcadiadevs.playerservers.hubcore.utils.GUIUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static os.arcadiadevs.playerservers.hubcore.PSHubCore.PSH;
|
||||
import static os.arcadiadevs.playerservers.hubcore.utils.ColorUtils.translate;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public class ClickEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onClick(PlayerInteractEvent e) {
|
||||
|
||||
Player player = e.getPlayer();
|
||||
|
||||
if ((e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) && player.getInventory().getItemInHand().getItemMeta() != null && player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(translate(PSH.getConfig().getString("compass-name")))) {
|
||||
|
||||
GUIUtils gu = new GUIUtils();
|
||||
gu.openSelector(player);
|
||||
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void inventory(InventoryClickEvent e) {
|
||||
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
|
||||
if (e.getCurrentItem() != null && e.getCurrentItem().getItemMeta() != null
|
||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase(translate(PSH.getConfig().getString("compass-name"))))
|
||||
e.setCancelled(true);
|
||||
|
||||
else if (e.getView().getTitle().equalsIgnoreCase(translate("&aServer Selector"))) {
|
||||
if (e.getCurrentItem().getItemMeta() != null && e.getCurrentItem().getItemMeta().getLore() != null) {
|
||||
if (e.getCurrentItem().getType() == XMaterial.EMERALD_BLOCK.parseMaterial()) {
|
||||
String UUID = e.getCurrentItem().getItemMeta().getLore().get(1).split(" ")[1].replaceAll("§7", "");
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(UUID);
|
||||
|
||||
p.sendPluginMessage(PSH, "BungeeCord", out.toByteArray());
|
||||
e.getWhoClicked().closeInventory();
|
||||
} else if (e.getCurrentItem().getType() == XMaterial.REDSTONE_BLOCK.parseMaterial())
|
||||
p.sendMessage(ColorUtils.translate("&9PlayerServers> &7Oops, the server you tried to connect to is offline."));
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void drop(PlayerDropItemEvent e) {
|
||||
if (Objects.requireNonNull(e.getItemDrop().getItemStack().getItemMeta()).getDisplayName().equalsIgnoreCase(translate(PSH.getConfig().getString("compass-name")))) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
|
||||
import static os.arcadiadevs.playerservers.hubcore.PSHubCore.PSH;
|
||||
|
||||
public class HubEvents implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void weatherChange(WeatherChangeEvent e) {
|
||||
if (PSH.getConfig().getBoolean("disable-weather")) {
|
||||
e.getWorld().setThundering(false);
|
||||
e.getWorld().setStorm(false);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityDamage(EntityDamageEvent e) {
|
||||
if (e.getEntity() instanceof Player && PSH.getConfig().getBoolean("disable-damage"))
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.events;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import os.arcadiadevs.playerservers.hubcore.utils.ColorUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static os.arcadiadevs.playerservers.hubcore.PSHubCore.PSH;
|
||||
|
||||
public class JoinEvent implements Listener {
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (PSH.getConfig().getBoolean("enable-compass")) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(PSH, () -> {
|
||||
|
||||
ItemStack is = new ItemStack(XMaterial.COMPASS.parseMaterial());
|
||||
ItemMeta im = is.getItemMeta();
|
||||
|
||||
im.setDisplayName(ColorUtils.translate(PSH.getConfig().getString("compass-name")));
|
||||
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
PSH.getConfig().getStringList("compass-description").forEach(string -> lore.add(ColorUtils.translate(string)));
|
||||
im.setLore(lore);
|
||||
is.setItemMeta(im);
|
||||
|
||||
Bukkit.getScheduler().runTask(PSH, () -> p.getInventory().setItem(PSH.getConfig().getInt("compass-location"), is));
|
||||
|
||||
});
|
||||
} else {
|
||||
p.getInventory().forEach(itemStack -> {
|
||||
if (itemStack.getType() == XMaterial.COMPASS.parseMaterial())
|
||||
p.getInventory().remove(itemStack);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.placeholders;
|
||||
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import os.arcadiadevs.playerservers.hubcore.database.DataBase;
|
||||
import os.arcadiadevs.playerservers.hubcore.database.structures.PingInfoStructure;
|
||||
import os.arcadiadevs.playerservers.hubcore.utils.PingUtil;
|
||||
|
||||
public class PlayerCount extends PlaceholderExpansion {
|
||||
|
||||
Plugin plugin;
|
||||
|
||||
public PlayerCount(Plugin plugin){
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "playerservers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "online";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return "OpenSource";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.0.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onRequest(OfflinePlayer p, String params) {
|
||||
DataBase db = new DataBase();
|
||||
PingUtil pu = new PingUtil();
|
||||
PingInfoStructure structure = pu.getData(Integer.parseInt(db.getPortByUUID(p.getUniqueId().toString())));
|
||||
|
||||
return (structure != null) ? String.valueOf(structure.getOnline()) : "Offline";
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class ColorUtils {
|
||||
|
||||
public static String translate(String text) {
|
||||
return ChatColor.translateAlternateColorCodes('&', text);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.utils;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import os.arcadiadevs.playerservers.hubcore.database.DataBase;
|
||||
import os.arcadiadevs.playerservers.hubcore.database.structures.DBInfoStructure;
|
||||
import os.arcadiadevs.playerservers.hubcore.database.structures.PingInfoStructure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static os.arcadiadevs.playerservers.hubcore.PSHubCore.PSH;
|
||||
import static os.arcadiadevs.playerservers.hubcore.utils.ColorUtils.translate;
|
||||
|
||||
public class GUIUtils {
|
||||
|
||||
public void openSelector(Player player) {
|
||||
DataBase db = new DataBase();
|
||||
PingUtil pu = new PingUtil();
|
||||
|
||||
Inventory gui = Bukkit.createInventory(player, 9*6, ChatColor.GREEN + "Server Selector");
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(PSH, () -> {
|
||||
for (DBInfoStructure is : db.getServersInfo()) {
|
||||
ItemStack istack;
|
||||
if (pu.isOnline("127.0.0.1", is.getPort())) {
|
||||
|
||||
PingInfoStructure pus = pu.getData(Integer.parseInt(is.getPort()));
|
||||
|
||||
istack = new ItemStack(XMaterial.EMERALD_BLOCK.parseMaterial());
|
||||
ItemMeta ir = istack.getItemMeta();
|
||||
//noinspection ConstantConditions
|
||||
ir.setDisplayName(translate("&a" + is.getPlayerName() + "'s server"));
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(translate("&cPort: &7" + is.getPort()));
|
||||
lore.add(translate("&cUUID: &7" + is.getServerID().split("-")[0]));
|
||||
lore.add(translate(String.format("&cOnline: &7%d/%d", pus.getOnline(), pus.getMax())));
|
||||
lore.add(translate("&cMOTD: &7" + pus.getMOTD()));
|
||||
ir.setLore(lore);
|
||||
istack.setItemMeta(ir);
|
||||
|
||||
gui.addItem(istack);
|
||||
}
|
||||
}
|
||||
|
||||
for (DBInfoStructure is : db.getServersInfo()) {
|
||||
if (!pu.isOnline("127.0.0.1", is.getPort())) {
|
||||
ItemStack istack = new ItemStack(XMaterial.REDSTONE_BLOCK.parseMaterial());
|
||||
ItemMeta ir = istack.getItemMeta();
|
||||
//noinspection ConstantConditions
|
||||
ir.setDisplayName(translate("&a" + is.getPlayerName() + "'s server"));
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(translate("&cPort: &7" + is.getPort()));
|
||||
lore.add(translate("&cUUID: &7" + is.getServerID().split("-")[0]));
|
||||
ir.setLore(lore);
|
||||
istack.setItemMeta(ir);
|
||||
|
||||
gui.addItem(istack);
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTask(PSH, () -> player.openInventory(gui));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package os.arcadiadevs.playerservers.hubcore.utils;
|
||||
|
||||
import os.arcadiadevs.playerservers.hubcore.database.structures.PingInfoStructure;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
|
||||
public class PingUtil {
|
||||
|
||||
public boolean isOnline(String address, String port) {
|
||||
boolean online = false;
|
||||
try {
|
||||
Socket s = new Socket(address, Integer.parseInt(port));
|
||||
s.close();
|
||||
online = true;
|
||||
} catch (IOException ignored) { }
|
||||
return online;
|
||||
}
|
||||
|
||||
public PingInfoStructure getData(int port) {
|
||||
try {
|
||||
Socket sock = new Socket("127.0.0.1", port);
|
||||
|
||||
DataOutputStream out = new DataOutputStream(sock.getOutputStream());
|
||||
DataInputStream in = new DataInputStream(sock.getInputStream());
|
||||
|
||||
out.write(0xFE);
|
||||
|
||||
int b;
|
||||
StringBuilder str = new StringBuilder();
|
||||
while ((b = in.read()) != -1) {
|
||||
if (b > 16 && b != 255 && b != 23 && b != 24) {
|
||||
str.append((char) b);
|
||||
}
|
||||
}
|
||||
|
||||
String[] data = str.toString().split("§");
|
||||
String serverMotd = data[0];
|
||||
int onlinePlayers = Integer.parseInt(data[1]);
|
||||
int maxPlayers = Integer.parseInt(data[2]);
|
||||
|
||||
return new PingInfoStructure(onlinePlayers, maxPlayers, serverMotd);
|
||||
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
src/main/resources/config.yml
Normal file
15
src/main/resources/config.yml
Normal file
@ -0,0 +1,15 @@
|
||||
mysql:
|
||||
hostname: 127.0.0.1
|
||||
username: web
|
||||
password: webmaster
|
||||
database: playerservers
|
||||
|
||||
enable-compass: true
|
||||
compass-name: "&aQuick Compass"
|
||||
compass-location: 0
|
||||
compass-description:
|
||||
- "&7Click here to open the server"
|
||||
- "&7selector or to create your own one"
|
||||
|
||||
disable-weather: true
|
||||
disable-damage: true
|
14
src/main/resources/plugin.yml
Normal file
14
src/main/resources/plugin.yml
Normal file
@ -0,0 +1,14 @@
|
||||
name: PSHubCore
|
||||
main: os.arcadiadevs.playerservers.hubcore.PSHubCore
|
||||
version: 1.3.0
|
||||
author: OpenSource
|
||||
|
||||
softdepend: [PlaceholderAPI]
|
||||
|
||||
commands:
|
||||
servers:
|
||||
usage: /servers
|
||||
description: Opens up server selector GUI
|
||||
aliases:
|
||||
- menu
|
||||
- opengui
|
15
target/classes/config.yml
Normal file
15
target/classes/config.yml
Normal file
@ -0,0 +1,15 @@
|
||||
mysql:
|
||||
hostname: 127.0.0.1
|
||||
username: web
|
||||
password: webmaster
|
||||
database: playerservers
|
||||
|
||||
enable-compass: true
|
||||
compass-name: "&aQuick Compass"
|
||||
compass-location: 0
|
||||
compass-description:
|
||||
- "&7Click here to open the server"
|
||||
- "&7selector or to create your own one"
|
||||
|
||||
disable-weather: true
|
||||
disable-damage: true
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14
target/classes/plugin.yml
Normal file
14
target/classes/plugin.yml
Normal file
@ -0,0 +1,14 @@
|
||||
name: PSHubCore
|
||||
main: os.arcadiadevs.playerservers.hubcore.PSHubCore
|
||||
version: 1.3.0
|
||||
author: OpenSource
|
||||
|
||||
softdepend: [PlaceholderAPI]
|
||||
|
||||
commands:
|
||||
servers:
|
||||
usage: /servers
|
||||
description: Opens up server selector GUI
|
||||
aliases:
|
||||
- menu
|
||||
- opengui
|
Loading…
Reference in New Issue
Block a user