diff options
Diffstat (limited to 'server/src/server.rs')
-rw-r--r-- | server/src/server.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/src/server.rs b/server/src/server.rs index 12eca299..6693d0fb 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -19,9 +19,10 @@ use crate::{ data::{DataIndex, Serverdata}, entity::{Entities, EntityContext}, interaction::{interact, tick_slot, InteractEffect, TickEffect}, + scoreboard::ScoreboardStore, ConnectionID, }; -use anyhow::{anyhow, bail, Result}; +use anyhow::{anyhow, bail, Context, Result}; use hurrycurry_client_lib::{Game, Item, Player, Tile}; use hurrycurry_protocol::{ glam::{IVec2, Vec2}, @@ -50,6 +51,7 @@ pub struct Server { pub packet_out: VecDeque<PacketC>, pub tx: Sender<PacketC>, pub connections: HashMap<ConnectionID, HashSet<PlayerID>>, + pub scoreboard: ScoreboardStore, } pub trait GameServerExt { @@ -231,11 +233,9 @@ impl GameServerExt for Game { impl Server { pub async fn new(tx: Sender<PacketC>) -> Result<Self> { - let mut index = DataIndex::default(); - index.reload()?; Ok(Self { game: Game::default(), - index, + index: DataIndex::load().await.context("loading data index")?, tx, packet_out: VecDeque::new(), connections: HashMap::new(), @@ -245,6 +245,9 @@ impl Server { score_changed: false, packet_loopback: VecDeque::new(), last_movement_update: HashMap::default(), + scoreboard: ScoreboardStore::load() + .await + .context("loading scoreboards")?, }) } } |