mirror of
https://github.com/rockyhawk64/CommandPanels.git
synced 2025-11-18 07:14:17 +01:00
Compare commits
11 Commits
76204cd69d
...
84ec10106c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84ec10106c | ||
|
|
5d9fbbbcff | ||
|
|
47fc8acd26 | ||
|
|
5f0571757d | ||
|
|
ed0b596d0b | ||
|
|
8b2f6ab423 | ||
|
|
de90b4f94f | ||
|
|
55593424af | ||
|
|
ab95c63853 | ||
|
|
be9dc8c4c2 | ||
|
|
c1edb95f8a |
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,4 +1,9 @@
|
||||
# Project exclude paths
|
||||
/out/
|
||||
/target/
|
||||
.idea/
|
||||
/out
|
||||
/target
|
||||
|
||||
# IDE
|
||||
.idea
|
||||
*.iml
|
||||
*.iws
|
||||
*.ipr
|
||||
3
.idea/.gitignore
vendored
3
.idea/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@ -1,13 +0,0 @@
|
||||
<?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="CommandPanels" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/panels" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/resource" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/resource_editor" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/resource_example" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,16 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="MismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="queryNames">
|
||||
<value />
|
||||
</option>
|
||||
<option name="updateNames">
|
||||
<value />
|
||||
</option>
|
||||
<option name="ignoredClasses">
|
||||
<value />
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
@ -1,125 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jitpack.io" />
|
||||
<option name="name" value="jitpack.io" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jeff-media-public" />
|
||||
<option name="name" value="jeff-media-public" />
|
||||
<option name="url" value="https://hub.jeff-media.com/nexus/repository/jeff-media-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="io.papermc" />
|
||||
<option name="name" value="io.papermc" />
|
||||
<option name="url" value="https://papermc.io/repo/repository/maven-releases/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="sonatype" />
|
||||
<option name="name" value="sonatype" />
|
||||
<option name="url" value="https://oss.sonatype.org/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="io.papermc" />
|
||||
<option name="name" value="io.papermc" />
|
||||
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="codemc-repo" />
|
||||
<option name="name" value="codemc-repo" />
|
||||
<option name="url" value="https://repo.codemc.io/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="opencollab-snapshot" />
|
||||
<option name="name" value="opencollab-snapshot" />
|
||||
<option name="url" value="https://repo.opencollab.dev/main/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="placeholderapi" />
|
||||
<option name="name" value="placeholderapi" />
|
||||
<option name="url" value="https://repo.extendedclip.com/content/repositories/placeholderapi/" />
|
||||
</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="oraxen" />
|
||||
<option name="name" value="Oraxen Repository" />
|
||||
<option name="url" value="https://repo.oraxen.com/#/releases" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="phoenix" />
|
||||
<option name="name" value="phoenix" />
|
||||
<option name="url" value="https://nexus.phoenixdevt.fr/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BenCodez Repo" />
|
||||
<option name="name" value="BenCodez Repo" />
|
||||
<option name="url" value="https://nexus.bencodez.com/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="oraxen" />
|
||||
<option name="name" value="Oraxen Repository" />
|
||||
<option name="url" value="https://repo.oraxen.com/releases" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="papermc" />
|
||||
<option name="name" value="papermc" />
|
||||
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jitpack-repo" />
|
||||
<option name="name" value="jitpack-repo" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="ess-repo" />
|
||||
<option name="name" value="ess-repo" />
|
||||
<option name="url" value="https://repo.essentialsx.net/releases/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="spigot-repo" />
|
||||
<option name="name" value="spigot-repo" />
|
||||
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="skript-releases" />
|
||||
<option name="name" value="Skript Repository" />
|
||||
<option name="url" value="https://repo.skriptlang.org/releases" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jeff-media-public" />
|
||||
<option name="name" value="jeff-media-public" />
|
||||
<option name="url" value="https://repo.jeff-media.com/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="reposilite-repository-releases" />
|
||||
<option name="name" value="Reposilite Repository" />
|
||||
<option name="url" value="https://repo.nexomc.com/releases" />
|
||||
</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="matteodev" />
|
||||
<option name="name" value="matteodev" />
|
||||
<option name="url" value="https://maven.devs.beer/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="minecraft-repo" />
|
||||
<option name="name" value="minecraft-repo" />
|
||||
<option name="url" value="https://libraries.minecraft.net/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:adventure-api:4.11.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-api/4.11.0/adventure-api-4.11.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-api/4.11.0/adventure-api-4.11.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-api/4.11.0/adventure-api-4.11.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:adventure-key:4.11.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-key/4.11.0/adventure-key-4.11.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-key/4.11.0/adventure-key-4.11.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-key/4.11.0/adventure-key-4.11.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:adventure-text-minimessage:4.11.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-text-minimessage/4.11.0/adventure-text-minimessage-4.11.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-text-minimessage/4.11.0/adventure-text-minimessage-4.11.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-text-minimessage/4.11.0/adventure-text-minimessage-4.11.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@ -1,11 +0,0 @@
|
||||
<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_21" project-jdk-name="21" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/CommandPanels.iml" filepath="$PROJECT_DIR$/CommandPanels.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,124 +0,0 @@
|
||||
<?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>
|
||||
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$" dumb="true">
|
||||
<sourceFolder url="file://$MODULE_DIR$/panels" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resource" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
||||
@ -12,6 +12,8 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class FileHandler {
|
||||
private final Context ctx;
|
||||
@ -41,7 +43,8 @@ public class FileHandler {
|
||||
// Create panels folder and add example panels if not there
|
||||
if (!ctx.plugin.folder.exists()) {
|
||||
if (!ctx.plugin.folder.mkdirs()) {
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task -> ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_CREATE_PANELS_FAIL));
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task ->
|
||||
ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_CREATE_PANELS_FAIL));
|
||||
return;
|
||||
}
|
||||
createExamplePanels();
|
||||
@ -54,6 +57,8 @@ public class FileHandler {
|
||||
ctx.plugin.panels.putAll(panels);
|
||||
ctx.panelCommand.populateCommands();
|
||||
});
|
||||
|
||||
createLangFile();
|
||||
}
|
||||
|
||||
private HashMap<String, Panel> loadYamlFilesRecursively(File directory) {
|
||||
@ -89,7 +94,7 @@ public class FileHandler {
|
||||
// Code for config files
|
||||
//this reads the encrypted resource files in the jar file
|
||||
private Reader getReaderFromStream(InputStream initialStream) throws IOException {
|
||||
if(initialStream == null) return new StringReader("Missing resource for this file!");
|
||||
if (initialStream == null) return new StringReader("Missing resource for this file!");
|
||||
// Read all bytes from the input stream
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
byte[] data = new byte[8192];
|
||||
@ -120,32 +125,26 @@ public class FileHandler {
|
||||
FileConfiguration floodgateCustomFile = YamlConfiguration.loadConfiguration(getReaderFromStream(ctx.plugin.getResource("floodgate_custom.yml")));
|
||||
floodgateCustomFile.save(new File(ctx.plugin.folder, "floodgate_custom.yml"));
|
||||
} catch (IOException | NullPointerException e) {
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task -> ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_CREATE_EXAMPLE_FAIL));
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task ->
|
||||
ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_CREATE_EXAMPLE_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
// if lang file is missing add it back
|
||||
private void createLangFile() {
|
||||
File messagesFile = new File(ctx.plugin.getDataFolder(), "lang.yml");
|
||||
if (messagesFile.exists()) {
|
||||
// Return, lang file already exists
|
||||
return;
|
||||
}
|
||||
if (messagesFile.exists()) return;
|
||||
|
||||
YamlConfiguration messagesYaml = Message.toYaml();
|
||||
try {
|
||||
messagesYaml.save(messagesFile);
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin,
|
||||
task -> ctx.text.sendError(
|
||||
ctx.plugin.getServer().getConsoleSender(),
|
||||
Message.FILE_CREATE_LANG_FAIL
|
||||
)
|
||||
);
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task ->
|
||||
ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_CREATE_LANG_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfigFiles(){
|
||||
public void updateConfigFiles() {
|
||||
// Register config files
|
||||
config = YamlConfiguration.loadConfiguration(new File(ctx.plugin.getDataFolder(), "config.yml"));
|
||||
|
||||
@ -158,9 +157,10 @@ public class FileHandler {
|
||||
configFileConfiguration.save(configFile);
|
||||
config = YamlConfiguration.loadConfiguration(new File(ctx.plugin.getDataFolder(), "config.yml"));
|
||||
} catch (IOException var11) {
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task -> ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_CREATE_CONFIG_FAIL));
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task ->
|
||||
ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_CREATE_CONFIG_FAIL));
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
// Check if the config file has any missing elements
|
||||
try {
|
||||
YamlConfiguration configFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(ctx.plugin.getResource("config.yml")));
|
||||
@ -168,7 +168,8 @@ public class FileHandler {
|
||||
config.options().copyDefaults(true);
|
||||
config.save(new File(ctx.plugin.getDataFolder() + File.separator + "config.yml"));
|
||||
} catch (IOException var10) {
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task -> ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_UPDATE_CONFIG_FAIL));
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task ->
|
||||
ctx.text.sendError(ctx.plugin.getServer().getConsoleSender(), Message.FILE_UPDATE_CONFIG_FAIL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ public class HeadDatabaseComponent implements MaterialComponent {
|
||||
api = new HeadDatabaseAPI();
|
||||
return api.getItemHead(head);
|
||||
} else {
|
||||
ctx.text.sendWarn(player, Message.REQUIRE_HEADDATABASE);
|
||||
ctx.text.sendWarn(player, Message.REQUIRE_HEAD_DATABASE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -21,14 +21,13 @@ public class ReloadCommand implements SubCommand {
|
||||
@Override
|
||||
public boolean execute(Context ctx, CommandSender sender, String[] args) {
|
||||
Bukkit.getAsyncScheduler().runNow(ctx.plugin, task -> {
|
||||
ctx.text.lang.reloadTranslations();
|
||||
ctx.fileHandler.updateConfigFiles();
|
||||
ctx.fileHandler.reloadPanels();
|
||||
ctx.panelCommand.populateCommands();
|
||||
ctx.text.lang.reloadTranslations();
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, t ->
|
||||
ctx.text.sendInfo(sender, Message.PLUGIN_RELOADED));
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ public class Placeholders extends PlaceholderExpansion {
|
||||
loadPlaceholders();
|
||||
}
|
||||
|
||||
private void loadPlaceholders(){
|
||||
private void loadPlaceholders() {
|
||||
resolvers.add(new SessionDataPlaceholder());
|
||||
resolvers.add(new DataPlaceholder());
|
||||
resolvers.add(new RandomPlaceholder());
|
||||
@ -43,7 +43,7 @@ public class Placeholders extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return ctx.plugin.getDescription().getVersion();
|
||||
return ctx.plugin.getPluginMeta().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,7 +54,7 @@ public class Placeholders extends PlaceholderExpansion {
|
||||
for (PlaceholderResolver resolver : resolvers) {
|
||||
try {
|
||||
String value = resolver.resolve(player, params, ctx);
|
||||
if(value != null){
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -24,15 +24,9 @@ public class LanguageManager {
|
||||
// The plugin will ensure they are still detected without it
|
||||
public void reloadTranslations() {
|
||||
translations.clear();
|
||||
try {
|
||||
YamlConfiguration langFile = YamlConfiguration.loadConfiguration(new File(ctx.plugin.getDataFolder(), "lang.yml"));
|
||||
for (String key : langFile.getKeys(false)) {
|
||||
translations.put(key.toLowerCase(), langFile.getString(key));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Send raw message as text class will not be initialised here
|
||||
Bukkit.getConsoleSender().sendMessage(Component.text(
|
||||
"[CommandPanels] Language file could not be loaded, periods should not be in language keys.", NamedTextColor.RED));
|
||||
YamlConfiguration langFile = YamlConfiguration.loadConfiguration(new File(ctx.plugin.getDataFolder(), "lang.yml"));
|
||||
for (String key : langFile.getKeys(false)) {
|
||||
translations.put(key.toLowerCase(), langFile.getString(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,9 +13,10 @@ public enum Message {
|
||||
// FileHandler / DataLoader / GenerateManager
|
||||
FILE_CREATE_PANELS_FAIL("Failed to create panels folder!"),
|
||||
FILE_CREATE_EXAMPLE_FAIL("Could not create example panels!"),
|
||||
FILE_CREATE_LANG_FAIL("Failed to create language file!"),
|
||||
FILE_CREATE_CONFIG_FAIL("Could not create the config file!"),
|
||||
FILE_UPDATE_CONFIG_FAIL("Could not update the config file!"),
|
||||
FILE_CREATE_LANG_FAIL("Failed to create language file!"),
|
||||
FILE_UPDATE_LANG_FAIL("Failed to update language file!"),
|
||||
FILE_SAVE_DATA_FAIL("Could not save data file."),
|
||||
FILE_SAVE_PANEL_FAIL("Could not save new panel file."),
|
||||
|
||||
@ -113,7 +114,7 @@ public enum Message {
|
||||
DIALOG_NO_BUTTONS("Dialog needs at least one button"),
|
||||
COOLDOWN_ERROR("You're opening panels too quickly"),
|
||||
TELEPORT_ERROR("Error with teleport tag"),
|
||||
REQUIRE_HEADDATABASE("Download the HeadDatabase plugin to use this feature!");
|
||||
REQUIRE_HEAD_DATABASE("Download the HeadDatabase plugin to use this feature!");
|
||||
|
||||
private final String message;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user