Vortex is a in java written template for complex java applications with mysql support and custom configs.
Make sure you've installed following things:
Java Development Kit 20 Installation Guide
Maven Installation Guide
Initialize IntelliJ Project
-
Start cloning this repository
git clone "https://github.com/maxi-schaefer/vortex"
-
Open your Project in Intellij File > Open > "Path to Vortex"
-
And your done!
You can create commands in dev.max.vortex.commands.impl, just create your command class and implement Command.java. Implement the methods and change the return values. Example:
public class YourCommand implements Command {
@Override
public String name() {
return "MyFirstCommand";
}
@Override
public String description() {
return "I like to code with vortex";
}
@Override
public void execute(String[] args) {
System.out.println("Hello World");
}
}
Register your command in the CommandManager with:
commands.add(new YourCommand());
After that your command should be registered and you can start coding it with the execute method. If you want your command to have aliases use the aliases method like this:
@Override
public List<String> aliases() {
return List.of(new String[]{ "test", "myAlias" });
}
Create your config class in dev.max.vortex.config.impl, add all your variables, getter, setter and a constructor Example:
@Getter
@Setter
@AllArgsConstructor
public class TestConfig {
private int testInt;
private String testString;
private double testDouble;
private float testFloat;
private boolean testBoolean;
}
Now add your new Config to the Configs class in dev.max.vortex.config like this:
@Setter
@Getter
public class Configs {
private TestConfig testConfig;
}
After this you need to initialize it VortexInstance you can do it like this:
public class VortexInstance {
private final TestConfig testConfig;
public VortexInstance() {
//...
testConfig = new TestConfig(1, "String", 2D, 0.3f, false);
}
}
In the ConfigSaver and ConfigLoader class you need to add following code:
config.setTestConfig(VortexInstance.getInstance().getTestConfig();
TestConfig testConfig = VortexInstance.getInstance().getTestConfig();
testConfig.setTestInt(config.getTestConfig().getTestInt());
testConfig.setTestString(config.getTestConfig().getTestString());
testConfig.setTestDouble(config.getTestConfig().getTestDouble());
testConfig.setTestFloat(config.getTestConfig().getTestFloat());
testConfig.setTestBoolean(config.getTestConfig().getTestBoolean());
Now you've added your first config!