Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 1.20.3 support #943

Merged
merged 2 commits into from
Dec 7, 2023
Merged
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
2 changes: 1 addition & 1 deletion bedwars-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bedwars-api</artifactId>
Expand Down
15 changes: 13 additions & 2 deletions bedwars-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bedwars-plugin</artifactId>
Expand Down Expand Up @@ -192,6 +192,11 @@
<artifactId>versionsupport_v1_20_R2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>versionsupport_v1_20_R3</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>versionsupport-common</artifactId>
Expand Down Expand Up @@ -247,7 +252,7 @@
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-base</artifactId>
<version>23.12</version>
<version>23.12.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -304,6 +309,12 @@
<version>23.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_20_R3</artifactId>
<version>23.12.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- End of Sidebar LIB-->
<!-- Slime Paper -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public SidebarLine normalizeTitle(@Nullable List<String> titleArray) {
for (String line : lineArray) {
// convert old placeholders
line = line.replace("{server_ip}", "{serverIp}");
String scoreLine = null;

// generic team placeholder {team}
if (null != arena) {
Expand All @@ -148,9 +149,14 @@ public SidebarLine normalizeTitle(@Nullable List<String> titleArray) {
line = genericTeamFormat
.replace("{TeamLetter}", teamLetter)
.replace("{TeamColor}", team.getColor().chat().toString())
.replace("{TeamName}", teamName)
.replace("{TeamStatus}", "{Team" + team.getName() + "Status}");
.replace("{TeamName}", teamName);

if (line.contains("{TeamStatus}") && getAPI().getVersionSupport().getVersion() >= 10) {
line = line.replace("{TeamStatus}", "");
scoreLine = "{Team" + team.getName() + "Status}";
} else {
line = line.replace("{TeamStatus}", "{Team" + team.getName() + "Status}");
}
} else {
// skip line
continue;
Expand Down Expand Up @@ -223,12 +229,7 @@ public SidebarLine normalizeTitle(@Nullable List<String> titleArray) {
if (divided.length > 1) {
sidebarLine = normalizeTitle(Arrays.asList(divided));
} else {
sidebarLine = new SidebarLine() {
@Override
public @NotNull String getLine() {
return finalTemp;
}
};
sidebarLine = new BwSidebarLine(finalTemp, scoreLine);
}

lines.add(sidebarLine);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.andrei1058.bedwars.sidebar;

import com.andrei1058.spigot.sidebar.ScoredLine;
import com.andrei1058.spigot.sidebar.SidebarLine;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class BwSidebarLine extends SidebarLine implements ScoredLine {

public final String content;
public final String score;

public BwSidebarLine(String content, @Nullable String score) {
this.content = content;
this.score = score == null ? "" : score;
}
@Override
public String getScore() {
return score;
}

@Override
public @NotNull String getLine() {
return content;
}
}
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<packaging>pom</packaging>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -113,6 +113,7 @@
<module>versionsupport_v1_19_R3</module>
<module>versionsupport_v1_20_R1</module>
<module>versionsupport_v1_20_R2</module>
<module>versionsupport_v1_20_R3</module>
</modules>

<distributionManagement>
Expand Down
2 changes: 1 addition & 1 deletion resetadapter_aswm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>resetadapter-aswm</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion resetadapter_slime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>resetadapter-slime</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion resetadapter_slimepaper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>resetadapter-slimepaper</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_12_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_8_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_1_8_R3</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_16_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_17_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_18_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_19_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_v1_19_R2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_19_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_v1_19_R3</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_20_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_v1_20_R1</artifactId>
Expand Down
8 changes: 7 additions & 1 deletion versionsupport_v1_20_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<version>23.10.1-SNAPSHOT</version>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_v1_20_R2</artifactId>
Expand Down Expand Up @@ -38,6 +38,12 @@
<version>1.20.2-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
70 changes: 70 additions & 0 deletions versionsupport_v1_20_R3/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<version>23.12.1-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_v1_20_R3</artifactId>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>bedwars-api</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>versionsupport-common</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.3-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.andrei1058.bedwars.support.version.v1_20_R3.despawnable;

public record DespawnableAttributes(DespawnableType type, double speed, double health, double damage, int despawnSeconds) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.andrei1058.bedwars.support.version.v1_20_R3.despawnable;

import com.andrei1058.bedwars.api.arena.team.ITeam;
import com.andrei1058.bedwars.api.server.VersionSupport;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public class DespawnableFactory {

private final VersionSupport versionSupport;
private final List<DespawnableProvider<? extends LivingEntity>> providers = new ArrayList<>();

public DespawnableFactory(VersionSupport versionSupport) {
this.versionSupport = versionSupport;
providers.add(new TeamIronGolem());
providers.add(new TeamSilverfish());
}

public LivingEntity spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team){
return providers.stream().filter(provider -> provider.getType() == attr.type())
.findFirst().orElseThrow().spawn(attr, location,team, versionSupport);
}
}
Loading
Loading