Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
12e5227
Velocity somewhat working (ALPHA) release
proferabg Jan 3, 2023
22fc3a9
Remove Un-ported Example
proferabg Jan 3, 2023
7aa6e6b
Remove Waterfall-Compat dependency
proferabg Jan 3, 2023
501394d
Move ChatUtil and add in unicode.txt
proferabg Jan 3, 2023
8b6be73
Fix some formatting and refactoring
proferabg Jan 4, 2023
404e0f9
Fix Redis Server ID
proferabg Jan 4, 2023
62590b4
Fix Packet Listener and target java 11 like Velocity
proferabg Jan 5, 2023
0f1839c
Remove SortingRuleAliasProcessor + Add Team Packet Registration
proferabg Jan 5, 2023
3bbc797
Remove deprecated API functions
proferabg Jan 5, 2023
f52e89b
Fix Compile Errors
proferabg Jan 7, 2023
5258dad
Merge remote-tracking branch 'origin-original/dev' into dev
proferabg Sep 24, 2023
1833ee5
Update Velocity to 1.20.1
proferabg Oct 1, 2023
d117a13
Update minecraft-data-api version
proferabg Oct 1, 2023
f1ba70d
Update Submodules
proferabg Oct 1, 2023
74f91a0
Merge remote-tracking branch 'upstream/master' into dev
proferabg Feb 7, 2025
326b399
Updated but not tested
proferabg Feb 7, 2025
d1b686d
Working? Seriously?
proferabg Feb 9, 2025
5d8e941
Fix github workflow
proferabg Feb 9, 2025
10d61aa
Make all projects build with JDK 8, make Bungee build with JDK 16, an…
proferabg Feb 9, 2025
52618b0
Make Velocity build without jar library
proferabg Feb 9, 2025
f8e469b
Update submodule
proferabg Feb 9, 2025
766a309
Update Submodules
proferabg Feb 15, 2025
17d6326
Remove check for plugin.
proferabg Feb 16, 2025
0486694
Copyrights, Velocity Metrics, and Team Packet Mode Enum
proferabg Feb 16, 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
11 changes: 9 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
with:
submodules: recursive

- name: Set up JDK 16
- name: Set up JDK 17
uses: actions/setup-java@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While probably not necessary, it could be good to update this to v4, because... why should it stay on v2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed if we want to use v4. Left it at v2 to minimize changes

with:
distribution: 'temurin'
java-version: '16'
java-version: '17'
cache: 'gradle'

- name: Build with Gradle
Expand All @@ -30,6 +30,13 @@ jobs:
name: BungeeTabListPlus Bungee
path: bootstrap-bungee/build/libs/BungeeTabListPlus-*-SNAPSHOT.jar

- name: Archive artifacts (Velocity)
uses: actions/upload-artifact@v4
if: success()
with:
name: BungeeTabListPlus Velocity
path: bootstrap-velocity/build/libs/BungeeTabListPlus-*-SNAPSHOT.jar

- name: Archive artifacts (Bukkit)
uses: actions/upload-artifact@v4
if: success()
Expand Down
2 changes: 1 addition & 1 deletion TabOverlayCommon
25 changes: 25 additions & 0 deletions api-velocity/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

dependencies {
compileOnly "com.velocitypowered:velocity-api:${rootProject.ext.velocityVersion}"
annotationProcessor "com.velocitypowered:velocity-api:${rootProject.ext.velocityVersion}"
api "de.codecrafter47.taboverlay:taboverlaycommon-api:1.0-SNAPSHOT"
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* Copyright (C) 2025 proferabg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package codecrafter47.bungeetablistplus.api.velocity;

import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player;
import de.codecrafter47.taboverlay.TabView;

import javax.annotation.Nonnull;
import java.awt.image.BufferedImage;
import java.util.concurrent.CompletableFuture;

public abstract class BungeeTabListPlusAPI {
private static BungeeTabListPlusAPI instance = null;

/**
* Registers a custom variable
* <p>
* You cannot use this to replace existing variables. If registering a variable which already
* exists there may be an exception thrown but there is no guarantee that an exception
* is thrown in that case.
*
* @param plugin your plugin
* @param variable your variable
*/
public static void registerVariable(Object plugin, Variable variable) {
Preconditions.checkState(instance != null, "instance is null, is the plugin enabled?");
instance.registerVariable0(plugin, variable);
}

protected abstract void registerVariable0(Object plugin, Variable variable);

/**
* Registers a custom variable bound to a specific server
* <p>
* You cannot use this to replace existing variables. If registering a variable which already
* exists there may be an exception thrown but there is no guarantee that an exception
* is thrown in that case.
*
* @param plugin your plugin
* @param variable your variable
*/
public static void registerVariable(Object plugin, ServerVariable variable) {
Preconditions.checkState(instance != null, "instance is null, is the plugin enabled?");
instance.registerVariable0(plugin, variable);
}

protected abstract void registerVariable0(Object plugin, ServerVariable variable);

/**
* Get the face part of the players skin as an icon for use in the tab list.
*
* @param player the player
* @return the icon
*/
@Nonnull
public static de.codecrafter47.taboverlay.Icon getPlayerIcon(Player player) {
Preconditions.checkState(instance != null, "BungeeTabListPlus not initialized");
return instance.getPlayerIcon0(player);
}

@Nonnull
protected abstract de.codecrafter47.taboverlay.Icon getPlayerIcon0(Player player);


/**
* Creates an icon from an 8x8 px image. The creation of the icon can take several
* minutes. When the icon has been created the callback is invoked.
*
* @param image the image
* @return a completable future providing the icon is ready
*/
public static CompletableFuture<de.codecrafter47.taboverlay.Icon> getIconFromImage(BufferedImage image) {
Preconditions.checkState(instance != null, "BungeeTabListPlus not initialized");
return instance.getIconFromImage0(image);
}

protected abstract CompletableFuture<de.codecrafter47.taboverlay.Icon> getIconFromImage0(BufferedImage image);

/**
* Get the tab view of a player. The tab view object allows registering and unregistering custom tab overlay
* handlers.
*
* @param player the player
* @return tab view of that player
* @throws IllegalStateException is the player is not found
* @see TabView
* @see de.codecrafter47.taboverlay.TabOverlayProviderSet
* @see de.codecrafter47.taboverlay.TabOverlayProvider
* @see de.codecrafter47.taboverlay.AbstractPlayerTabOverlayProvider
*/
public static TabView getTabViewForPlayer(Player player) {
Preconditions.checkState(instance != null, "BungeeTabListPlus not initialized");
return instance.getTabViewForPlayer0(player);
}

protected abstract TabView getTabViewForPlayer0(Player player);

/**
* Get the FakePlayerManager instance
*
* @return the FakePlayerManager instance
*/
public static FakePlayerManager getFakePlayerManager() {
Preconditions.checkState(instance != null, "BungeeTabListPlus not initialized");
return instance.getFakePlayerManager0();
}

protected abstract FakePlayerManager getFakePlayerManager0();

/**
* Check if a player is hidden from the tab list.
* <p>
* A player is regarded as hidden if one of the following conditions is true:
* - The player is hidden using a vanish plugin(e.g. SuperVanish, Essentials, ...)
* - The player has been hidden using the /btlp hide command
* - The player is in the list of hidden players in the configuration
* - The player is on one of the hidden servers(configuration)
*
* @param player the player
* @return true if hidden, false otherwise
*/
public static boolean isHidden(Player player) {
Preconditions.checkState(instance != null, "BungeeTabListPlus not initialized");
return instance.isHidden0(player);
}

protected abstract boolean isHidden0(Player player);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (C) 2025 proferabg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package codecrafter47.bungeetablistplus.api.velocity;

import codecrafter47.bungeetablistplus.api.velocity.tablist.FakePlayer;
import com.velocitypowered.api.proxy.server.ServerInfo;

import java.util.Collection;

/**
* Controls fake players
*/
public interface FakePlayerManager {

/**
* Get all fake players which are currently displayed on the tab list
*
* @return collection of all fake players
*/
Collection<FakePlayer> getOnlineFakePlayers();

/**
* @return whether the plugin will randomly add fake players it finds in the config, and randomly removes fake players
*/
boolean isRandomJoinLeaveEnabled();

/**
* set whether the plugin should randomly add fake players it finds in the config, and randomly removes fake players
*
* @param value whether random join/leave events for fake players should be enabled
*/
void setRandomJoinLeaveEnabled(boolean value);

/**
* Creates a fake player which is immediately visible on the tab list
*
* @param name name of the fake player
* @param server server of the fake player
* @return the fake player
*/
FakePlayer createFakePlayer(String name, ServerInfo server);

/**
* remove a fake player
*
* @param fakePlayer the fake player to be removed
*/
void removeFakePlayer(FakePlayer fakePlayer);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2025 proferabg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package codecrafter47.bungeetablistplus.api.velocity;

import lombok.Data;
import lombok.NonNull;

import java.io.Serializable;
import java.util.UUID;

/**
* An icon shown in the tab list.
*/
@Data
public class Icon implements Serializable {

private static final long serialVersionUID = 1L;

private final UUID player;
@NonNull
private final String[][] properties;

/**
* The default icon. The client will show a random Alex/ Steve face when using this.
*/
public static final Icon DEFAULT = new Icon(null, new String[0][]);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2025 proferabg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package codecrafter47.bungeetablistplus.api.velocity;

/**
* Base class for creating custom Variables bound to a server.
* <p>
* To create a custom (per server) Variable you need to create a subclass of this class
* and register an instance of it with {@link BungeeTabListPlusAPI#registerVariable}
* <p>
* After registration the variable can be used in the config file in several ways:
* Use {@code ${viewer server <name>}} to resolve the variable for the server of the
* player looking at the tab list.
* Use {@code ${player server <name>}} to resolve the variable for the server of a
* player displayed on the tab list, this one can only be used inside the playerComponent.
* Use {@code ${server <name>}} to resolve the variable for a particular server inside the
* serverHeader option of the players by server component.
* Use {@code ${server:<serverName> <name>}} to resolve the variable for a specific server.
*/
public abstract class ServerVariable {
private final String name;

/**
* invoked by the subclass to set the name of the variable
*
* @param name name of the variable without { }
*/
public ServerVariable(String name) {
this.name = name;
}

/**
* This method is periodically invoked by BungeeTabListPlus to check whether the replacement for the variable changed.
* <p>
* The implementation is expected to be thread safe.
*
* @param serverName name of the server for which the variable should be replaced
* @return the replacement for the variable
*/
public abstract String getReplacement(String serverName);

/**
* Getter for the variable name.
*
* @return the name of the variable
*/
public final String getName() {
return name;
}
}
Loading