initial project commit
This commit is contained in:
commit
d7c79d7eac
117 changed files with 2561 additions and 0 deletions
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
23
.idea/compiler.xml
Normal file
23
.idea/compiler.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?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="core" />
|
||||||
|
<module name="v1_18_R2" />
|
||||||
|
<module name="nicko-core" />
|
||||||
|
<module name="nicko-v1_18_R2" />
|
||||||
|
<module name="nicko-v1_18_R1" />
|
||||||
|
</profile>
|
||||||
|
<profile name="Annotation profile for Nicko" enabled="true">
|
||||||
|
<sourceOutputDir name="../target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="../target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="dist" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
7
.idea/discord.xml
Normal file
7
.idea/discord.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT" />
|
||||||
|
<option name="description" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
10
.idea/inspectionProfiles/Project_Default.xml
Normal file
10
.idea/inspectionProfiles/Project_Default.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,net.minecraft.server.level.EntityPlayer,x,net.minecraft.world.entity.Entity,W" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedReceiverParameter" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="UnusedSymbol" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
35
.idea/jarRepositories.xml
Normal file
35
.idea/jarRepositories.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="codemc-snapshots" />
|
||||||
|
<option name="name" value="codemc-snapshots" />
|
||||||
|
<option name="url" value="https://repo.codemc.io/repository/maven-snapshots/" />
|
||||||
|
</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="spigot-repo" />
|
||||||
|
<option name="name" value="spigot-repo" />
|
||||||
|
<option name="url" value="https://hub.spigotmc.org/nexus/content/groups/public/" />
|
||||||
|
</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="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="bungeecord-repo" />
|
||||||
|
<option name="name" value="bungeecord-repo" />
|
||||||
|
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
14
.idea/misc.xml
Normal file
14
.idea/misc.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</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>
|
118
core/dependency-reduced-pom.xml
Normal file
118
core/dependency-reduced-pom.xml
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
<?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/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>nicko-parent</artifactId>
|
||||||
|
<groupId>net.artelnatif</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>nicko-core</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>${basedir}/src/main/resources/</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12.4</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.3.1-SNAPSHOT</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>net.artelnatif:nicko-*</include>
|
||||||
|
<include>xyz.upperlevel.spigot.book:spigot-book-api</include>
|
||||||
|
<include>net.wesjd:anvilgui</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>xyz.upperlevel.spigot.book</pattern>
|
||||||
|
<shadedPattern>net.artelnatif.bookapi</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>net.wesjd.anvilgui</pattern>
|
||||||
|
<shadedPattern>net.artelnatif.anvilgui</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
<minimizeJar>false</minimizeJar>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>bungeecord-repo</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>codemc-snapshots</id>
|
||||||
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.18.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>bungeecord-api</artifactId>
|
||||||
|
<version>1.18-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>31.1-jre</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>5.8.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>opentest4j</artifactId>
|
||||||
|
<groupId>org.opentest4j</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>junit-platform-commons</artifactId>
|
||||||
|
<groupId>org.junit.platform</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>apiguardian-api</artifactId>
|
||||||
|
<groupId>org.apiguardian</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
</properties>
|
||||||
|
</project>
|
124
core/pom.xml
Normal file
124
core/pom.xml
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<artifactId>nicko-core</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>net.artelnatif</groupId>
|
||||||
|
<artifactId>nicko-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>bungeecord-repo</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>codemc-snapshots</id>
|
||||||
|
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.18.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>bungeecord-api</artifactId>
|
||||||
|
<version>1.18-R0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xyz.upperlevel.spigot.book</groupId>
|
||||||
|
<artifactId>spigot-book-api</artifactId>
|
||||||
|
<version>1.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.wesjd</groupId>
|
||||||
|
<artifactId>anvilgui</artifactId>
|
||||||
|
<version>1.5.3-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>31.1-jre</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>5.8.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12.4</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.3.1-SNAPSHOT</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>net.artelnatif:nicko-*</include>
|
||||||
|
<include>xyz.upperlevel.spigot.book:spigot-book-api</include>
|
||||||
|
<include>net.wesjd:anvilgui</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>xyz.upperlevel.spigot.book</pattern>
|
||||||
|
<shadedPattern>net.artelnatif.bookapi</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>net.wesjd.anvilgui</pattern>
|
||||||
|
<shadedPattern>net.artelnatif.anvilgui</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
<!-- Prevents breaking AnvilGUI's VersionWrapper. -->
|
||||||
|
<minimizeJar>false</minimizeJar>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>${basedir}/src/main/resources/</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</project>
|
104
core/src/main/java/com/yoshiplex/rainbow/RainbowText.java
Normal file
104
core/src/main/java/com/yoshiplex/rainbow/RainbowText.java
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
package com.yoshiplex.rainbow;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RainbowText {
|
||||||
|
private static final List<String> RAINBOW = Arrays.asList("§4", "§c", "§6", "§a", "§2", "§b", "§3", "§9", "§1", "§5", "§d");
|
||||||
|
private int place;
|
||||||
|
private List<String> rainbowArray = null;
|
||||||
|
// STOPSHIP: 7/28/22 i18n
|
||||||
|
private String text = "You did not provide any text.";
|
||||||
|
private String fancyText = "§4You did not provide any text";
|
||||||
|
private String prefix = "";
|
||||||
|
|
||||||
|
public RainbowText(String text) {
|
||||||
|
this(text, (String) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RainbowText(String text, String formatCode) {
|
||||||
|
place = 0;
|
||||||
|
if (text != null) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
if (formatCode != null) {
|
||||||
|
prefix = formatCode;
|
||||||
|
}
|
||||||
|
rainbowArray = RAINBOW;
|
||||||
|
updateFancy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFancy() {
|
||||||
|
int spot = place;
|
||||||
|
String fancyText = "";
|
||||||
|
for (char l : text.toCharArray()) {
|
||||||
|
String letter = Character.toString(l);
|
||||||
|
String t1 = fancyText;
|
||||||
|
if (!letter.equalsIgnoreCase(" ")) {
|
||||||
|
fancyText = t1 + rainbowArray.get(spot) + prefix + letter;
|
||||||
|
if (spot == rainbowArray.size() - 1) {
|
||||||
|
spot = 0;
|
||||||
|
} else {
|
||||||
|
spot++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fancyText = t1 + letter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.fancyText = fancyText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveRainbow() {
|
||||||
|
if (rainbowArray.size() - 1 == place) {
|
||||||
|
place = 0;
|
||||||
|
} else {
|
||||||
|
place++;
|
||||||
|
}
|
||||||
|
updateFancy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveRainbowRight() {
|
||||||
|
if (place == 0) {
|
||||||
|
place = rainbowArray.size() - 1;
|
||||||
|
} else {
|
||||||
|
place--;
|
||||||
|
}
|
||||||
|
updateFancy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrigonalText() {
|
||||||
|
return this.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return this.fancyText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlace(int place) {
|
||||||
|
if (place > RAINBOW.size() - 1 || place < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.place = place;
|
||||||
|
updateFancy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlace() {
|
||||||
|
return this.place;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getRainbow() {
|
||||||
|
return rainbowArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFormatPrefix() {
|
||||||
|
return this.prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormatPrefix(String prefix) {
|
||||||
|
this.prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getDefaultRainbow() {
|
||||||
|
return RAINBOW;
|
||||||
|
}
|
||||||
|
}
|
94
core/src/main/java/net/artelnatif/nicko/NickoBukkit.java
Normal file
94
core/src/main/java/net/artelnatif/nicko/NickoBukkit.java
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
package net.artelnatif.nicko;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.bungee.NickoBungee;
|
||||||
|
import net.artelnatif.nicko.command.NickoCommand;
|
||||||
|
import net.artelnatif.nicko.command.NickoTabCompleter;
|
||||||
|
import net.artelnatif.nicko.config.NickoConfiguration;
|
||||||
|
import net.artelnatif.nicko.event.PlayerJoinListener;
|
||||||
|
import net.artelnatif.nicko.event.PlayerQuitListener;
|
||||||
|
import net.artelnatif.nicko.impl.Internals;
|
||||||
|
import net.artelnatif.nicko.impl.InternalsProvider;
|
||||||
|
import net.artelnatif.nicko.mojang.MojangAPI;
|
||||||
|
import net.artelnatif.nicko.pluginchannel.UpdateMessageHandler;
|
||||||
|
import net.artelnatif.nicko.storage.PlayerDataStore;
|
||||||
|
import net.artelnatif.nicko.utils.ServerUtils;
|
||||||
|
import org.bukkit.command.PluginCommand;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class NickoBukkit extends JavaPlugin {
|
||||||
|
private static NickoBukkit plugin;
|
||||||
|
|
||||||
|
private NickoConfiguration nickoConfiguration;
|
||||||
|
private MojangAPI mojangAPI;
|
||||||
|
private PlayerDataStore dataStore;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
plugin = this;
|
||||||
|
|
||||||
|
final PluginCommand command = getCommand("nicko");
|
||||||
|
if (command != null) {
|
||||||
|
command.setExecutor(new NickoCommand());
|
||||||
|
command.setTabCompleter(new NickoTabCompleter());
|
||||||
|
}
|
||||||
|
|
||||||
|
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), this);
|
||||||
|
|
||||||
|
mojangAPI = new MojangAPI();
|
||||||
|
nickoConfiguration = new NickoConfiguration(this);
|
||||||
|
|
||||||
|
getLogger().info("Loading configuration...");
|
||||||
|
saveDefaultConfig();
|
||||||
|
|
||||||
|
getLogger().info("Loading persistence...");
|
||||||
|
dataStore = new PlayerDataStore(this);
|
||||||
|
if (!dataStore.getStorage().getProvider().init()) {
|
||||||
|
dataStore.getStorage().setError(true);
|
||||||
|
getLogger().warning("Failed to open persistence, data will NOT be saved!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nickoConfiguration.isBungeecordEnabled()) {
|
||||||
|
getLogger().info("Enabling Bungeecord support...");
|
||||||
|
if (ServerUtils.checkBungeeCordHook()) {
|
||||||
|
getServer().getMessenger().registerIncomingPluginChannel(this, NickoBungee.NICKO_PLUGIN_CHANNEL_UPDATE, new UpdateMessageHandler());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getLogger().info("Nicko (Bukkit) has been enabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
getLogger().info("Closing persistence...");
|
||||||
|
if (!dataStore.getStorage().getProvider().close()) {
|
||||||
|
getLogger().warning("Failed to close persistence!");
|
||||||
|
}
|
||||||
|
if (dataStore.getStorage().isError()) {
|
||||||
|
dataStore.getStorage().setError(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nickoConfiguration.isBungeecordEnabled()) {
|
||||||
|
getServer().getMessenger().unregisterIncomingPluginChannel(this);
|
||||||
|
getServer().getMessenger().unregisterOutgoingPluginChannel(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLogger().info("Nicko (Bukkit) has been disabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NickoBukkit getInstance() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MojangAPI getMojangAPI() {
|
||||||
|
return mojangAPI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NickoConfiguration getNickoConfig() { return nickoConfiguration; }
|
||||||
|
|
||||||
|
public PlayerDataStore getDataStore() { return dataStore; }
|
||||||
|
|
||||||
|
public Internals getInternals() {
|
||||||
|
return InternalsProvider.getInternals();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
package net.artelnatif.nicko.anvil;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.disguise.AppearanceManager;
|
||||||
|
import net.artelnatif.nicko.disguise.NickoProfile;
|
||||||
|
import net.artelnatif.nicko.mojang.MojangUtils;
|
||||||
|
import net.wesjd.anvilgui.AnvilGUI;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
public class AnvilManager {
|
||||||
|
private final Player player;
|
||||||
|
private final NickoProfile profile;
|
||||||
|
private final AppearanceManager appearanceManager;
|
||||||
|
|
||||||
|
public AnvilManager(Player player) {
|
||||||
|
this.player = player;
|
||||||
|
this.appearanceManager = AppearanceManager.get(player);
|
||||||
|
this.profile = appearanceManager.getProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openNameAndSkinAnvil() {
|
||||||
|
final AnvilGUI.Builder skin = getSkinAnvil();
|
||||||
|
final AnvilGUI.Builder name = new AnvilGUI.Builder()
|
||||||
|
.plugin(NickoBukkit.getInstance())
|
||||||
|
.itemLeft(getLeftItem())
|
||||||
|
.onComplete((anvilPlayer, response) -> {
|
||||||
|
if (MojangUtils.isUsernameInvalid(response)) {
|
||||||
|
return AnvilGUI.Response.text("Invalid username!");
|
||||||
|
} else {
|
||||||
|
profile.setName(response);
|
||||||
|
skin.open(player);
|
||||||
|
return AnvilGUI.Response.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.text("New name...");
|
||||||
|
|
||||||
|
name.open(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openNameAnvil() {
|
||||||
|
new AnvilGUI.Builder()
|
||||||
|
.plugin(NickoBukkit.getInstance())
|
||||||
|
.itemLeft(getLeftItem())
|
||||||
|
.onComplete((anvilPlayer, response) -> {
|
||||||
|
if (MojangUtils.isUsernameInvalid(response)) {
|
||||||
|
return AnvilGUI.Response.text("Invalid username!");
|
||||||
|
} else {
|
||||||
|
appearanceManager.setName(response);
|
||||||
|
appearanceManager.updatePlayer(false);
|
||||||
|
return AnvilGUI.Response.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.text("New name...")
|
||||||
|
.open(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openSkinAnvil() {
|
||||||
|
getSkinAnvil().open(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AnvilGUI.Builder getSkinAnvil() {
|
||||||
|
return new AnvilGUI.Builder()
|
||||||
|
.plugin(NickoBukkit.getInstance())
|
||||||
|
.itemLeft(getLeftItem())
|
||||||
|
.onComplete((anvilPlayer, response) -> {
|
||||||
|
if (MojangUtils.isUsernameInvalid(response)) {
|
||||||
|
return AnvilGUI.Response.text("Invalid username!");
|
||||||
|
} else {
|
||||||
|
appearanceManager.setSkin(response);
|
||||||
|
appearanceManager.updatePlayer(true);
|
||||||
|
return AnvilGUI.Response.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.text("New skin...");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getLeftItem() {
|
||||||
|
final ItemStack item = new ItemStack(Material.PAPER);
|
||||||
|
final ItemMeta meta = item.getItemMeta();
|
||||||
|
meta.setDisplayName("§0ID");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package net.artelnatif.nicko.bungee;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
|
|
||||||
|
public class NickoBungee extends Plugin {
|
||||||
|
public static final String NICKO_PLUGIN_CHANNEL_BASE = "nicko:";
|
||||||
|
public static final String NICKO_PLUGIN_CHANNEL_FETCH = NICKO_PLUGIN_CHANNEL_BASE + "fetch";
|
||||||
|
public static final String NICKO_PLUGIN_CHANNEL_UPDATE = NICKO_PLUGIN_CHANNEL_BASE + "update";
|
||||||
|
|
||||||
|
private static NickoBungee plugin;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
getLogger().info("Registering channels...");
|
||||||
|
getProxy().registerChannel(NICKO_PLUGIN_CHANNEL_FETCH);
|
||||||
|
getProxy().registerChannel(NICKO_PLUGIN_CHANNEL_UPDATE);
|
||||||
|
|
||||||
|
getLogger().info("Nicko (Bungee) has been enabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
getLogger().info("Unregistering channels...");
|
||||||
|
getProxy().unregisterChannel(NICKO_PLUGIN_CHANNEL_FETCH);
|
||||||
|
getProxy().unregisterChannel(NICKO_PLUGIN_CHANNEL_UPDATE);
|
||||||
|
|
||||||
|
getLogger().info("Nicko (Bungee) has been disabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NickoBungee getInstance() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package net.artelnatif.nicko.bungee.event;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.bungee.NickoBungee;
|
||||||
|
import net.artelnatif.nicko.bungee.pluginchannel.PluginChannelHelper;
|
||||||
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.connection.Server;
|
||||||
|
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||||
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
|
||||||
|
public class ServerSwitchListener implements Listener {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Nicko Message Format
|
||||||
|
* FETCH: nicko:skin/fetch
|
||||||
|
* - UUID
|
||||||
|
*
|
||||||
|
* UPDATE: nicko:skin/update
|
||||||
|
* - UUID
|
||||||
|
* - Skin
|
||||||
|
* - Name
|
||||||
|
*/
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSwitch(ServerSwitchEvent event) {
|
||||||
|
final ServerInfo from = event.getFrom();
|
||||||
|
final ProxiedPlayer player = event.getPlayer();
|
||||||
|
final Server to = player.getServer();
|
||||||
|
PluginChannelHelper.sendMessage(from, NickoBungee.NICKO_PLUGIN_CHANNEL_FETCH, player.getUniqueId().toString());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package net.artelnatif.nicko.bungee.pluginchannel;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
|
|
||||||
|
public class PluginChannelHelper {
|
||||||
|
public static boolean sendMessage(final ServerInfo info, final String channel, final String... data) {
|
||||||
|
final ByteArrayDataOutput output = ByteStreams.newDataOutput();
|
||||||
|
output.writeUTF(channel);
|
||||||
|
for (String elt : data) {
|
||||||
|
output.writeUTF(elt);
|
||||||
|
}
|
||||||
|
System.out.printf("(%s) PluginMessage <-> %s", info.getSocketAddress().toString(), output);
|
||||||
|
return info.sendData(channel, output.toByteArray(), false);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package net.artelnatif.nicko.command;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.command.sub.NickoCheckSubCmd;
|
||||||
|
import net.artelnatif.nicko.command.sub.NickoDebugSubCmd;
|
||||||
|
import net.artelnatif.nicko.command.sub.NickoDisguiseSubCmd;
|
||||||
|
import net.artelnatif.nicko.command.sub.NickoGUISubCmd;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
|
||||||
|
public class NickoCommand implements CommandExecutor {
|
||||||
|
private final String opPrefix = "§c(OP)";
|
||||||
|
private String helpMessage = """
|
||||||
|
§cNicko §8§o[{version}] §f- §2Help:
|
||||||
|
§6/nicko disguise §f- §7Change your appearance.
|
||||||
|
§6/nicko revert §f- §7Revert your appearance to your default skin and name.
|
||||||
|
§6/nicko help §f- §7Prints this help message.
|
||||||
|
""";
|
||||||
|
private String adminHelpMessage = """
|
||||||
|
{admin} §6/nicko disguise §b<player> §f- §7Change designed player's appearance.
|
||||||
|
{admin} §6/nicko revert §b<player> §f- §7Revert designed player's appearance to their default skin and name.
|
||||||
|
{admin} §6/nicko check §b<player> §f- §7Prints detailed information about designed player's appearance.
|
||||||
|
""".replace("{admin}", opPrefix);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (args.length >= 1) {
|
||||||
|
switch (args[0]) {
|
||||||
|
case "disguise" -> new NickoDisguiseSubCmd(this).execute(sender);
|
||||||
|
case "debug" -> new NickoDebugSubCmd(this).execute(sender, args);
|
||||||
|
case "check" -> new NickoCheckSubCmd(this).execute(sender, args);
|
||||||
|
case "gui" -> new NickoGUISubCmd(this).execute(sender, args);
|
||||||
|
default -> sendHelpMessages(sender);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sendHelpMessages(sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendHelpMessages(CommandSender sender) {
|
||||||
|
helpMessage = helpMessage.replace("{version}", NickoBukkit.getInstance().getDescription().getVersion());
|
||||||
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
|
helpMessage = ChatColor.stripColor(helpMessage);
|
||||||
|
adminHelpMessage = ChatColor.stripColor(adminHelpMessage);
|
||||||
|
}
|
||||||
|
sender.sendMessage(helpMessage);
|
||||||
|
if (sender.isOp()) {
|
||||||
|
sender.sendMessage(adminHelpMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package net.artelnatif.nicko.command;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
|
||||||
|
public class NickoPermissions {
|
||||||
|
|
||||||
|
public static final String NICKO_PERMISSION_BASE = "nicko.";
|
||||||
|
// TODO: 20/06/2022 i18n
|
||||||
|
public static final String NICKO_PERMISSION_MISSING = NickoBukkit.getInstance().getNickoConfig().getPrefix() + "§cMissing permission.";
|
||||||
|
|
||||||
|
public static final class Player {
|
||||||
|
public static final class Command {
|
||||||
|
public static final String NICKO_PERMISSION_PLAYER_COMMAND_USE = NICKO_PERMISSION_BASE + "use";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package net.artelnatif.nicko.command;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabCompleter;
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class NickoTabCompleter implements TabCompleter {
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
if (args.length == 1) {
|
||||||
|
return List.of("disguise", "revert", "help", "check");
|
||||||
|
} else if (args.length == 2 && !args[0].equalsIgnoreCase("help")) {
|
||||||
|
return Bukkit.getOnlinePlayers().stream().map(HumanEntity::getName).toList();
|
||||||
|
} else {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package net.artelnatif.nicko.command.sub;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.command.NickoCommand;
|
||||||
|
import net.artelnatif.nicko.disguise.AppearanceManager;
|
||||||
|
import net.artelnatif.nicko.utils.PlayerUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
|
public class NickoCheckSubCmd extends NickoSubCmd {
|
||||||
|
public NickoCheckSubCmd(NickoCommand nickoCommand) {
|
||||||
|
super(nickoCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
final String targetName = args[1];
|
||||||
|
final Player target = Bukkit.getPlayerExact(targetName);
|
||||||
|
|
||||||
|
AppearanceManager appearanceManager;
|
||||||
|
if (PlayerUtils.isPlayerOffline(target)) {
|
||||||
|
appearanceManager = AppearanceManager.get(targetName);
|
||||||
|
} else {
|
||||||
|
appearanceManager = AppearanceManager.get(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringJoiner builder = new StringJoiner("\n");
|
||||||
|
builder.add("§c" + NickoBukkit.getInstance().getNickoConfig().getPrefix() + "§f- §6Check for:§f§o" + targetName);
|
||||||
|
if (!appearanceManager.hasData()) {
|
||||||
|
builder.add("§cThis player has not data.");
|
||||||
|
} else {
|
||||||
|
builder.add("§7- §fNicked: " + (appearanceManager.isNicked() ? "§a✔" : "§c❌"));
|
||||||
|
builder.add("§7- §fNickname: §6" + (appearanceManager.getName().equals(targetName) ? "N/A" : appearanceManager.getName()));
|
||||||
|
builder.add("§7- §fSkin: §6" + (appearanceManager.getSkin().equals(targetName) ? "N/A" : appearanceManager.getSkin()));
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(builder.toString());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package net.artelnatif.nicko.command.sub;
|
||||||
|
|
||||||
|
import com.yoshiplex.rainbow.RainbowText;
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.command.NickoCommand;
|
||||||
|
import net.artelnatif.nicko.disguise.AppearanceManager;
|
||||||
|
import net.artelnatif.nicko.mojang.MojangUtils;
|
||||||
|
import net.artelnatif.nicko.utils.PlayerUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class NickoDebugSubCmd extends NickoSubCmd {
|
||||||
|
|
||||||
|
public NickoDebugSubCmd(NickoCommand nickoCommand) {
|
||||||
|
super(nickoCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
Player target;
|
||||||
|
String name, skin;
|
||||||
|
if (args.length == 3) {
|
||||||
|
target = (Player) sender;
|
||||||
|
name = args[1];
|
||||||
|
skin = args[2];
|
||||||
|
} else {
|
||||||
|
final String playerName = args[1];
|
||||||
|
target = Bukkit.getPlayer(playerName);
|
||||||
|
|
||||||
|
if(args.length < 3) {
|
||||||
|
sender.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + "§cMissing argument.");
|
||||||
|
}
|
||||||
|
|
||||||
|
name = args[2];
|
||||||
|
skin = args[3];
|
||||||
|
if (PlayerUtils.isPlayerOffline(target)) {
|
||||||
|
sender.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + "§cSpecified player is offline.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final AppearanceManager appearanceManager = AppearanceManager.get(target.getPlayer());
|
||||||
|
|
||||||
|
if (MojangUtils.isUsernameInvalid(name) || MojangUtils.isUsernameInvalid(skin)) {
|
||||||
|
sender.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + "§cSpecified username is invalid.");
|
||||||
|
}
|
||||||
|
|
||||||
|
appearanceManager.setNameAndSkin(name, skin);
|
||||||
|
final RainbowText whooshText = new RainbowText("Whoosh!");
|
||||||
|
target.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + whooshText.getText());
|
||||||
|
target.playSound(target.getLocation(), Sound.ENTITY_ITEM_FRAME_PLACE, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package net.artelnatif.nicko.command.sub;
|
||||||
|
|
||||||
|
import com.yoshiplex.rainbow.RainbowText;
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.command.NickoCommand;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import xyz.upperlevel.spigot.book.BookUtil;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class NickoDisguiseSubCmd extends NickoSubCmd {
|
||||||
|
|
||||||
|
public NickoDisguiseSubCmd(NickoCommand nickoCommand) {
|
||||||
|
super(nickoCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(CommandSender sender) {
|
||||||
|
if (sender instanceof Player player) {
|
||||||
|
final String disguiseBaseCommand = "/nicko gui {player} ";
|
||||||
|
final String disguiseNameCommand = disguiseBaseCommand + "name";
|
||||||
|
final String disguiseSkinCommand = disguiseBaseCommand + "skin";
|
||||||
|
final String disguiseBothCommand = disguiseBaseCommand + "full";
|
||||||
|
|
||||||
|
final RainbowText text = new RainbowText(NickoBukkit.getInstance().getNickoConfig().getDisguiseKitHeader());
|
||||||
|
final int displacement = new Random().nextInt(RainbowText.getDefaultRainbow().size() - 1);
|
||||||
|
text.setPlace(displacement);
|
||||||
|
|
||||||
|
final ItemStack book = BookUtil.writtenBook()
|
||||||
|
.author("Nicko")
|
||||||
|
.title("§6Nicko - Book of magic")
|
||||||
|
.generation(BookMeta.Generation.ORIGINAL)
|
||||||
|
.pages(
|
||||||
|
new BookUtil.PageBuilder()
|
||||||
|
.add(
|
||||||
|
new TextComponent(text.getText())
|
||||||
|
)
|
||||||
|
.newLine()
|
||||||
|
.newLine()
|
||||||
|
.add("§0This disguise kit will help you change your name and skin.")
|
||||||
|
.newLine()
|
||||||
|
.newLine()
|
||||||
|
.add("§0Go through each page until the end or cancel the process at any time by exiting any of the interfaces.")
|
||||||
|
.build(),
|
||||||
|
new BookUtil.PageBuilder()
|
||||||
|
.add(
|
||||||
|
BookUtil.TextBuilder.of("§6> §0Change my skin")
|
||||||
|
.onHover(BookUtil.HoverAction.showText("Clicking this will prompt you a menu to change your skin."))
|
||||||
|
.onClick(BookUtil.ClickAction.runCommand(disguiseSkinCommand.replace("{player}", player.getName())))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.newLine()
|
||||||
|
.newLine()
|
||||||
|
.add(
|
||||||
|
BookUtil.TextBuilder.of("§6> §0Change my name")
|
||||||
|
.onHover(BookUtil.HoverAction.showText("Clicking this will prompt you a menu to change your name."))
|
||||||
|
.onClick(BookUtil.ClickAction.runCommand(disguiseNameCommand.replace("{player}", player.getName())))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.newLine()
|
||||||
|
.newLine()
|
||||||
|
.add(
|
||||||
|
BookUtil.TextBuilder.of("§6> §0Change both")
|
||||||
|
.onHover(BookUtil.HoverAction.showText("Clicking this will prompt you a menu to change both your name and your skin."))
|
||||||
|
.onClick(BookUtil.ClickAction.runCommand(disguiseBothCommand.replace("{player}", player.getName())))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
BookUtil.openPlayer(player, book);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + "This command can only be performed by players!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package net.artelnatif.nicko.command.sub;
|
||||||
|
|
||||||
|
import com.yoshiplex.rainbow.RainbowText;
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.anvil.AnvilManager;
|
||||||
|
import net.artelnatif.nicko.command.NickoCommand;
|
||||||
|
import net.artelnatif.nicko.command.NickoPermissions;
|
||||||
|
import net.artelnatif.nicko.utils.PlayerUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class NickoGUISubCmd extends NickoSubCmd {
|
||||||
|
public NickoGUISubCmd(NickoCommand nickoCommand) {
|
||||||
|
super(nickoCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
Player target;
|
||||||
|
if (args.length < 3) {
|
||||||
|
target = (Player) sender;
|
||||||
|
} else {
|
||||||
|
final String playerName = args[1];
|
||||||
|
target = Bukkit.getPlayerExact(playerName);
|
||||||
|
if (PlayerUtils.isPlayerOffline(target)) {
|
||||||
|
sender.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + "§cSpecified player is offline.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sender.hasPermission(NickoPermissions.Player.Command.NICKO_PERMISSION_PLAYER_COMMAND_USE)) {
|
||||||
|
sender.sendMessage(NickoPermissions.NICKO_PERMISSION_MISSING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final AnvilManager manager = new AnvilManager(target);
|
||||||
|
final String arg = args.length < 3 ? args[1] : args[2];
|
||||||
|
switch (arg) {
|
||||||
|
case "name" -> manager.openNameAnvil();
|
||||||
|
case "skin" -> manager.openSkinAnvil();
|
||||||
|
case "full" -> manager.openNameAndSkinAnvil();
|
||||||
|
default ->
|
||||||
|
sender.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + "§cInvalid argument.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final RainbowText whooshText = target == sender ? new RainbowText("Success!") : new RainbowText("Success! %player% is now undercover!".replace("%player%", target.getName()));
|
||||||
|
sender.sendMessage(NickoBukkit.getInstance().getNickoConfig().getPrefix() + whooshText.getText());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package net.artelnatif.nicko.command.sub;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.command.NickoCommand;
|
||||||
|
|
||||||
|
public class NickoSubCmd {
|
||||||
|
private final NickoCommand nickoCommand;
|
||||||
|
|
||||||
|
public NickoSubCmd(NickoCommand nickoCommand) {
|
||||||
|
this.nickoCommand = nickoCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NickoCommand getMainCommand() {
|
||||||
|
return nickoCommand;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package net.artelnatif.nicko.config;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
public class NickoConfiguration {
|
||||||
|
private final NickoBukkit nicko;
|
||||||
|
|
||||||
|
public NickoConfiguration(NickoBukkit nicko) {
|
||||||
|
this.nicko = nicko;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrefix() {
|
||||||
|
return getConfig().getString("prefix");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisguiseKitHeader() {
|
||||||
|
return getConfig().getString("disguisekit.header");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigurationSection getBungeecordSection() { return getConfig().getConfigurationSection("bungeecord"); }
|
||||||
|
|
||||||
|
public ConfigurationSection getStorageSction() { return getConfig().getConfigurationSection("storage"); }
|
||||||
|
|
||||||
|
public ConfigurationSection getRedisSection() { return getBungeecordSection().getConfigurationSection("redis"); }
|
||||||
|
|
||||||
|
public boolean isLocalStorage() { return getStorageSction().getBoolean("local"); }
|
||||||
|
|
||||||
|
public boolean isBungeecordEnabled() { return getBungeecordSection().getBoolean("enabled"); }
|
||||||
|
|
||||||
|
public String getStorageUsername() { return getStorageSction().getString("username"); }
|
||||||
|
|
||||||
|
public String getStoragePassword() { return getStorageSction().getString("password"); }
|
||||||
|
|
||||||
|
public String getStorageAddress() { return getStorageSction().getString("address"); }
|
||||||
|
|
||||||
|
private FileConfiguration getConfig() {
|
||||||
|
return nicko.getConfig();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package net.artelnatif.nicko.disguise;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.storage.PlayerDataStore;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class AppearanceManager {
|
||||||
|
private final NickoProfile profile;
|
||||||
|
private final Player player;
|
||||||
|
private final NickoBukkit instance = NickoBukkit.getInstance();
|
||||||
|
private final PlayerDataStore dataStore = instance.getDataStore();
|
||||||
|
|
||||||
|
private AppearanceManager(UUID uuid) {
|
||||||
|
this.player = Bukkit.getPlayer(uuid);
|
||||||
|
this.profile = dataStore.getData(uuid).orElse(NickoProfile.EMPTY_PROFILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AppearanceManager(String name) {
|
||||||
|
this.player = null;
|
||||||
|
this.profile = dataStore.getOfflineData(name).orElse(NickoProfile.EMPTY_PROFILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AppearanceManager get(Player player) {
|
||||||
|
return new AppearanceManager(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AppearanceManager get(String name) {
|
||||||
|
return new AppearanceManager(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasData() {
|
||||||
|
return !profile.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNicked() {
|
||||||
|
return hasData() && !profile.getSkin().equals(player.getName()) || !profile.getName().equals(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkin(String skin) {
|
||||||
|
profile.setSkin(skin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkin() {
|
||||||
|
return profile.getSkin();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
profile.setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return profile.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NickoProfile getProfile() {
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameAndSkin(String name, String skin) {
|
||||||
|
this.profile.setName(name);
|
||||||
|
this.profile.setSkin(skin);
|
||||||
|
updatePlayer(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePlayer(boolean skinChange) {
|
||||||
|
NickoBukkit.getInstance().getInternals().updateProfile(player, profile, skinChange);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package net.artelnatif.nicko.disguise;
|
||||||
|
|
||||||
|
public class NickoProfile {
|
||||||
|
public static final NickoProfile EMPTY_PROFILE = new NickoProfile(null, null);
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String skin;
|
||||||
|
|
||||||
|
public NickoProfile(String name, String skin) {
|
||||||
|
this.name = name;
|
||||||
|
this.skin = skin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return this != NickoProfile.EMPTY_PROFILE || (name == null && skin == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkin() {
|
||||||
|
return skin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkin(String skin) {
|
||||||
|
this.skin = skin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "NickoProfile{" +
|
||||||
|
"name='" + name + '\'' +
|
||||||
|
", skin='" + skin + '\'' +
|
||||||
|
", empty='" + isEmpty() + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package net.artelnatif.nicko.event;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.disguise.AppearanceManager;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class PlayerJoinListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
Bukkit.getScheduler().runTaskLater(NickoBukkit.getInstance(), () -> {
|
||||||
|
final AppearanceManager appearanceManager = AppearanceManager.get(player);
|
||||||
|
|
||||||
|
if (appearanceManager.hasData()) {
|
||||||
|
final boolean skinChange = !player.getName().equals(appearanceManager.getSkin());
|
||||||
|
appearanceManager.updatePlayer(skinChange);
|
||||||
|
}
|
||||||
|
}, 20L);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package net.artelnatif.nicko.event;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
public class PlayerQuitListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
NickoBukkit.getInstance().getDataStore().saveData(player);
|
||||||
|
}
|
||||||
|
}
|
13
core/src/main/java/net/artelnatif/nicko/i18n/I18N.java
Normal file
13
core/src/main/java/net/artelnatif/nicko/i18n/I18N.java
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package net.artelnatif.nicko.i18n;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
|
||||||
|
public class I18N {
|
||||||
|
public static final class Message {
|
||||||
|
public static final String BASE = NickoBukkit.getInstance().getNickoConfig().getPrefix() + " ";
|
||||||
|
|
||||||
|
public static final class Command {
|
||||||
|
public static final String TARGET_OFFLINE = BASE + "§cSpecified player is offline. Try again.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
core/src/main/java/net/artelnatif/nicko/impl/Internals.java
Normal file
10
core/src/main/java/net/artelnatif/nicko/impl/Internals.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package net.artelnatif.nicko.impl;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.disguise.NickoProfile;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public interface Internals {
|
||||||
|
void updateSelf(Player player);
|
||||||
|
void updateOthers(Player player);
|
||||||
|
void updateProfile(Player player, NickoProfile profile, boolean skinChange);
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package net.artelnatif.nicko.impl;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
public class InternalsProvider {
|
||||||
|
private static Internals internals;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
final String packageName = Internals.class.getPackage().getName();
|
||||||
|
final String bukkitVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||||
|
final String fullClassName = packageName + "." + bukkitVersion;
|
||||||
|
System.out.println("[DEBUG] packageName = " + packageName);
|
||||||
|
System.out.println("[DEBUG] bukkitVersion = " + bukkitVersion);
|
||||||
|
System.out.println("[DEBUG] Searching for " + fullClassName + "...");
|
||||||
|
internals = (Internals) Class.forName(fullClassName).getConstructors()[0].newInstance();
|
||||||
|
} catch (InvocationTargetException | ClassNotFoundException | InstantiationException | IllegalAccessException |
|
||||||
|
ClassCastException exception) {
|
||||||
|
Bukkit.getLogger().log(Level.SEVERE, "Nicko could not find a valid implementation for this server version. Is your server supported?");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Internals getInternals() {
|
||||||
|
return internals;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package net.artelnatif.nicko.mojang;
|
||||||
|
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.cache.CacheLoader;
|
||||||
|
import com.google.common.cache.LoadingCache;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public class MojangAPI {
|
||||||
|
public static final String URL_NAME = "https://api.mojang.com/users/profiles/minecraft/{name}";
|
||||||
|
public static final String URL_SKIN = "https://sessionserver.mojang.com/session/minecraft/profile/{uuid}?unsigned=false";
|
||||||
|
|
||||||
|
private final CacheLoader<String, Optional<MojangSkin>> loader = new CacheLoader<>() {
|
||||||
|
@Nonnull
|
||||||
|
public Optional<MojangSkin> load(@Nonnull String uuid) throws Exception {
|
||||||
|
return getSkinFromMojang(uuid);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private final LoadingCache<String, Optional<MojangSkin>> cache = CacheBuilder
|
||||||
|
.newBuilder()
|
||||||
|
.build(loader);
|
||||||
|
|
||||||
|
public Optional<MojangSkin> getSkin(String uuid) throws IOException, ExecutionException {
|
||||||
|
return cache.get(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<String> getUUID(String name) throws IOException {
|
||||||
|
final String parametrizedUrl = URL_NAME.replace("{name}", name);
|
||||||
|
final JsonObject object = getRequestToUrl(parametrizedUrl);
|
||||||
|
if (hasNoError(object)) {
|
||||||
|
return Optional.of(object.get("id").getAsString());
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Optional<MojangSkin> getSkinFromMojang(String uuid) throws IOException {
|
||||||
|
final String parametrizedUrl = URL_SKIN.replace("{uuid}", uuid);
|
||||||
|
final JsonObject object = getRequestToUrl(parametrizedUrl);
|
||||||
|
if (hasNoError(object)) {
|
||||||
|
final MojangSkin skin = MojangSkin.buildFromJson(object);
|
||||||
|
return Optional.of(skin);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonObject getRequestToUrl(String parametrizedUrl) throws IOException {
|
||||||
|
final URL url = new URL(parametrizedUrl);
|
||||||
|
final HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||||
|
con.setDoInput(true);
|
||||||
|
con.setRequestMethod("GET");
|
||||||
|
|
||||||
|
final BufferedReader input = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||||
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
String line;
|
||||||
|
while ((line = input.readLine()) != null) {
|
||||||
|
builder.append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final JsonElement jsonElt = JsonParser.parseString(builder.toString());
|
||||||
|
return jsonElt.getAsJsonObject();
|
||||||
|
} catch (JsonParseException | IllegalStateException exception) {
|
||||||
|
System.out.println("Failed to parse request (" + parametrizedUrl + ")! Does the username exists?");
|
||||||
|
return getErrorObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonObject getErrorObject() {
|
||||||
|
final JsonObject errorObject = new JsonObject();
|
||||||
|
errorObject.addProperty("error", "An error occurred.");
|
||||||
|
return errorObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasNoError(JsonObject object) {
|
||||||
|
return object.get("error") == null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package net.artelnatif.nicko.mojang;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
public record MojangSkin(String name, String value, String signature) {
|
||||||
|
public static MojangSkin buildFromJson(JsonObject object) {
|
||||||
|
final String name = object.get("name").getAsString();
|
||||||
|
final JsonObject properties = object.get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||||
|
final String value = properties.get("value").getAsString();
|
||||||
|
final String signature = properties.get("signature").getAsString();
|
||||||
|
return new MojangSkin(name, value, signature);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package net.artelnatif.nicko.mojang;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class MojangUtils {
|
||||||
|
public static boolean isUsernameInvalid(String username) {
|
||||||
|
return !Pattern.matches("^\\w{3,16}$", username);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UUID fromTrimmed(String trimmedUUID) throws IllegalArgumentException {
|
||||||
|
if (trimmedUUID == null) throw new IllegalArgumentException();
|
||||||
|
StringBuilder builder = new StringBuilder(trimmedUUID.trim());
|
||||||
|
/* Backwards adding to avoid index adjustments */
|
||||||
|
try {
|
||||||
|
builder.insert(20, "-");
|
||||||
|
builder.insert(16, "-");
|
||||||
|
builder.insert(12, "-");
|
||||||
|
builder.insert(8, "-");
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return UUID.fromString(builder.toString());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package net.artelnatif.nicko.pluginchannel;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import net.artelnatif.nicko.bungee.NickoBungee;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
|
public class UpdateMessageHandler implements PluginMessageListener {
|
||||||
|
@Override
|
||||||
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
|
if(!channel.equals(NickoBungee.NICKO_PLUGIN_CHANNEL_UPDATE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ByteArrayDataInput in = ByteStreams.newDataInput(message);
|
||||||
|
final String subchannel = in.readUTF();
|
||||||
|
if(subchannel.equals(NickoBungee.NICKO_PLUGIN_CHANNEL_UPDATE)) {
|
||||||
|
// TODO: 10/20/22 update player
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package net.artelnatif.nicko.storage;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.disguise.NickoProfile;
|
||||||
|
import net.artelnatif.nicko.mojang.MojangUtils;
|
||||||
|
import net.artelnatif.nicko.storage.json.JSONStorage;
|
||||||
|
import net.artelnatif.nicko.storage.sql.SQLStorage;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class PlayerDataStore {
|
||||||
|
private final Storage storage;
|
||||||
|
|
||||||
|
public PlayerDataStore(NickoBukkit instance) {
|
||||||
|
this.storage = instance.getNickoConfig().isLocalStorage() ? new JSONStorage() : new SQLStorage(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final HashMap<UUID, NickoProfile> PROFILES = new HashMap<>();
|
||||||
|
|
||||||
|
public Optional<NickoProfile> getData(UUID uuid) {
|
||||||
|
if(storage.isError()) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PROFILES.containsKey(uuid)) {
|
||||||
|
return Optional.of(PROFILES.get(uuid));
|
||||||
|
} else if (storage.isStored(uuid)) {
|
||||||
|
Optional<NickoProfile> retrievedProfile = storage.retrieve(uuid);
|
||||||
|
retrievedProfile.ifPresent(profile -> PROFILES.put(uuid, profile));
|
||||||
|
return retrievedProfile;
|
||||||
|
} else {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<NickoProfile> getOfflineData(String name) {
|
||||||
|
if(storage.isError()) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final Optional<String> uuidTrimmed = NickoBukkit.getInstance().getMojangAPI().getUUID(name);
|
||||||
|
if (uuidTrimmed.isPresent()) {
|
||||||
|
final UUID uuid = MojangUtils.fromTrimmed(uuidTrimmed.get());
|
||||||
|
return getData(uuid);
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
} catch (IOException e) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveData(Player player) {
|
||||||
|
if(storage.isError()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
storage.store(player.getUniqueId(), PROFILES.get(player.getUniqueId()));
|
||||||
|
PROFILES.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Storage getStorage() {
|
||||||
|
return storage;
|
||||||
|
}
|
||||||
|
}
|
26
core/src/main/java/net/artelnatif/nicko/storage/Storage.java
Normal file
26
core/src/main/java/net/artelnatif/nicko/storage/Storage.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package net.artelnatif.nicko.storage;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.disguise.NickoProfile;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public abstract class Storage {
|
||||||
|
private boolean error = false;
|
||||||
|
|
||||||
|
public abstract StorageProvider getProvider();
|
||||||
|
|
||||||
|
public abstract void store(UUID uuid, NickoProfile profile);
|
||||||
|
|
||||||
|
public abstract boolean isStored(UUID uuid);
|
||||||
|
|
||||||
|
public abstract Optional<NickoProfile> retrieve(UUID uuid);
|
||||||
|
|
||||||
|
public boolean isError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(boolean error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package net.artelnatif.nicko.storage;
|
||||||
|
|
||||||
|
public interface StorageProvider {
|
||||||
|
boolean init();
|
||||||
|
|
||||||
|
boolean close();
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package net.artelnatif.nicko.storage.json;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.disguise.NickoProfile;
|
||||||
|
import net.artelnatif.nicko.storage.Storage;
|
||||||
|
import net.artelnatif.nicko.storage.StorageProvider;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class JSONStorage extends Storage {
|
||||||
|
final Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().create();
|
||||||
|
final File directory = new File(NickoBukkit.getInstance().getDataFolder() + "/players/");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageProvider getProvider() { return new JSONStorageProvider(directory); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void store(UUID uuid, NickoProfile profile) {
|
||||||
|
final String profileToJson = gson.toJson(profile);
|
||||||
|
final File file = new File(directory, uuid.toString() + ".json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (checkFileExists(file)) {
|
||||||
|
try (FileWriter fileWriter = new FileWriter(file)) {
|
||||||
|
try (BufferedWriter writer = new BufferedWriter(fileWriter)) {
|
||||||
|
writer.write(profileToJson);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("Could not write to file.");
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("Could not create file.");
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStored(UUID uuid) {
|
||||||
|
final File directory = new File(NickoBukkit.getInstance().getDataFolder() + "/players/");
|
||||||
|
final File file = new File(directory, uuid.toString() + ".json");
|
||||||
|
return file.exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<NickoProfile> retrieve(UUID uuid) {
|
||||||
|
final File directory = new File(NickoBukkit.getInstance().getDataFolder() + "/players/");
|
||||||
|
final File file = new File(directory, uuid.toString() + ".json");
|
||||||
|
try (FileReader fileReader = new FileReader(file)) {
|
||||||
|
try (BufferedReader reader = new BufferedReader(fileReader)) {
|
||||||
|
NickoProfile value = gson.fromJson(reader, NickoProfile.class);
|
||||||
|
return Optional.of(value);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkFileExists(File file) throws IOException {
|
||||||
|
if (!file.exists()) {
|
||||||
|
return file.createNewFile();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package net.artelnatif.nicko.storage.json;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.storage.StorageProvider;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class JSONStorageProvider implements StorageProvider {
|
||||||
|
private final File directory;
|
||||||
|
|
||||||
|
public JSONStorageProvider(File directory) {
|
||||||
|
this.directory = directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init()
|
||||||
|
{
|
||||||
|
return directory.exists() || directory.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean close() { return true; }
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package net.artelnatif.nicko.storage.sql;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.disguise.NickoProfile;
|
||||||
|
import net.artelnatif.nicko.storage.Storage;
|
||||||
|
import net.artelnatif.nicko.storage.StorageProvider;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class SQLStorage extends Storage {
|
||||||
|
private final NickoBukkit instance;
|
||||||
|
|
||||||
|
public SQLStorage(NickoBukkit instance) {
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageProvider getProvider() {
|
||||||
|
return new SQLStorageProvider(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void store(UUID uuid, NickoProfile profile) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStored(UUID uuid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<NickoProfile> retrieve(UUID uuid) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package net.artelnatif.nicko.storage.sql;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import net.artelnatif.nicko.config.NickoConfiguration;
|
||||||
|
import net.artelnatif.nicko.storage.StorageProvider;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class SQLStorageProvider implements StorageProvider {
|
||||||
|
private final NickoBukkit instance;
|
||||||
|
private Connection connection;
|
||||||
|
|
||||||
|
public SQLStorageProvider(NickoBukkit instance) {
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init() {
|
||||||
|
try {
|
||||||
|
final NickoConfiguration config = instance.getNickoConfig();
|
||||||
|
connection = DriverManager.getConnection("jdbc://" + config.getStorageAddress(), config.getStorageUsername(), config.getStoragePassword());
|
||||||
|
return !connection.isClosed() && connection != null;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean close() {
|
||||||
|
try {
|
||||||
|
connection.close();
|
||||||
|
return connection.isClosed();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package net.artelnatif.nicko.utils;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PlayerUtils {
|
||||||
|
public static boolean isPlayerOffline(Player player) {
|
||||||
|
return player == null || !player.isOnline();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package net.artelnatif.nicko.utils;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
public class ServerUtils {
|
||||||
|
public static boolean checkBungeeCordHook() {
|
||||||
|
final NickoBukkit instance = NickoBukkit.getInstance();
|
||||||
|
final Server server = instance.getServer();
|
||||||
|
final YamlConfiguration config = server.spigot().getConfig();
|
||||||
|
if (!config.getConfigurationSection("settings").getBoolean("settings.bungeecord")) {
|
||||||
|
instance.getLogger().severe("Hummm. You have enabled BungeeCord support inside Nicko,");
|
||||||
|
instance.getLogger().severe("but it seems that your server is not hooked to your BungeeCord instance.");
|
||||||
|
instance.getLogger().severe("If the server is already hooked to BungeeCord, please enable it into your spigot.yml aswell.");
|
||||||
|
instance.getLogger().severe("The plugin will not continue.");
|
||||||
|
instance.getServer().getPluginManager().disablePlugin(instance);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
4
core/src/main/resources/bungee.yml
Normal file
4
core/src/main/resources/bungee.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name: ${project.parent.name}
|
||||||
|
main: net.artelnatif.nicko.bungee.NickoBungee
|
||||||
|
version: ${project.version}
|
||||||
|
author: Aro
|
28
core/src/main/resources/config.yml
Normal file
28
core/src/main/resources/config.yml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Nicko ${project.version} - Config:
|
||||||
|
|
||||||
|
prefix: "§8[§6Nicko§8] "
|
||||||
|
|
||||||
|
bungeecord:
|
||||||
|
# Enables Bungeecord support, switching through servers will keep player's skins.
|
||||||
|
enabled: false
|
||||||
|
redis:
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
|
# Time To Live, the time the data will be stored on a player-by-player basis.
|
||||||
|
ttl: -1
|
||||||
|
|
||||||
|
|
||||||
|
disguisekit:
|
||||||
|
# The rainbow header text in the book.
|
||||||
|
header: "Nicko's Disguise Kit"
|
||||||
|
|
||||||
|
storage:
|
||||||
|
# Indicates wherever the data will be stored
|
||||||
|
# locally through a .json file or a (My)SQL database.
|
||||||
|
local: true
|
||||||
|
# SQL database's address
|
||||||
|
address: "localhost"
|
||||||
|
# SQL database's username.
|
||||||
|
username: ""
|
||||||
|
# SQL database's password.
|
||||||
|
password: ""
|
7
core/src/main/resources/plugin.yml
Normal file
7
core/src/main/resources/plugin.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
name: ${project.parent.name}
|
||||||
|
main: net.artelnatif.nicko.NickoBukkit
|
||||||
|
version: ${project.version}
|
||||||
|
author: Aro
|
||||||
|
api-version: 1.18
|
||||||
|
commands:
|
||||||
|
nicko:
|
|
@ -0,0 +1,87 @@
|
||||||
|
package net.artelnatif.nicko.test;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import net.artelnatif.nicko.mojang.MojangAPI;
|
||||||
|
import net.artelnatif.nicko.mojang.MojangSkin;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public class MojangAPITest {
|
||||||
|
public static final String NAME = "Notch";
|
||||||
|
public static final String URL_NAME = "https://api.mojang.com/users/profiles/minecraft/{name}";
|
||||||
|
public static final String URL_SKIN = "https://sessionserver.mojang.com/session/minecraft/profile/{uuid}?unsigned=false";
|
||||||
|
|
||||||
|
public static JsonObject object = null;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("MojangAPI - GET - Name")
|
||||||
|
public void testGetMojangAPIName() throws IOException {
|
||||||
|
final URL url = new URL(URL_NAME.replace("{name}", NAME));
|
||||||
|
final HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
|
||||||
|
urlConnection.setRequestMethod("GET");
|
||||||
|
urlConnection.setDoOutput(true);
|
||||||
|
|
||||||
|
//DataOutputStream output = new DataOutputStream(urlConnection.getOutputStream());
|
||||||
|
//output.writeBytes();
|
||||||
|
//output.flush();
|
||||||
|
//output.close();
|
||||||
|
|
||||||
|
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||||
|
final StringBuilder response = new StringBuilder();
|
||||||
|
String inputLine;
|
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
response.append(inputLine);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
object = JsonParser.parseString(response.toString()).getAsJsonObject();
|
||||||
|
Assertions.assertEquals(NAME, object.get("name").getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("MojangAPI - GET - Skin")
|
||||||
|
public void testGetMojangAPISkin() throws IOException {
|
||||||
|
final URL url = new URL(URL_SKIN.replace("{uuid}", object.get("id").getAsString().replaceAll("-", "")));
|
||||||
|
final HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
|
||||||
|
urlConnection.setRequestMethod("GET");
|
||||||
|
urlConnection.setDoOutput(true);
|
||||||
|
|
||||||
|
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||||
|
final StringBuilder response = new StringBuilder();
|
||||||
|
String inputLine;
|
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
response.append(inputLine);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
System.out.println(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("MojangAPI - New Methods")
|
||||||
|
public void testNewMojangAPIMethods() throws IOException {
|
||||||
|
final MojangAPI mojangAPI = new MojangAPI();
|
||||||
|
final Optional<String> uuid = mojangAPI.getUUID(NAME);
|
||||||
|
Assertions.assertTrue(uuid.isPresent());
|
||||||
|
|
||||||
|
final Optional<MojangSkin> skin;
|
||||||
|
try {
|
||||||
|
skin = mojangAPI.getSkin(uuid.get());
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Assertions.assertTrue(skin.isPresent());
|
||||||
|
Assertions.assertDoesNotThrow(this::testNewMojangAPIMethods);
|
||||||
|
}
|
||||||
|
}
|
4
core/target/classes/bungee.yml
Normal file
4
core/target/classes/bungee.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name: Nicko
|
||||||
|
main: net.artelnatif.nicko.bungee.NickoBungee
|
||||||
|
version: 1.0-SNAPSHOT
|
||||||
|
author: Aro
|
BIN
core/target/classes/com/yoshiplex/rainbow/RainbowText.class
Normal file
BIN
core/target/classes/com/yoshiplex/rainbow/RainbowText.class
Normal file
Binary file not shown.
26
core/target/classes/config.yml
Normal file
26
core/target/classes/config.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Nicko 1.0-SNAPSHOT - Config:
|
||||||
|
|
||||||
|
prefix: "§8[§6Nicko§8] "
|
||||||
|
|
||||||
|
bungeecord:
|
||||||
|
redis:
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
|
# Time To Live, the time the data will be stored on a player-by-player basis.
|
||||||
|
ttl: -1
|
||||||
|
|
||||||
|
|
||||||
|
disguisekit:
|
||||||
|
# The rainbow header text in the book.
|
||||||
|
header: "Nicko's Disguise Kit"
|
||||||
|
|
||||||
|
storage:
|
||||||
|
# Indicates wherever the data will be stored
|
||||||
|
# locally through a .json file or a (My)SQL database.
|
||||||
|
local: true
|
||||||
|
# SQL database's address
|
||||||
|
address: "localhost"
|
||||||
|
# SQL database's username.
|
||||||
|
username: ""
|
||||||
|
# SQL database's password.
|
||||||
|
password: ""
|
BIN
core/target/classes/net/artelnatif/nicko/NickoBukkit.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/NickoBukkit.class
Normal file
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.
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.
BIN
core/target/classes/net/artelnatif/nicko/i18n/I18N$Message.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/i18n/I18N$Message.class
Normal file
Binary file not shown.
BIN
core/target/classes/net/artelnatif/nicko/i18n/I18N.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/i18n/I18N.class
Normal file
Binary file not shown.
BIN
core/target/classes/net/artelnatif/nicko/impl/Internals.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/impl/Internals.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
core/target/classes/net/artelnatif/nicko/mojang/MojangAPI.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/mojang/MojangAPI.class
Normal file
Binary file not shown.
BIN
core/target/classes/net/artelnatif/nicko/mojang/MojangSkin.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/mojang/MojangSkin.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
core/target/classes/net/artelnatif/nicko/storage/Storage.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/storage/Storage.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
core/target/classes/net/artelnatif/nicko/utils/PlayerUtils.class
Normal file
BIN
core/target/classes/net/artelnatif/nicko/utils/PlayerUtils.class
Normal file
Binary file not shown.
7
core/target/classes/plugin.yml
Normal file
7
core/target/classes/plugin.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
name: Nicko
|
||||||
|
main: net.artelnatif.nicko.NickoBukkit
|
||||||
|
version: 1.0-SNAPSHOT
|
||||||
|
author: Aro
|
||||||
|
api-version: 1.18
|
||||||
|
commands:
|
||||||
|
nicko:
|
5
core/target/maven-archiver/pom.properties
Normal file
5
core/target/maven-archiver/pom.properties
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#Generated by Maven
|
||||||
|
#Thu Oct 13 10:30:55 CEST 2022
|
||||||
|
groupId=net.artelnatif
|
||||||
|
artifactId=nicko-core
|
||||||
|
version=1.0-SNAPSHOT
|
|
@ -0,0 +1,38 @@
|
||||||
|
net/artelnatif/nicko/disguise/AppearanceManager.class
|
||||||
|
net/artelnatif/nicko/mojang/MojangSkin.class
|
||||||
|
net/artelnatif/nicko/command/NickoPermissions$Player.class
|
||||||
|
net/artelnatif/nicko/impl/Internals.class
|
||||||
|
net/artelnatif/nicko/anvil/AnvilManager.class
|
||||||
|
net/artelnatif/nicko/bungee/event/ServerSwitchListener.class
|
||||||
|
com/yoshiplex/rainbow/RainbowText.class
|
||||||
|
net/artelnatif/nicko/storage/PlayerDataStore.class
|
||||||
|
net/artelnatif/nicko/command/sub/NickoDisguiseSubCmd.class
|
||||||
|
net/artelnatif/nicko/mojang/MojangAPI$1.class
|
||||||
|
net/artelnatif/nicko/i18n/I18N$Message$Command.class
|
||||||
|
net/artelnatif/nicko/mojang/MojangAPI.class
|
||||||
|
net/artelnatif/nicko/command/NickoTabCompleter.class
|
||||||
|
net/artelnatif/nicko/i18n/I18N$Message.class
|
||||||
|
net/artelnatif/nicko/event/PlayerJoinListener.class
|
||||||
|
net/artelnatif/nicko/command/NickoCommand.class
|
||||||
|
net/artelnatif/nicko/disguise/NickoProfile.class
|
||||||
|
net/artelnatif/nicko/event/PlayerQuitListener.class
|
||||||
|
net/artelnatif/nicko/impl/InternalsProvider.class
|
||||||
|
net/artelnatif/nicko/config/NickoConfiguration.class
|
||||||
|
net/artelnatif/nicko/storage/json/JSONStorage.class
|
||||||
|
net/artelnatif/nicko/bungee/pluginchannel/PluginChannelHelper.class
|
||||||
|
net/artelnatif/nicko/storage/sql/SQLStorage.class
|
||||||
|
net/artelnatif/nicko/mojang/MojangUtils.class
|
||||||
|
net/artelnatif/nicko/command/NickoPermissions$Player$Command.class
|
||||||
|
net/artelnatif/nicko/utils/PlayerUtils.class
|
||||||
|
net/artelnatif/nicko/i18n/I18N.class
|
||||||
|
net/artelnatif/nicko/storage/sql/SQLStorageProvider.class
|
||||||
|
net/artelnatif/nicko/storage/StorageProvider.class
|
||||||
|
net/artelnatif/nicko/command/sub/NickoGUISubCmd.class
|
||||||
|
net/artelnatif/nicko/command/sub/NickoCheckSubCmd.class
|
||||||
|
net/artelnatif/nicko/bungee/NickoBungee.class
|
||||||
|
net/artelnatif/nicko/command/sub/NickoSubCmd.class
|
||||||
|
net/artelnatif/nicko/command/NickoPermissions.class
|
||||||
|
net/artelnatif/nicko/command/sub/NickoDebugSubCmd.class
|
||||||
|
net/artelnatif/nicko/storage/Storage.class
|
||||||
|
net/artelnatif/nicko/NickoBukkit.class
|
||||||
|
net/artelnatif/nicko/storage/json/JSONStorageProvider.class
|
|
@ -0,0 +1,33 @@
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/NickoPermissions.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/storage/json/JSONStorage.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/event/PlayerQuitListener.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/disguise/NickoProfile.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/NickoTabCompleter.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/storage/json/JSONStorageProvider.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/com/yoshiplex/rainbow/RainbowText.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/impl/InternalsProvider.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/anvil/AnvilManager.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/bungee/event/ServerSwitchListener.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/sub/NickoCheckSubCmd.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/disguise/AppearanceManager.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/storage/StorageProvider.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/NickoBukkit.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/storage/Storage.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/bungee/NickoBungee.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/bungee/pluginchannel/PluginChannelHelper.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/storage/PlayerDataStore.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/utils/PlayerUtils.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/storage/sql/SQLStorageProvider.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/event/PlayerJoinListener.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/config/NickoConfiguration.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/mojang/MojangAPI.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/sub/NickoDebugSubCmd.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/NickoCommand.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/sub/NickoSubCmd.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/i18n/I18N.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/impl/Internals.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/sub/NickoDisguiseSubCmd.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/storage/sql/SQLStorage.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/mojang/MojangSkin.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/command/sub/NickoGUISubCmd.java
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/main/java/net/artelnatif/nicko/mojang/MojangUtils.java
|
|
@ -0,0 +1 @@
|
||||||
|
net/artelnatif/nicko/test/MojangAPITest.class
|
|
@ -0,0 +1 @@
|
||||||
|
/home/aro/IdeaProjects/Nicko/core/src/test/java/net/artelnatif/nicko/test/MojangAPITest.java
|
BIN
core/target/nicko-core-1.0-SNAPSHOT.jar
Normal file
BIN
core/target/nicko-core-1.0-SNAPSHOT.jar
Normal file
Binary file not shown.
BIN
core/target/original-nicko-core-1.0-SNAPSHOT.jar
Normal file
BIN
core/target/original-nicko-core-1.0-SNAPSHOT.jar
Normal file
Binary file not shown.
Binary file not shown.
36
dist/dependency-reduced-pom.xml
vendored
Normal file
36
dist/dependency-reduced-pom.xml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?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/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>nicko-parent</artifactId>
|
||||||
|
<groupId>net.artelnatif</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>dist</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<build>
|
||||||
|
<directory>../target</directory>
|
||||||
|
<finalName>nicko-${project.version}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.3.1-SNAPSHOT</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>net.artelnatif:nicko-*</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
57
dist/pom.xml
vendored
Normal file
57
dist/pom.xml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>net.artelnatif</groupId>
|
||||||
|
<artifactId>nicko-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>dist</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<directory>../target</directory>
|
||||||
|
<finalName>nicko-${project.version}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.3.1-SNAPSHOT</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>net.artelnatif:nicko-*</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.artelnatif</groupId>
|
||||||
|
<artifactId>nicko-core</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.artelnatif</groupId>
|
||||||
|
<artifactId>nicko-v1_18_R2</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
24
pom.xml
Normal file
24
pom.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<groupId>net.artelnatif</groupId>
|
||||||
|
<artifactId>nicko-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>Nicko</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>core</module>
|
||||||
|
<module>dist</module>
|
||||||
|
<module>v1_18_R2</module>
|
||||||
|
<module>v1_18_R1</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
</project>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue