Skip to content

dscalzi/SkyChanger

Repository files navigation

# Header

Builds

SkyChanger is a light-weight plugin for Spigot and Sponge. The main function of this plugin is to change the color of the sky for yourself, a specific player, a specific world, or everyone. This plugin functions by sending packets with a specified value to the target player(s).

Like the project? Leave a ⭐ on the repository!


Feature List

  • Allow players to change the color of their personal sky.
  • Change the sky color for specific players.
  • Change the sky color for a specific world.
  • Change the sky color for everyone online.
  • Freeze/Unfreeze yourself, others, a world, or everyone online.
  • Configurable limits to the range of packets that can be sent.
  • Usage messages tailored to specific users based on permission level.
  • Multilanguage support.
  • Metrics tracking by bStats.

If you would like to contribute your language or correct an incorrect translation, follow this quick guide.

You can find more extensive details on the wiki.


Building and Contributing

If you would like to contribute to SkyChanger, feel free to submit a pull request. The project does not use a specific code style, however please keep to the conventions used throughout the code.

You can build SkyChanger using Gradle. Clone the repository and run the following command.

$ gradlew build

Developer API

If you want to hook SkyChanger into your own plugin or simply want to extend functionality, you may use the provided API. If you feel the API is missing anything, or should be changed, please let us know.

GitHub Packages

SkyChanger 5.x+ will be hosted on GitHub packages. See https://github.com/dscalzi/SkyChanger/packages SkyChanger 4.x and earlier were hosted on jcenter, which shutdown.

Javadocs are not hosted, however they are provided on the maven repository.

Gradle

See https://docs.github.com/articles/configuring-gradle-for-use-with-github-package-registry/ to learn more.

dependencies {
    // For Bukkit
    implementation 'com.dscalzi:skychanger-bukkit:VERSION'
    // For Sponge
    implementation 'com.dscalzi:skychanger-sponge:VERSION'
}

Maven

See https://docs.github.com/articles/configuring-apache-maven-for-use-with-github-package-registry/ to learn more.

<!-- For Bukkit -->
<dependency>
  <groupId>com.dscalzi</groupId>
  <artifactId>skychanger-bukkit</artifactId>
  <version>VERSION</version>
</dependency>

<!-- For Sponge -->
<dependency>
  <groupId>com.dscalzi</groupId>
  <artifactId>skychanger-sponge</artifactId>
  <version>VERSION</version>
</dependency>

Example Usage

/**
* Example usage of the API. The following implementation
* would not be practical, it exists only to demonstrate
* the API capabilities.
* 
* @param player The player to experiment on.
*/
public void skychangerTests(Player player) {
    // Get a reference to the API.
    final SkyAPI api = SkyChanger.getAPI();

    // Change the sky and save the result.
    // Equivalent to /SkyChanger 3
    boolean result1 = api.changeSky(SkyChanger.wrapPlayer(player), SkyPacket.RAIN_LEVEL_CHANGE, 3F);

    if(result1) {
        player.sendMessage("Why did the sky turn red?");
    }

    // Equivalent to /SkyChanger 4 8
    boolean result2 = api.changeSky(SkyChanger.wrapPlayer(player), SkyPacket.RAIN_LEVEL_CHANGE, 4F)
                 && api.changeSky(SkyChanger.wrapPlayer(player), SkyPacket.THUNDER_LEVEL_CHANGE, 8F);

    if(result2) {
        player.sendMessage("Why did the sky turn light blue?");
    }

    // Freeze the player.
    boolean result3 = api.freeze(SkyChanger.wrapPlayer(player));

    if(result3) {
        player.sendMessage("Where did the land go?");

        // Unfreeze the player.
        result3 = api.unfreeze(SkyChanger.wrapPlayer(player));

        if(result3) {
            player.sendMessage("You've been unfrozen! Press (F3 + A) to reload chunks.");
        }
    }
}

Links