Rename method

This commit is contained in:
filoghost 2021-08-26 19:31:15 +02:00
parent cf2ca694bf
commit 5de079917e
20 changed files with 32 additions and 32 deletions

View File

@ -24,7 +24,7 @@ public interface Hologram {
*
* @since 1
*/
@NotNull HologramLines lines();
@NotNull HologramLines getLines();
/**
* Returns the {@link VisibilitySettings} of this hologram.

View File

@ -41,8 +41,8 @@ public class DeathHolograms extends JavaPlugin implements Listener {
public void onPlayerDeath(PlayerDeathEvent event) {
Hologram hologram = holographicDisplaysAPI.createHologram(event.getEntity().getEyeLocation());
hologram.lines().appendText(ChatColor.RED + "Player " + ChatColor.GOLD + event.getEntity().getName() + ChatColor.RED + " died here!");
hologram.lines().appendText(ChatColor.GRAY + "Time of death: " + TIME_FORMATTER.format(Instant.now()));
hologram.getLines().appendText(ChatColor.RED + "Player " + ChatColor.GOLD + event.getEntity().getName() + ChatColor.RED + " died here!");
hologram.getLines().appendText(ChatColor.GRAY + "Time of death: " + TIME_FORMATTER.format(Instant.now()));
}
}

View File

@ -49,8 +49,8 @@ public class PowerUps extends JavaPlugin implements Listener {
// Spawn the floating item with a label
Hologram hologram = holographicDisplaysAPI.createHologram(event.getEntity().getLocation().add(0.0, 0.9, 0.0));
hologram.lines().appendText(ChatColor.AQUA + "" + ChatColor.BOLD + "Speed PowerUp");
ItemHologramLine itemLine = hologram.lines().appendItem(new ItemStack(Material.SUGAR));
hologram.getLines().appendText(ChatColor.AQUA + "" + ChatColor.BOLD + "Speed PowerUp");
ItemHologramLine itemLine = hologram.getLines().appendItem(new ItemStack(Material.SUGAR));
itemLine.setPickupListener((Player player) -> {
// Play an effect

View File

@ -177,10 +177,10 @@ public class HolographicDisplays extends FCommonsPlugin {
hologramDatabase.createHolograms(internalHologramManager, errorCollector);
for (APIHologram hologram : apiHologramManager.getHolograms()) {
hologram.lines().updatePositions();
hologram.getLines().updatePositions();
}
for (V2Hologram hologram : v2HologramManager.getHolograms()) {
hologram.lines().updatePositions();
hologram.getLines().updatePositions();
}
}

View File

@ -37,7 +37,7 @@ public class APIHologram extends BaseHologram implements Hologram {
}
@Override
public @NotNull APIHologramLines lines() {
public @NotNull APIHologramLines getLines() {
return lines;
}

View File

@ -44,7 +44,7 @@ public class V2Hologram extends BaseHologram implements Hologram {
}
@Override
public BaseHologramLines<V2HologramLine> lines() {
public BaseHologramLines<V2HologramLine> getLines() {
return lines;
}

View File

@ -16,7 +16,7 @@ public interface V2HologramLine extends HologramLine, EditableHologramLine {
@Override
default void removeLine() {
getParent().lines().remove(this);
getParent().getLines().remove(this);
}
default Plugin getCreatorPlugin() {

View File

@ -38,7 +38,7 @@ public class AddLineCommand extends LineEditingCommand implements QuickEditComma
InternalHologramLine line = hologramEditor.parseHologramLine(hologram, serializedLine);
hologram.lines().add(line);
hologram.getLines().add(line);
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
sender.sendMessage(ColorScheme.PRIMARY + "Line added.");

View File

@ -37,11 +37,11 @@ public class CopyCommand extends HologramSubCommand {
InternalHologram toHologram = hologramEditor.getExistingHologram(args[1]);
List<InternalHologramLine> clonedLines = new ArrayList<>();
for (InternalHologramLine line : fromHologram.lines()) {
for (InternalHologramLine line : fromHologram.getLines()) {
clonedLines.add(hologramEditor.parseHologramLine(toHologram, line.getSerializedConfigValue()));
}
toHologram.lines().setAll(clonedLines);
toHologram.getLines().setAll(clonedLines);
hologramEditor.saveChanges(toHologram, ChangeType.EDIT_LINES);
sender.sendMessage(ColorScheme.PRIMARY + "Lines of hologram \"" + fromHologram.getName() + "\""

View File

@ -67,7 +67,7 @@ public class CreateCommand extends HologramSubCommand {
line = hologram.createTextLine(defaultText, defaultText.replace(ChatColor.COLOR_CHAR, '&'));
}
hologram.lines().add(line);
hologram.getLines().add(line);
hologramEditor.saveChanges(hologram, ChangeType.CREATE);
hologramEditor.teleportLookingDown(player, player.getLocation());

View File

@ -37,7 +37,7 @@ public class InfoCommand extends LineEditingCommand implements QuickEditCommand
DisplayFormat.sendTitle(sender, "Lines of the hologram \"" + hologram.getName() + "\"");
int index = 0;
for (InternalHologramLine line : hologram.lines()) {
for (InternalHologramLine line : hologram.getLines()) {
index++;
sender.sendMessage(ColorScheme.SECONDARY_BOLD + index + ColorScheme.SECONDARY_DARK + ". "
+ ColorScheme.SECONDARY + line.getSerializedConfigValue());

View File

@ -41,14 +41,14 @@ public class InsertLineCommand extends LineEditingCommand implements QuickEditCo
int insertAfterIndex = CommandValidate.parseInteger(args[1]);
String serializedLine = Strings.joinFrom(" ", args, 2);
int oldLinesAmount = hologram.lines().size();
int oldLinesAmount = hologram.getLines().size();
CommandValidate.check(insertAfterIndex >= 0 && insertAfterIndex <= oldLinesAmount,
"The line number must be between 0 and " + oldLinesAmount + ".");
InternalHologramLine line = hologramEditor.parseHologramLine(hologram, serializedLine);
hologram.lines().insert(insertAfterIndex, line);
hologram.getLines().insert(insertAfterIndex, line);
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
if (insertAfterIndex == 0) {

View File

@ -114,9 +114,9 @@ public class ReadImageCommand extends LineEditingCommand {
}
if (!append) {
hologram.lines().clear();
hologram.getLines().clear();
}
hologram.lines().addAll(newLines);
hologram.getLines().addAll(newLines);
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
if (append) {

View File

@ -85,7 +85,7 @@ public class ReadTextCommand extends LineEditingCommand {
}
}
hologram.lines().setAll(newLines);
hologram.getLines().setAll(newLines);
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
if (FileUtils.hasFileExtension(fileToRead, "jpg", "png", "jpeg", "gif")) {

View File

@ -35,7 +35,7 @@ public class RemoveLineCommand extends LineEditingCommand implements QuickEditCo
InternalHologram hologram = hologramEditor.getExistingHologram(args[0]);
int lineNumber = CommandValidate.parseInteger(args[1]);
int linesAmount = hologram.lines().size();
int linesAmount = hologram.getLines().size();
CommandValidate.check(lineNumber >= 1 && lineNumber <= linesAmount,
"The line number must be between 1 and " + linesAmount + ".");
@ -44,7 +44,7 @@ public class RemoveLineCommand extends LineEditingCommand implements QuickEditCo
CommandValidate.check(linesAmount >= 2,
"A hologram must always have at least 1 line. If you want to delete it, use /" + context.getRootLabel() + " delete.");
hologram.lines().remove(index);
hologram.getLines().remove(index);
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
sender.sendMessage(ColorScheme.PRIMARY + "Line " + lineNumber + " removed.");

View File

@ -38,7 +38,7 @@ public class SetLineCommand extends LineEditingCommand implements QuickEditComma
String serializedLine = Strings.joinFrom(" ", args, 2);
int lineNumber = CommandValidate.parseInteger(args[1]);
int linesAmount = hologram.lines().size();
int linesAmount = hologram.getLines().size();
CommandValidate.check(lineNumber >= 1 && lineNumber <= linesAmount,
"The line number must be between 1 and " + linesAmount + ".");
@ -46,7 +46,7 @@ public class SetLineCommand extends LineEditingCommand implements QuickEditComma
InternalHologramLine line = hologramEditor.parseHologramLine(hologram, serializedLine);
hologram.lines().set(index, line);
hologram.getLines().set(index, line);
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
sender.sendMessage(ColorScheme.PRIMARY + "Line " + lineNumber + " changed.");

View File

@ -30,7 +30,7 @@ public class HologramConfig {
public HologramConfig(InternalHologram hologram) {
this.name = hologram.getName();
this.serializedLines = new ArrayList<>();
for (InternalHologramLine line : hologram.lines()) {
for (InternalHologramLine line : hologram.getLines()) {
serializedLines.add(line.getSerializedConfigValue());
}
@ -70,7 +70,7 @@ public class HologramConfig {
}
}
hologram.lines().addAll(lines);
hologram.getLines().addAll(lines);
}
private ImmutablePosition parsePosition() throws HologramLoadException {

View File

@ -89,7 +89,7 @@ public class DisplayFormat {
public static void sendHologramSummary(CommandSender sender, InternalHologram hologram, boolean showWorld) {
ImmutablePosition position = hologram.getPosition();
sender.sendMessage(ColorScheme.SECONDARY_DARK + "- " + ColorScheme.SECONDARY_BOLD + hologram.getName()
+ ColorScheme.SECONDARY_DARK + " (" + hologram.lines().size() + " lines) at "
+ ColorScheme.SECONDARY_DARK + " (" + hologram.getLines().size() + " lines) at "
+ (showWorld ? "world: \"" + position.getWorldName() + "\", " : "")
+ "x: " + position.getBlockX() + ", "
+ "y: " + position.getBlockY() + ", "

View File

@ -26,7 +26,7 @@ public abstract class BaseHologram extends BaseHologramComponent {
this.lineTrackerManager = lineTrackerManager;
}
public abstract BaseHologramLines<? extends EditableHologramLine> lines();
public abstract BaseHologramLines<? extends EditableHologramLine> getLines();
protected abstract boolean isVisibleTo(Player player);
@ -39,7 +39,7 @@ public abstract class BaseHologram extends BaseHologramComponent {
@Override
public final void setDeleted() {
super.setDeleted();
lines().setDeleted();
getLines().setDeleted();
}
public @NotNull ImmutablePosition getPosition() {
@ -71,7 +71,7 @@ public abstract class BaseHologram extends BaseHologramComponent {
checkNotDeleted();
position.set(worldName, x, y, z);
lines().updatePositions();
getLines().updatePositions();
}
protected void onWorldLoad(World world) {
@ -98,7 +98,7 @@ public abstract class BaseHologram extends BaseHologramComponent {
public String toString() {
return "Hologram{"
+ "position=" + position
+ ", lines=" + lines()
+ ", lines=" + getLines()
+ ", deleted=" + isDeleted()
+ "}";
}

View File

@ -26,7 +26,7 @@ public class InternalHologram extends BaseHologram {
}
@Override
public BaseHologramLines<InternalHologramLine> lines() {
public BaseHologramLines<InternalHologramLine> getLines() {
return lines;
}