EasyLoops is a small, simple and easy to use library for creating loops in Java.
- Implementing EasyLoops into your project
- Creating a loop
- Download
- License
- Contributing
- Contact
- Credits
To activate EasyLoops in your project, you need to add the following code to your project:
new de.thedesigncraft.easyloops.EasyLoops("YOUR_LOOP_PACKAGE_NAME");Be sure to replace YOUR_LOOP_PACKAGE_NAME with the name of the package where your loops are located.
For example, you can directly add this code to your main class:
import de.thedesigncraft.easyloops.*;
public class Main {
public static void main(String[] args) {
new EasyLoops("com.example.loops");
}
}To create a loop, you need to create a class that implements
the ILoop
interface.
import de.thedesigncraft.easyloops.*;
public class ExampleLoop implements ILoop {
@Override
public boolean activated() {
return false;
}
@Override
public int secondsInterval() {
return 0;
}
@Override
public void execute() {
}
}The activated() method is used to activate or deactivate the loop. If the method returns true, the loop will be
executed. If the method returns false, the loop won't be executed.
The secondsInterval() method is used to set the interval in seconds. The loop will be executed
every secondsInterval() seconds.
In the execute() method, you can write the code that should be executed every secondsInterval() seconds.
Be sure to replace the VERSION key below with the one of the versions shown above!
If you haven't yet created a settings.xml file, or you haven't yet added your GitHub-Authentication in the settings.xml file, take a look at Preparing your settings.xml file.
<repository>
<id>github</id>
<name>GitHub TheDesignCraftYT Packages</name>
<url>https://maven.pkg.github.com/TheDesignCraftYT/EasyLoops</url>
</repository><dependency>
<groupId>de.thedesigncraft</groupId>
<artifactId>easyloops</artifactId>
<version>VERSION</version>
</dependency>If you don't have a settings.xml file yet, you can create one in the .m2 folder in your home directory.
If you are using Windows, the .m2 folder is located in C:\Users\YOUR_USERNAME\.m2.
If you are using Linux, the .m2 folder is located in /home/YOUR_USERNAME/.m2.
In the settings.xml file, you need to add the following code in the <servers> tag:
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_GITHUB_TOKEN</password>
</server>Be sure to replace YOUR_GITHUB_USERNAME with your GitHub username and YOUR_GITHUB_TOKEN with a personal GitHub access token.
If you haven't yet created a gradle.properties file, or you haven't yet added your GitHub-Authentication in the gradle.properties file, take a look at Preparing your gradle.properties file.
Gradle Groovy:
repositories {
maven {
url = uri 'https://maven.pkg.github.com/TheDesignCraftYT/EasyLoops'
credentials {
username = project.findProperty('gpr.user') ?: System.getenv('USERNAME')
password = project.findProperty('gpr.key') ?: System.getenv('TOKEN')
}
}
}dependencies {
implementation 'de.thedesigncraft:easyloops:VERSION'
}Kotlin DSL:
repositories {
maven {
url = uri("https://maven.pkg.github.com/TheDesignCraftYT/EasyLoops")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}dependencies {
implementation("de.thedesigncraft:easyloops:VERSION")
}If you don't have a gradle.properties file yet, you can create one in the gradle folder in your project directory.
In the gradle.properties file, you need to add the following code:
gpr.user=YOUR_GITHUB_USERNAME
gpr.key=YOUR_GITHUB_TOKENBe sure to replace YOUR_GITHUB_USERNAME with your GitHub username and YOUR_GITHUB_TOKEN with a personal GitHub access token.
This project is licensed under the Apache 2.0 License.
If you want to contribute to this project, you can create a pull request.
If you have any questions, you can contact me on Discord: TheDesignCraft#2977
- TheDesignCraft - Creator and maintainer
- JetBrains - Providing free licenses for their products
- GitHub - Providing free packages for open source projects
- Maven - Providing free packages for open source projects
- Gradle - Providing free packages for open source projects