PageManager class
Пакет: com.hypixel.hytale.server.core.entity.entities.player.pages
Файл: com/hypixel/hytale/server/core/entity/entities/player/pages/PageManager.java
Поля (8)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
break |
|
|
break |
|
|
return |
|
|
return |
|
UICommandBuilder |
var4 |
|
UIEventBuilder |
var5 |
|
List |
var5 |
|
List |
var6 |
Методы (21)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
throw new |
IllegalArgumentExceptionthrow new IllegalArgumentException("Client sent unexpected acknowledgement") |
public |
void |
clearCustomPageAcknowledgementsvoid clearCustomPageAcknowledgements() |
|
|
for for(OpenWindow var8 : var6) |
|
|
for for(OpenWindow var7 : var5) |
public |
void |
handleEventvoid handleEvent(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull CustomPageEvent var3) |
|
|
if if(this.customPage != null) |
|
|
if if(this.customPage != null) |
|
|
if if(this.windowManager == null) |
|
|
if if(var6 == null) |
|
|
if if(this.windowManager == null) |
|
|
if if(var5 == null) |
|
|
if if(this.customPage == null) |
|
|
if if(this.customPage != null) |
public |
void |
initvoid init(@Nonnull PlayerRef var1, @Nonnull WindowManager var2) |
public |
void |
openCustomPagevoid openCustomPage(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull CustomUIPage var3) |
public |
boolean |
openCustomPageWithWindowsboolean openCustomPageWithWindows(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull CustomUIPage var3, @Nonnull Window... var4) |
public |
void |
setPagevoid setPage(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull Page var3) |
public |
void |
setPagevoid setPage(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull Page var3, boolean var4) |
public |
boolean |
setPageWithWindowsboolean setPageWithWindows(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull Page var3, boolean var4, @Nonnull Window... var5) |
|
|
switch switch(var3.type) |
public |
void |
updateCustomPagevoid updateCustomPage(@Nonnull CustomPage var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.entity.entities.player.pages;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.protocol.packets.interface_.CustomPage;
class="kw">import com.hypixel.hytale.protocol.packets.interface_.CustomPageEvent;
class="kw">import com.hypixel.hytale.protocol.packets.interface_.Page;
class="kw">import com.hypixel.hytale.protocol.packets.interface_.SetPage;
class="kw">import com.hypixel.hytale.protocol.packets.window.OpenWindow;
class="kw">import com.hypixel.hytale.server.core.entity.entities.player.windows.Window;
class="kw">import com.hypixel.hytale.server.core.entity.entities.player.windows.WindowManager;
class="kw">import com.hypixel.hytale.server.core.modules.anchoraction.AnchorActionModule;
class="kw">import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
class="kw">import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.List;
class="kw">import java.util.concurrent.atomic.AtomicInteger;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class PageManager {
@Nullable
class="kw">private WindowManager windowManager;
class="kw">private PlayerRef playerRef;
@Nullable
class="kw">private CustomUIPage customPage;
@Nonnull
class="kw">private class="kw">final AtomicInteger customPageRequiredAcknowledgments = new AtomicInteger();
class="kw">public PageManager() {
}
class="kw">public void init(@Nonnull PlayerRef var1, @Nonnull WindowManager var2) {
this.windowManager = var2;
this.playerRef = var1;
}
class="kw">public void clearCustomPageAcknowledgements() {
this.customPageRequiredAcknowledgments.set(0);
}
@Nullable
class="kw">public CustomUIPage getCustomPage() {
class="kw">return this.customPage;
}
class="kw">public void setPage(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull Page var3) {
this.setPage(var1, var2, var3, false);
}
class="kw">public void setPage(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull Page var3, boolean var4) {
if (this.customPage != null) {
this.customPage.onDismiss(var1, var2);
this.customPage = null;
this.customPageRequiredAcknowledgments.incrementAndGet();
}
this.playerRef.getPacketHandler().writeNoCache(new SetPage(var3, var4));
}
class="kw">public void openCustomPage(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull CustomUIPage var3) {
UICommandBuilder var4 = new UICommandBuilder();
UIEventBuilder var5 = new UIEventBuilder();
if (this.customPage != null) {
this.customPage.onDismiss(var1, var1.getStore());
}
var3.build(var1, var4, var5, var2);
this.updateCustomPage(new CustomPage(var3.getClass().getName(), true, true, var3.getLifetime(), var4.getCommands(), var5.getEvents()));
this.customPage = var3;
}
class="kw">public boolean setPageWithWindows(
@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull Page var3, boolean var4, @Nonnull Window... var5
) {
if (this.windowManager == null) {
class="kw">return false;
}
List var6 = this.windowManager.openWindows(var1, var2, var5);
if (var6 == null) {
class="kw">return false;
}
this.setPage(var1, var2, var3, var4);
for (OpenWindow var8 : var6) {
this.playerRef.getPacketHandler().write(var8);
}
class="kw">return true;
}
class="kw">public boolean openCustomPageWithWindows(
@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull CustomUIPage var3, @Nonnull Window... var4
) {
if (this.windowManager == null) {
class="kw">return false;
}
List var5 = this.windowManager.openWindows(var1, var2, var4);
if (var5 == null) {
class="kw">return false;
}
this.openCustomPage(var1, var2, var3);
for (OpenWindow var7 : var5) {
this.playerRef.getPacketHandler().write(var7);
}
class="kw">return true;
}
class="kw">public void updateCustomPage(@Nonnull CustomPage var1) {
this.customPageRequiredAcknowledgments.incrementAndGet();
this.playerRef.getPacketHandler().write(var1);
}
class="kw">public void handleEvent(@Nonnull Ref<EntityStore> var1, @Nonnull Store<EntityStore> var2, @Nonnull CustomPageEvent var3) {
class="kw">switch (var3.type) {
case Dismiss:
if (this.customPage == null) {
class="kw">return;
}
this.customPage.onDismiss(var1, var2);
this.customPage = null;
break;
case Data:
if (this.customPageRequiredAcknowledgments.get() != 0) {
class="kw">return;
}
if (this.customPage != null) {
this.customPage.handleDataEvent(var1, var2, var3.data);
} else {
AnchorActionModule.get().tryHandle(this.playerRef, var3.data);
}
break;
case Acknowledge:
if (this.customPageRequiredAcknowledgments.decrementAndGet() < 0) {
this.customPageRequiredAcknowledgments.incrementAndGet();
throw new IllegalArgumentException("Client sent unexpected acknowledgement");
}
}
}
}