Coder Social home page Coder Social logo

maicolantali / clashj Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.85 MB

ClashJ is a Kotlin library designed as an asynchronous API wrapper for Clash of Clans

Home Page: https://maicolantali.github.io/clashJ/

License: MIT License

Kotlin 100.00%

clashj's Introduction

ClashJ

Release KDocs

License Build Validation

ClashJ is a fully asynchronous Clash of Clans API wrapper, written in Kotlin.

๐Ÿ”‘ Key points

  • Fully asynchronous library
  • Support the login with the Email and Password
  • 100% Clash of Clans API
  • Events

โ„น๏ธ Getting started

The library required Java 17 or higher versions.

Download with Gradle

  1. Add it in your root build.gradlee at the end of repositories:

    repositories {
       // ...
       maven { url 'https://jitpack.io' }
    }
  2. Add the dependency

    dependencies {
       implementation 'com.github.MaicolAntali:clashJ:1.0.4'
    }

Download with Maven

  1. Add it in your root pom.xml at the end of repositories:

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
  2. Add the dependency

    <dependency>
        <groupId>com.github.MaicolAntali</groupId>
        <artifactId>clashJ</artifactId>
        <version>1.0.4</version>
    </dependency>

Usage Example

Simple Usage Example

fun main() = runBlocking {
    // Build a client with the default option 
    val client = Client("email", "pwd")
   
   // Login into the Clash of Clans developer website
   client.login()

    // Retrive player info
    val player = client.getPlayer("#tag").await()
    println("Name: ${player.name}, TH lvl: ${player.townHallLevel}")

    // Retrive clan info
    val clan = client.getClan("#tag").await()
    println("Name: ${clan.name}, Tag: ${clan.tag}")
}

Event Usage Example

fun main() = runBlocking {
    val eventClient = EventClient("email", "pwd")

    // Add player and clan to monitored events
    eventClient.addPlayerToMonitoredEvent("#playerTag")
    eventClient.addClanToMonitoredEvent("#clanTag")

    // Register a callback for the "JoinClan" event
    eventClient.registerPlayerCallback(MonitoredEvent.PlayerEvents.JoinClan) { _, current ->
        println("${current.name} has joined a clan.")
    }

    // Register a callback for the "MemberJoin" event
    eventClient.registerClanCallback(MonitoredEvent.ClanEvents.MemberJoin) { _, current, member ->
        println("${member.name} has joined the clan ${current.name}.")
    }

    // Login and start polling for events
    eventClient.login()
    eventClient.startPolling()
}

๐Ÿ”—Links

โœ… Contributing

Thank you for considering contributing to clashJ!

Here's how you can contribute:

  1. Check for Issues: See if there's an existing issue or feature request related to your contribution. If not, create a new one, so we can discuss it.
  2. Fork & Branch: Fork the repository and create a new branch for your changes.
  3. Code: Write your code following the Kotlin coding standards.
  4. Tests are Awesome: If you're adding new features, don't forget to include tests.
  5. Pull Request: Submit a pull request with a brief description of your changes.

Disclaimer

This content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it. For more information, see Supercell's Fan Content Policy.

clashj's People

Contributors

dependabot[bot] avatar maicolantali avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.