Merge pull request #54 from TBMCPlugins/dev
First release of the 'redesign', organizing most features into components
This commit is contained in:
commit
814a5c7eb9
33 changed files with 797 additions and 101 deletions
|
@ -1,13 +1,13 @@
|
||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:master-v1.0-g8d3b6b6-296">
|
<library name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:master-248b0d8d0a-1">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-v1.0-g8d3b6b6-296/Towny-master-v1.0-g8d3b6b6-296.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-248b0d8d0a-1/Towny-master-248b0d8d0a-1.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC>
|
<JAVADOC>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-v1.0-g8d3b6b6-296/Towny-master-v1.0-g8d3b6b6-296-javadoc.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-248b0d8d0a-1/Towny-master-248b0d8d0a-1-javadoc.jar!/" />
|
||||||
</JAVADOC>
|
</JAVADOC>
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-v1.0-g8d3b6b6-296/Towny-master-v1.0-g8d3b6b6-296-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-248b0d8d0a-1/Towny-master-248b0d8d0a-1-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
|
@ -1,13 +1,13 @@
|
||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="Maven: com.github.milkbowl:VaultAPI:master-c8cb88f27a-1">
|
<library name="Maven: com.github.milkbowl:VaultAPI:master-431c5273c2-1">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-c8cb88f27a-1/VaultAPI-master-c8cb88f27a-1.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-431c5273c2-1/VaultAPI-master-431c5273c2-1.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC>
|
<JAVADOC>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-c8cb88f27a-1/VaultAPI-master-c8cb88f27a-1-javadoc.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-431c5273c2-1/VaultAPI-master-431c5273c2-1-javadoc.jar!/" />
|
||||||
</JAVADOC>
|
</JAVADOC>
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-c8cb88f27a-1/VaultAPI-master-c8cb88f27a-1-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-431c5273c2-1/VaultAPI-master-431c5273c2-1-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
|
@ -4,6 +4,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" filepath="$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" />
|
<module fileurl="file://$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" filepath="$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" filepath="$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" />
|
<module fileurl="file://$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" filepath="$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" filepath="$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" filepath="$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" />
|
<module fileurl="file://$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" filepath="$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
|
|
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>
|
|
@ -12,7 +12,6 @@
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
|
||||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import buttondevteam.lib.PluginUpdater;
|
import buttondevteam.component.updater.PluginUpdater;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
1
ButtonCore/lombok.config
Normal file
1
ButtonCore/lombok.config
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lombok.var.flagUsage = ALLOW
|
|
@ -72,6 +72,26 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<useSystemClassLoader>false
|
||||||
|
</useSystemClassLoader> <!-- https://stackoverflow.com/a/53012553/2703239 -->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package buttondevteam.component.commands;
|
||||||
|
|
||||||
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
|
||||||
|
public class CommandComponent extends Component { //TODO: Do we just move everything here?
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package buttondevteam.component.restart;
|
||||||
|
|
||||||
|
import buttondevteam.core.PrimeRestartCommand;
|
||||||
|
import buttondevteam.core.ScheduledRestartCommand;
|
||||||
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
|
public class RestartComponent extends Component {
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
//TODO: Permissions for the commands
|
||||||
|
TBMCChatAPI.AddCommand(getPlugin(), ScheduledRestartCommand.class);
|
||||||
|
TBMCChatAPI.AddCommand(getPlugin(), PrimeRestartCommand.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.component.updater;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
@ -136,7 +137,7 @@ public class PluginUpdater {
|
||||||
public static List<String> GetPluginNames() {
|
public static List<String> GetPluginNames() {
|
||||||
List<String> ret = new ArrayList<>();
|
List<String> ret = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
String resp = TBMCCoreAPI.DownloadString("https://api.github.com/orgs/TBMCPlugins/repos");
|
String resp = TBMCCoreAPI.DownloadString("https://api.github.com/orgs/" + "TBMCPlugins" + "/repos"); //TODO: PluginUpdater
|
||||||
JsonArray arr = new JsonParser().parse(resp).getAsJsonArray();
|
JsonArray arr = new JsonParser().parse(resp).getAsJsonArray();
|
||||||
for (JsonElement obj : arr) {
|
for (JsonElement obj : arr) {
|
||||||
JsonObject jobj = obj.getAsJsonObject();
|
JsonObject jobj = obj.getAsJsonObject();
|
|
@ -0,0 +1,16 @@
|
||||||
|
package buttondevteam.component.updater;
|
||||||
|
|
||||||
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
|
public class PluginUpdaterComponent extends Component {
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
TBMCChatAPI.AddCommand(getPlugin(), UpdatePluginCommand.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() { //TODO: Unregister commands and such
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.component.updater;
|
||||||
|
|
||||||
import buttondevteam.lib.PluginUpdater;
|
import buttondevteam.core.MainPlugin;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
|
@ -0,0 +1,30 @@
|
||||||
|
package buttondevteam.core;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = true)
|
||||||
|
public class ComponentCommand extends TBMCCommandBase {
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
if (args.length < 2)
|
||||||
|
return false;
|
||||||
|
switch (args[0]) {
|
||||||
|
case "enable":
|
||||||
|
break;
|
||||||
|
case "disable":
|
||||||
|
break;
|
||||||
|
case "list":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package buttondevteam.core;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
|
public final class ComponentManager {
|
||||||
|
private ComponentManager() {}
|
||||||
|
|
||||||
|
private static boolean componentsEnabled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This flag is used to enable components registered after the others were enabled.
|
||||||
|
* @return Whether already registered components have been enabled
|
||||||
|
*/
|
||||||
|
public static boolean areComponentsEnabled() { return componentsEnabled; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables components based on a configuration - any component registered afterwards will be also enabled
|
||||||
|
*/
|
||||||
|
public static void enableComponents() {
|
||||||
|
//Component.getComponents().values().stream().filter(c->cs.getConfigurationSection(c.getClass().getSimpleName()).getBoolean("enabled")).forEach(c-> {
|
||||||
|
Component.getComponents().values().stream().filter(c -> c.shouldBeEnabled().get()).forEach(c -> {
|
||||||
|
try {
|
||||||
|
Component.setComponentEnabled(c, true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCCoreAPI.SendException("Failed to enable one of the components: " + c.getClass().getSimpleName(), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
componentsEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables all components that are enabled
|
||||||
|
*/
|
||||||
|
public static void disableComponents() {
|
||||||
|
Component.getComponents().values().stream().filter(Component::isEnabled).forEach(c -> {
|
||||||
|
try {
|
||||||
|
Component.setComponentEnabled(c, false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCCoreAPI.SendException("Failed to disable one of the components: " + c.getClass().getSimpleName(), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
componentsEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will also return false if the component is not registered.
|
||||||
|
*
|
||||||
|
* @param cl The component class
|
||||||
|
* @return Whether the component is registered and enabled
|
||||||
|
*/
|
||||||
|
public static boolean isEnabled(Class<? extends Component> cl) {
|
||||||
|
val c = Component.getComponents().get(cl);
|
||||||
|
return c != null && c.isEnabled();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,10 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
import buttondevteam.lib.PluginUpdater;
|
import buttondevteam.component.restart.RestartComponent;
|
||||||
|
import buttondevteam.component.updater.PluginUpdater;
|
||||||
|
import buttondevteam.component.updater.PluginUpdaterComponent;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.architecture.Component;
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import buttondevteam.lib.chat.ChatRoom;
|
import buttondevteam.lib.chat.ChatRoom;
|
||||||
import buttondevteam.lib.chat.Color;
|
import buttondevteam.lib.chat.Color;
|
||||||
|
@ -47,9 +50,9 @@ public class MainPlugin extends JavaPlugin {
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
Test = getConfig().getBoolean("test", true);
|
Test = getConfig().getBoolean("test", true);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
TBMCChatAPI.AddCommand(this, UpdatePluginCommand.class);
|
Component.registerComponent(this, new PluginUpdaterComponent());
|
||||||
TBMCChatAPI.AddCommand(this, ScheduledRestartCommand.class);
|
Component.registerComponent(this, new RestartComponent());
|
||||||
TBMCChatAPI.AddCommand(this, PrimeRestartCommand.class);
|
ComponentManager.enableComponents();
|
||||||
TBMCChatAPI.AddCommand(this, MemberCommand.class);
|
TBMCChatAPI.AddCommand(this, MemberCommand.class);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||||
ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender
|
ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender
|
||||||
|
@ -82,6 +85,7 @@ public class MainPlugin extends JavaPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
ComponentManager.disableComponents();
|
||||||
logger.info("Saving player data...");
|
logger.info("Saving player data...");
|
||||||
TBMCPlayerBase.savePlayers();
|
TBMCPlayerBase.savePlayers();
|
||||||
logger.info("Player data saved.");
|
logger.info("Player data saved.");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
import buttondevteam.lib.chat.IDiscordSender;
|
import buttondevteam.lib.chat.IFakePlayer;
|
||||||
import buttondevteam.lib.player.TBMCPlayerBase;
|
import buttondevteam.lib.player.TBMCPlayerBase;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -43,7 +43,7 @@ public class PlayerListener implements Listener {
|
||||||
if (PrimeRestartCommand.isLoud())
|
if (PrimeRestartCommand.isLoud())
|
||||||
Bukkit.broadcastMessage("§cNobody is online anymore. Restarting.");
|
Bukkit.broadcastMessage("§cNobody is online anymore. Restarting.");
|
||||||
Bukkit.spigot().restart();
|
Bukkit.spigot().restart();
|
||||||
} else if (!(event.getPlayer() instanceof IDiscordSender) && System.nanoTime() - 10 * 1000000000L - lasttime > 0) { //Ten seconds passed since last reminder
|
} else if (!(event.getPlayer() instanceof IFakePlayer) && System.nanoTime() - 10 * 1000000000L - lasttime > 0) { //Ten seconds passed since last reminder
|
||||||
lasttime = System.nanoTime();
|
lasttime = System.nanoTime();
|
||||||
if (PrimeRestartCommand.isLoud())
|
if (PrimeRestartCommand.isLoud())
|
||||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "The server will restart as soon as nobody is online.");
|
Bukkit.broadcastMessage(ChatColor.DARK_RED + "The server will restart as soon as nobody is online.");
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import buttondevteam.lib.chat.ChatMessage;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.experimental.Delegate;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
@ -16,28 +17,19 @@ import javax.annotation.Nullable;
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class TBMCChatEvent extends TBMCChatEventBase {
|
public class TBMCChatEvent extends TBMCChatEventBase {
|
||||||
public TBMCChatEvent(CommandSender sender, ChromaGamerBase user, Channel channel, String message, int score, boolean fromcmd, String groupid) {
|
public TBMCChatEvent(Channel channel, ChatMessage cm, Channel.RecipientTestResult rtr) {
|
||||||
super(channel, message, score, groupid);
|
super(channel, cm.getMessage(), rtr.score, rtr.groupID);
|
||||||
this.sender = sender;
|
this.cm = cm;
|
||||||
this.fromcmd = fromcmd;
|
|
||||||
this.ignoreSenderPermissions = false;
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TBMCChatEvent(CommandSender sender, ChromaGamerBase user, Channel channel, String message, int score, boolean fromcmd, String groupid, boolean ignoreSenderPermissions) {
|
|
||||||
super(channel, message, score, groupid);
|
|
||||||
this.sender = sender;
|
|
||||||
this.user = user;
|
|
||||||
this.fromcmd = fromcmd;
|
|
||||||
this.ignoreSenderPermissions = ignoreSenderPermissions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private final CommandSender sender;
|
@Delegate //<-- Backwards compatibility
|
||||||
private final boolean fromcmd;
|
private ChatMessage cm;
|
||||||
private final boolean ignoreSenderPermissions;
|
|
||||||
private final ChromaGamerBase user;
|
private boolean isIgnoreSenderPermissions() {
|
||||||
|
return cm.getPermCheck() != cm.getSender();
|
||||||
|
}
|
||||||
// TODO: Message object with data?
|
// TODO: Message object with data?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +37,7 @@ public class TBMCChatEvent extends TBMCChatEventBase {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSendTo(CommandSender sender) {
|
public boolean shouldSendTo(CommandSender sender) {
|
||||||
if (isIgnoreSenderPermissions() && sender.equals(this.sender))
|
if (isIgnoreSenderPermissions() && sender.equals(this.cm.getSender()))
|
||||||
return true; //Allow sending the message no matter what
|
return true; //Allow sending the message no matter what
|
||||||
return super.shouldSendTo(sender);
|
return super.shouldSendTo(sender);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +47,7 @@ public class TBMCChatEvent extends TBMCChatEventBase {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getMCScore(CommandSender sender) {
|
public int getMCScore(CommandSender sender) {
|
||||||
if (isIgnoreSenderPermissions() && sender.equals(this.sender))
|
if (isIgnoreSenderPermissions() && sender.equals(this.cm.getSender()))
|
||||||
return getScore(); //Send in the correct group no matter what
|
return getScore(); //Send in the correct group no matter what
|
||||||
return super.getMCScore(sender);
|
return super.getMCScore(sender);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +58,7 @@ public class TBMCChatEvent extends TBMCChatEventBase {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getGroupID(CommandSender sender) {
|
public String getGroupID(CommandSender sender) {
|
||||||
if (isIgnoreSenderPermissions() && sender.equals(this.sender))
|
if (isIgnoreSenderPermissions() && sender.equals(this.cm.getSender()))
|
||||||
return getGroupID(); //Send in the correct group no matter what
|
return getGroupID(); //Send in the correct group no matter what
|
||||||
return super.getGroupID(sender);
|
return super.getGroupID(sender);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
|
import buttondevteam.component.updater.PluginUpdater;
|
||||||
import buttondevteam.core.MainPlugin;
|
import buttondevteam.core.MainPlugin;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import buttondevteam.lib.potato.DebugPotato;
|
import buttondevteam.lib.potato.DebugPotato;
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package buttondevteam.lib.architecture;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public abstract class ButtonPlugin extends JavaPlugin {
|
||||||
|
private final HashMap<String, ConfigData<?>> datamap = new HashMap<>();
|
||||||
|
private ConfigurationSection section;
|
||||||
|
|
||||||
|
protected abstract void pluginEnable();
|
||||||
|
|
||||||
|
protected abstract void pluginDisable();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
section = getConfig().getConfigurationSection("global");
|
||||||
|
if (section == null) section = getConfig().createSection("global");
|
||||||
|
try {
|
||||||
|
pluginEnable();
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCCoreAPI.SendException("Error while enabling plugin " + getName() + "!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
try {
|
||||||
|
pluginDisable();
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCCoreAPI.SendException("Error while disabling plugin " + getName() + "!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IHaveConfig#getData(Map, ConfigurationSection, String, Object)
|
||||||
|
*/
|
||||||
|
protected <T> ConfigData<T> getData(String path, T def) {
|
||||||
|
return IHaveConfig.getData(datamap, section, path, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IHaveConfig#getData(Map, ConfigurationSection, String, Object, Function, Function)
|
||||||
|
*/
|
||||||
|
protected <T> ConfigData<T> getData(String path, T def, Function<Object, T> getter, Function<T, Object> setter) {
|
||||||
|
return IHaveConfig.getData(datamap, section, path, def, getter, setter);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,221 @@
|
||||||
|
package buttondevteam.lib.architecture;
|
||||||
|
|
||||||
|
import buttondevteam.core.ComponentManager;
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.architecture.exceptions.UnregisteredComponentException;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.experimental.var;
|
||||||
|
import lombok.val;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration is based on class name
|
||||||
|
*/
|
||||||
|
public abstract class Component {
|
||||||
|
private static HashMap<Class<? extends Component>, Component> components = new HashMap<>();
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private boolean enabled = false;
|
||||||
|
@Getter(value = AccessLevel.PROTECTED)
|
||||||
|
@NonNull
|
||||||
|
private JavaPlugin plugin;
|
||||||
|
@NonNull
|
||||||
|
private ConfigurationSection config;
|
||||||
|
|
||||||
|
public ConfigData<Boolean> shouldBeEnabled() {
|
||||||
|
return getData("enabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashMap<String, ConfigData<?>> datamap = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IHaveConfig#getData(Map, ConfigurationSection, String, Object)
|
||||||
|
*/
|
||||||
|
protected <T> ConfigData<T> getData(String path, T def) {
|
||||||
|
return IHaveConfig.getData(datamap, config, path, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IHaveConfig#getData(Map, ConfigurationSection, String, Object, Function, Function)
|
||||||
|
*/
|
||||||
|
protected <T> ConfigData<T> getData(String path, T def, Function<Object, T> getter, Function<T, Object> setter) {
|
||||||
|
return IHaveConfig.getData(datamap, config, path, def, getter, setter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a component checking it's dependencies and calling {@link #register(JavaPlugin)}.<br>
|
||||||
|
* Make sure to register the dependencies first.<br>
|
||||||
|
* The component will be enabled automatically, regardless of when it was registered.
|
||||||
|
*
|
||||||
|
* @param component The component to register
|
||||||
|
* @return Whether the component is registered successfully (it may have failed to enable)
|
||||||
|
*/
|
||||||
|
public static boolean registerComponent(JavaPlugin plugin, Component component) {
|
||||||
|
return registerUnregisterComponent(plugin, component, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a component by calling {@link #unregister(JavaPlugin)}.<br>
|
||||||
|
* Make sure to unregister the dependencies last.
|
||||||
|
*
|
||||||
|
* @param componentClass The component class to unregister
|
||||||
|
* @return Whether the component is unregistered successfully (it also got disabled)
|
||||||
|
*/
|
||||||
|
public static boolean unregisterComponent(JavaPlugin plugin, Class<? extends Component> componentClass) {
|
||||||
|
val component = components.get(componentClass);
|
||||||
|
if (component == null)
|
||||||
|
return false; //Failed to load
|
||||||
|
return registerUnregisterComponent(plugin, component, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean registerUnregisterComponent(JavaPlugin plugin, Component component, boolean register) {
|
||||||
|
try {
|
||||||
|
val metaAnn = component.getClass().getAnnotation(ComponentMetadata.class);
|
||||||
|
if (metaAnn != null) {
|
||||||
|
Class<? extends Component>[] dependencies = metaAnn.depends();
|
||||||
|
for (val dep : dependencies) {
|
||||||
|
if (!components.containsKey(dep)) {
|
||||||
|
plugin.getLogger().warning("Failed to " + (register ? "" : "un") + "register component " + component.getClassName() + " as a required dependency is missing/disabled: " + dep.getSimpleName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (register) {
|
||||||
|
component.plugin = plugin;
|
||||||
|
var compconf = plugin.getConfig().getConfigurationSection("components");
|
||||||
|
if (compconf == null) compconf = plugin.getConfig().createSection("components");
|
||||||
|
component.config = compconf.getConfigurationSection(component.getClassName());
|
||||||
|
if (component.config == null) component.config = compconf.createSection(component.getClassName());
|
||||||
|
component.register(plugin);
|
||||||
|
components.put(component.getClass(), component);
|
||||||
|
if (ComponentManager.areComponentsEnabled() && component.shouldBeEnabled().get()) {
|
||||||
|
try { //Enable components registered after the previous ones getting enabled
|
||||||
|
setComponentEnabled(component, true);
|
||||||
|
return true;
|
||||||
|
} catch (Exception | NoClassDefFoundError e) {
|
||||||
|
TBMCCoreAPI.SendException("Failed to enable component " + component.getClassName() + "!", e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (component.enabled) {
|
||||||
|
try {
|
||||||
|
component.disable();
|
||||||
|
component.enabled = false;
|
||||||
|
} catch (Exception | NoClassDefFoundError e) {
|
||||||
|
TBMCCoreAPI.SendException("Failed to disable component " + component.getClassName() + "!", e);
|
||||||
|
return false; //If failed to disable, won't unregister either
|
||||||
|
}
|
||||||
|
}
|
||||||
|
component.unregister(plugin);
|
||||||
|
components.remove(component.getClass());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCCoreAPI.SendException("Failed to " + (register ? "" : "un") + "register component " + component.getClassName() + "!", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a component checking it's dependencies and calling {@link #register(JavaPlugin)}.<br>
|
||||||
|
* Make sure to register the dependencies first.
|
||||||
|
*
|
||||||
|
* @param component The component to register
|
||||||
|
*/
|
||||||
|
public static void setComponentEnabled(Component component, boolean enabled) throws UnregisteredComponentException {
|
||||||
|
if (!components.containsKey(component.getClass()))
|
||||||
|
throw new UnregisteredComponentException(component);
|
||||||
|
if (component.enabled = enabled)
|
||||||
|
component.enable();
|
||||||
|
else
|
||||||
|
component.disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently registered components<br>
|
||||||
|
*
|
||||||
|
* @return The currently registered components
|
||||||
|
*/
|
||||||
|
public static Map<Class<? extends Component>, Component> getComponents() {
|
||||||
|
return Collections.unmodifiableMap(components);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the module, when called by the JavaPlugin class.
|
||||||
|
* This gets fired when the plugin is enabled. Use {@link #enable()} to register commands and such.
|
||||||
|
*
|
||||||
|
* @param plugin Plugin object
|
||||||
|
*/
|
||||||
|
protected void register(JavaPlugin plugin) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters the module, when called by the JavaPlugin class.
|
||||||
|
* This gets fired when the plugin is disabled.
|
||||||
|
* Do any cleanups needed within this method.
|
||||||
|
*
|
||||||
|
* @param plugin Plugin object
|
||||||
|
*/
|
||||||
|
protected void unregister(JavaPlugin plugin) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the module, when called by the JavaPlugin class. Call
|
||||||
|
* registerCommand() and registerListener() within this method.<br>
|
||||||
|
* To access the plugin, use {@link #getPlugin()}.
|
||||||
|
*/
|
||||||
|
protected abstract void enable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the module, when called by the JavaPlugin class. Do
|
||||||
|
* any cleanups needed within this method.
|
||||||
|
* To access the plugin, use {@link #getPlugin()}.
|
||||||
|
*/
|
||||||
|
protected abstract void disable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a TBMCCommand to the plugin. Make sure to add it to plugin.yml and use {@link buttondevteam.lib.chat.CommandClass}.
|
||||||
|
*
|
||||||
|
* @param plugin Main plugin responsible for stuff
|
||||||
|
* @param commandBase Custom coded command class
|
||||||
|
*/
|
||||||
|
protected void registerCommand(JavaPlugin plugin, TBMCCommandBase commandBase) {
|
||||||
|
TBMCChatAPI.AddCommand(plugin, commandBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a Listener to this plugin
|
||||||
|
*
|
||||||
|
* @param plugin Main plugin responsible for stuff
|
||||||
|
* @param listener The event listener to register
|
||||||
|
* @return The provided listener
|
||||||
|
*/
|
||||||
|
protected Listener registerListener(JavaPlugin plugin, Listener listener) {
|
||||||
|
TBMCCoreAPI.RegisterEventsForExceptions(listener, plugin);
|
||||||
|
return listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getClassName() {
|
||||||
|
Class<?> enclosingClass = getClass().getEnclosingClass();
|
||||||
|
String className;
|
||||||
|
if (enclosingClass != null) {
|
||||||
|
className = (enclosingClass.getName());
|
||||||
|
} else {
|
||||||
|
className = (getClass().getName());
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package buttondevteam.lib.architecture;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface ComponentMetadata {
|
||||||
|
Class<? extends Component>[] depends();
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package buttondevteam.lib.architecture;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the getter/setter constructor if {@link T} isn't a primitive type or String.<br>
|
||||||
|
* Use {@link Component#getData(String, Object)} or {@link ButtonPlugin#getData(String, Object)} to get an instance.
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
|
||||||
|
@AllArgsConstructor(access = AccessLevel.PACKAGE)
|
||||||
|
public class ConfigData<T> { //TODO: Save after a while
|
||||||
|
private final ConfigurationSection config;
|
||||||
|
private final String path;
|
||||||
|
private final T def;
|
||||||
|
/**
|
||||||
|
* The parameter is of a primitive type as returned by {@link YamlConfiguration#get(String)}
|
||||||
|
*/
|
||||||
|
private Function<Object, T> getter;
|
||||||
|
/**
|
||||||
|
* The result should be a primitive type or string that can be retrieved correctly later
|
||||||
|
*/
|
||||||
|
private Function<T, Object> setter;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public T get() {
|
||||||
|
Object val = config.get(path, def);
|
||||||
|
if (getter != null) {
|
||||||
|
T hmm = getter.apply(val);
|
||||||
|
if (hmm == null) hmm = def; //Set if the getter returned null
|
||||||
|
return hmm;
|
||||||
|
}
|
||||||
|
return (T) val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(T value) {
|
||||||
|
Object val;
|
||||||
|
if (setter != null)
|
||||||
|
val = setter.apply(value);
|
||||||
|
else val = value;
|
||||||
|
config.set(path, val);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package buttondevteam.lib.architecture;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Members of this interface should be protected (access level)
|
||||||
|
*/
|
||||||
|
final class IHaveConfig {
|
||||||
|
private IHaveConfig() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method overload should only be used with primitves or String.
|
||||||
|
*
|
||||||
|
* @param path The path in config to use
|
||||||
|
* @param def The value to use by default
|
||||||
|
* @param <T> The type of this variable (only use primitives or String)
|
||||||
|
* @return The data object that can be used to get or set the value
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected static <T> ConfigData<T> getData(Map<String, ConfigData<?>> datamap, ConfigurationSection config, String path, T def) {
|
||||||
|
ConfigData<?> data = datamap.get(path);
|
||||||
|
if (data == null) datamap.put(path, data = new ConfigData<>(config, path, def));
|
||||||
|
return (ConfigData<T>) data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method overload may be used with any class.
|
||||||
|
*
|
||||||
|
* @param path The path in config to use
|
||||||
|
* @param def The value to use by default
|
||||||
|
* @param getter A function that converts a primitive representation to the correct value
|
||||||
|
* @param setter A function that converts a value to a primitive representation
|
||||||
|
* @param <T> The type of this variable (can be any class)
|
||||||
|
* @return The data object that can be used to get or set the value
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected static <T> ConfigData<T> getData(Map<String, ConfigData<?>> datamap, ConfigurationSection config, String path, T def, Function<Object, T> getter, Function<T, Object> setter) {
|
||||||
|
ConfigData<?> data = datamap.get(path);
|
||||||
|
if (data == null) datamap.put(path, data = new ConfigData<>(config, path, def, getter, setter));
|
||||||
|
return (ConfigData<T>) data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package buttondevteam.lib.architecture.exceptions;
|
||||||
|
|
||||||
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
|
||||||
|
public class UnregisteredComponentException extends Exception {
|
||||||
|
|
||||||
|
public UnregisteredComponentException(Component component) {
|
||||||
|
super("The component '" + component.getClass().getSimpleName() + "' isn't registered!");
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ public class Channel {
|
||||||
/**
|
/**
|
||||||
* Filters both the sender and the targets
|
* Filters both the sender and the targets
|
||||||
*/
|
*/
|
||||||
public final Function<CommandSender, RecipientTestResult> filteranderrormsg;
|
private final Function<CommandSender, RecipientTestResult> filteranderrormsg;
|
||||||
|
|
||||||
private static final List<Channel> channels = new ArrayList<>();
|
private static final List<Channel> channels = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -87,10 +87,7 @@ public class Channel {
|
||||||
* Note: Errors are sent to the sender automatically
|
* Note: Errors are sent to the sender automatically
|
||||||
*/
|
*/
|
||||||
public int getMCScore(CommandSender sender) {
|
public int getMCScore(CommandSender sender) {
|
||||||
if (filteranderrormsg == null)
|
return getRTR(sender).score; //No need to check if there was an error
|
||||||
return SCORE_SEND_OK;
|
|
||||||
RecipientTestResult result = filteranderrormsg.apply(sender);
|
|
||||||
return result.errormessage == null ? result.score : SCORE_SEND_NOPE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,10 +97,13 @@ public class Channel {
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getGroupID(CommandSender sender) {
|
public String getGroupID(CommandSender sender) {
|
||||||
|
return getRTR(sender).groupID; //No need to check if there was an error
|
||||||
|
}
|
||||||
|
|
||||||
|
public RecipientTestResult getRTR(CommandSender sender) {
|
||||||
if (filteranderrormsg == null)
|
if (filteranderrormsg == null)
|
||||||
return GROUP_EVERYONE;
|
return new RecipientTestResult(SCORE_SEND_OK, GROUP_EVERYONE);
|
||||||
RecipientTestResult result = filteranderrormsg.apply(sender);
|
return filteranderrormsg.apply(sender);
|
||||||
return result.errormessage == null ? result.groupID : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Channel> getChannels() {
|
public static List<Channel> getChannels() {
|
||||||
|
@ -143,9 +143,10 @@ public class Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RecipientTestResult {
|
public static class RecipientTestResult {
|
||||||
public String errormessage = null;
|
public final String errormessage;
|
||||||
public int score = SCORE_SEND_NOPE; // Anything below 0 is "never send"
|
public final int score; // Anything below 0 is "never send"
|
||||||
public String groupID = null;
|
public final String groupID;
|
||||||
|
public static final RecipientTestResult ALL = new RecipientTestResult(SCORE_SEND_OK, GROUP_EVERYONE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a result that indicates an <b>error</b>
|
* Creates a result that indicates an <b>error</b>
|
||||||
|
@ -154,6 +155,8 @@ public class Channel {
|
||||||
*/
|
*/
|
||||||
public RecipientTestResult(String errormessage) {
|
public RecipientTestResult(String errormessage) {
|
||||||
this.errormessage = errormessage;
|
this.errormessage = errormessage;
|
||||||
|
this.score = SCORE_SEND_NOPE;
|
||||||
|
this.groupID = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,8 +166,10 @@ public class Channel {
|
||||||
* @param groupID The ID of the target group.
|
* @param groupID The ID of the target group.
|
||||||
*/
|
*/
|
||||||
public RecipientTestResult(int score, String groupID) {
|
public RecipientTestResult(int score, String groupID) {
|
||||||
|
if (score < 0) throw new IllegalArgumentException("Score must be non-negative!");
|
||||||
this.score = score;
|
this.score = score;
|
||||||
this.groupID = groupID;
|
this.groupID = groupID;
|
||||||
|
this.errormessage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import lombok.Setter;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
|
@ -20,7 +21,8 @@ public class ChatMessage {
|
||||||
/**
|
/**
|
||||||
* The message to send as the user.
|
* The message to send as the user.
|
||||||
*/
|
*/
|
||||||
private final String message;
|
@Setter
|
||||||
|
private String message;
|
||||||
/**
|
/**
|
||||||
* Indicates whether the message comes from running a command (like /tableflip). Implemented to be used from Discord.
|
* Indicates whether the message comes from running a command (like /tableflip). Implemented to be used from Discord.
|
||||||
*/
|
*/
|
||||||
|
@ -29,6 +31,20 @@ public class ChatMessage {
|
||||||
* The sender which we should check for permissions. Same as {@link #sender} by default.
|
* The sender which we should check for permissions. Same as {@link #sender} by default.
|
||||||
*/
|
*/
|
||||||
private CommandSender permCheck;
|
private CommandSender permCheck;
|
||||||
|
/**
|
||||||
|
* The origin of the message, "Minecraft" or "Discord" for example. May be displayed to the user.<br>
|
||||||
|
* <b>This is the user class capitalized folder name.</b>
|
||||||
|
*/
|
||||||
|
private final String origin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sender which we should check for permissions. Same as {@link #sender} by default.
|
||||||
|
*
|
||||||
|
* @return The perm check or the sender
|
||||||
|
*/
|
||||||
|
public CommandSender getPermCheck() {
|
||||||
|
return permCheck == null ? sender : permCheck;
|
||||||
|
}
|
||||||
|
|
||||||
private static ChatMessageBuilder builder() {
|
private static ChatMessageBuilder builder() {
|
||||||
return new ChatMessageBuilder();
|
return new ChatMessageBuilder();
|
||||||
|
@ -36,7 +52,6 @@ public class ChatMessage {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static ChatMessageBuilder builder(CommandSender sender, ChromaGamerBase user, String message) {
|
public static ChatMessageBuilder builder(CommandSender sender, ChromaGamerBase user, String message) {
|
||||||
return builder().sender(sender).user(user).message(message);
|
return builder().sender(sender).user(user).message(message).origin(user.getFolder().substring(0, 1).toUpperCase() + user.getFolder().substring(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@ public class ChatRoom extends Channel {
|
||||||
|
|
||||||
public void joinRoom(CommandSender sender) {
|
public void joinRoom(CommandSender sender) {
|
||||||
usersInRoom.add(sender);
|
usersInRoom.add(sender);
|
||||||
TBMCChatAPI.SendSystemMessage(this, 0, "everyone", sender.getName() + " joined the room");
|
TBMCChatAPI.SendSystemMessage(this, RecipientTestResult.ALL, sender.getName() + " joined the room");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void leaveRoom(CommandSender sender) {
|
public void leaveRoom(CommandSender sender) {
|
||||||
usersInRoom.remove(sender);
|
usersInRoom.remove(sender);
|
||||||
TBMCChatAPI.SendSystemMessage(this, 0, "everyone", sender.getName() + " left the room");
|
TBMCChatAPI.SendSystemMessage(this, RecipientTestResult.ALL, sender.getName() + " left the room");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@ import org.bukkit.command.CommandSender;
|
||||||
* @author Norbi
|
* @author Norbi
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IDiscordSender extends CommandSender {
|
public interface IFakePlayer extends CommandSender {
|
||||||
|
|
||||||
}
|
}
|
|
@ -228,17 +228,18 @@ public class TBMCChatAPI {
|
||||||
public static boolean SendChatMessage(ChatMessage cm, Channel channel) {
|
public static boolean SendChatMessage(ChatMessage cm, Channel channel) {
|
||||||
if (!Channel.getChannels().contains(channel))
|
if (!Channel.getChannels().contains(channel))
|
||||||
throw new RuntimeException("Channel " + channel.DisplayName + " not registered!");
|
throw new RuntimeException("Channel " + channel.DisplayName + " not registered!");
|
||||||
val permcheck = cm.getPermCheck() == null ? cm.getSender() : cm.getPermCheck();
|
val permcheck = cm.getPermCheck();
|
||||||
RecipientTestResult rtr = getScoreOrSendError(channel, permcheck);
|
RecipientTestResult rtr = getScoreOrSendError(channel, permcheck);
|
||||||
int score = rtr.score;
|
int score = rtr.score;
|
||||||
if (score == -1 || rtr.groupID == null)
|
if (score == Channel.SCORE_SEND_NOPE || rtr.groupID == null)
|
||||||
return true;
|
return true;
|
||||||
TBMCChatPreprocessEvent eventPre = new TBMCChatPreprocessEvent(cm.getSender(), channel, cm.getMessage());
|
TBMCChatPreprocessEvent eventPre = new TBMCChatPreprocessEvent(cm.getSender(), channel, cm.getMessage());
|
||||||
Bukkit.getPluginManager().callEvent(eventPre);
|
Bukkit.getPluginManager().callEvent(eventPre);
|
||||||
if (eventPre.isCancelled())
|
if (eventPre.isCancelled())
|
||||||
return true;
|
return true;
|
||||||
|
cm.setMessage(eventPre.getMessage());
|
||||||
TBMCChatEvent event;
|
TBMCChatEvent event;
|
||||||
event = new TBMCChatEvent(cm.getSender(), cm.getUser(), channel, eventPre.getMessage(), score, cm.isFromCommand(), rtr.groupID, permcheck != cm.getSender());
|
event = new TBMCChatEvent(channel, cm, rtr);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event.isCancelled();
|
return event.isCancelled();
|
||||||
}
|
}
|
||||||
|
@ -248,30 +249,26 @@ public class TBMCChatAPI {
|
||||||
*
|
*
|
||||||
* @param channel
|
* @param channel
|
||||||
* The channel to send to
|
* The channel to send to
|
||||||
* @param score
|
* @param rtr
|
||||||
* The score to use to find the group - use 0 if the channel doesn't have scores
|
* The score&group to use to find the group - use {@link RecipientTestResult#ALL} if the channel doesn't have scores
|
||||||
* @param message
|
* @param message
|
||||||
* The message to send
|
* The message to send
|
||||||
* @return The event cancelled state
|
* @return The event cancelled state
|
||||||
*/
|
*/
|
||||||
public static boolean SendSystemMessage(Channel channel, int score, String groupid, String message) {
|
public static boolean SendSystemMessage(Channel channel, RecipientTestResult rtr, String message) {
|
||||||
if (!Channel.getChannels().contains(channel))
|
if (!Channel.getChannels().contains(channel))
|
||||||
throw new RuntimeException("Channel " + channel.DisplayName + " not registered!");
|
throw new RuntimeException("Channel " + channel.DisplayName + " not registered!");
|
||||||
TBMCSystemChatEvent event = new TBMCSystemChatEvent(channel, message, score, groupid);
|
TBMCSystemChatEvent event = new TBMCSystemChatEvent(channel, message, rtr.score, rtr.groupID);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event.isCancelled();
|
return event.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RecipientTestResult getScoreOrSendError(Channel channel, CommandSender sender) {
|
private static RecipientTestResult getScoreOrSendError(Channel channel, CommandSender sender) {
|
||||||
if (channel.filteranderrormsg == null)
|
RecipientTestResult result = channel.getRTR(sender);
|
||||||
return new RecipientTestResult(0, "everyone");
|
|
||||||
else {
|
|
||||||
RecipientTestResult result = channel.filteranderrormsg.apply(sender);
|
|
||||||
if (result.errormessage != null)
|
if (result.errormessage != null)
|
||||||
sender.sendMessage("§c" + result.errormessage);
|
sender.sendMessage("§c" + result.errormessage);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a chat channel. See {@link Channel#Channel(String, Color, String, java.util.function.Function)} for details.
|
* Register a chat channel. See {@link Channel#Channel(String, Color, String, java.util.function.Function)} for details.
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -203,6 +204,7 @@ public abstract class ChromaGamerBase implements AutoCloseable {
|
||||||
* @return The player as a {@link T} object or null if not having an account there
|
* @return The player as a {@link T} object or null if not having an account there
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@Nullable
|
||||||
public <T extends ChromaGamerBase> T getAs(Class<T> cl) { // TODO: Provide a way to use TBMCPlayerBase's loaded players
|
public <T extends ChromaGamerBase> T getAs(Class<T> cl) { // TODO: Provide a way to use TBMCPlayerBase's loaded players
|
||||||
if (cl.getSimpleName().equals(getClass().getSimpleName()))
|
if (cl.getSimpleName().equals(getClass().getSimpleName()))
|
||||||
return (T) this;
|
return (T) this;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.lang.annotation.*;
|
||||||
@Inherited
|
@Inherited
|
||||||
public @interface UserClass {
|
public @interface UserClass {
|
||||||
/**
|
/**
|
||||||
* Indicates which folder should the player files be saved in.
|
* Indicates which folder should the player files be saved in. Must be lowercase.
|
||||||
*/
|
*/
|
||||||
String foldername();
|
String foldername();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,14 @@
|
||||||
<compilerArgument>-proc:none</compilerArgument>
|
<compilerArgument>-proc:none</compilerArgument>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<useSystemClassLoader>false
|
||||||
|
</useSystemClassLoader> <!-- https://stackoverflow.com/a/53012553/2703239 -->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue