Files
CustomNPC-Plus/src/main/java/noppes/npcs/controllers/data/Line.java
T

74 lines
1.6 KiB
Java
Raw Normal View History

package noppes.npcs.controllers.data;
2018-09-13 12:03:28 -04:00
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
2023-12-03 20:48:37 -06:00
import noppes.npcs.api.entity.IEntityLivingBase;
import noppes.npcs.api.handler.data.ILine;
2018-09-13 12:03:28 -04:00
2023-12-03 20:48:37 -06:00
public class Line implements ILine {
2018-09-13 12:03:28 -04:00
2025-03-12 20:12:01 -04:00
public Line() {
}
public Line(String text) {
this.text = text;
}
public String text = "";
public String sound = "";
public boolean hideText = false;
public ILine copy() {
Line line = new Line(text);
line.sound = sound;
line.hideText = hideText;
return line;
}
public ILine formatTarget(EntityLivingBase entity) {
if (entity == null)
return this;
Line line = (Line) copy();
if (entity instanceof EntityPlayer)
line.text = line.text.replace("@target", ((EntityPlayer) entity).getDisplayName());
else
line.text = line.text.replace("@target", entity.getCommandSenderName());
return line;
}
public ILine formatTarget(IEntityLivingBase entityLivingBase) {
return this.formatTarget(entityLivingBase.getMCEntity());
}
@Override
public String getText() {
return this.text;
}
@Override
public void setText(String text) {
this.text = text;
}
@Override
public String getSound() {
return this.sound;
}
@Override
public void setSound(String sound) {
this.sound = sound;
}
@Override
public void hideText(boolean hide) {
this.hideText = hide;
}
@Override
public boolean hideText() {
return this.hideText;
}
2018-09-13 12:03:28 -04:00
}