HyCodeYourTale
classpublicPriority 3

ShopPageSupplier

com.hypixel.hytale.builtin.adventure.shop.ShopPageSupplier

implements OpenCustomUIInteraction.CustomPageSupplier

0

Methods

0

Public Methods

1

Fields

1

Constructors

Constants

BuilderCodec<ShopPageSupplier>CODEC= BuilderCodec.builder(ShopPageSupplier.class, ShopPageSupplier::new) .appendInherited( ...

Constructors

public
ShopPageSupplier()

Fields

Protected Fields (1)

protectedString shopId

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Source Code

package com.hypixel.hytale.builtin.adventure.shop;

import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.entity.InteractionContext;
import com.hypixel.hytale.server.core.entity.entities.player.pages.CustomUIPage;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.OpenCustomUIInteraction;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;

public class ShopPageSupplier implements OpenCustomUIInteraction.CustomPageSupplier {
   public static final BuilderCodec<ShopPageSupplier> CODEC = BuilderCodec.builder(ShopPageSupplier.class, ShopPageSupplier::new)
      .appendInherited(
         new KeyedCodec<>("ShopId", Codec.STRING), (data, o) -> data.shopId = o, data -> data.shopId, (data, parent) -> data.shopId = parent.shopId
      )
      .add()
      .build();
   protected String shopId;

   public ShopPageSupplier() {
   }

   @Nonnull
   @Override
   public CustomUIPage tryCreate(
      Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor, @Nonnull PlayerRef playerRef, InteractionContext context
   ) {
      return new ShopPage(playerRef, this.shopId);
   }
}