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

94 lines
2.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.Hologram;
import eu.univento.core.api.player.CustomPlayer;
import lombok.Data;
import org.bukkit.Location;
import org.bukkit.util.Vector;
/**
* @author joethei
* @version 0.1
*/
@Data
public abstract class PlayerGUIComponent {
protected CustomPlayer player;
protected GUIComponent component;
protected Location location;
protected String label;
protected boolean focused = false;
protected String[] lines;
protected int[] componentIds;
protected Location[] armorStandLocations;
protected boolean hidden;
public PlayerGUIComponent(CustomPlayer player, GUIComponent component) {
this.player = player;
this.component = component;
this.hidden = component.isHidden();
}
public abstract void updateComponentLines();
public abstract void spawnEntities(Location location, boolean param);
public abstract void updateLocation(Location location, boolean param);
public void destroyArmorStands() {
for(Hologram hologram : component.getHolograms()) {
hologram.destroy();
}
}
public void renderLabel(Location location, Vector vector, boolean param) {
if(component.getLabel() != null) {
double distance = component.getLabelDistance();
Location loc = player.getLocation();
if(param) {
loc = this.location;
distance = 15.0D;
}
location = calculateArmorStandLocation(-1, loc, vector, distance, component.getLineHeight(), component.getPosition().getY(), component.getPosition().getX());
if(param) {
this.location.setX(this.location.getX() + vector.getX() * -15.0D);
this.location.setY(this.location.getY() + vector.getY() * -15.0D);
}
String label = component.getLabel();
}
}
protected void updateLabelText() {
}
protected void updateLabelLocation(Location location, Vector vector, boolean param) {
}
protected Location calculateArmorStandLocation(int param, Location location, Vector vector, double double1, double double2, double double3, double double4) {
return null;
}
protected Vector customNormalize(Vector vector) {
return null;
}
protected Vector rotateAboutYAxis(Vector vector, double param) {
return null;
}
public void focusComponent(boolean param) {
}
public void unfocusComponent(boolean param) {
}
}