Skip to content

TheDesignCraftYT/EasyLoops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

releases-shield license-shield discord-shield

EasyLoops

EasyLoops is a small, simple and easy to use library for creating loops in Java.

Summary

  1. Implementing EasyLoops into your project
  2. Creating a loop
  3. Download
  4. License
  5. Contributing
  6. Contact
  7. Credits

Implementing EasyLoops into your project

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");
    }
}

Creating a loop

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.

Download

stable-releases-shield snapshots-shield

Be sure to replace the VERSION key below with the one of the versions shown above!

Maven

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>

Preparing your settings.xml file

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.

Gradle

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")
}

Preparing your gradle.properties file

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_TOKEN

Be sure to replace YOUR_GITHUB_USERNAME with your GitHub username and YOUR_GITHUB_TOKEN with a personal GitHub access token.

License

This project is licensed under the Apache 2.0 License.

Contributing

If you want to contribute to this project, you can create a pull request.

Contact

If you have any questions, you can contact me on Discord: TheDesignCraft#2977

Credits

  • 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

About

A small java library to make it easier for you to loop code.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages