Rename methods

This commit is contained in:
filoghost 2021-05-16 20:59:34 +02:00
parent 40d18d1235
commit a31f29cb32
16 changed files with 19 additions and 24 deletions

View File

@ -103,7 +103,7 @@ public interface Hologram {
* @return the amount of lines * @return the amount of lines
* @since 1 * @since 1
*/ */
int size(); int getLineCount();
/** /**

View File

@ -26,9 +26,9 @@ public interface StandardHologram {
List<? extends StandardHologramLine> getLines(); List<? extends StandardHologramLine> getLines();
int getLinesAmount(); int getLineCount();
Plugin getOwnerPlugin(); Plugin getCreatorPlugin();
boolean isVisibleTo(Player player); boolean isVisibleTo(Player player);

View File

@ -66,7 +66,7 @@ public class DebugCommand extends HologramSubCommand {
for (Entry<StandardHologram, HologramDebugInfo> entry : hologramsDebugInfo.entrySet()) { for (Entry<StandardHologram, HologramDebugInfo> entry : hologramsDebugInfo.entrySet()) {
StandardHologram hologram = entry.getKey(); StandardHologram hologram = entry.getKey();
HologramDebugInfo debugInfo = entry.getValue(); HologramDebugInfo debugInfo = entry.getValue();
sender.sendMessage(Colors.PRIMARY_SHADOW + "- '" + hologram.toFormattedString() + "': " + hologram.getLinesAmount() + " lines, " sender.sendMessage(Colors.PRIMARY_SHADOW + "- '" + hologram.toFormattedString() + "': " + hologram.getLineCount() + " lines, "
+ debugInfo.getTotalEntities() + " entities (" + debugInfo.aliveEntities + " alive, " + debugInfo.deadEntities + " dead)"); + debugInfo.getTotalEntities() + " entities (" + debugInfo.aliveEntities + " alive, " + debugInfo.deadEntities + " dead)");
} }
} }

View File

@ -47,9 +47,9 @@ public class InsertlineCommand extends LineEditingCommand implements QuickEditCo
int insertAfterIndex = CommandValidate.parseInteger(args[1]); int insertAfterIndex = CommandValidate.parseInteger(args[1]);
String serializedLine = Strings.joinFrom(" ", args, 2); String serializedLine = Strings.joinFrom(" ", args, 2);
int oldLinesAmount = hologram.getLinesAmount(); int oldLinesAmount = hologram.getLineCount();
CommandValidate.check(insertAfterIndex >= 0 && insertAfterIndex <= oldLinesAmount, "The number must be between 0 and " + hologram.getLinesAmount() + "(amount of lines of the hologram)."); CommandValidate.check(insertAfterIndex >= 0 && insertAfterIndex <= oldLinesAmount, "The number must be between 0 and " + hologram.getLineCount() + "(amount of lines of the hologram).");
InternalHologramLine line = HologramCommandValidate.parseHologramLine(hologram, serializedLine); InternalHologramLine line = HologramCommandValidate.parseHologramLine(hologram, serializedLine);
hologram.insertLine(insertAfterIndex, line); hologram.insertLine(insertAfterIndex, line);

View File

@ -58,7 +58,7 @@ public class ListCommand extends HologramSubCommand {
+ " " + Colors.SECONDARY_SHADOW + "at x: " + (int) hologram.getX() + " " + Colors.SECONDARY_SHADOW + "at x: " + (int) hologram.getX()
+ ", y: " + (int) hologram.getY() + ", y: " + (int) hologram.getY()
+ ", z: " + (int) hologram.getZ() + ", z: " + (int) hologram.getZ()
+ " (lines: " + hologram.getLinesAmount() + ", world: \"" + hologram.getWorld().getName() + "\")"); + " (lines: " + hologram.getLineCount() + ", world: \"" + hologram.getWorld().getName() + "\")");
} }
} }

View File

@ -53,7 +53,7 @@ public class NearCommand extends HologramSubCommand {
Messages.sendTitle(player, "Near holograms"); Messages.sendTitle(player, "Near holograms");
for (InternalHologram nearHologram : nearHolograms) { for (InternalHologram nearHologram : nearHolograms) {
player.sendMessage(Colors.SECONDARY_SHADOW + "- " + Colors.SECONDARY + Colors.BOLD + nearHologram.getName() + " " + Colors.SECONDARY_SHADOW + "at x: " + (int) nearHologram.getX() + ", y: " + (int) nearHologram.getY() + ", z: " + (int) nearHologram.getZ() + " (lines: " + nearHologram.getLinesAmount() + ")"); player.sendMessage(Colors.SECONDARY_SHADOW + "- " + Colors.SECONDARY + Colors.BOLD + nearHologram.getName() + " " + Colors.SECONDARY_SHADOW + "at x: " + (int) nearHologram.getX() + ", y: " + (int) nearHologram.getY() + ", z: " + (int) nearHologram.getZ() + " (lines: " + nearHologram.getLineCount() + ")");
} }
} }

View File

@ -41,10 +41,10 @@ public class RemovelineCommand extends LineEditingCommand implements QuickEditCo
int lineNumber = CommandValidate.parseInteger(args[1]); int lineNumber = CommandValidate.parseInteger(args[1]);
CommandValidate.check(lineNumber >= 1 && lineNumber <= hologram.getLinesAmount(), "The line number must be between 1 and " + hologram.getLinesAmount() + "."); CommandValidate.check(lineNumber >= 1 && lineNumber <= hologram.getLineCount(), "The line number must be between 1 and " + hologram.getLineCount() + ".");
int index = lineNumber - 1; int index = lineNumber - 1;
CommandValidate.check(hologram.getLinesAmount() > 1, "The hologram should have at least 1 line. If you want to delete it, use /" + context.getRootLabel() + " delete."); CommandValidate.check(hologram.getLineCount() > 1, "The hologram should have at least 1 line. If you want to delete it, use /" + context.getRootLabel() + " delete.");
hologram.removeLine(index); hologram.removeLine(index);

View File

@ -43,7 +43,7 @@ public class SetlineCommand extends LineEditingCommand implements QuickEditComma
String serializedLine = Strings.joinFrom(" ", args, 2); String serializedLine = Strings.joinFrom(" ", args, 2);
int lineNumber = CommandValidate.parseInteger(args[1]); int lineNumber = CommandValidate.parseInteger(args[1]);
CommandValidate.check(lineNumber >= 1 && lineNumber <= hologram.getLinesAmount(), "The line number must be between 1 and " + hologram.getLinesAmount() + "."); CommandValidate.check(lineNumber >= 1 && lineNumber <= hologram.getLineCount(), "The line number must be between 1 and " + hologram.getLineCount() + ".");
int index = lineNumber - 1; int index = lineNumber - 1;
InternalHologramLine line = HologramCommandValidate.parseHologramLine(hologram, serializedLine); InternalHologramLine line = HologramCommandValidate.parseHologramLine(hologram, serializedLine);

View File

@ -61,7 +61,7 @@ public class V2HologramAdapter implements Hologram {
@Override @Override
public int size() { public int size() {
return newHologram.size(); return newHologram.getLineCount();
} }
@Override @Override

View File

@ -52,7 +52,7 @@ public class V2HologramsAPIProvider extends HologramsAPIProvider {
List<Hologram> ownedHolograms = new ArrayList<>(); List<Hologram> ownedHolograms = new ArrayList<>();
for (APIHologram hologram : apiHologramManager.getHolograms()) { for (APIHologram hologram : apiHologramManager.getHolograms()) {
if (hologram.getOwnerPlugin().equals(plugin)) { if (hologram.getCreatorPlugin().equals(plugin)) {
ownedHolograms.add(hologram.getV2Adapter()); ownedHolograms.add(hologram.getV2Adapter());
} }
} }

View File

@ -40,7 +40,7 @@ public class APIHologram extends BaseHologram<APIHologramLine> implements Hologr
} }
@Override @Override
public Plugin getOwnerPlugin() { public Plugin getCreatorPlugin() {
return plugin; return plugin;
} }
@ -89,11 +89,6 @@ public class APIHologram extends BaseHologram<APIHologramLine> implements Hologr
return getLines().get(index); return getLines().get(index);
} }
@Override
public int size() {
return getLinesAmount();
}
@Override @Override
public void setAllowPlaceholders(boolean allowPlaceholders) { public void setAllowPlaceholders(boolean allowPlaceholders) {
if (this.allowPlaceholders == allowPlaceholders) { if (this.allowPlaceholders == allowPlaceholders) {

View File

@ -37,7 +37,7 @@ public class APIHologramManager extends BaseHologramManager<APIHologram> {
List<Hologram> ownedHolograms = new ArrayList<>(); List<Hologram> ownedHolograms = new ArrayList<>();
for (APIHologram hologram : getHolograms()) { for (APIHologram hologram : getHolograms()) {
if (hologram.getOwnerPlugin().equals(plugin)) { if (hologram.getCreatorPlugin().equals(plugin)) {
ownedHolograms.add(hologram); ownedHolograms.add(hologram);
} }
} }

View File

@ -129,7 +129,7 @@ public abstract class BaseHologram<T extends StandardHologramLine> extends BaseH
} }
@Override @Override
public int getLinesAmount() { public int getLineCount() {
return lines.size(); return lines.size();
} }

View File

@ -40,7 +40,7 @@ public abstract class BaseItemLine extends BaseTouchableLine implements Standard
try { try {
pickupHandler.onPickup(player); pickupHandler.onPickup(player);
} catch (Throwable t) { } catch (Throwable t) {
Log.warning("The plugin " + getHologram().getOwnerPlugin().getName() + " generated an exception" Log.warning("The plugin " + getHologram().getCreatorPlugin().getName() + " generated an exception"
+ " when the player " + player.getName() + " picked up an item from a hologram.", t); + " when the player " + player.getName() + " picked up an item from a hologram.", t);
} }
} }

View File

@ -56,7 +56,7 @@ public abstract class BaseTouchableLine extends BaseHologramLine implements Stan
try { try {
touchHandler.onTouch(player); touchHandler.onTouch(player);
} catch (Throwable t) { } catch (Throwable t) {
Log.warning("The plugin " + getHologram().getOwnerPlugin().getName() + " generated an exception" Log.warning("The plugin " + getHologram().getCreatorPlugin().getName() + " generated an exception"
+ " when the player " + player.getName() + " touched a hologram.", t); + " when the player " + player.getName() + " touched a hologram.", t);
} }
} }

View File

@ -36,7 +36,7 @@ public class InternalHologram extends BaseHologram<InternalHologramLine> {
} }
@Override @Override
public Plugin getOwnerPlugin() { public Plugin getCreatorPlugin() {
return HolographicDisplays.getInstance(); return HolographicDisplays.getInstance();
} }