Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
06c7a6e
Merge pull request #16 from andrei1058/master
andrei1058 Feb 9, 2023
198c8ed
fix prefix and suffix length
andrei1058 Feb 17, 2023
d6c01d4
Merge remote-tracking branch 'origin/develop' into develop
andrei1058 Feb 17, 2023
9decf18
fix prefix and suffix length
andrei1058 Feb 17, 2023
4877a0d
fix bw #662
andrei1058 Feb 17, 2023
684d894
check identifier length
andrei1058 Feb 25, 2023
fe6f92c
Merge branch 'master' into develop
andrei1058 Jun 25, 2023
e049569
Add 1_20_R1 Support (#28)
JT122406 Jun 25, 2023
48408c6
fix first line getting skipped
andrei1058 Oct 14, 2023
a80969b
fix placeholders being registered after title, fix first line getting…
andrei1058 Oct 14, 2023
8971c2b
fix placeholders being registered after title, fix first line getting…
andrei1058 Oct 15, 2023
70ddd0c
Merge branch 'master' into develop
andrei1058 Oct 28, 2023
809150b
Merge remote-tracking branch 'origin/master'
andrei1058 Oct 28, 2023
5f22878
Merge branch 'master' into develop
andrei1058 Oct 28, 2023
fb58396
clean up
andrei1058 Oct 28, 2023
7e65949
clean up (#37)
andrei1058 Oct 28, 2023
2e9384b
Add 1.20 R2 support (#38)
andrei1058 Oct 28, 2023
8a90929
workflow update
andrei1058 Feb 10, 2025
d77c7e6
Merge branch 'updateworkflow' into develop
andrei1058 Feb 10, 2025
d9a1d2f
papi version update
andrei1058 Feb 10, 2025
87ee90a
skip docs
andrei1058 Feb 10, 2025
f068373
version update
andrei1058 Feb 10, 2025
f763525
expose
andrei1058 Feb 10, 2025
b7029a7
version string update
andrei1058 Feb 23, 2025
e1eca63
fix paper support (remapping issue I guess)
andrei1058 Feb 23, 2025
5c0dc9c
clean up
andrei1058 Feb 26, 2025
4e62614
fix tab prefix-suffix
andrei1058 Mar 2, 2025
9863a9c
enable distribution management back
andrei1058 Mar 2, 2025
0fcc5c8
Merge remote-tracking branch 'origin/master' into develop
andrei1058 Mar 2, 2025
ce0abfc
fix health not getting updated
andrei1058 Mar 2, 2025
548531a
add 1.21.3 support
andrei1058 Mar 2, 2025
40a5f9d
add 1.21.4 support
andrei1058 Mar 2, 2025
e0dbdb5
allow javadocs
andrei1058 Mar 23, 2025
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ This project is divided in several modules:
- `sidebar-v_1_20_R2` provides support for 1.20.2 (R2)
- `sidebar-v_1_20_R3` provides support for 1.20.3 (R3)
- `sidebar-v_1_20_R4` provides support for 1.20.4 (R4). Requires `sidebar-v_1_20_R3`.
- `sidebar-v_1_21_R1` provides support for 1.21.1 (R1). Requires `sidebar-cmn1`.
- `sidebar-v_1_21_R1` provides support for 1.21 and 1.21.1 (R1). Requires `sidebar-cmn1`.
- `sidebar-v_1_21_R2` provides support for 1.21.3 (R2). Requires `sidebar-cmn1`.
- `sidebar-v_1_21_R3` provides support for 1.21.4 (R3). Requires `sidebar-cmn1`.

### IMPORTANT
It is really important to call Sidebar#remove(player) when a player leaves the server to avoid memory leaks.
Expand Down
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-pom</artifactId>
<packaging>pom</packaging>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
<modules>
<module>sidebar-base</module>
<module>sidebar-v1_21_R3</module>
<module>sidebar-v1_21_R2</module>
<module>sidebar-v1_21_R1</module>
<module>sidebar-v1_20_R4</module>
<module>sidebar-v1_20_R3</module>
Expand Down
2 changes: 1 addition & 1 deletion sidebar-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import java.util.regex.Pattern;

public class PAPIAdapter implements PAPISupport {

public PAPIAdapter() {}

@Override
public String replacePlaceholders(Player p, String s) {
return PlaceholderAPI.setPlaceholders(p, s);
Expand Down
22 changes: 1 addition & 21 deletions sidebar-cmn1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-pom</artifactId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>

<artifactId>sidebar-cmn1</artifactId>
Expand Down Expand Up @@ -40,24 +40,4 @@
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>20</source>
<target>20</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion sidebar-v1_12_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_16_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_17_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_18_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_19_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_19_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_20_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_20_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_20_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_20_R4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion sidebar-v1_21_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.1-SNAPSHOT</version>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

import com.andrei1058.spigot.sidebar.*;
import dev.andrei1058.spigot.sidebar.cmn1.PlayerListImplCmn1;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.chat.IChatMutableComponent;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.PacketPlayOutScoreboardTeam;
import net.minecraft.world.scores.ScoreboardTeam;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -65,7 +70,7 @@ public void sendCreateToPlayer(Player player) {
public void sendUserCreateToReceivers(@NotNull Player player) {
// send 3: add entities to team
PacketPlayOutScoreboardTeam packetPlayOutScoreboardTeam = PacketPlayOutScoreboardTeam.a(
this, player.getName(), (PacketPlayOutScoreboardTeam.a) cachedScoreboardActionA);
this, player.getName(), cachedScoreboardActionA);
handle.getSidebar().getReceivers().forEach(
r -> sendPacket(r, packetPlayOutScoreboardTeam)
);
Expand Down Expand Up @@ -150,13 +155,25 @@ private static Object getScoreboardAction(String action) {
if (action.equals(name)) {
return obj;
}
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
//Bukkit.getConsoleSender().sendMessage(ChatColor.RED+"Could not find ENUM");
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
}
}
} catch (Exception exception) {
// exception.printStackTrace();
} catch (Exception ignored) {
}
throw new RuntimeException("Something went wrong... please report this to SidebarLib by andrei1058");
}

public @NotNull IChatBaseComponent e() {
return handle.getPrefixComp();
}

public @NotNull IChatBaseComponent f() {
return handle.getSuffixComp();
}

@Contract(value = "_ -> new", pure = true)
@Override
public @NotNull IChatMutableComponent d(IChatBaseComponent var0) {
return IChatBaseComponent.b(handle.getPrefixComp().toString() + var0.getString() + handle.getSuffixComp().toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public ScoreLine createScoreLine(WrappedSidebar sidebar, SidebarLine line, int s
public void sendScore(@NotNull WrappedSidebar sidebar, String playerName, int score) {
if (sidebar.getHealthObjective() == null) return;
PacketPlayOutScoreboardScore packetPlayOutScoreboardScore = new PacketPlayOutScoreboardScore(
sidebar.getHealthObjective().getName(),
playerName,
sidebar.getHealthObjective().getName(),
score,
Optional.empty(),
Optional.empty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public SidebarObjective createObjective(String name, IScoreboardCriteria iScoreb
protected class SidebarObjectiveImpl extends ScoreboardObjective implements SidebarObjective {

private SidebarLine displayName;
private IChatMutableComponent displayNameComp = IChatBaseComponent.b(" ");
private IChatMutableComponent displayNameComp = IChatBaseComponent.b("");
private final DisplaySlot type;

public SidebarObjectiveImpl(String name, IScoreboardCriteria criteria, SidebarLine displayName, int type) {
Expand Down Expand Up @@ -71,7 +71,7 @@ public void sendRemove(Player player) {

@Override
public String getName() {
return this.b();
return super.b();
}

@Override
Expand Down Expand Up @@ -227,6 +227,7 @@ public void sendCreate(Player player) {
@Override
public void sendRemove(Player player) {
PlayerConnection conn = ((CraftPlayer) player).getHandle().c;
// var1=1 means remove
PacketPlayOutScoreboardTeam packetPlayOutScoreboardTeam = PacketPlayOutScoreboardTeam.a(team);
var resetScore = new ClientboundResetScorePacket(team.b(), getSidebarObjective().getName());
conn.b(resetScore);
Expand All @@ -241,6 +242,7 @@ public void sendRemoveToAllReceivers() {
}

public void sendUpdate(Player player) {
// false=2 is for update packet, true=0 for create
PacketPlayOutScoreboardTeam packetTeamUpdate = PacketPlayOutScoreboardTeam.a(team, false);
((CraftPlayer) player).getHandle().c.b(packetTeamUpdate);
}
Expand Down Expand Up @@ -280,6 +282,7 @@ public void setSuffix(@NotNull String secondPart) {
}

public void sendUpdateToAllReceivers() {
// false=2 is for update packet, true=0 for create
PacketPlayOutScoreboardTeam packetTeamUpdate = PacketPlayOutScoreboardTeam.a(team, false);
getReceivers().forEach(r -> ((CraftPlayer) r).getHandle().c.b(packetTeamUpdate));
}
Expand Down
61 changes: 61 additions & 0 deletions sidebar-v1_21_R2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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">
<parent>
<artifactId>sidebar-pom</artifactId>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<version>25.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>sidebar-v1_21_R2</artifactId>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>20</source>
<target>20</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>nms</id>
<url>https://repo.codemc.io/repository/nms/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-base</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.21.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-cmn1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Loading