package com.hypixel.hytale.builtin.beds.sleep.systems.player; import com.hypixel.hytale.builtin.beds.sleep.components.PlayerSomnolence; import com.hypixel.hytale.builtin.mounts.MountedComponent; import com.hypixel.hytale.component.CommandBuffer; import com.hypixel.hytale.component.ComponentType; import com.hypixel.hytale.component.Ref; import com.hypixel.hytale.component.Store; import com.hypixel.hytale.component.query.Query; import com.hypixel.hytale.component.system.RefChangeSystem; import com.hypixel.hytale.protocol.BlockMountType; import com.hypixel.hytale.server.core.universe.world.storage.EntityStore; import org.checkerframework.checker.nullness.compatqual.NonNullDecl; import org.checkerframework.checker.nullness.compatqual.NullableDecl; public class WakeUpOnDismountSystem extends RefChangeSystem { @Override public ComponentType componentType() { return MountedComponent.getComponentType(); } @Override public Query getQuery() { return MountedComponent.getComponentType(); } public void onComponentAdded( @NonNullDecl Ref ref, @NonNullDecl MountedComponent component, @NonNullDecl Store store, @NonNullDecl CommandBuffer commandBuffer ) { } public void onComponentSet( @NonNullDecl Ref ref, @NullableDecl MountedComponent oldComponent, @NonNullDecl MountedComponent newComponent, @NonNullDecl Store store, @NonNullDecl CommandBuffer commandBuffer ) { } public void onComponentRemoved( @NonNullDecl Ref ref, @NonNullDecl MountedComponent component, @NonNullDecl Store store, @NonNullDecl CommandBuffer commandBuffer ) { if (component.getBlockMountType() == BlockMountType.Bed) { commandBuffer.putComponent(ref, PlayerSomnolence.getComponentType(), PlayerSomnolence.AWAKE); } } }