Overview: 9 | * 10 | *
This feature will show a LabyMod banner in the bottom right corner. It was made for LabyMod
11 | * tournaments. A special feature of this watermark is that the server can force an emote to the
12 | * player without changing the unique identifier.
13 | */
14 | public interface WatermarkTransmitter {
15 |
16 | /**
17 | * Transmits the watermark packet to the client.
18 | *
19 | * @param uniqueId The unique identifier of the receiver.
20 | * @param showWatermark {@code true} if the watermark should be displayed, otherwise {@code
21 | * false}.
22 | */
23 | void transmit(UUID uniqueId, boolean showWatermark);
24 |
25 | /**
26 | * Transmits the watermark packet to all online laby users.
27 | *
28 | * @param showWatermark {@code true} if the watermark should be displayed, otherwise {@code
29 | * false}.
30 | */
31 | void broadcastTransmit(boolean showWatermark);
32 | }
33 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/emote/Emote.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.emote;
2 |
3 | import com.google.gson.JsonObject;
4 |
5 | import java.util.UUID;
6 |
7 | /** Represents an emote. */
8 | public interface Emote {
9 |
10 | /**
11 | * Retrieves the unique identifier of a NPC where the emote is to be played.
12 | *
13 | * @return The unique identifier of a NPC.
14 | */
15 | UUID getNPCUniqueId();
16 |
17 | /**
18 | * Retrieves the identifier of an emote to be played.
19 | *
20 | * @return The identifier of an emote.
21 | */
22 | int getEmoteId();
23 |
24 | /**
25 | * Retrieves the emote as a {@link JsonObject}.
26 | *
27 | * @return The emote as a json object.
28 | */
29 | JsonObject asJsonObject();
30 |
31 | /** A factory for creating {@link Emote}. */
32 | interface Factory {
33 |
34 | /**
35 | * Creates a new {@link Emote} with the {@code npcUniqueId} and the {@code emoteId}.
36 | *
37 | * @param npcUniqueId The unique identifier of a NPC.
38 | * @param emoteId The identifier of an emote.
39 | * @return A created emote.
40 | */
41 | Emote create(UUID npcUniqueId, int emoteId);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/sticker/Sticker.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.sticker;
2 |
3 | import com.google.gson.JsonObject;
4 |
5 | import java.util.UUID;
6 |
7 | /** Represents a sticker. */
8 | public interface Sticker {
9 |
10 | /**
11 | * Retrieves the unique identifier of a NPC where the sticker is to be played.
12 | *
13 | * @return The unique identifier of a NPC.
14 | */
15 | UUID getNPCUniqueId();
16 |
17 | /**
18 | * Retrieves the identifier of a sticker to be played.
19 | *
20 | * @return The identifier of a sticker.
21 | */
22 | short getStickerId();
23 |
24 | /**
25 | * Retrieves the sticker as a {@link JsonObject}.
26 | *
27 | * @return The sticker as a json object.
28 | */
29 | JsonObject asJsonObject();
30 |
31 | /** A factory for creating {@link Sticker}'s. */
32 | interface Factory {
33 |
34 | /**
35 | * Creates a new {@link Sticker} with the {@code npcUniqueId} and the {@code stickerId}.
36 | *
37 | * @param npcUniqueId The unique identifier of a NPC.
38 | * @param stickerId The identifier of a sticker.
39 | * @return A created sticker.
40 | */
41 | Sticker create(UUID npcUniqueId, short stickerId);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/server/bukkit/src/main/java/net/labymod/serverapi/bukkit/player/BukkitLabyModPlayer.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bukkit.player;
2 |
3 | import net.labymod.serverapi.api.extension.AddonExtension;
4 | import net.labymod.serverapi.api.extension.ModificationExtension;
5 | import net.labymod.serverapi.api.extension.PackageExtension;
6 | import net.labymod.serverapi.api.protocol.ChunkCachingProtocol;
7 | import net.labymod.serverapi.api.protocol.ShadowProtocol;
8 | import net.labymod.serverapi.common.player.DefaultLabyModPlayer;
9 | import org.bukkit.entity.Player;
10 |
11 | import java.util.List;
12 |
13 | public class BukkitLabyModPlayer extends DefaultLabyModPlayer Overview:
9 | *
10 | * It is possible to use Cine Scopes (Black bars) for game mode cinematics.
11 | *
12 | * @deprecated Use {@link CineScopesTransmitter}.
13 | */
14 | @Deprecated
15 | public interface CineScopes {
16 |
17 | /**
18 | * Sends the cine scope packet to the client.
19 | *
20 | * @param uniqueId The unique identifier of the receiver.
21 | * @param showCineScopes {@code true} if the black bar should be fade in, for fade out{@code
22 | * false}.
23 | * @param coveragePercent The height of the black bars in percent. The minimum of the black bars
24 | * is 1% and the maximum is 50%.
25 | * @param duration The duration
26 | * @deprecated Use {@link CineScopesTransmitter#transmit(UUID, boolean, int, long)}
27 | */
28 | @Deprecated
29 | void sendCineScope(UUID uniqueId, boolean showCineScopes, int coveragePercent, long duration);
30 |
31 | /** {@link CineScopesTransmitter#broadcastTransmit(boolean, int, long)} */
32 | @Deprecated
33 | void broadcastSendCineScope(boolean showCineScopes, int coveragePercent, long duration);
34 | }
35 |
--------------------------------------------------------------------------------
/proxy/bungeecord/src/main/java/net/labymod/serverapi/bungee/event/BungeeReceivePayloadEvent.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bungee.event;
2 |
3 | import net.md_5.bungee.api.plugin.Event;
4 |
5 | import java.util.UUID;
6 |
7 | /** Fired when a custom payload message is received from the client. */
8 | public class BungeeReceivePayloadEvent extends Event {
9 |
10 | private final UUID uniqueId;
11 | private final String identifier;
12 | private final byte[] payload;
13 |
14 | public BungeeReceivePayloadEvent(UUID uniqueId, String identifier, byte[] payload) {
15 | this.uniqueId = uniqueId;
16 | this.identifier = identifier;
17 | this.payload = payload;
18 | }
19 |
20 | /**
21 | * Retrieves the unique identiifer of the client player.
22 | *
23 | * @return The unique identifier of the client player.
24 | */
25 | public UUID getUniqueId() {
26 | return uniqueId;
27 | }
28 |
29 | /**
30 | * Retrieves the channel identifier to which the payload was sent.
31 | *
32 | * @return The channel identifier to which the payload was sent.
33 | */
34 | public String getIdentifier() {
35 | return identifier;
36 | }
37 |
38 | /**
39 | * Retrieves the sent payload.
40 | *
41 | * @return The sent payload.
42 | */
43 | public byte[] getPayload() {
44 | return payload;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/proxy/velocity/src/main/java/net/labymod/serverapi/velocity/event/VelocityMessageReceiveEvent.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.velocity.event;
2 |
3 | import com.google.gson.JsonElement;
4 | import com.velocitypowered.api.proxy.Player;
5 |
6 | /** Is fired when a payload message is received. */
7 | public class VelocityMessageReceiveEvent {
8 |
9 | private final Player player;
10 | private final String messageKey;
11 | private final JsonElement messageContent;
12 |
13 | public VelocityMessageReceiveEvent(Player player, String messageKey, JsonElement messageContent) {
14 | this.player = player;
15 | this.messageKey = messageKey;
16 | this.messageContent = messageContent;
17 | }
18 |
19 | /**
20 | * Retrieves the player that received the payload message.
21 | *
22 | * @return The player that received the payload message.
23 | */
24 | public Player getPlayer() {
25 | return player;
26 | }
27 |
28 | /**
29 | * Retrieves the key assigned to the message content.
30 | *
31 | * @return The key assigned to the message content.
32 | */
33 | public String getMessageKey() {
34 | return messageKey;
35 | }
36 |
37 | /**
38 | * Retrieves the message content as a JSON tree.
39 | *
40 | * @return The message content as a JSON tree.
41 | */
42 | public JsonElement getMessageContent() {
43 | return messageContent;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/server/bukkit/src/main/java/net/labymod/serverapi/bukkit/event/BukkitMessageReceiveEvent.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bukkit.event;
2 |
3 | import com.google.gson.JsonElement;
4 | import org.bukkit.entity.Player;
5 |
6 | /** Is fired when a custom payload message is received from the client. */
7 | public class BukkitMessageReceiveEvent extends BukkitLabyModEvent {
8 |
9 | private final Player player;
10 | private final String messageKey;
11 | private final JsonElement messageContent;
12 |
13 | public BukkitMessageReceiveEvent(Player player, String messageKey, JsonElement messageContent) {
14 | this.player = player;
15 | this.messageKey = messageKey;
16 | this.messageContent = messageContent;
17 | }
18 |
19 | /**
20 | * Retrieves the player that received the payload message.
21 | *
22 | * @return The player that received the payload message.
23 | */
24 | public Player getPlayer() {
25 | return player;
26 | }
27 |
28 | /**
29 | * Retrieves the key assigned to the message content.
30 | *
31 | * @return The key assigned to the message content.
32 | */
33 | public String getMessageKey() {
34 | return messageKey;
35 | }
36 |
37 | /**
38 | * Retrieves the message content as a JSON tree.
39 | *
40 | * @return The message content as a JSON tree.
41 | */
42 | public JsonElement getMessageContent() {
43 | return messageContent;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/server/bukkit/src/main/java/net/labymod/serverapi/bukkit/BukkitLabyModPlugin.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bukkit;
2 |
3 | import net.labymod.serverapi.api.LabyAPI;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadChannelRegistrar;
6 | import net.labymod.serverapi.bukkit.payload.channel.BukkitLegacyLabyModPayloadChannel;
7 | import org.bukkit.event.Listener;
8 | import org.bukkit.plugin.java.JavaPlugin;
9 |
10 | public class BukkitLabyModPlugin extends JavaPlugin {
11 |
12 | private LabyService service;
13 |
14 | @Override
15 | public void onEnable() {
16 | this.service = new BukkitLabyService(this, getDescription().getVersion());
17 | LabyAPI.initialize(this.service);
18 |
19 | PayloadChannelRegistrar Overview:
9 | *
10 | * This feature will show a LabyMod banner in the bottom right corner. It was made for LabyMod
11 | * tournaments. A special feature of this watermark is that the server can force an emote to the
12 | * player without changing the unique identifier.
13 | *
14 | * @deprecated Use {@link WatermarkTransmitter}.
15 | */
16 | @Deprecated
17 | public interface Watermark {
18 |
19 | /**
20 | * Sends the watermark packet to the client.
21 | *
22 | * @param uniqueId The unique identifier of the receiver.
23 | * @param showWatermark {@code true} if the watermark should be displayed, otherwise {@code
24 | * false}.
25 | * @deprecated Use {@link WatermarkTransmitter#transmit(UUID, boolean)}
26 | */
27 | @Deprecated
28 | void displayWatermark(UUID uniqueId, boolean showWatermark);
29 |
30 | /**
31 | * Sends the watermark packet to all online laby users.
32 | *
33 | * @param showWatermark {@code true} if the watermark should be displayed, otherwise {@code
34 | * false}.
35 | * @deprecated Use {@link WatermarkTransmitter#broadcastTransmit(boolean)}
36 | */
37 | @Deprecated
38 | void broadcastDisplayWatermark(boolean showWatermark);
39 | }
40 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/CineScopesTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents the cine scope packet.
7 | *
8 | * Overview:
9 | *
10 | * It is possible to use Cine Scopes (Black bars) for game mode cinematics.
11 | */
12 | public interface CineScopesTransmitter {
13 |
14 | /**
15 | * Transmits the cine scope packet to the client.
16 | *
17 | * @param uniqueId The unique identifier of the receiver.
18 | * @param showCineScopes {@code true} if the black bar should be fade in, for fade out{@code
19 | * false}.
20 | * @param coveragePercent The height of the black bars in percent. The minimum of the black bars
21 | * is 0% and the maximum is 50%.
22 | * @param duration The duration
23 | */
24 | void transmit(UUID uniqueId, boolean showCineScopes, int coveragePercent, long duration);
25 |
26 | /**
27 | * Transmits the cine scope packet to all online laby users.
28 | *
29 | * @param showCineScopes {@code true} if the black bar should be fade in, for fade out {@code
30 | * false}.
31 | * @param coveragePercent The height of the black bars in percent. The minimum of the black bars
32 | * is 1% and the maximum is 50%.
33 | * @param duration The duration.
34 | */
35 | void broadcastTransmit(boolean showCineScopes, int coveragePercent, long duration);
36 | }
37 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/actionmenu/MenuTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction.actionmenu;
2 |
3 | import java.util.UUID;
4 | /**
5 | * Represents the action menu of a player.
6 | *
7 | * Overview:
8 | *
9 | * In version 3.3.1, we introduced a middle click for players. It features custom actions
10 | * are executed for the player that has been clicked on. A server can add custom buttons to that
11 | * list of actions.
12 | */
13 | public interface MenuTransmitter {
14 |
15 | /**
16 | * Adds a menu entry to a list, which should then be displayed in the menu.
17 | *
18 | * @param entry The menu entry which should be displayed.
19 | * @return This object for a fluent chaining.
20 | */
21 | MenuTransmitter addEntry(MenuEntry entry);
22 |
23 | /**
24 | * Adds to a list an array of menu entries, which should then be displayed in the menu.
25 | *
26 | * @param entries An array menu entries which should be displayed.
27 | * @return This object for a fluent chaining.
28 | */
29 | MenuTransmitter addEntries(MenuEntry... entries);
30 |
31 | /**
32 | * Transmits an action menu to the client.
33 | *
34 | * @param uniqueId The unique identifier of the receiver.
35 | */
36 | void transmit(UUID uniqueId);
37 |
38 | /**
39 | * Transmits an action menu to all online laby users.
40 | */
41 | void broadcastTransmit();
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/addon/DefaultRecommendedAddon.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.addon;
2 |
3 | import com.google.gson.JsonObject;
4 | import java.util.UUID;
5 | import net.labymod.serverapi.api.serverinteraction.addon.RecommendedAddon;
6 |
7 | public class DefaultRecommendedAddon implements RecommendedAddon {
8 |
9 | private final UUID publishedUniqueId;
10 | private final JsonObject recommendAddonObject;
11 | private boolean required;
12 |
13 | public DefaultRecommendedAddon(UUID publishedUniqueId, boolean required) {
14 | this.publishedUniqueId = publishedUniqueId;
15 | this.recommendAddonObject = new JsonObject();
16 | this.required = required;
17 | this.recommendAddonObject.addProperty("uuid", publishedUniqueId.toString());
18 | }
19 |
20 | /** {@inheritDoc} */
21 | @Override
22 | public UUID getPublishedUniqueId() {
23 | return this.publishedUniqueId;
24 | }
25 |
26 | /** {@inheritDoc} */
27 | @Override
28 | public boolean isRequired() {
29 | return this.required;
30 | }
31 |
32 | /** {@inheritDoc} */
33 | @Override
34 | public void setRequired(boolean required) {
35 | this.required = required;
36 | this.recommendAddonObject.addProperty("required", required);
37 | }
38 |
39 | /** {@inheritDoc} */
40 | @Override
41 | public JsonObject asJsonObject() {
42 | return this.recommendAddonObject;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/subtile/SubTitleTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction.subtile;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents a subtitle transmitter that sends a payload message in channel account_subtitle
7 | * to the LabyMod client.
8 | *
9 | * Overview:
10 | *
11 | * The LabyMod client can display a subtitle tag (similar through using the scoreboard) under a
12 | * players name.
13 | */
14 | public interface SubTitleTransmitter {
15 |
16 | /**
17 | * Adds a subtitle to a list which will be displayed when sending.
18 | *
19 | * @param subTitle The subtitle which should be displayed above the player.
20 | * @return This object for a fluent chaining.
21 | */
22 | SubTitleTransmitter addSubtitle(SubTitle subTitle);
23 |
24 | /**
25 | * Adds to a list an array of subtitles which will be displayed when sending.
26 | *
27 | * @param subTitles An array subtitles which should be displayed above the player's.
28 | * @return This object for a fluent chaining.
29 | */
30 | SubTitleTransmitter addSubtitles(SubTitle... subTitles);
31 |
32 | /**
33 | * Transmits a list of all subtitles to the client.
34 | *
35 | * @param uniqueId The unique identifier of the receiver.
36 | */
37 | void transmit(UUID uniqueId);
38 |
39 | /** Transmits a list of all subtitles to all online laby users. */
40 | void broadcastTransmit();
41 | }
42 |
--------------------------------------------------------------------------------
/proxy/bungeecord/src/main/java/net/labymod/serverapi/bungee/event/BungeeMessageReceiveEvent.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bungee.event;
2 |
3 | import com.google.gson.JsonElement;
4 | import net.md_5.bungee.api.connection.ProxiedPlayer;
5 | import net.md_5.bungee.api.plugin.Event;
6 |
7 | /** Is fired when a payload message is received. */
8 | public class BungeeMessageReceiveEvent extends Event {
9 |
10 | private final ProxiedPlayer player;
11 | private final String messageKey;
12 | private final JsonElement messageContent;
13 |
14 | public BungeeMessageReceiveEvent(
15 | ProxiedPlayer player, String messageKey, JsonElement messageContent) {
16 | this.player = player;
17 | this.messageKey = messageKey;
18 | this.messageContent = messageContent;
19 | }
20 |
21 | /**
22 | * Retrieves the player that received the payload message.
23 | *
24 | * @return The player that received the payload message.
25 | */
26 | public ProxiedPlayer getPlayer() {
27 | return player;
28 | }
29 |
30 | /**
31 | * Retrieves the key assigned to the message content.
32 | *
33 | * @return THe key assigned to the message content.
34 | */
35 | public String getMessageKey() {
36 | return messageKey;
37 | }
38 |
39 | /**
40 | * Retrieves the message content as a JSON tree.
41 | *
42 | * @return The message content as a JSON tree.
43 | */
44 | public JsonElement getMessageContent() {
45 | return messageContent;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/TabListCacheTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents the tab list cache packet.
7 | *
8 | * Overview:
9 | *
10 | * LabyMod has a cache for the player tab-list. If you want to spawn a NPC, you have to add it to
11 | * the tab-list to make it visible and remove it again to keep the tab-list clean. With LabyMod you
12 | * can add the NPC to the tab-list and remove it in the same tick again. The client will remember
13 | * the information and use it when you spawn the actual Player entity.
14 | */
15 | public interface TabListCacheTransmitter {
16 |
17 | /**
18 | * Whether the tab list cache should be enabled or not.
19 | *
20 | * @return {@code true} if the tab list cache is enabled, otherwise {@code false}.
21 | */
22 | boolean isEnabled();
23 |
24 | /**
25 | * Changes whether the tab list cache should be enabled or not.
26 | *
27 | * @param enabled {@code true} if the tab list cache should be enabled, otherwise {@code false}.
28 | */
29 | void setEnabled(boolean enabled);
30 |
31 | /**
32 | * Transmits the tab list cache packet to the laby client.
33 | *
34 | * @param uniqueId The unique identifier of the laby client user.
35 | */
36 | void transmit(UUID uniqueId);
37 |
38 | /** Transmits the tab list cache packet to all online laby users. */
39 | void transmitBroadcast();
40 | }
41 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/actionmenu/DefaultMenuEntry.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.actionmenu;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.serverinteraction.actionmenu.ActionType;
5 | import net.labymod.serverapi.api.serverinteraction.actionmenu.MenuEntry;
6 |
7 | public class DefaultMenuEntry implements MenuEntry {
8 |
9 | private final String displayName;
10 | private final String value;
11 | private final ActionType actionType;
12 | private final JsonObject entryObject;
13 |
14 | public DefaultMenuEntry(String displayName, String value, ActionType actionType) {
15 | this.displayName = displayName;
16 | this.value = value;
17 | this.actionType = actionType;
18 | this.entryObject = new JsonObject();
19 |
20 | this.entryObject.addProperty("displayName", displayName);
21 | this.entryObject.addProperty("value", value);
22 | this.entryObject.addProperty("type", actionType.name());
23 | }
24 |
25 | /** {@inheritDoc} */
26 | @Override
27 | public String getDisplayName() {
28 | return this.displayName;
29 | }
30 |
31 | /** {@inheritDoc} */
32 | @Override
33 | public String getValue() {
34 | return this.value;
35 | }
36 |
37 | /** {@inheritDoc} */
38 | @Override
39 | public ActionType getActionType() {
40 | return this.actionType;
41 | }
42 |
43 | /** {@inheritDoc} */
44 | @Override
45 | public JsonObject asJsonObject() {
46 | return this.entryObject;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/addon/AddonRecommendationTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction.addon;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents the addon recommendation packet.
7 | *
8 | * Overview:
9 | *
10 | * With this packet the server can recommend published addons to the user and the user can
11 | * install them very simple in a GUI. Multiple add-ons can be suggested at the same time or can also
12 | * be flagged as being required. You have to react to the response of the client if an addon is
13 | * required.
14 | */
15 | public interface AddonRecommendationTransmitter {
16 |
17 | /**
18 | * Adds a recommending addon to a list which will be sent to the client.
19 | *
20 | * @param recommendedAddon The recommended addon to be added.
21 | * @return This object for a fluent chaining.
22 | */
23 | AddonRecommendationTransmitter addRecommendAddon(RecommendedAddon recommendedAddon);
24 |
25 | /**
26 | * Adds to a list an array of recommending addons which will be sent to the client.
27 | *
28 | * @param recommendedAddons An array of recommended addons to be added.
29 | * @return This object for a fluent chaining.
30 | */
31 | AddonRecommendationTransmitter addRecommendAddons(RecommendedAddon... recommendedAddons);
32 |
33 | /**
34 | * Transmits the addon recommendation packet to the client.
35 | *
36 | * @param uniqueId The unique identifier of the receiver.
37 | */
38 | void transmit(UUID uniqueId);
39 | }
40 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/DefaultWatermark.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
6 | import net.labymod.serverapi.api.player.LabyModPlayer;
7 | import net.labymod.serverapi.api.player.LabyModPlayerService;
8 | import net.labymod.serverapi.api.serverinteraction.Watermark;
9 |
10 | import java.util.UUID;
11 |
12 | public class DefaultWatermark implements Watermark {
13 |
14 | private static final String WATERMARK_CHANNEL = "watermark";
15 | private final LabyModPlayerService> playerService;
16 | private final PayloadCommunicator payloadCommunicator;
17 |
18 | public DefaultWatermark(LabyService service) {
19 | this.payloadCommunicator = service.getPayloadCommunicator();
20 | this.playerService = service.getLabyPlayerService();
21 | }
22 |
23 | /** {@inheritDoc} */
24 | @Override
25 | public void displayWatermark(UUID uniqueId, boolean showWatermark) {
26 | JsonObject watermarkObject = new JsonObject();
27 | watermarkObject.addProperty("visible", showWatermark);
28 |
29 | this.payloadCommunicator.sendLabyModMessage(uniqueId, WATERMARK_CHANNEL, watermarkObject);
30 | }
31 |
32 | /** {@inheritDoc} */
33 | @Override
34 | public void broadcastDisplayWatermark(boolean showWatermark) {
35 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
36 | this.displayWatermark(player.getUniqueId(), showWatermark);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/economy/EconomyDisplayTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction.economy;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents the economy display packet.
7 | *
8 | * Overview:
9 | *
10 | * It is also possible to display the balance of your economy system. If the user enters a shop
11 | * or is in a trading situation, you can display the amount of the balance in the top right corner.
12 | * You can also use this feature in games if you have to collect coins.
13 | */
14 | public interface EconomyDisplayTransmitter {
15 |
16 | /**
17 | * Transmits the balance display to the LabyMod client.
18 | *
19 | * @param uniqueId The unique identifier of the receiver.
20 | * @param economyBalanceType The type of the economy balance.
21 | * @param showBalanceDisplay {@code true} shows the balance display, otherwise {@code false}.
22 | * @param balance The balance of the receiver.
23 | */
24 | void transmit(
25 | UUID uniqueId,
26 | EconomyBalanceType economyBalanceType,
27 | boolean showBalanceDisplay,
28 | int balance);
29 |
30 | /**
31 | * Transmits the balance display to all online laby users.
32 | *
33 | * @param economyBalanceType The type of the economy balance.
34 | * @param showBalanceDisplay {@code true} shows the balance display, otherwise {@code false}.
35 | * @param balance The balance of the receiver.
36 | */
37 | void broadcastTransmit(
38 | EconomyBalanceType economyBalanceType, boolean showBalanceDisplay, int balance);
39 | }
40 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/actionmenu/MenuEntry.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction.actionmenu;
2 |
3 | import com.google.gson.JsonObject;
4 |
5 | /** Represents a menu entry. */
6 | public interface MenuEntry {
7 |
8 | /**
9 | * Retrieves the display name of the menu entry.
10 | *
11 | * @return The display name of the entry.
12 | */
13 | String getDisplayName();
14 |
15 | /**
16 | * Retrieves the value of the menu entry.
17 | *
18 | * Note:
19 | *
20 | * `{name}` will be replaced with the players name.
21 | *
22 | * @return The value of the menu entry.
23 | */
24 | String getValue();
25 |
26 | /**
27 | * Retrieves the action type of the menu entry.
28 | *
29 | * @return The action type of the entry.
30 | */
31 | ActionType getActionType();
32 |
33 | /**
34 | * Retrieves the menu entry as a {@link JsonObject}.
35 | *
36 | * @return The menu entry as a json object.
37 | */
38 | JsonObject asJsonObject();
39 |
40 | /** A factory for creating {@link MenuEntry}'s. */
41 | interface Factory {
42 |
43 | /**
44 | * Creates a new {@link MenuEntry} with the given {@code displayName}, {@code value} and the
45 | * {@code actionType}.
46 | *
47 | * @param displayName The display name of the menu entry.
48 | * @param value The value for the menu entry.
49 | * @param actionType The action type for the menu entry.
50 | * @return A created menu entry.
51 | */
52 | MenuEntry create(String displayName, String value, ActionType actionType);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/DefaultWatermarkTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction;
2 |
3 | import com.google.gson.JsonObject;
4 | import java.util.UUID;
5 | import net.labymod.serverapi.api.LabyService;
6 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
7 | import net.labymod.serverapi.api.player.LabyModPlayer;
8 | import net.labymod.serverapi.api.player.LabyModPlayerService;
9 | import net.labymod.serverapi.api.serverinteraction.WatermarkTransmitter;
10 |
11 | public class DefaultWatermarkTransmitter implements WatermarkTransmitter {
12 |
13 | private static final String WATERMARK_CHANNEL = "watermark";
14 | private final LabyModPlayerService> playerService;
15 | private final PayloadCommunicator payloadCommunicator;
16 |
17 | public DefaultWatermarkTransmitter(LabyService service) {
18 | this.payloadCommunicator = service.getPayloadCommunicator();
19 | this.playerService = service.getLabyPlayerService();
20 | }
21 |
22 | /** {@inheritDoc} */
23 | @Override
24 | public void transmit(UUID uniqueId, boolean showWatermark) {
25 | JsonObject watermarkObject = new JsonObject();
26 | watermarkObject.addProperty("visible", showWatermark);
27 |
28 | this.payloadCommunicator.sendLabyModMessage(uniqueId, WATERMARK_CHANNEL, watermarkObject);
29 | }
30 |
31 | /** {@inheritDoc} */
32 | @Override
33 | public void broadcastTransmit(boolean showWatermark) {
34 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
35 | this.transmit(player.getUniqueId(), showWatermark);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/proxy/bungeecord/src/main/java/net/labymod/serverapi/bungee/BungeeLabyModPlugin.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bungee;
2 |
3 | import net.labymod.serverapi.api.LabyAPI;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadChannelRegistrar;
6 | import net.labymod.serverapi.bungee.payload.channel.BungeeLegacyLabyModPayloadChannel;
7 | import net.md_5.bungee.api.plugin.Listener;
8 | import net.md_5.bungee.api.plugin.Plugin;
9 | import net.md_5.bungee.api.plugin.PluginManager;
10 |
11 | public class BungeeLabyModPlugin extends Plugin {
12 |
13 | private LabyService service;
14 |
15 | @Override
16 | public void onEnable() {
17 | this.service = new BungeeLabyService(this, this.getDescription().getVersion());
18 | LabyAPI.initialize(this.service);
19 |
20 | PayloadChannelRegistrar Overview:
9 | *
10 | * In version 3.3.1, we introduced a middle click for players. It features custom actions
11 | * are executed for the player that has been clicked on. A server can add custom buttons to that
12 | * list of actions.
13 | *
14 | * @deprecated {@link MenuTransmitter}
15 | */
16 | @Deprecated
17 | public interface Menu {
18 |
19 | /**
20 | * Adds a menu entry to a list, which should then be displayed in the menu.
21 | *
22 | * @param entry The menu entry which should be displayed.
23 | * @return This object for a fluent chaining.
24 | * @deprecated {@link MenuTransmitter#addEntry(MenuEntry)}
25 | */
26 | @Deprecated
27 | Menu addEntry(MenuEntry entry);
28 |
29 | /**
30 | * Adds to a list an array of menu entries, which should then be displayed in the menu.
31 | *
32 | * @param entries An array menu entries which should be displayed.
33 | * @return This object for a fluent chaining.
34 | * @deprecated {@link MenuTransmitter#addEntries(MenuEntry...)}
35 | */
36 | @Deprecated
37 | Menu addEntries(MenuEntry... entries);
38 |
39 | /**
40 | * Transmits an action menu to the client.
41 | *
42 | * @param uniqueId The unique identifier of the receiver.
43 | * @deprecated {@link MenuTransmitter#transmit(UUID)}
44 | */
45 | @Deprecated
46 | void transmit(UUID uniqueId);
47 |
48 | /**
49 | * Transmits an action menu to all online laby users.
50 | *
51 | * @deprecated {@link MenuTransmitter#broadcastTransmit()}
52 | */
53 | @Deprecated
54 | void broadcastTransmit();
55 | }
56 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/ServerSwitcherTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents the server switch packet.
7 | *
8 | * Overview:
9 | *
10 | * With out server switch packet you can send LabyMod users between different servers. The server
11 | * can request a user to directly connect to a different IP address (or domain name). This can be
12 | * used to create multi-server-networks. As this does not need any extra proxy software and
13 | * hardware, it is generally cheaper for a network to connect players directly to the server instead
14 | * of using an intermediate software like BungeeCord.
15 | */
16 | public interface ServerSwitcherTransmitter {
17 |
18 | /**
19 | * Transmits a player to another network or server.
20 | *
21 | * @param uniqueId The unique identifier of a player which should be sent to another
22 | * network/server.
23 | * @param title The title of the warning.
24 | * @param address The address of the network / server where the player should be sent to.
25 | * @param preview {@code true} if information about the network / server should be displayed,
26 | * otherwise {@code false}.
27 | */
28 | void transmit(UUID uniqueId, String title, String address, boolean preview);
29 |
30 | /**
31 | * Transmits all online laby user to another network or server.
32 | *
33 | * @param title The title of the warning.
34 | * @param address The address of the network / server where the players should be sent to.
35 | * @param preview {@code true} if information about the network / server should be displayed,
36 | * otherwise {@code false}.
37 | */
38 | void broadcastTransmit(String title, String address, boolean preview);
39 | }
40 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/sticker/StickerTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.sticker;
2 |
3 | import net.labymod.serverapi.api.emote.EmoteTransmitter;
4 |
5 | import java.util.UUID;
6 |
7 | /**
8 | * Represents a sticker transmitter that sends a payload message in channel sticker_api to
9 | * the LabyMod client.
10 | *
11 | * Overview:
12 | *
13 | * LabyMod users can play client side a sticker for all other players on the minecraft server.
14 | * Minecraft servers can also force-play stickers for specifc player's using the plugin messages.
15 | *
16 | * Warning:
17 | *
18 | * This works only for NPC's and not for real players.
19 | *
20 | *
21 | *
22 | * The behavior is the same as in the emote api ({@link EmoteTransmitter}).
23 | *
24 | * A list of all available stickers.
25 | */
26 | public interface StickerTransmitter {
27 |
28 | /**
29 | * Adds a sticker to a list to be played when sending.
30 | *
31 | * @param sticker The sticker which should be played.
32 | * @return This object for a fluent chaining.
33 | */
34 | StickerTransmitter addSticker(Sticker sticker);
35 |
36 | /**
37 | * ADds to a list an array of stickers to be played when sending.
38 | *
39 | * @param stickers An array stickers which should be played.
40 | * @return This object for a fluent chaining.
41 | */
42 | StickerTransmitter addStickers(Sticker... stickers);
43 |
44 | /**
45 | * Transmits a list of all forced stickers to the client.
46 | *
47 | * @param receiverUniqueId The unique identifier of the receiver.
48 | */
49 | void transmit(UUID receiverUniqueId);
50 |
51 | /** Transmits a list of all forced stickers to all laby users. */
52 | void broadcastTransmit();
53 | }
54 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/DefaultServerSwitcherTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction;
2 |
3 | import com.google.gson.JsonObject;
4 | import java.util.UUID;
5 | import net.labymod.serverapi.api.LabyService;
6 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
7 | import net.labymod.serverapi.api.player.LabyModPlayer;
8 | import net.labymod.serverapi.api.player.LabyModPlayerService;
9 | import net.labymod.serverapi.api.serverinteraction.ServerSwitcherTransmitter;
10 |
11 | public class DefaultServerSwitcherTransmitter implements ServerSwitcherTransmitter {
12 |
13 | private static final String SERVER_SWITCH_CHANNEL = "server_switch";
14 | private final PayloadCommunicator payloadCommunicator;
15 | private final LabyModPlayerService> playerService;
16 |
17 | public DefaultServerSwitcherTransmitter(LabyService service) {
18 | this.payloadCommunicator = service.getPayloadCommunicator();
19 | this.playerService = service.getLabyPlayerService();
20 | }
21 |
22 | /** {@inheritDoc} */
23 | @Override
24 | public void transmit(UUID uniqueId, String title, String address, boolean preview) {
25 | JsonObject serverSwitchObject = new JsonObject();
26 |
27 | serverSwitchObject.addProperty("title", title);
28 | serverSwitchObject.addProperty("address", address);
29 | serverSwitchObject.addProperty("preview", preview);
30 |
31 | this.payloadCommunicator.sendLabyModMessage(
32 | uniqueId, SERVER_SWITCH_CHANNEL, serverSwitchObject);
33 | }
34 |
35 | /** {@inheritDoc} */
36 | @Override
37 | public void broadcastTransmit(String title, String address, boolean preview) {
38 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
39 | this.transmit(player.getUniqueId(), title, address, preview);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/permission/DefaultPermission.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.permission;
2 |
3 | import net.labymod.serverapi.api.permission.Permissible;
4 |
5 | /** A default implementation of the {@link Permissible}. */
6 | public class DefaultPermission implements Permissible {
7 |
8 | private final String internalName;
9 | private final String name;
10 | private boolean enabled;
11 |
12 | /**
13 | * Initializes a new default permission with the given parameters.
14 | *
15 | * Note: The permission is default enabled.
16 | *
17 | * @param internalName The internal name of the permission.
18 | * @param name The name of the permission.
19 | */
20 | protected DefaultPermission(String internalName, String name) {
21 | this(internalName, name, true);
22 | }
23 |
24 | /**
25 | * Initializes a new default permission with the given parameters.
26 | *
27 | * @param internalName The internal name of the permission.
28 | * @param name The name of the permission.
29 | * @param enabled {@code true} if the permission should be enabled, otherwise {@code false}.
30 | */
31 | protected DefaultPermission(String internalName, String name, boolean enabled) {
32 | this.internalName = internalName;
33 | this.name = name;
34 | this.enabled = enabled;
35 | }
36 |
37 | /** {@inheritDoc} */
38 | @Override
39 | public String getInternalName() {
40 | return this.internalName;
41 | }
42 |
43 | /** {@inheritDoc} */
44 | @Override
45 | public String getName() {
46 | return this.name;
47 | }
48 |
49 | /** {@inheritDoc} */
50 | @Override
51 | public boolean isEnabled() {
52 | return this.enabled;
53 | }
54 |
55 | /** {@inheritDoc} */
56 | @Override
57 | public void setEnabled(boolean enabled) {
58 | this.enabled = enabled;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/DefaultTabListCacheTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction;
2 |
3 | import com.google.gson.JsonObject;
4 | import java.util.UUID;
5 | import net.labymod.serverapi.api.LabyService;
6 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
7 | import net.labymod.serverapi.api.player.LabyModPlayer;
8 | import net.labymod.serverapi.api.player.LabyModPlayerService;
9 | import net.labymod.serverapi.api.serverinteraction.TabListCacheTransmitter;
10 |
11 | public class DefaultTabListCacheTransmitter implements TabListCacheTransmitter {
12 |
13 | private static final String TABLIST_CACHE_CHANNEL = "tablist_cache";
14 |
15 | private final LabyModPlayerService> playerService;
16 | private final PayloadCommunicator communicator;
17 | private boolean enabled;
18 |
19 | public DefaultTabListCacheTransmitter(LabyService service) {
20 | this.communicator = service.getPayloadCommunicator();
21 | this.playerService = service.getLabyPlayerService();
22 | this.enabled = true;
23 | }
24 |
25 | /** {@inheritDoc} */
26 | @Override
27 | public boolean isEnabled() {
28 | return this.enabled;
29 | }
30 |
31 | /** {@inheritDoc} */
32 | @Override
33 | public void setEnabled(boolean enabled) {
34 | this.enabled = enabled;
35 | }
36 |
37 | /** {@inheritDoc} */
38 | @Override
39 | public void transmit(UUID uniqueId) {
40 | JsonObject object = new JsonObject();
41 | object.addProperty("enabled", this.enabled);
42 | this.communicator.sendLabyModMessage(uniqueId, TABLIST_CACHE_CHANNEL, object);
43 | }
44 |
45 | /** {@inheritDoc} */
46 | @Override
47 | public void transmitBroadcast() {
48 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
49 | this.transmit(player.getUniqueId());
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/DefaultTabListCache.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
6 | import net.labymod.serverapi.api.player.LabyModPlayer;
7 | import net.labymod.serverapi.api.player.LabyModPlayerService;
8 | import net.labymod.serverapi.api.serverinteraction.TabListCache;
9 |
10 | import java.util.UUID;
11 |
12 | /** Default implementation of {@link TabListCache}. */
13 | public class DefaultTabListCache implements TabListCache {
14 |
15 | private static final String TABLIST_CACHE_CHANNEL = "tablist_cache";
16 |
17 | private final LabyModPlayerService> playerService;
18 | private final PayloadCommunicator communicator;
19 | private boolean enabled;
20 |
21 | public DefaultTabListCache(LabyService service) {
22 | this.communicator = service.getPayloadCommunicator();
23 | this.playerService = service.getLabyPlayerService();
24 | this.enabled = true;
25 | }
26 |
27 | /** {@inheritDoc} */
28 | @Override
29 | public boolean isEnabled() {
30 | return this.enabled;
31 | }
32 |
33 | /** {@inheritDoc} */
34 | @Override
35 | public void setEnabled(boolean enabled) {
36 | this.enabled = enabled;
37 | }
38 |
39 | /** {@inheritDoc} */
40 | @Override
41 | public void transmit(UUID uniqueId) {
42 | JsonObject object = new JsonObject();
43 | object.addProperty("enabled", this.enabled);
44 | this.communicator.sendLabyModMessage(uniqueId, TABLIST_CACHE_CHANNEL, object);
45 | }
46 |
47 | /** {@inheritDoc} */
48 | @Override
49 | public void transmitBroadcast() {
50 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
51 | this.transmit(player.getUniqueId());
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/labychat/DefaultPlayingGameModeTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.labychat;
2 |
3 | import com.google.gson.JsonObject;
4 | import java.util.UUID;
5 | import net.labymod.serverapi.api.LabyService;
6 | import net.labymod.serverapi.api.labychat.PlayingGameModeTransmitter;
7 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
8 | import net.labymod.serverapi.api.player.LabyModPlayer;
9 | import net.labymod.serverapi.api.player.LabyModPlayerService;
10 |
11 | /** Default implementation of the {@link PlayingGameModeTransmitter}. */
12 | public class DefaultPlayingGameModeTransmitter implements PlayingGameModeTransmitter {
13 |
14 | private static final String SERVER_GAMEMODE_CHANNEL = "server_gamemode";
15 | private final LabyModPlayerService> playerService;
16 | private final PayloadCommunicator payloadCommunicator;
17 |
18 | public DefaultPlayingGameModeTransmitter(LabyService service) {
19 | this.payloadCommunicator = service.getPayloadCommunicator();
20 | this.playerService = service.getLabyPlayerService();
21 | }
22 |
23 | /** {@inheritDoc} */
24 | @Override
25 | public void transmit(UUID uniqueId, boolean visible, String gameModeName) {
26 | JsonObject currentPlayingGameModeObject = new JsonObject();
27 | currentPlayingGameModeObject.addProperty("show_gamemode", visible);
28 | currentPlayingGameModeObject.addProperty("gamemode_name", gameModeName);
29 |
30 | this.payloadCommunicator.sendLabyModMessage(
31 | uniqueId, SERVER_GAMEMODE_CHANNEL, currentPlayingGameModeObject);
32 | }
33 |
34 | /** {@inheritDoc} */
35 | @Override
36 | public void broadcastTransmit(boolean visible, String gameModeName) {
37 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
38 | this.transmit(player.getUniqueId(), visible, gameModeName);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/economy/EconomyDisplay.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction.economy;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents the economy display packet.
7 | *
8 | * Overview:
9 | *
10 | * It is also possible to display the balance of your economy system. If the user enters a shop
11 | * or is in a trading situation, you can display the amount of the balance in the top right corner.
12 | * You can also use this feature in games if you have to collect coins.
13 | *
14 | * @deprecated Use {@link EconomyDisplayTransmitter}
15 | */
16 | @Deprecated
17 | public interface EconomyDisplay {
18 |
19 | /**
20 | * Sends the balance display to the LabyMod client.
21 | *
22 | * @param uniqueId The unique identifier of the receiver.
23 | * @param economyBalanceType The type of the economy balance.
24 | * @param showBalanceDisplay {@code true} shows the balance display, otherwise {@code false}.
25 | * @param balance The balance of the receiver.
26 | * @deprecated Use {@link EconomyDisplayTransmitter#transmit(UUID, EconomyBalanceType, boolean, int)}
27 | */
28 | @Deprecated
29 | void sendBalanceDisplay(
30 | UUID uniqueId,
31 | EconomyBalanceType economyBalanceType,
32 | boolean showBalanceDisplay,
33 | int balance);
34 |
35 | /**
36 | * Sends the balance display to all online laby users.
37 | *
38 | * @param economyBalanceType The type of the economy balance.
39 | * @param showBalanceDisplay {@code true} shows the balance display, otherwise {@code false}.
40 | * @param balance The balance of the receiver.
41 | * @deprecated Use {@link EconomyDisplayTransmitter#broadcastTransmit(EconomyBalanceType, boolean, int)}
42 | */
43 | @Deprecated
44 | void broadcastSendBalanceDisplay(
45 | EconomyBalanceType economyBalanceType, boolean showBalanceDisplay, int balance);
46 | }
47 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/serverinteraction/addon/AddonRecommendation.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.serverinteraction.addon;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * Represents the addon recommendation packet.
7 | *
8 | * Overview:
9 | *
10 | * With this packet the server can recommend published addons to the user and the user can
11 | * install them very simple in a GUI. Multiple add-ons can be suggested at the same time or can also
12 | * be flagged as being required. You have to react to the response of the client if an addon is
13 | * required.
14 | * @deprecated Use {@link AddonRecommendationTransmitter}
15 | */
16 | @Deprecated
17 | public interface AddonRecommendation {
18 |
19 | /**
20 | * Adds a recommending addon to a list which will be sent to the client.
21 | *
22 | * @param recommendedAddon The recommended addon to be added.
23 | * @return This object for a fluent chaining.
24 | * @deprecated Use {@link AddonRecommendationTransmitter#addRecommendAddon(RecommendedAddon)}
25 | */
26 | @Deprecated
27 | AddonRecommendation addRecommendAddon(RecommendedAddon recommendedAddon);
28 |
29 | /**
30 | * Adds to a list an array of recommending addons which will be sent to the client.
31 | *
32 | * @param recommendedAddons An array of recommended addons to be added.
33 | * @return This object for a fluent chaining.
34 | * @deprecated Use {@link AddonRecommendationTransmitter#addRecommendAddons(RecommendedAddon...)}
35 | */
36 | @Deprecated
37 | AddonRecommendation addRecommendAddons(RecommendedAddon... recommendedAddons);
38 |
39 | /**
40 | * Sends the addon recommendation packet to the client.
41 | *
42 | * @param uniqueId The unique identifier of the receiver.
43 | * @deprecated Use {@link AddonRecommendationTransmitter#transmit(UUID)}
44 | */
45 | @Deprecated
46 | void sendRecommendAddons(UUID uniqueId);
47 | }
48 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/actionmenu/DefaultMenu.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.actionmenu;
2 |
3 | import com.google.gson.JsonArray;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
6 | import net.labymod.serverapi.api.player.LabyModPlayer;
7 | import net.labymod.serverapi.api.player.LabyModPlayerService;
8 | import net.labymod.serverapi.api.serverinteraction.actionmenu.Menu;
9 | import net.labymod.serverapi.api.serverinteraction.actionmenu.MenuEntry;
10 |
11 | import java.util.UUID;
12 |
13 | public class DefaultMenu implements Menu {
14 |
15 | private static final String USER_MENU_ACTIONS_CHANNEL = "user_menu_actions";
16 |
17 | private final LabyModPlayerService> playerService;
18 | private final PayloadCommunicator payloadCommunicator;
19 | private final JsonArray entries;
20 |
21 | public DefaultMenu(LabyService service) {
22 | this.payloadCommunicator = service.getPayloadCommunicator();
23 | this.playerService = service.getLabyPlayerService();
24 | this.entries = new JsonArray();
25 | }
26 |
27 | /** {@inheritDoc} */
28 | @Override
29 | public Menu addEntry(MenuEntry entry) {
30 | this.entries.add(entry.asJsonObject());
31 | return this;
32 | }
33 |
34 | /** {@inheritDoc} */
35 | @Override
36 | public Menu addEntries(MenuEntry... entries) {
37 | for (MenuEntry entry : entries) {
38 | this.entries.add(entry.asJsonObject());
39 | }
40 | return this;
41 | }
42 |
43 | /** {@inheritDoc} */
44 | @Override
45 | public void transmit(UUID uniqueId) {
46 | this.payloadCommunicator.sendLabyModMessage(uniqueId, USER_MENU_ACTIONS_CHANNEL, this.entries);
47 | }
48 |
49 | @Override
50 | public void broadcastTransmit() {
51 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
52 | this.transmit(player.getUniqueId());
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/DefaultCineScopes.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
6 | import net.labymod.serverapi.api.player.LabyModPlayer;
7 | import net.labymod.serverapi.api.player.LabyModPlayerService;
8 | import net.labymod.serverapi.api.serverinteraction.CineScopes;
9 |
10 | import java.util.UUID;
11 |
12 | public class DefaultCineScopes implements CineScopes {
13 |
14 | private static final String CINESCOPES_CHANNEL = "cinescopes";
15 |
16 | private final LabyModPlayerService> playerService;
17 | private final PayloadCommunicator payloadCommunicator;
18 |
19 | public DefaultCineScopes(LabyService service) {
20 | this.payloadCommunicator = service.getPayloadCommunicator();
21 | this.playerService = service.getLabyPlayerService();
22 | }
23 |
24 | /** {@inheritDoc} */
25 | @Override
26 | public void sendCineScope(
27 | UUID uniqueId, boolean showCineScopes, int coveragePercent, long duration) {
28 | JsonObject cineScopeObject = new JsonObject();
29 |
30 | if (coveragePercent < 1) {
31 | coveragePercent = 1;
32 | } else if (coveragePercent > 50) {
33 | coveragePercent = 50;
34 | }
35 |
36 | cineScopeObject.addProperty("visible", showCineScopes);
37 | cineScopeObject.addProperty("coverage", coveragePercent);
38 | cineScopeObject.addProperty("duration", duration);
39 |
40 | this.payloadCommunicator.sendLabyModMessage(uniqueId, CINESCOPES_CHANNEL, cineScopeObject);
41 | }
42 |
43 | @Override
44 | public void broadcastSendCineScope(boolean showCineScopes, int coveragePercent, long duration) {
45 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
46 | this.sendCineScope(player.getUniqueId(), showCineScopes, coveragePercent, duration);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/player/DefaultLabyModPlayerService.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.player;
2 |
3 | import net.labymod.serverapi.api.player.LabyModPlayer;
4 | import net.labymod.serverapi.api.player.LabyModPlayerService;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import java.util.Optional;
9 | import java.util.UUID;
10 | import java.util.function.Predicate;
11 |
12 | public class DefaultLabyModPlayerService Note: The functions shows the current game mode in LabyChat.
29 | *
30 | * @param uniqueId The unique identifier of a player.
31 | * @param gameModeName The name of the game mode.
32 | * @deprecated Use {@link PlayingGameModeTransmitter#transmit(UUID, String)}
33 | */
34 | @Deprecated
35 | default void sendCurrentPlayingGameMode(UUID uniqueId, String gameModeName) {
36 | this.sendCurrentPlayingGameMode(uniqueId, true, gameModeName);
37 | }
38 |
39 | /** @deprecated Use {@link PlayingGameModeTransmitter#broadcastTransmit(boolean, String)} */
40 | @Deprecated
41 | void broadcastCurrentlyPlayingGameMode(boolean visible, String gameModeName);
42 |
43 | /** @deprecated Use {@link PlayingGameModeTransmitter#broadcastTransmit(String)} */
44 | @Deprecated
45 | default void broadcastCurrentlyPlayingGameMode(String gameModeName) {
46 | this.broadcastCurrentlyPlayingGameMode(true, gameModeName);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/permission/Permissible.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.permission;
2 |
3 | /** Represents a Labymod permission. */
4 | public interface Permissible {
5 |
6 | /**
7 | * Retrieves the internal name of this permission.
8 | *
9 | * Note: The internal name is sent to the client.
10 | *
11 | * @return The permission's internal name.
12 | */
13 | String getInternalName();
14 |
15 | /**
16 | * Retrieves the name of this permission.
17 | *
18 | * @return The permission's name.
19 | */
20 | String getName();
21 |
22 | /**
23 | * Whether the permission is enabled.
24 | *
25 | * @return {@code true} if the permission is enabled, otherwise {@code false}.
26 | */
27 | boolean isEnabled();
28 |
29 | /**
30 | * Changes whether the permission is enabled.
31 | *
32 | * @param enabled {@code true} if the permission should be enabled, otherwise {@code false}.
33 | */
34 | void setEnabled(boolean enabled);
35 |
36 | /** A factory for creating {@link Permissible}'s. */
37 | interface Factory {
38 |
39 | /**
40 | * Creates a new {@link Permissible} with the given name.
41 | *
42 | * Note: The created permission is default enabled.
43 | *
44 | * @param internalName The internal name of the permission.
45 | * @param name The name of the permission to be created.
46 | * @return A created permission.
47 | */
48 | Permissible create(String internalName, String name);
49 |
50 | /**
51 | * Creates a new {@link Permissible} with the given name and the enable state.
52 | *
53 | * @param internalName The internal name of the permission.
54 | * @param name The name of the permission to be created.
55 | * @param enabled {@code true} if the permission should be enabled, otherwise {@code false}.
56 | * @return A created permission.
57 | */
58 | Permissible create(String internalName, String name, boolean enabled);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/LabyDebugger.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api;
2 |
3 | /** Represents the debugger for the plugin. */
4 | public interface LabyDebugger {
5 |
6 | /**
7 | * Whether the plugin is in debug mode.
8 | *
9 | * @return {@code true} if the plugin is in debug mode, otherwise {@code false}.
10 | */
11 | boolean isDebug();
12 |
13 | /**
14 | * Changes whether the plugin is in debug mode.
15 | *
16 | * @param debug {@code true} if the plugin should be in debug mode, otherwise {@code false}.
17 | */
18 | void setDebug(boolean debug);
19 |
20 | /**
21 | * Logs a message at the INFO level.
22 | *
23 | * @param message The message string to be logged.
24 | */
25 | void info(String message);
26 |
27 | /**
28 | * Logs an exception (throwable) at the INFO level with an accompanying message.
29 | *
30 | * @param message The message accompanying the exception.
31 | * @param throwable The exception (throwable) to be log.
32 | */
33 | void info(String message, Throwable throwable);
34 |
35 | /**
36 | * Logs a message at the WARN level.
37 | *
38 | * @param message The message string to be logged.
39 | */
40 | void warn(String message);
41 |
42 | /**
43 | * Logs an exception (throwable) at the WARN level with an accompanying message.
44 | *
45 | * @param message The message accompanying the exception.
46 | * @param throwable The exception (throwable) to be log.
47 | */
48 | void warn(String message, Throwable throwable);
49 |
50 | /**
51 | * Logs a message at the ERROR level.
52 | *
53 | * @param message The message string to be logged.
54 | */
55 | void error(String message);
56 |
57 | /**
58 | * Logs an exception (throwable) at the ERROR level with an accompanying message.
59 | *
60 | * @param message The message accompanying the exception.
61 | * @param throwable The exception (throwable) to be log.
62 | */
63 | void error(String message, Throwable throwable);
64 | }
65 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/DefaultCineScopesTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction;
2 |
3 | import com.google.gson.JsonObject;
4 | import java.util.UUID;
5 | import net.labymod.serverapi.api.LabyService;
6 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
7 | import net.labymod.serverapi.api.player.LabyModPlayer;
8 | import net.labymod.serverapi.api.player.LabyModPlayerService;
9 | import net.labymod.serverapi.api.serverinteraction.CineScopesTransmitter;
10 |
11 | public class DefaultCineScopesTransmitter implements CineScopesTransmitter {
12 |
13 | private static final String CINESCOPES_CHANNEL = "cinescopes";
14 |
15 | private final LabyModPlayerService> playerService;
16 | private final PayloadCommunicator payloadCommunicator;
17 |
18 | public DefaultCineScopesTransmitter(LabyService service) {
19 | this.payloadCommunicator = service.getPayloadCommunicator();
20 | this.playerService = service.getLabyPlayerService();
21 | }
22 |
23 | /** {@inheritDoc} */
24 | @Override
25 | public void transmit(UUID uniqueId, boolean showCineScopes, int coveragePercent, long duration) {
26 | JsonObject cineScopeObject = new JsonObject();
27 |
28 | if (coveragePercent < 0) {
29 | coveragePercent = 0;
30 | } else if (coveragePercent > 50) {
31 | coveragePercent = 50;
32 | }
33 |
34 | cineScopeObject.addProperty("visible", showCineScopes);
35 | cineScopeObject.addProperty("coverage", coveragePercent);
36 | cineScopeObject.addProperty("duration", duration);
37 |
38 | this.payloadCommunicator.sendLabyModMessage(uniqueId, CINESCOPES_CHANNEL, cineScopeObject);
39 | }
40 |
41 | /** {@inheritDoc} */
42 | @Override
43 | public void broadcastTransmit(boolean showCineScopes, int coveragePercent, long duration) {
44 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
45 | this.transmit(player.getUniqueId(), showCineScopes, coveragePercent, duration);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/emote/EmoteTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.emote;
2 |
3 | import net.labymod.serverapi.api.serverinteraction.Watermark;
4 |
5 | import java.util.UUID;
6 |
7 | /**
8 | * Represents an emote transmitter that sends a payload message in channel emote_api to the
9 | * LabyMod client.
10 | *
11 | * Overview:
12 | *
13 | * LabyMod users can play client side an emote for all other players on the Minecraft server.
14 | * Minecraft servers can also force-play emotes for specific player's using the payload messages.
15 | *
16 | * Warning: This works only for NPC's and not for real players.
17 | *
18 | * Servers can make NPC's do emotes. To prevent abuse, this does not work for real players. To
19 | * enforce this, emotes can only be forced for players that have the second half of their {@link
20 | * UUID} entirely being 0 (64 least significant bits are 0, or the second long value equals 0) You
21 | * therefore need to spawn them with a unique identifier like this.
22 | *
23 | * This rule does not apply if the {@link Watermark} feature is activated.
24 | */
25 | public interface EmoteTransmitter {
26 |
27 | /**
28 | * Adds an emote to a list to be played when sending.
29 | *
30 | * @param emote The emote which should be played.
31 | * @return This object for a fluent chaining.
32 | */
33 | EmoteTransmitter addEmote(Emote emote);
34 |
35 | /**
36 | * Adds to a list an array of emotes to be played when sending.
37 | *
38 | * @param emotes An array emotes which should be played.
39 | * @return This object for a fluent chaining.
40 | */
41 | EmoteTransmitter addEmotes(Emote... emotes);
42 |
43 | /**
44 | * Transmits a list of all forced emotes to the client.
45 | *
46 | * @param receiverUniqueId The unique identifier of the receiver.
47 | */
48 | void transmit(UUID receiverUniqueId);
49 |
50 | /** Transmits a list of all forced emotes to all online laby users. */
51 | void broadcastTransmit();
52 | }
53 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/addon/DefaultAddonRecommendation.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.addon;
2 |
3 | import com.google.gson.JsonArray;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
6 | import net.labymod.serverapi.api.serverinteraction.addon.AddonRecommendation;
7 | import net.labymod.serverapi.api.serverinteraction.addon.RecommendedAddon;
8 |
9 | import java.util.ArrayList;
10 | import java.util.Arrays;
11 | import java.util.List;
12 | import java.util.UUID;
13 |
14 | public class DefaultAddonRecommendation implements AddonRecommendation {
15 |
16 | private static final String ADDON_RECOMMENDATION_CHANNEL = "addon_recommendation";
17 | private final PayloadCommunicator payloadCommunicator;
18 | private final List Overview:
9 | *
10 | * With out server switch packet you can send LabyMod users between different servers. The server
11 | * can request a user to directly connect to a different IP address (or domain name). This can be
12 | * used to create multi-server-networks. As this does not need any extra proxy software and
13 | * hardware, it is generally cheaper for a network to connect players directly to the server instead
14 | * of using an intermediate software like BungeeCord.
15 | *
16 | * @deprecated Use {@link ServerSwitcherTransmitter}
17 | */
18 | @Deprecated
19 | public interface ServerSwitcher {
20 |
21 | /**
22 | * Sends a player to another network or server.
23 | *
24 | * @param uniqueId The unique identifier of a player which should be sent to another
25 | * network/server.
26 | * @param title The title of the warning.
27 | * @param address The address of the network / server where the player should be sent to.
28 | * @param preview {@code true} if information about the network / server should be displayed,
29 | * otherwise {@code false}.
30 | * @deprecated Use {@link ServerSwitcherTransmitter#transmit(UUID, String, String, boolean)}
31 | */
32 | @Deprecated
33 | void sendPlayerToServer(UUID uniqueId, String title, String address, boolean preview);
34 |
35 | /**
36 | * Sends all online laby user to another network or server.
37 | *
38 | * @param title The title of the warning.
39 | * @param address The address of the network / server where the players should be sent to.
40 | * @param preview {@code true} if information about the network / server should be displayed,
41 | * otherwise {@code false}.
42 | * @deprecated Use {@link ServerSwitcherTransmitter#broadcastTransmit(String, String, boolean)}
43 | */
44 | @Deprecated
45 | void broadcastSendPlayerToServer(String title, String address, boolean preview);
46 | }
47 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/economy/DefaultEconomyDisplayTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.economy;
2 |
3 | import com.google.gson.JsonObject;
4 | import java.util.UUID;
5 | import net.labymod.serverapi.api.LabyService;
6 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
7 | import net.labymod.serverapi.api.player.LabyModPlayer;
8 | import net.labymod.serverapi.api.player.LabyModPlayerService;
9 | import net.labymod.serverapi.api.serverinteraction.economy.EconomyBalanceType;
10 | import net.labymod.serverapi.api.serverinteraction.economy.EconomyDisplayTransmitter;
11 |
12 | public class DefaultEconomyDisplayTransmitter implements EconomyDisplayTransmitter {
13 |
14 | private static final String ECONOMY_CHANNEL = "economy";
15 |
16 | private final PayloadCommunicator payloadCommunicator;
17 | private final LabyModPlayerService> playerService;
18 |
19 | public DefaultEconomyDisplayTransmitter(LabyService service) {
20 | this.payloadCommunicator = service.getPayloadCommunicator();
21 | this.playerService = service.getLabyPlayerService();
22 | }
23 |
24 | /** {@inheritDoc} */
25 | @Override
26 | public void transmit(
27 | UUID uniqueId,
28 | EconomyBalanceType economyBalanceType,
29 | boolean showBalanceDisplay,
30 | int balance) {
31 | JsonObject economyObject = new JsonObject();
32 | JsonObject cashObject = new JsonObject();
33 |
34 | cashObject.addProperty("visible", showBalanceDisplay);
35 | cashObject.addProperty("balance", balance);
36 |
37 | economyObject.add(economyBalanceType.getKey(), cashObject);
38 |
39 | this.payloadCommunicator.sendLabyModMessage(uniqueId, ECONOMY_CHANNEL, economyObject);
40 | }
41 |
42 | /** {@inheritDoc} */
43 | @Override
44 | public void broadcastTransmit(
45 | EconomyBalanceType economyBalanceType, boolean showBalanceDisplay, int balance) {
46 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
47 | this.transmit(player.getUniqueId(), economyBalanceType, showBalanceDisplay, balance);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/economy/DefaultEconomyDisplay.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.economy;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
6 | import net.labymod.serverapi.api.player.LabyModPlayer;
7 | import net.labymod.serverapi.api.player.LabyModPlayerService;
8 | import net.labymod.serverapi.api.serverinteraction.economy.EconomyBalanceType;
9 | import net.labymod.serverapi.api.serverinteraction.economy.EconomyDisplay;
10 |
11 | import java.util.UUID;
12 |
13 | public class DefaultEconomyDisplay implements EconomyDisplay {
14 |
15 | private static final String ECONOMY_CHANNEL = "economy";
16 |
17 | private final PayloadCommunicator payloadCommunicator;
18 | private final LabyModPlayerService> playerService;
19 |
20 | public DefaultEconomyDisplay(LabyService service) {
21 | this.payloadCommunicator = service.getPayloadCommunicator();
22 | this.playerService = service.getLabyPlayerService();
23 | }
24 |
25 | /** {@inheritDoc} */
26 | @Override
27 | public void sendBalanceDisplay(
28 | UUID uniqueId,
29 | EconomyBalanceType economyBalanceType,
30 | boolean showBalanceDisplay,
31 | int balance) {
32 |
33 | JsonObject economyObject = new JsonObject();
34 | JsonObject cashObject = new JsonObject();
35 |
36 | cashObject.addProperty("visible", showBalanceDisplay);
37 | cashObject.addProperty("balance", balance);
38 |
39 | economyObject.add(economyBalanceType.getKey(), cashObject);
40 |
41 | this.payloadCommunicator.sendLabyModMessage(uniqueId, ECONOMY_CHANNEL, economyObject);
42 | }
43 |
44 | /** {@inheritDoc} */
45 | @Override
46 | public void broadcastSendBalanceDisplay(
47 | EconomyBalanceType economyBalanceType, boolean showBalanceDisplay, int balance) {
48 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
49 | this.sendBalanceDisplay(
50 | player.getUniqueId(), economyBalanceType, showBalanceDisplay, balance);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/proxy/velocity/src/main/java/net/labymod/serverapi/velocity/event/VelocitySendPayloadEvent.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.velocity.event;
2 |
3 | import com.velocitypowered.api.event.ResultedEvent;
4 | import com.velocitypowered.api.event.connection.PluginMessageEvent.ForwardResult;
5 | import com.velocitypowered.api.proxy.Player;
6 | import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
7 |
8 | /** Is fired when a custom payload is sent. */
9 | public class VelocitySendPayloadEvent implements ResultedEvent Note: The modern payload channel namespace is `legacy`.
12 | *
13 | * @param channelIdentifier The channel identifier for the modern and legacy payload channel.
14 | */
15 | void registerModernLegacyChannelIdentifier(String channelIdentifier);
16 |
17 | /**
18 | * Registers a new legacy payload channel with the {@code channelIdentifier}.
19 | *
20 | * @param channelIdentifier The channel identifier for the legacy payload channel.
21 | */
22 | void registerLegacyChannelIdentifier(String channelIdentifier);
23 |
24 | /**
25 | * Registers a new modern payload channel with the given {@code namespace} and {@code path}.
26 | *
27 | * @param namespace The namespace of the channel identifier.
28 | * @param path The path of the channel identifier.
29 | */
30 | void registerModernChannelIdentifier(String namespace, String path);
31 |
32 | /**
33 | * Unregisters a modern and legacy payload channel.
34 | *
35 | * @param channelIdentifier The channel identifier of the payload channels to be unregistered.
36 | */
37 | void unregisterModernLegacyChannelIdentifier(String channelIdentifier);
38 |
39 | /**
40 | * Unregisters a legacy payload channel.
41 | *
42 | * @param channelIdentifier The channel identifier to be unregistered.
43 | */
44 | void unregisterLegacyChannelIdentifier(String channelIdentifier);
45 |
46 | /**
47 | * Unregisters a modern payload channel.
48 | *
49 | * @param namespace The namespace of the modern payload channel to be unregistered.
50 | * @param path The path of the modern payload channel to be unregistered.
51 | */
52 | void unregisterModernChannelIdentifier(String namespace, String path);
53 |
54 | /**
55 | * Retrieves a multimap with all registered channel identifiers.
56 | *
57 | * @return A multimap with all registered channel identifiers.
58 | */
59 | Multimap Note:
47 | *
48 | * This creates a subtitle which is {@code 0.8D} in size.
49 | *
50 | * @param uniqueId The unique identifier of the player for which the subtitle should be
51 | * displayed.
52 | * @param value The value of the subtitle.
53 | * @return A created subtitle.
54 | */
55 | SubTitle create(UUID uniqueId, String value);
56 |
57 | SubTitle create(UUID uniqueId, JsonObject rawText);
58 |
59 | /**
60 | * Creates a new {@link SubTitle} with the given {@code uniqueId}, {@code value} and the {@code
61 | * size}.
62 | *
63 | * Note:
64 | *
65 | * The smallest subtitle size is {@code 0.8D} and the largest is {@code 1.6D} which is the
66 | * size of the normal Minecraft tag.
67 | *
68 | * @param uniqueId The unique identifier of the player for which the subtitle should be
69 | * displayed.
70 | * @param value The value of the subtitle.
71 | * @param size The size of the subtitle.
72 | * @return A created subtitle.
73 | */
74 | SubTitle create(UUID uniqueId, String value, double size);
75 |
76 | SubTitle create(UUID uniqueId, JsonObject rawText, double size);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/subtitle/DefaultSubTitle.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.subtitle;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.serverinteraction.subtile.SubTitle;
5 |
6 | import java.util.UUID;
7 |
8 | public class DefaultSubTitle implements SubTitle {
9 |
10 | private final UUID uniqueId;
11 | private String value;
12 | private JsonObject rawText;
13 | private final double size;
14 |
15 | private final JsonObject subTitleObject;
16 |
17 | protected DefaultSubTitle(UUID uniqueId, String value) {
18 | this(uniqueId, value, 0.8D);
19 | }
20 |
21 | protected DefaultSubTitle(UUID uniqueId, JsonObject rawText) {
22 | this(uniqueId, rawText, 0.8D);
23 | }
24 |
25 | protected DefaultSubTitle(UUID uniqueId, String value, double size) {
26 | size = this.checkSize(size);
27 |
28 | this.uniqueId = uniqueId;
29 | this.value = value;
30 | this.size = size;
31 | this.subTitleObject = new JsonObject();
32 |
33 | this.subTitleObject.addProperty("uuid", uniqueId.toString());
34 |
35 | this.subTitleObject.addProperty("size", size);
36 |
37 | if (this.value != null) {
38 | this.subTitleObject.addProperty("value", value);
39 | }
40 | }
41 |
42 | protected DefaultSubTitle(UUID uniqueId, JsonObject rawText, double size) {
43 | size = this.checkSize(size);
44 |
45 | this.uniqueId = uniqueId;
46 | this.rawText = rawText;
47 | this.size = size;
48 |
49 | this.subTitleObject = new JsonObject();
50 |
51 | this.subTitleObject.addProperty("uuid", uniqueId.toString());
52 | this.subTitleObject.addProperty("size", size);
53 |
54 | if (this.rawText != null) {
55 | this.subTitleObject.addProperty("raw_json_text", this.rawText.toString());
56 | }
57 | }
58 |
59 | private double checkSize(double size) {
60 | return size < 0.8D ? 0.8D : Math.min(size, 1.6D);
61 | }
62 |
63 | /** {@inheritDoc} */
64 | @Override
65 | public UUID getUniqueId() {
66 | return this.uniqueId;
67 | }
68 |
69 | /** {@inheritDoc} */
70 | @Override
71 | public String getValue() {
72 | return this.value;
73 | }
74 |
75 | /** {@inheritDoc} */
76 | @Override
77 | public double getSize() {
78 | return this.size;
79 | }
80 |
81 | /** {@inheritDoc} */
82 | @Override
83 | public JsonObject getRawTextAsJson() {
84 | return this.rawText;
85 | }
86 |
87 | /** {@inheritDoc} */
88 | @Override
89 | public JsonObject asJsonObject() {
90 | return this.subTitleObject;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/labymod-api/src/main/java/net/labymod/serverapi/api/payload/PayloadCommunicator.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.api.payload;
2 |
3 | import com.google.gson.JsonElement;
4 | import java.util.UUID;
5 |
6 | public interface PayloadCommunicator {
7 |
8 | /**
9 | * Sends a custom payload into the given channel {@code identifier}.
10 | *
11 | * @param uniqueId The unique identifier of a player that is to receive the payload.
12 | * @param identifier The channel identifier where the payload should be sent to .
13 | * @param payload The payload as a byte array.
14 | */
15 | void send(UUID uniqueId, String identifier, byte[] payload);
16 |
17 | /**
18 | * Sends a custom payload into the chunk caching protocol channel.
19 | *
20 | * @param uniqueId TThe unique identifier of a player that is to receive the payload.
21 | * @param payload The payload as a byte array.
22 | */
23 | void sendChunkCachingProtocolMessage(UUID uniqueId, byte[] payload);
24 |
25 | /**
26 | * Sends a custom payload into the shadow protocol channel.
27 | *
28 | * @param uniqueId The unique identifier of a player that is to receive the payload.
29 | * @param payload The payload as a byte array.
30 | */
31 | void sendShadowProtocolMessage(UUID uniqueId, byte[] payload);
32 |
33 | /**
34 | * Sends a custom payload into the lava update protocol channel.
35 | *
36 | * @param uniqueId The unique identifier of a player that is to receive the payload.
37 | * @param payload The payload as a byte array.
38 | */
39 | void sendLavaUpdateProtocolMessage(UUID uniqueId, byte[] payload);
40 |
41 | /**
42 | * Sends a custom payload as a json tree into the lmc channel.
43 | *
44 | * @param uniqueId The unique identifier of a player that is to receive the payload.
45 | * @param messageKey The key of the message.
46 | * @param messageContent The content for the message as a json tree.
47 | */
48 | void sendLabyModMessage(UUID uniqueId, String messageKey, JsonElement messageContent);
49 |
50 | /**
51 | * Sends a custom payload message to the `labymod3:main` channel with the `server_api` key.
52 | *
53 | * @param uniqueId The unique identifier of a player that is to receive the payload.
54 | */
55 | void sendServerApiMessage(UUID uniqueId);
56 |
57 | /**
58 | * Receives a custom payload from the given channel {@code identifier}.
59 | *
60 | * @param uniqueId The unique identifier of a player that sent the payload.
61 | * @param identifier The channel identifier to which the payload was sent.
62 | * @param payload The payload as a byte array.
63 | */
64 | void receive(UUID uniqueId, String identifier, byte[] payload);
65 | }
66 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/discord/DefaultRichPresenceTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.discord;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.discord.RichPresenceTransmitter;
6 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
7 |
8 | import java.util.UUID;
9 |
10 | /** Default implementation of {@link RichPresenceTransmitter}. */
11 | public class DefaultRichPresenceTransmitter implements RichPresenceTransmitter {
12 |
13 | private static final String DISCORD_RPC_CHANNEL = "discord_rpc";
14 | private final PayloadCommunicator payloadCommunicator;
15 |
16 | public DefaultRichPresenceTransmitter(LabyService service) {
17 | this.payloadCommunicator = service.getPayloadCommunicator();
18 | }
19 |
20 | /** {@inheritDoc} */
21 | @Override
22 | public void updateRichPresenceTimer(UUID receiverUniqueId, String gameMode, long startTime) {
23 | this.updateRichPresence(receiverUniqueId, gameMode, startTime, 0L);
24 | }
25 |
26 | /** {@inheritDoc} */
27 | @Override
28 | public void updateRichPresenceCountdown(UUID receiverUniqueId, String gameMode, long endTime) {
29 | this.updateRichPresence(receiverUniqueId, gameMode, 0L, System.currentTimeMillis());
30 | }
31 |
32 | /** {@inheritDoc} */
33 | @Override
34 | public void updateRichPresence(
35 | UUID receiverUniqueId, boolean hasGame, String gameMode, long startTime, long endTime) {
36 |
37 | JsonObject richPresenceObject = new JsonObject();
38 |
39 | richPresenceObject.addProperty("hasGame", hasGame);
40 |
41 | if (hasGame) {
42 | richPresenceObject.addProperty("game_mode", gameMode);
43 | richPresenceObject.addProperty("game_startTime", startTime);
44 | richPresenceObject.addProperty("game_endTime", endTime);
45 | }
46 |
47 | this.payloadCommunicator.sendLabyModMessage(
48 | receiverUniqueId, DISCORD_RPC_CHANNEL, richPresenceObject);
49 | }
50 |
51 | /** {@inheritDoc} */
52 | @Override
53 | public void updateParty(
54 | UUID receiverUniqueId,
55 | boolean hasParty,
56 | UUID partyLeaderUniqueId,
57 | int partySize,
58 | int maximalPartyMembers,
59 | String domain) {
60 |
61 | JsonObject partyObject = new JsonObject();
62 |
63 | partyObject.addProperty("hasParty", hasParty);
64 |
65 | if (hasParty) {
66 | partyObject.addProperty("partyId", partyLeaderUniqueId.toString() + ":" + domain);
67 | partyObject.addProperty("party_size", partySize);
68 | partyObject.addProperty("party_max", maximalPartyMembers);
69 | }
70 |
71 | this.payloadCommunicator.sendLabyModMessage(receiverUniqueId, DISCORD_RPC_CHANNEL, partyObject);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/proxy/velocity/src/main/java/net/labymod/serverapi/velocity/VelocityLabyModPlugin.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.velocity;
2 |
3 | import com.google.inject.Inject;
4 | import com.velocitypowered.api.event.Subscribe;
5 | import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
6 | import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
7 | import com.velocitypowered.api.proxy.ProxyServer;
8 | import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
9 | import java.util.Optional;
10 | import net.labymod.serverapi.api.LabyAPI;
11 | import net.labymod.serverapi.api.LabyService;
12 | import net.labymod.serverapi.api.payload.PayloadChannelRegistrar;
13 | import net.labymod.serverapi.velocity.payload.channel.VelocityLegacyLabyModPayloadChannel;
14 | import org.slf4j.Logger;
15 |
16 | public class VelocityLabyModPlugin {
17 |
18 | private final ProxyServer proxyServer;
19 | private final Logger logger;
20 | private LabyService service;
21 | private PayloadChannelRegistrar LabyModPlayerService getLabyPlayerService() {
53 | return (LabyModPlayerService ) this.playerService;
54 | }
55 |
56 | /** {@inheritDoc} */
57 | @Override
58 | public PayloadCommunicator getPayloadCommunicator() {
59 | return this.payloadCommunicator;
60 | }
61 |
62 | /** {@inheritDoc} */
63 | @SuppressWarnings("unchecked")
64 | @Override
65 | public PayloadChannelRegistrar getPayloadChannelRegistrar() {
66 | return (PayloadChannelRegistrar ) this.payloadChannelRegistrar;
67 | }
68 |
69 | /** {@inheritDoc} */
70 | @SuppressWarnings("unchecked")
71 | @Override
72 | public ConnectionService getConnectionService() {
73 | return (ConnectionService ) this.connectionService;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/proxy/bungeecord/src/main/java/net/labymod/serverapi/bungee/BungeeLabyService.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bungee;
2 |
3 | import net.labymod.serverapi.api.LabyDebugger;
4 | import net.labymod.serverapi.api.connection.ConnectionService;
5 | import net.labymod.serverapi.api.payload.PayloadChannelRegistrar;
6 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
7 | import net.labymod.serverapi.api.player.LabyModPlayerService;
8 | import net.labymod.serverapi.bungee.connection.BungeeConnectionService;
9 | import net.labymod.serverapi.bungee.payload.BungeePayloadChannelRegistrar;
10 | import net.labymod.serverapi.bungee.payload.BungeePayloadCommunicator;
11 | import net.labymod.serverapi.common.AbstractLabyService;
12 | import net.labymod.serverapi.common.player.DefaultLabyModPlayerService;
13 | import net.md_5.bungee.api.connection.ProxiedPlayer;
14 |
15 | public class BungeeLabyService extends AbstractLabyService {
16 |
17 | private final LabyDebugger labyDebugger;
18 | private final ConnectionService LabyModPlayerService getLabyPlayerService() {
54 | return (LabyModPlayerService ) this.playerService;
55 | }
56 |
57 | /** {@inheritDoc} */
58 | @Override
59 | public PayloadCommunicator getPayloadCommunicator() {
60 | return this.payloadCommunicator;
61 | }
62 |
63 | /** {@inheritDoc} */
64 | @SuppressWarnings("unchecked")
65 | @Override
66 | public PayloadChannelRegistrar getPayloadChannelRegistrar() {
67 | return (PayloadChannelRegistrar ) this.payloadChannelRegistrar;
68 | }
69 |
70 | /** {@inheritDoc} */
71 | @SuppressWarnings("unchecked")
72 | @Override
73 | public ConnectionService getConnectionService() {
74 | return (ConnectionService ) this.connectionService;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/serverinteraction/gui/DefaultInputPromptTransmitter.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.serverinteraction.gui;
2 |
3 | import com.google.gson.JsonObject;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
6 | import net.labymod.serverapi.api.player.LabyModPlayer;
7 | import net.labymod.serverapi.api.player.LabyModPlayerService;
8 | import net.labymod.serverapi.api.serverinteraction.gui.InputPromptTransmitter;
9 |
10 | import java.util.UUID;
11 |
12 | public class DefaultInputPromptTransmitter implements InputPromptTransmitter {
13 | private static final String INPUT_PROMPT_CHANNEL = "input_prompt";
14 | private final PayloadCommunicator communicator;
15 | private final LabyModPlayerService> playerService;
16 |
17 | public DefaultInputPromptTransmitter(LabyService service) {
18 | this.communicator = service.getPayloadCommunicator();
19 | this.playerService = service.getLabyPlayerService();
20 | }
21 |
22 | @Override
23 | public void transmit(
24 | UUID uniqueId,
25 | int promptSessionId,
26 | JsonObject rawText,
27 | String value,
28 | String placeholder,
29 | int maximumAmount) {
30 |
31 | JsonObject object = new JsonObject();
32 | object.addProperty("id", promptSessionId);
33 | object.addProperty("raw_json_text", rawText.toString());
34 | object.addProperty("value", value);
35 | object.addProperty("placeholder", placeholder);
36 | object.addProperty("max_length", maximumAmount);
37 |
38 | this.communicator.sendLabyModMessage(uniqueId, INPUT_PROMPT_CHANNEL, object);
39 | }
40 |
41 | @Override
42 | public void transmit(
43 | UUID uniqueId,
44 | int promptSessionId,
45 | String message,
46 | String value,
47 | String placeholder,
48 | int maximumAmount) {
49 |
50 | JsonObject object = new JsonObject();
51 | object.addProperty("id", promptSessionId);
52 | object.addProperty("message", message);
53 | object.addProperty("value", value);
54 | object.addProperty("placeholder", placeholder);
55 | object.addProperty("max_length", maximumAmount);
56 |
57 | this.communicator.sendLabyModMessage(uniqueId, INPUT_PROMPT_CHANNEL, object);
58 | }
59 |
60 | @Override
61 | public void broadcastTransmit(
62 | int promptSessionId,
63 | JsonObject rawText,
64 | String value,
65 | String placeholder,
66 | int maximumAmount) {
67 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
68 | this.transmit(
69 | player.getUniqueId(), promptSessionId, rawText, value, placeholder, maximumAmount);
70 | }
71 | }
72 |
73 | @Override
74 | public void broadcastTransmit(
75 | int promptSessionId, String message, String value, String placeholder, int maximumAmount) {
76 | for (LabyModPlayer> player : this.playerService.getPlayers()) {
77 | this.transmit(
78 | player.getUniqueId(), promptSessionId, message, value, placeholder, maximumAmount);
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/labymod-common/src/main/java/net/labymod/serverapi/common/player/DefaultLabyModPlayer.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.common.player;
2 |
3 | import net.labymod.serverapi.api.extension.AddonExtension;
4 | import net.labymod.serverapi.api.extension.ModificationExtension;
5 | import net.labymod.serverapi.api.extension.PackageExtension;
6 | import net.labymod.serverapi.api.player.LabyModPlayer;
7 | import net.labymod.serverapi.api.protocol.ChunkCachingProtocol;
8 | import net.labymod.serverapi.api.protocol.ShadowProtocol;
9 |
10 | import java.util.List;
11 | import java.util.UUID;
12 |
13 | public class DefaultLabyModPlayer Overview:
10 | *
11 | * With this feature it is possible to request a text input from a player. The server can send
12 | * any text with any pre-entered input to the client.
13 | */
14 | public interface InputPromptTransmitter {
15 |
16 | /**
17 | * Transmits the input prompt to the client with the specified {@code uniqueId}.
18 | *
19 | * @param uniqueId The unique identifier of the receiver.
20 | * @param promptSessionId The prompt session identifier.
21 | * @param rawText The message above the text field as a {@link JsonObject}.
22 | * @param value The value inside of the text field.
23 | * @param placeholder A placeholder text inside of the field if there is no value given.
24 | * @param maximumAmount The maximum amount of character of the text field value.
25 | */
26 | void transmit(
27 | UUID uniqueId,
28 | int promptSessionId,
29 | JsonObject rawText,
30 | String value,
31 | String placeholder,
32 | int maximumAmount);
33 |
34 | /**
35 | * Transmits the input prompt to the client with the specified {@code uniqueId}.
36 | *
37 | * @param uniqueId The unique identifier of the receiver.
38 | * @param promptSessionId The prompt session identifier.
39 | * @param message The message above the text field.
40 | * @param value The value inside of the text field.
41 | * @param placeholder The placeholder text inside of the field if there is not value given.
42 | * @param maximumAmount The maximum amount of character of the text field value.
43 | */
44 | void transmit(
45 | UUID uniqueId,
46 | int promptSessionId,
47 | String message,
48 | String value,
49 | String placeholder,
50 | int maximumAmount);
51 |
52 | /**
53 | * Transmits the input prompt to all online laby users.
54 | *
55 | * @param promptSessionId The prompt session identifier.
56 | * @param rawText The message above the text field as a {@link JsonObject}.
57 | * @param value The value inside of the text field.
58 | * @param placeholder The placeholder text inside of the field if there is not value given.
59 | * @param maximumAmount The maximum amount of character of the text field value.
60 | */
61 | void broadcastTransmit(
62 | int promptSessionId, JsonObject rawText, String value, String placeholder, int maximumAmount);
63 |
64 | /**
65 | * Transmits the input prompt to all online laby users.
66 | *
67 | * @param promptSessionId The prompt session identifier.
68 | * @param message The message above the text field.
69 | * @param value The value inside of the text field.
70 | * @param placeholder The placeholder text inside of the field if there is not value given.
71 | * @param maximumAmount The maximum amount of character of the text field value.
72 | */
73 | void broadcastTransmit(
74 | int promptSessionId, String message, String value, String placeholder, int maximumAmount);
75 | }
76 |
--------------------------------------------------------------------------------
/proxy/velocity/src/main/java/net/labymod/serverapi/velocity/VelocityLabyService.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.velocity;
2 |
3 | import com.velocitypowered.api.proxy.Player;
4 | import com.velocitypowered.api.proxy.ProxyServer;
5 | import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
6 | import net.labymod.serverapi.api.LabyDebugger;
7 | import net.labymod.serverapi.api.connection.ConnectionService;
8 | import net.labymod.serverapi.api.payload.PayloadChannelRegistrar;
9 | import net.labymod.serverapi.api.payload.PayloadCommunicator;
10 | import net.labymod.serverapi.api.player.LabyModPlayerService;
11 | import net.labymod.serverapi.common.AbstractLabyService;
12 | import net.labymod.serverapi.common.player.DefaultLabyModPlayerService;
13 | import net.labymod.serverapi.velocity.connection.VelocityConnectionService;
14 | import net.labymod.serverapi.velocity.payload.VelocityPayloadChannelRegistrar;
15 | import net.labymod.serverapi.velocity.payload.VelocityPayloadCommunicator;
16 | import org.slf4j.Logger;
17 |
18 | public class VelocityLabyService extends AbstractLabyService {
19 |
20 | private final LabyDebugger labyDebugger;
21 | private final ConnectionService LabyModPlayerService getLabyPlayerService() {
58 | return (LabyModPlayerService ) this.playerService;
59 | }
60 |
61 | /** {@inheritDoc} */
62 | @Override
63 | public PayloadCommunicator getPayloadCommunicator() {
64 | return this.payloadCommunicator;
65 | }
66 |
67 | /** {@inheritDoc} */
68 | @SuppressWarnings("unchecked")
69 | @Override
70 | public PayloadChannelRegistrar getPayloadChannelRegistrar() {
71 | return (PayloadChannelRegistrar ) this.payloadChannelRegistrar;
72 | }
73 |
74 | /** {@inheritDoc} */
75 | @SuppressWarnings("unchecked")
76 | @Override
77 | public ConnectionService getConnectionService() {
78 | return (ConnectionService ) this.connectionService;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/server/bukkit/src/main/java/net/labymod/serverapi/bukkit/payload/BukkitPayloadCommunicator.java:
--------------------------------------------------------------------------------
1 | package net.labymod.serverapi.bukkit.payload;
2 |
3 | import java.util.UUID;
4 | import net.labymod.serverapi.api.LabyService;
5 | import net.labymod.serverapi.api.payload.PayloadChannelRegistrar;
6 | import net.labymod.serverapi.api.payload.PayloadChannelType;
7 | import net.labymod.serverapi.bukkit.BukkitLabyModPlugin;
8 | import net.labymod.serverapi.bukkit.event.BukkitReceivePayloadEvent;
9 | import net.labymod.serverapi.bukkit.event.BukkitSendPayloadEvent;
10 | import net.labymod.serverapi.bukkit.payload.transmitter.BukkitPayloadTransmitter;
11 | import net.labymod.serverapi.common.payload.DefaultPayloadCommunicator;
12 | import org.bukkit.entity.Player;
13 | import org.bukkit.plugin.messaging.PluginMessageListener;
14 |
15 | public class BukkitPayloadCommunicator extends DefaultPayloadCommunicator
16 | implements PluginMessageListener {
17 |
18 | private final BukkitLabyModPlugin plugin;
19 | private PayloadChannelRegistrar