2021-03-23 11:51:40 +01:00
|
|
|
/*
|
|
|
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
2024-01-12 10:01:48 +01:00
|
|
|
* Copyright (C) 2016-2024 ViaVersion and contributors
|
2021-03-23 11:51:40 +01:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
package com.viaversion.viaversion.api.legacy.bossbar;
|
2016-03-06 19:27:26 +01:00
|
|
|
|
2021-04-26 21:35:29 +02:00
|
|
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
2016-03-06 19:27:26 +01:00
|
|
|
import java.util.Set;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
2021-04-28 11:10:16 +02:00
|
|
|
public interface BossBar {
|
2020-02-10 10:05:56 +01:00
|
|
|
|
2016-03-08 13:46:30 +01:00
|
|
|
/**
|
|
|
|
* Get the current title
|
|
|
|
*
|
|
|
|
* @return the title
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
String getTitle();
|
2016-03-08 13:46:30 +01:00
|
|
|
|
2016-03-06 19:27:26 +01:00
|
|
|
/**
|
2016-03-18 22:18:48 +01:00
|
|
|
* Change the title
|
2016-03-06 19:27:26 +01:00
|
|
|
*
|
2016-03-18 22:18:48 +01:00
|
|
|
* @param title Title can be in either JSON or just text
|
2016-05-26 14:54:22 +02:00
|
|
|
* @return The BossBar object
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar setTitle(String title);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-08 13:46:30 +01:00
|
|
|
* Get the health
|
2016-03-06 19:27:26 +01:00
|
|
|
*
|
2016-03-08 13:46:30 +01:00
|
|
|
* @return float between 0F - 1F
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
float getHealth();
|
2016-03-06 19:27:26 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-18 22:18:48 +01:00
|
|
|
* Change the health
|
2016-03-06 19:27:26 +01:00
|
|
|
*
|
2016-03-18 22:18:48 +01:00
|
|
|
* @param health this float has to be between 0F - 1F
|
2016-05-26 14:54:22 +02:00
|
|
|
* @return The BossBar object
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar setHealth(float health);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
2016-03-08 13:46:30 +01:00
|
|
|
/**
|
|
|
|
* Get the bossbar color
|
|
|
|
*
|
2016-05-26 14:54:22 +02:00
|
|
|
* @return The colour
|
2016-03-08 13:46:30 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossColor getColor();
|
2016-03-08 13:46:30 +01:00
|
|
|
|
2016-03-06 19:27:26 +01:00
|
|
|
/**
|
2023-10-11 15:14:41 +02:00
|
|
|
* Yay, colors!
|
2016-03-06 19:27:26 +01:00
|
|
|
*
|
2016-03-18 22:18:48 +01:00
|
|
|
* @param color Whatever color you want!
|
2016-05-26 14:54:22 +02:00
|
|
|
* @return The BossBar object
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar setColor(BossColor color);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
2016-03-08 13:46:30 +01:00
|
|
|
/**
|
|
|
|
* Get the bosbar style
|
|
|
|
*
|
|
|
|
* @return BossStyle
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossStyle getStyle();
|
2016-03-08 13:46:30 +01:00
|
|
|
|
2016-03-18 22:18:48 +01:00
|
|
|
/**
|
|
|
|
* Change the bosbar style
|
|
|
|
*
|
|
|
|
* @param style BossStyle
|
2016-05-26 14:54:22 +02:00
|
|
|
* @return The BossBar object
|
2016-03-18 22:18:48 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar setStyle(BossStyle style);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
2016-04-01 16:03:56 +02:00
|
|
|
/**
|
2020-06-25 17:07:30 +02:00
|
|
|
* Show the bossbar to a player (uuid). This only works for frontend connections. Use #addConnection(UserConnection) for other types.
|
2016-05-09 18:44:10 +02:00
|
|
|
*
|
|
|
|
* @param player uuid of the player
|
2016-05-26 14:54:22 +02:00
|
|
|
* @return The BossBar object
|
2016-05-09 18:44:10 +02:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar addPlayer(UUID player);
|
2016-09-25 21:17:09 +02:00
|
|
|
|
2020-06-25 15:50:34 +02:00
|
|
|
/**
|
2020-06-25 16:25:59 +02:00
|
|
|
* Show the bossbar to a player connection.
|
2020-06-25 15:50:34 +02:00
|
|
|
*
|
|
|
|
* @param conn UserConnection of the connection
|
|
|
|
* @return The BossBar object
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar addConnection(UserConnection conn);
|
2016-09-24 19:31:41 +02:00
|
|
|
|
2016-09-27 18:31:10 +02:00
|
|
|
/**
|
2020-06-25 17:07:30 +02:00
|
|
|
* Removes the bossbar from a player. This only works for frontend connections. For others types, use #removeConnection(UserConnection)
|
2016-09-27 18:31:10 +02:00
|
|
|
*
|
2020-06-25 15:50:34 +02:00
|
|
|
* @param uuid The players UUID
|
2016-09-27 18:31:10 +02:00
|
|
|
* @return The BossBar object
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar removePlayer(UUID uuid);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
2020-06-25 15:50:34 +02:00
|
|
|
/**
|
2020-06-25 16:25:59 +02:00
|
|
|
* Removes the bossbar from a player connection.
|
2020-06-25 15:50:34 +02:00
|
|
|
*
|
|
|
|
* @param conn The UserConnection
|
|
|
|
* @return The BossBar object
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar removeConnection(UserConnection conn);
|
2020-06-25 15:50:34 +02:00
|
|
|
|
2016-03-06 19:27:26 +01:00
|
|
|
/**
|
|
|
|
* Add flags
|
|
|
|
*
|
2016-05-26 14:54:22 +02:00
|
|
|
* @param flag The flag to add
|
|
|
|
* @return The BossBar object
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar addFlag(BossFlag flag);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove flags.
|
|
|
|
*
|
2016-05-26 14:54:22 +02:00
|
|
|
* @param flag The flag to remove
|
|
|
|
* @return The BossBar object
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar removeFlag(BossFlag flag);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
|
|
|
/**
|
2016-05-26 14:54:22 +02:00
|
|
|
* @param flag The flag to check against
|
|
|
|
* @return True if it has the flag
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
boolean hasFlag(BossFlag flag);
|
2016-03-06 19:27:26 +01:00
|
|
|
|
|
|
|
/**
|
2020-06-25 16:25:59 +02:00
|
|
|
* Get players. Only returns UUIDs which are front-end. For all connections, use #getConnections()
|
2016-03-06 19:27:26 +01:00
|
|
|
*
|
|
|
|
* @return UUIDS from players (sorry I lied)
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
Set<UUID> getPlayers();
|
2016-03-06 19:27:26 +01:00
|
|
|
|
2020-06-25 15:50:34 +02:00
|
|
|
/**
|
2020-06-25 16:25:59 +02:00
|
|
|
* Get UserConnections.
|
2020-06-25 15:50:34 +02:00
|
|
|
*
|
|
|
|
* @return UserConnection from players
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
Set<UserConnection> getConnections();
|
2020-06-25 15:50:34 +02:00
|
|
|
|
2016-03-06 19:27:26 +01:00
|
|
|
/**
|
|
|
|
* Show the bossbar to everyone (In the getPlayer set)
|
2016-05-26 14:54:22 +02:00
|
|
|
*
|
|
|
|
* @return The BossBar object
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar show();
|
2016-03-06 19:27:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide the bossbar from everyone (In the getPlayer set)
|
2016-05-26 14:54:22 +02:00
|
|
|
*
|
|
|
|
* @return The BossBar object
|
2016-03-06 19:27:26 +01:00
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
BossBar hide();
|
2016-03-06 19:27:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is it visible?
|
|
|
|
*
|
|
|
|
* @return visibility changable with show() and hide()
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
boolean isVisible();
|
2017-02-03 17:24:14 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the UUID of this bossbar
|
|
|
|
*
|
|
|
|
* @return Unique Id for this bossbar
|
|
|
|
*/
|
2021-04-28 11:10:16 +02:00
|
|
|
UUID getId();
|
2016-03-06 19:27:26 +01:00
|
|
|
}
|