add some native bedrock scoreboard features
This commit is contained in:
parent
160251fb0b
commit
8e006930be
@ -12,6 +12,7 @@ interface player {
|
|||||||
use bedrock-packets.{clientbound-packet as bedrock-packet};
|
use bedrock-packets.{clientbound-packet as bedrock-packet};
|
||||||
use uuid.{uuid};
|
use uuid.{uuid};
|
||||||
use status-effect.{status-effect-type, status-effect-instance};
|
use status-effect.{status-effect-type, status-effect-instance};
|
||||||
|
use scoreboard.{scoreboard, bedrock-scoreboard};
|
||||||
|
|
||||||
/// Represents per-player weather condition overrides.
|
/// Represents per-player weather condition overrides.
|
||||||
enum player-weather {
|
enum player-weather {
|
||||||
@ -818,6 +819,18 @@ interface player {
|
|||||||
show-player: func(other: player);
|
show-player: func(other: player);
|
||||||
/// Checks if this player can see another specified player.
|
/// Checks if this player can see another specified player.
|
||||||
can-see: func(other: player) -> bool;
|
can-see: func(other: player) -> bool;
|
||||||
|
/// Checks if this player can see another specified player.
|
||||||
|
can-see-player: func(other: player) -> bool;
|
||||||
|
|
||||||
|
/// Sets the tab list ping / latency indicator in milliseconds.
|
||||||
|
set-tab-list-ping: func(latency-ms: s32);
|
||||||
|
|
||||||
|
/// Sets a client-side item cooldown overlay.
|
||||||
|
set-item-cooldown: func(item-id: string, ticks: s32);
|
||||||
|
/// Returns the remaining cooldown ticks for an item, if active.
|
||||||
|
get-item-cooldown: func(item-id: string) -> option<s32>;
|
||||||
|
/// Checks if an item is currently on cooldown.
|
||||||
|
has-item-cooldown: func(item-id: string) -> bool;
|
||||||
|
|
||||||
/// Raycasts from the player's eyes to find the block being targeted.
|
/// Raycasts from the player's eyes to find the block being targeted.
|
||||||
get-target-block: func(max-distance: u32) -> option<position>;
|
get-target-block: func(max-distance: u32) -> option<position>;
|
||||||
@ -862,6 +875,12 @@ interface player {
|
|||||||
|
|
||||||
/// Clears any currently shown dialog for the player.
|
/// Clears any currently shown dialog for the player.
|
||||||
clear-dialog: func();
|
clear-dialog: func();
|
||||||
|
|
||||||
|
/// Returns the Java scoreboard handle for this player.
|
||||||
|
get-scoreboard: func() -> scoreboard;
|
||||||
|
|
||||||
|
/// Resets the player's custom Java scoreboard back to the world scoreboard.
|
||||||
|
reset-scoreboard: func();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A handle to a player connected via the Bedrock Edition.
|
/// A handle to a player connected via the Bedrock Edition.
|
||||||
@ -894,6 +913,12 @@ interface player {
|
|||||||
|
|
||||||
/// Opens a Bedrock custom form for the player.
|
/// Opens a Bedrock custom form for the player.
|
||||||
open-form: func(form: form) -> u32;
|
open-form: func(form: form) -> u32;
|
||||||
|
|
||||||
|
/// Returns the Bedrock scoreboard handle for this player.
|
||||||
|
get-scoreboard: func() -> bedrock-scoreboard;
|
||||||
|
|
||||||
|
/// Resets the player's custom Bedrock scoreboard back to the world scoreboard.
|
||||||
|
reset-scoreboard: func();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of all players in a specific world.
|
/// Returns a list of all players in a specific world.
|
||||||
|
|||||||
@ -45,6 +45,8 @@ world plugin {
|
|||||||
import status-effect;
|
import status-effect;
|
||||||
// Provides 1 : 1 inter-plugin communication
|
// Provides 1 : 1 inter-plugin communication
|
||||||
import ipc;
|
import ipc;
|
||||||
|
/// Provides player management.
|
||||||
|
import player;
|
||||||
|
|
||||||
// --- Plugin-provided exports ---
|
// --- Plugin-provided exports ---
|
||||||
|
|
||||||
|
|||||||
@ -56,11 +56,15 @@ interface scoreboard {
|
|||||||
|
|
||||||
resource scoreboard {
|
resource scoreboard {
|
||||||
add-objective: func(name: string, display-name: text-component, render-type: render-type);
|
add-objective: func(name: string, display-name: text-component, render-type: render-type);
|
||||||
|
update-objective: func(name: string, display-name: text-component, render-type: render-type);
|
||||||
remove-objective: func(name: string);
|
remove-objective: func(name: string);
|
||||||
set-display-slot: func(slot: display-slot, objective-name: string);
|
set-display-slot: func(slot: display-slot, objective-name: string);
|
||||||
|
clear-display-slot: func(slot: display-slot);
|
||||||
|
|
||||||
update-score: func(entity-name: string, objective-name: string, value: s32);
|
update-score: func(entity-name: string, objective-name: string, value: s32);
|
||||||
|
add-score: func(entity-name: string, objective-name: string, delta: s32) -> s32;
|
||||||
remove-score: func(entity-name: string, objective-name: string);
|
remove-score: func(entity-name: string, objective-name: string);
|
||||||
|
reset-entity-scores: func(entity-name: string);
|
||||||
|
|
||||||
create-team: func(name: string, settings: team-settings);
|
create-team: func(name: string, settings: team-settings);
|
||||||
remove-team: func(name: string);
|
remove-team: func(name: string);
|
||||||
@ -68,5 +72,30 @@ interface scoreboard {
|
|||||||
|
|
||||||
add-player-to-team: func(team-name: string, player-name: string);
|
add-player-to-team: func(team-name: string, player-name: string);
|
||||||
remove-player-from-team: func(team-name: string, player-name: string);
|
remove-player-from-team: func(team-name: string, player-name: string);
|
||||||
|
clear-team-players: func(team-name: string);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum bedrock-sort-order {
|
||||||
|
ascending,
|
||||||
|
descending
|
||||||
|
}
|
||||||
|
|
||||||
|
enum bedrock-display-slot {
|
||||||
|
player-list,
|
||||||
|
sidebar,
|
||||||
|
below-name
|
||||||
|
}
|
||||||
|
|
||||||
|
resource bedrock-scoreboard {
|
||||||
|
add-objective: func(name: string, display-name: string, sort-order: bedrock-sort-order);
|
||||||
|
update-objective: func(name: string, display-name: string, sort-order: bedrock-sort-order);
|
||||||
|
remove-objective: func(name: string);
|
||||||
|
set-display-slot: func(slot: bedrock-display-slot, objective-name: string);
|
||||||
|
clear-display-slot: func(slot: bedrock-display-slot);
|
||||||
|
|
||||||
|
update-score: func(entity-name: string, objective-name: string, value: s32);
|
||||||
|
add-score: func(entity-name: string, objective-name: string, delta: s32) -> s32;
|
||||||
|
remove-score: func(entity-name: string, objective-name: string);
|
||||||
|
reset-entity-scores: func(entity-name: string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user