Core/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPage.java

54 lines
1.6 KiB
Java

/*
* Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.core.api.gui.hologram.components;
import eu.univento.core.api.player.CustomPlayer;
import lombok.Getter;
import org.bukkit.Location;
import java.util.HashMap;
/**
* @author joethei
* @version 0.1
*/
@Getter
public class PlayerGUIPage {
protected CustomPlayer player;
protected GUIPage page;
protected Location location;
protected HashMap<String, PlayerGUIComponent> components;
protected HashMap<String, GUIComponent> guiComponents;
public PlayerGUIPage(CustomPlayer player, HashMap<String, PlayerGUIComponent> components, Location location, GUIPage page) {
this.player = player;
this.components = components;
this.location = location;
this.page = page;
this.guiComponents = new HashMap<>();
}
public void updateIncrement() {
for(GUIComponent component : guiComponents.values()) {
component.updateIncrement();
}
}
public void renderComponent(GUIComponent component) {
PlayerGUIComponent playerGUIComponent = this.components.get(component.getId());
if(playerGUIComponent != null) {
removeComponent(component.getId());
}
PlayerGUIComponent guiComponent = component.initPlayerGUIComponent(player);
guiComponent.setHidden(false);
guiComponent.spawnEntities(location, this instanceof StationaryPlayerGUIPage);
}
public void removeComponent(String param) {
}
}