Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@
<version>1.21.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc....................</groupId>
<artifactId>spigot</artifactId>
<version>1.21.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand All @@ -244,13 +250,13 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.6</version>
<version>2.11.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.SkriptLang</groupId>
<artifactId>Skript</artifactId>
<version>2.12.0</version>
<version>2.13.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@
<version>1.21.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc....................</groupId>
<artifactId>spigot</artifactId>
<version>1.21.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
Expand All @@ -199,7 +205,7 @@
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api</artifactId>
<version>2.15.3-SNAPSHOT</version>
<version>2.15.5</version>
</dependency>

<dependency>
Expand All @@ -216,13 +222,13 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.6</version>
<version>2.11.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.SkriptLang</groupId>
<artifactId>Skript</artifactId>
<version>2.12.0</version>
<version>2.13.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,193 +1,178 @@
package nl.mtvehicles.core.infrastructure.enums;

import nl.mtvehicles.core.infrastructure.annotations.VersionSpecific;
import nl.mtvehicles.core.movement.PacketHandler;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

/**
* Enum of supported server versions (used for different NMS and Spigot API changes)
* Enum of supported server versions (used for different NMS and Spigot API
* changes)
*/
@VersionSpecific
public enum ServerVersion {
/**
* 1.12-1.12.2
*/
v1_12,
v1_12_R1(PacketHandler::movement_1_12_R1),
/**
* 1.13.1-1.13.2
*/
v1_13,
v1_13_R2(PacketHandler::movement_1_13_R2),
/**
* 1.15-1.15.2
*/
v1_15,
v1_15_R1(PacketHandler::movement_1_15_R1),
/**
* 1.16.4-1.16.5
*/
v1_16,
v1_16_R3(PacketHandler::movement_1_16_R3),
/**
* 1.17-1.17.1
*/
v1_17,
v1_17_R1(PacketHandler::movement_1_17_R1),
/**
* 1.18-1.18.1
*/
v1_18_R1,
v1_18_R1(PacketHandler::movement_1_18_R1),
/**
* 1.18.2
*/
v1_18_R2,
v1_18_R2(PacketHandler::movement_1_18_R2),
/**
* 1.19-1.19.2
*
* @since 2.4.3
*/
v1_19_R1,
v1_19_R1(PacketHandler::movement_1_19_R1),
/**
* 1.19.3
*
* @since 2.5.0
*/
v1_19_R2,
v1_19_R2(PacketHandler::movement_1_19_R2),
/**
* 1.19.4
*
* @since 2.5.0
*/
v1_19_R3,
v1_19_R3(PacketHandler::movement_1_19_R3),
/**
* 1.20 and 1.20.1
*
* @since 2.5.6
*/
v1_20_R1,
v1_20_R1(PacketHandler::movement_1_20_R1),
/**
* 1.20.2
*
* @since 2.5.2
*/
v1_20_R2,
v1_20_R2(PacketHandler::movement_1_20_R2),
/**
* 1.20.3 and 1.20.4
*
* @since 2.5.2
*/
v1_20_R3,
v1_20_R3(PacketHandler::movement_1_20_R3),
/**
* 1.20.5 and 1.20.6
*
* @since 2.5.4
*/
v1_20_R4,
v1_20_R4(PacketHandler::movement_1_20_R4),
/**
* 1.21 and 1.21.1
*
* @since 2.5.4
*/
v1_21_R1,
v1_21_R1(PacketHandler::movement_1_21_R1),
/**
* 1.21.2 and 1.21.3
*
* @since 2.5.5
*/
v1_21_R2,
v1_21_R2(PacketHandler::movement_1_21_R2),
/**
* 1.21.4
*
* @since 2.5.5
*/
v1_21_R3,
v1_21_R3(PacketHandler::movement_1_21_R3),
/**
* 1.21.5
*
* @since 2.5.6
*/
v1_21_R4,
v1_21_R4(PacketHandler::movement_1_21_R4),
/**
* 1.21.6, 1.21.7 and 1.21.8
*
* @since 2.5.6
*/
v1_21_R5,
v1_21_R5(PacketHandler::movement_1_21_R5),
/**
* 1.21.9 and 1.21.10
*
* @since 2.5.8
*/
v1_21_R6;

public boolean is1_12(){
return this.equals(v1_12);
}

public boolean is1_13(){
return this.equals(v1_13);
}

public boolean is1_15(){
return this.equals(v1_15);
}

public boolean is1_16(){
return this.equals(v1_16);
}

public boolean is1_17(){
return this.equals(v1_17);
}

public boolean is1_18_R1(){
return this.equals(v1_18_R1);
}
v1_21_R6(PacketHandler::movement_1_21_R6),
/**
* 1.21.11
*
* @since 2.5.8
*/
v1_21_R7(PacketHandler::movement_1_21_R7);

public boolean is1_18_R2(){
return this.equals(v1_18_R2);
/**
* Function interface for packet movement handlers
*/
public interface MovementHandler {
void handle(Player player);
}

public boolean is1_19(){
return this.equals(v1_19_R1);
}
private final MovementHandler movementHandler;

public boolean is1_19_R2(){
return this.equals(v1_19_R2);
ServerVersion(MovementHandler movementHandler) {
this.movementHandler = movementHandler;
}

public boolean is1_19_R3(){return this.equals(v1_19_R3);}

public boolean is1_20_R1() {return this.equals(v1_20_R1);}

public boolean is1_20_R2() {return this.equals(v1_20_R2);}

public boolean is1_20_R3() {
return this.equals(v1_20_R3);
/**
* Get the movement handler for this server version
*
* @return The movement handler for this version
*/
public MovementHandler getMovementHandler() {
return this.movementHandler;
}

public boolean is1_20_R4(){return this.equals(v1_20_R4);}

public boolean is1_21_R1(){return this.equals(v1_21_R1);}

public boolean is1_21_R2(){return this.equals(v1_21_R2);}

public boolean is1_21_R3(){return this.equals(v1_21_R3);}

public boolean is1_21_R4(){return this.equals(v1_21_R4);}

public boolean is1_21_R5(){return this.equals(v1_21_R5);}

public boolean is1_21_R6(){return this.equals(v1_21_R6);}

/**
* Check whether the server version is older than the given one
*/
public boolean isOlderThan(@NotNull ServerVersion version){
public boolean isOlderThan(@NotNull ServerVersion version) {
return this.ordinal() < version.ordinal();
}

/**
* Check whether the server version is older than the given one or whether it is the same
* Check whether the server version is older than the given one or whether it is
* the same
*/
public boolean isOlderOrEqualTo(@NotNull ServerVersion version){
public boolean isOlderOrEqualTo(@NotNull ServerVersion version) {
return this.ordinal() <= version.ordinal();
}

/**
* Check whether the server version is newer than the given one
*/
public boolean isNewerThan(@NotNull ServerVersion version){
public boolean isNewerThan(@NotNull ServerVersion version) {
return this.ordinal() > version.ordinal();
}

/**
* Check whether the server version is newer than the given one or whether it is the same
* Check whether the server version is newer than the given one or whether it is
* the same
*/
public boolean isNewerOrEqualTo(@NotNull ServerVersion version){
public boolean isNewerOrEqualTo(@NotNull ServerVersion version) {
return this.ordinal() >= version.ordinal();
}

Expand Down
Loading