💥 Lot of breaking changes.

This commit is contained in:
LambdAurora
2020-01-04 15:19:02 +01:00
parent 7c06afb4a4
commit 738d094fb1
59 changed files with 554 additions and 328 deletions

15
common/build.gradle Normal file
View File

@@ -0,0 +1,15 @@
plugins {
id 'java-library'
}
dependencies {
api "org.jetbrains:annotations:17.0.0"
api "org.aperlambda:lambdajcommon:1.7.2"
api "com.electronwill.night-config:core:3.5.3"
api "com.electronwill.night-config:toml:3.5.3"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright © 2020 LambdAurora <aurora42lambda@gmail.com>
*
* This file is part of LambdaControls.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
*/
package me.lambdaurora.lambdacontrols;
import org.aperlambda.lambdacommon.utils.Nameable;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Optional;
/**
* Represents the controls mode.
*
* @author LambdAurora
* @version 1.1.0
* @since 1.0.0
*/
public enum ControlsMode implements Nameable
{
DEFAULT,
CONTROLLER,
TOUCHSCREEN;
/**
* Returns the next controls mode available.
*
* @return The next available controls mode.
*/
public ControlsMode next()
{
ControlsMode[] v = values();
if (v.length == this.ordinal() + 1)
return v[0];
return v[this.ordinal() + 1];
}
/**
* Gets the translation key of this controls mode.
*
* @return The translated key of this controls mode.
* @since 1.1.0
*/
public String get_translation_key()
{
return "lambdacontrols.controls_mode." + this.get_name();
}
@Override
public @NotNull String get_name()
{
return this.name().toLowerCase();
}
/**
* Gets the controls mode from its identifier.
*
* @param id The identifier of the controls mode.
* @return The controls mode if found, else empty.
*/
public static Optional<ControlsMode> by_id(@NotNull String id)
{
return Arrays.stream(values()).filter(mode -> mode.get_name().equalsIgnoreCase(id)).findFirst();
}
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright © 2020 LambdAurora <aurora42lambda@gmail.com>
*
* This file is part of LambdaControls.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
*/
package me.lambdaurora.lambdacontrols;
/**
* Represents the constants used by LambdaControls.
*
* @author LambdAurora
* @version 1.1.0
* @since 1.1.0
*/
public class LambdaControlsConstants
{
public static final String NAMESPACE = "lambdacontrols";
}