entities) {
setPassengers(Ints.toArray(entities));
}
-
+
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntity.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntity.java
index cf55a8d7..fa6965a4 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntity.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntity.java
@@ -27,18 +27,18 @@ import org.bukkit.World;
import org.bukkit.entity.Entity;
public class WrapperPlayServerSpawnEntity extends AbstractPacket {
-
+
public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY;
-
+
private static PacketConstructor entityConstructor;
-
+
/**
* Represents the different object types.
*
* @author Kristian
*/
public static class ObjectTypes extends IntEnum {
-
+
public static final int BOAT = 1;
public static final int ITEM_STACK = 2;
public static final int MINECART = 10;
@@ -67,29 +67,29 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
* The singleton instance. Can also be retrieved from the parent class.
*/
private static final ObjectTypes INSTANCE = new ObjectTypes();
-
+
/**
* Retrieve an instance of the object types enum.
*/
public static ObjectTypes getInstance() {
return INSTANCE;
}
-
+
}
-
+
public WrapperPlayServerSpawnEntity() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}
-
+
public WrapperPlayServerSpawnEntity(PacketContainer packet) {
super(packet, TYPE);
}
-
+
public WrapperPlayServerSpawnEntity(Entity entity, int type, int objectData) {
super(fromEntity(entity, type, objectData), TYPE);
}
-
+
// Useful constructor
private static PacketContainer fromEntity(Entity entity, int type, int objectData) {
if (entityConstructor == null) {
@@ -99,21 +99,21 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, entity, type, objectData);
}
}
-
+
if (NMSVersion.isGreaterEqualThan(NMSVersion.v1_14_R1)) {
return entityConstructor.createPacket(entity, objectData);
} else {
return entityConstructor.createPacket(entity, type, objectData);
}
}
-
+
/**
* Retrieve entity ID of the Object.
*/
public int getEntityID() {
return handle.getIntegers().read(0);
}
-
+
/**
* Retrieve the entity that will be spawned.
*/
@@ -127,26 +127,26 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
public Entity getEntity(PacketEvent event) {
return getEntity(event.getPlayer().getWorld());
}
-
+
/**
* Set entity ID of the Object.
*/
public void setEntityID(int value) {
handle.getIntegers().write(0, value);
}
-
+
/**
* Retrieve the type of object. See {@link ObjectTypes}
*/
public int getType() {
return handle.getIntegers().read(6);
}
-
+
/**
* Set the type of object. See {@link ObjectTypes}.
*/
public void setType(int value) {
handle.getIntegers().write(6, value);
}
-
+
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntityLiving.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntityLiving.java
index c2459d99..7d4cd4ba 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntityLiving.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/lib/packetwrapper/WrapperPlayServerSpawnEntityLiving.java
@@ -27,24 +27,24 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
-
+
public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY_LIVING;
-
+
private static PacketConstructor entityConstructor;
-
+
public WrapperPlayServerSpawnEntityLiving() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}
-
+
public WrapperPlayServerSpawnEntityLiving(PacketContainer packet) {
super(packet, TYPE);
}
-
+
public WrapperPlayServerSpawnEntityLiving(Entity entity) {
super(fromEntity(entity), TYPE);
}
-
+
// Useful constructor
private static PacketContainer fromEntity(Entity entity) {
if (entityConstructor == null) {
@@ -52,14 +52,14 @@ public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
}
return entityConstructor.createPacket(entity);
}
-
+
/**
* Retrieve entity ID.
*/
public int getEntityID() {
return handle.getIntegers().read(0);
}
-
+
/**
* Retrieve the entity that will be spawned.
*/
@@ -73,14 +73,14 @@ public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
public Entity getEntity(PacketEvent event) {
return getEntity(event.getPlayer().getWorld());
}
-
+
/**
* Set entity ID.
*/
public void setEntityID(int value) {
handle.getIntegers().write(0, value);
}
-
+
/**
* Retrieve the type of mob.
*/
@@ -88,7 +88,7 @@ public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
public EntityType getType() {
return EntityType.fromId(handle.getIntegers().read(1));
}
-
+
/**
* Set the type of mob.
*/
@@ -96,7 +96,7 @@ public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
public void setType(EntityType value) {
handle.getIntegers().write(1, (int) value.getTypeId());
}
-
+
/**
* Retrieve the data watcher.
*
@@ -105,12 +105,12 @@ public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
public WrappedDataWatcher getMetadata() {
return handle.getDataWatcherModifier().read(0);
}
-
+
/**
* Set the data watcher.
*/
public void setMetadata(WrappedDataWatcher value) {
handle.getDataWatcherModifier().write(0, value);
}
-
+
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/InteractListener.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/InteractListener.java
index 7ec07430..26dbb4d0 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/InteractListener.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/InteractListener.java
@@ -18,24 +18,24 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent;
public class InteractListener implements Listener {
-
+
private final NMSManager nmsManager;
-
+
public InteractListener(NMSManager nmsManager) {
this.nmsManager = nmsManager;
}
-
+
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSlimeInteract(PlayerInteractEntityEvent event) {
if (event.getRightClicked().getType() != EntityType.SLIME) {
return;
}
-
+
Player clicker = event.getPlayer();
if (clicker.getGameMode() == GameMode.SPECTATOR) {
return;
}
-
+
NMSEntity entityBase = nmsManager.getNMSEntityBase(event.getRightClicked());
if (entityBase == null) {
return;
@@ -48,5 +48,5 @@ public class InteractListener implements Listener {
((StandardTouchableLine) line).onTouch(clicker);
}
-
+
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/UpdateNotificationListener.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/UpdateNotificationListener.java
index 65cd0482..45bb3ecc 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/UpdateNotificationListener.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/listener/UpdateNotificationListener.java
@@ -36,11 +36,11 @@ public class UpdateNotificationListener implements Listener {
public void onJoin(PlayerJoinEvent event) {
if (Configuration.updateNotification && newVersion != null) {
Player player = event.getPlayer();
-
+
if (player.hasPermission(Permissions.UPDATE_NOTIFICATION)) {
- player.sendMessage(Colors.PRIMARY_SHADOW + "[HolographicDisplays] "
+ player.sendMessage(Colors.PRIMARY_SHADOW + "[HolographicDisplays] "
+ Colors.PRIMARY + "Found an update: " + newVersion + ". Download:");
- player.sendMessage(Colors.PRIMARY_SHADOW + ">> "
+ player.sendMessage(Colors.PRIMARY_SHADOW + ">> "
+ Colors.PRIMARY + "https://dev.bukkit.org/projects/holographic-displays");
}
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/MessagePartJoiner.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/MessagePartJoiner.java
index 976b9250..fff9a545 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/MessagePartJoiner.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/MessagePartJoiner.java
@@ -62,7 +62,7 @@ class MessagePartJoiner {
if (previousMessagePart == null) {
return;
}
-
+
if (hasSentenceEnding(previousMessagePart)) {
output.append(" ");
this.appendedFirstSentenceSeparator = false;
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/PrintableErrorCollector.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/PrintableErrorCollector.java
index 480e9002..915cdfe4 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/PrintableErrorCollector.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/log/PrintableErrorCollector.java
@@ -18,15 +18,15 @@ import java.util.ArrayList;
import java.util.List;
public class PrintableErrorCollector extends ErrorCollector {
-
+
private static final String ERROR_PREFIX = ChatColor.RED + "[HolographicDisplays] ";
-
+
public void logErrorCount() {
Bukkit.getConsoleSender().sendMessage(ERROR_PREFIX
+ "Encountered " + getErrorsCount() + " error(s) on load. "
+ "Check previous console logs for more information.");
}
-
+
@Override
public void logToConsole() {
StringBuilder output = new StringBuilder();
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/StandardPlaceholder.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/StandardPlaceholder.java
index 19289cab..e31dd112 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/StandardPlaceholder.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/StandardPlaceholder.java
@@ -45,7 +45,7 @@ public abstract class StandardPlaceholder {
/*
* Below methods may use externally provided objects which can throw any exception
*/
-
+
protected abstract int doGetRefreshIntervalTicks() throws Throwable;
protected abstract @Nullable String doGetReplacement(Player player, @Nullable String argument) throws Throwable;
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/TickClock.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/TickClock.java
index 54a36383..66452e92 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/TickClock.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/TickClock.java
@@ -8,7 +8,7 @@ package me.filoghost.holographicdisplays.plugin.placeholder;
public class TickClock {
private long currentTick;
-
+
public void incrementTick() {
currentTick++;
}
@@ -16,5 +16,5 @@ public class TickClock {
public long getCurrentTick() {
return currentTick;
}
-
+
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationPlaceholder.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationPlaceholder.java
index fc7f6029..b491a93f 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationPlaceholder.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationPlaceholder.java
@@ -14,7 +14,7 @@ public class AnimationPlaceholder implements Placeholder {
private final int refreshIntervalTicks;
private final List frames;
private int currentIndex;
-
+
public AnimationPlaceholder(int refreshIntervalTicks, List frames) {
this.frames = frames;
this.refreshIntervalTicks = refreshIntervalTicks;
@@ -24,7 +24,7 @@ public class AnimationPlaceholder implements Placeholder {
public int getRefreshIntervalTicks() {
return refreshIntervalTicks;
}
-
+
@Override
public String getReplacement(String argument) {
String result = frames.get(currentIndex);
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationRegistry.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationRegistry.java
index f04ac2d3..a30c5136 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationRegistry.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/AnimationRegistry.java
@@ -22,9 +22,9 @@ import java.util.Map;
import java.util.stream.Stream;
public class AnimationRegistry implements PlaceholderFactory {
-
+
private static final String SPEED_PREFIX = "speed:";
-
+
private final Map animationsByFilename = new HashMap<>();
public void loadAnimations(ConfigManager configManager, ErrorCollector errorCollector) throws IOException, ConfigSaveException {
@@ -36,7 +36,7 @@ public class AnimationRegistry implements PlaceholderFactory {
configManager.getExampleAnimationLoader().createDefault();
return;
}
-
+
try (Stream animationFiles = Files.list(animationFolder)) {
animationFiles.forEach(file -> readAnimationFile(file, errorCollector));
}
@@ -44,7 +44,7 @@ public class AnimationRegistry implements PlaceholderFactory {
private void readAnimationFile(Path file, ErrorCollector errorCollector) {
String fileName = file.getFileName().toString();
-
+
try {
List lines = Files.readAllLines(file);
if (lines.size() == 0) {
@@ -68,14 +68,14 @@ public class AnimationRegistry implements PlaceholderFactory {
}
if (!validSpeedFound) {
- errorCollector.add("could not find a valid \"" + SPEED_PREFIX + " \""
- + " in the first line of the file \"" + fileName + "\","
+ errorCollector.add("could not find a valid \"" + SPEED_PREFIX + " \""
+ + " in the first line of the file \"" + fileName + "\","
+ " default speed of 0.5 seconds will be used");
}
if (lines.isEmpty()) {
lines.add("[No lines: " + fileName + "]");
- errorCollector.add("could not find any line in \"" + fileName + "\" (excluding the speed),"
+ errorCollector.add("could not find any line in \"" + fileName + "\" (excluding the speed),"
+ " you should add at least one more line");
}
@@ -92,7 +92,7 @@ public class AnimationRegistry implements PlaceholderFactory {
errorCollector.add(e, "couldn't load the animation file \"" + fileName + "\"");
}
}
-
+
@Override
public Placeholder getPlaceholder(String fileNameArgument) {
Placeholder placeholder = animationsByFilename.get(fileNameArgument);
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/DefaultPlaceholders.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/DefaultPlaceholders.java
index 9ba0d059..a8fbadb5 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/DefaultPlaceholders.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/DefaultPlaceholders.java
@@ -29,7 +29,7 @@ public class DefaultPlaceholders {
BungeeServerTracker bungeeServerTracker) {
HolographicDisplays plugin = HolographicDisplays.getInstance();
placeholderRegistry.unregisterAll(plugin);
-
+
placeholderRegistry.registerGlobalPlaceholder(plugin, "rainbow", new AnimationPlaceholder(4, toStringList(
ChatColor.RED,
ChatColor.GOLD,
@@ -106,7 +106,7 @@ public class DefaultPlaceholders {
placeholderRegistry.registerIndividualPlaceholderReplacer(plugin, "player", Integer.MAX_VALUE, (player, argument) -> {
return player.getName();
});
-
+
placeholderRegistry.registerIndividualPlaceholderReplacer(plugin, "displayName", 20, (player, argument) -> {
return player.getDisplayName();
});
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/OnlinePlayersPlaceholderFactory.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/OnlinePlayersPlaceholderFactory.java
index 75489359..9094ebbd 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/OnlinePlayersPlaceholderFactory.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/OnlinePlayersPlaceholderFactory.java
@@ -26,12 +26,12 @@ public class OnlinePlayersPlaceholderFactory implements PlaceholderFactory {
// No argument specified, return online players in this server
return new LocalOnlinePlayersPlaceholder();
}
-
+
String[] serverNames = Strings.splitAndTrim(argument, ",");
return new BungeeOnlinePlayersPlaceholder(serverNames, bungeeServerTracker);
}
-
-
+
+
private static class LocalOnlinePlayersPlaceholder implements Placeholder {
@Override
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/WorldPlayersPlaceholderFactory.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/WorldPlayersPlaceholderFactory.java
index 549e1e12..2acd4b2f 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/WorldPlayersPlaceholderFactory.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/internal/WorldPlayersPlaceholderFactory.java
@@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
public class WorldPlayersPlaceholderFactory implements PlaceholderFactory {
-
+
@Override
public Placeholder getPlaceholder(@Nullable String argument) {
if (argument == null) {
@@ -42,7 +42,7 @@ public class WorldPlayersPlaceholderFactory implements PlaceholderFactory {
@Override
public String getReplacement(@Nullable String argument) {
int count = 0;
-
+
for (String worldName : worldNames) {
World world = Bukkit.getWorld(worldName);
if (world == null) {
@@ -55,7 +55,7 @@ public class WorldPlayersPlaceholderFactory implements PlaceholderFactory {
}
}
}
-
+
return String.valueOf(count);
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderIdentifier.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderIdentifier.java
index 0772bcee..b5a1b06f 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderIdentifier.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderIdentifier.java
@@ -10,7 +10,7 @@ import me.filoghost.fcommons.collection.CaseInsensitiveString;
public class PlaceholderIdentifier {
private final CaseInsensitiveString identifier;
-
+
public PlaceholderIdentifier(String identifier) {
this.identifier = new CaseInsensitiveString(identifier);
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderOccurrence.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderOccurrence.java
index d9f84999..8cd790d1 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderOccurrence.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderOccurrence.java
@@ -12,11 +12,11 @@ import org.jetbrains.annotations.Nullable;
import java.util.Objects;
public class PlaceholderOccurrence {
-
+
private final PluginName pluginName;
private final PlaceholderIdentifier identifier;
private final String argument;
-
+
private final int hashCode; // Cached for performance reasons
private PlaceholderOccurrence(PluginName pluginName, PlaceholderIdentifier identifier, String argument) {
@@ -25,15 +25,15 @@ public class PlaceholderOccurrence {
this.argument = argument;
this.hashCode = Objects.hash(pluginName, identifier, argument);
}
-
+
public @Nullable PluginName getPluginName() {
return pluginName;
}
-
+
public @NotNull PlaceholderIdentifier getIdentifier() {
return identifier;
}
-
+
public @Nullable String getArgument() {
return argument;
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderReplaceFunction.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderReplaceFunction.java
index 86feb115..6411b338 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderReplaceFunction.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PlaceholderReplaceFunction.java
@@ -9,5 +9,5 @@ package me.filoghost.holographicdisplays.plugin.placeholder.parsing;
public interface PlaceholderReplaceFunction {
String getReplacement(PlaceholderOccurrence placeholderOccurrence);
-
+
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PluginName.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PluginName.java
index b49dc6c8..8bb27236 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PluginName.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/PluginName.java
@@ -37,7 +37,7 @@ public class PluginName {
public final int hashCode() {
return pluginName.hashCode();
}
-
+
@Override
public String toString() {
return pluginName.toString();
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholders.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholders.java
index 494837ab..07613492 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholders.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholders.java
@@ -28,7 +28,7 @@ public class StringWithPlaceholders {
this.string = string;
this.stringParts = stringParts;
}
-
+
@Override
public String toString() {
return string;
@@ -42,7 +42,7 @@ public class StringWithPlaceholders {
if (stringParts == null) {
return false;
}
-
+
for (StringPart stringPart : stringParts) {
if (stringPart instanceof PlaceholderStringPart) {
PlaceholderStringPart placeholderStringPart = (PlaceholderStringPart) stringPart;
@@ -51,7 +51,7 @@ public class StringWithPlaceholders {
}
}
}
-
+
return false;
}
@@ -63,7 +63,7 @@ public class StringWithPlaceholders {
StringBuilder output = new StringBuilder();
StringBuilder fullOutput = new StringBuilder();
List newStringParts = null; // Lazy initialization
-
+
for (StringPart part : stringParts) {
if (part instanceof PlaceholderStringPart) {
PlaceholderStringPart placeholderStringPart = (PlaceholderStringPart) part;
@@ -91,11 +91,11 @@ public class StringWithPlaceholders {
fullOutput.append(literalStringPart.literalString);
}
}
-
+
if (output.length() > 0 && newStringParts != null) {
newStringParts.add(new LiteralStringPart(output.toString()));
}
-
+
return new StringWithPlaceholders(fullOutput.toString(), newStringParts);
}
@@ -103,15 +103,15 @@ public class StringWithPlaceholders {
if (!containsPlaceholders()) {
return string;
}
-
+
StringBuilder output = new StringBuilder();
for (StringPart part : stringParts) {
output.append(part.getValue(replaceFunction));
}
-
+
return output.toString();
}
-
+
private @Nullable List splitToParts(String string) {
int placeholderStartIndex = -1;
int lastAppendIndex = 0;
@@ -124,14 +124,14 @@ public class StringWithPlaceholders {
// Inside placeholder
if (currentChar == PLACEHOLDER_END_CHAR) {
int endIndex = currentIndex + 1;
-
+
// The unparsed string includes the opening and closing tags (e.g.: "{online: lobby}")
String unparsedString = string.substring(placeholderStartIndex, endIndex);
-
+
// The content string does NOT include the opening and closing tags (e.g.: "online: lobby")
String contentString = unparsedString.substring(1, unparsedString.length() - 1);
PlaceholderOccurrence content = PlaceholderOccurrence.parse(contentString);
-
+
if (stringParts == null) {
stringParts = new ArrayList<>();
}
@@ -140,7 +140,7 @@ public class StringWithPlaceholders {
if (placeholderStartIndex != lastAppendIndex) {
stringParts.add(new LiteralStringPart(string.substring(lastAppendIndex, placeholderStartIndex)));
}
-
+
// Append placeholder part
stringParts.add(new PlaceholderStringPart(content, unparsedString));
lastAppendIndex = endIndex;
@@ -157,25 +157,25 @@ public class StringWithPlaceholders {
}
}
}
-
+
// Append trailing literal part (if any)
if (lastAppendIndex != string.length() && stringParts != null) {
stringParts.add(new LiteralStringPart(string.substring(lastAppendIndex)));
}
-
+
return stringParts;
}
-
-
+
+
private interface StringPart {
-
+
String getValue(PlaceholderReplaceFunction placeholderReplaceFunction);
-
+
}
-
-
+
+
private static class LiteralStringPart implements StringPart {
-
+
private final String literalString;
LiteralStringPart(String literalString) {
@@ -188,7 +188,7 @@ public class StringWithPlaceholders {
}
}
-
+
private static class PlaceholderStringPart implements StringPart {
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/GlobalPlaceholderExpansion.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/GlobalPlaceholderExpansion.java
index 9f43e75b..f0c682db 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/GlobalPlaceholderExpansion.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/GlobalPlaceholderExpansion.java
@@ -36,7 +36,7 @@ class GlobalPlaceholderExpansion extends PlaceholderExpansion {
} catch (Throwable t) {
throw new PlaceholderException(t, this);
}
-
+
if (placeholder != null) {
return new GlobalStandardPlaceholder(placeholder, this);
} else {
@@ -44,26 +44,26 @@ class GlobalPlaceholderExpansion extends PlaceholderExpansion {
}
}
-
+
private static class GlobalStandardPlaceholder extends StandardPlaceholder {
-
+
private final @NotNull Placeholder placeholder;
-
+
GlobalStandardPlaceholder(@NotNull Placeholder placeholder, @NotNull GlobalPlaceholderExpansion source) {
super(source);
this.placeholder = placeholder;
}
-
+
@Override
protected int doGetRefreshIntervalTicks() {
return placeholder.getRefreshIntervalTicks();
}
-
+
@Override
protected @Nullable String doGetReplacement(Player player, @Nullable String argument) {
return placeholder.getReplacement(argument);
}
-
+
}
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/IndividualPlaceholderExpansion.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/IndividualPlaceholderExpansion.java
index 16182bbc..e01bdf33 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/IndividualPlaceholderExpansion.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/IndividualPlaceholderExpansion.java
@@ -36,7 +36,7 @@ class IndividualPlaceholderExpansion extends PlaceholderExpansion {
} catch (Throwable t) {
throw new PlaceholderException(t, this);
}
-
+
if (placeholder != null) {
return new IndividualStandardPlaceholder(placeholder, this);
} else {
@@ -44,26 +44,26 @@ class IndividualPlaceholderExpansion extends PlaceholderExpansion {
}
}
-
+
private static class IndividualStandardPlaceholder extends StandardPlaceholder {
-
+
private final @NotNull IndividualPlaceholder placeholder;
-
+
IndividualStandardPlaceholder(@NotNull IndividualPlaceholder placeholder, @NotNull IndividualPlaceholderExpansion source) {
super(source);
this.placeholder = placeholder;
}
-
+
@Override
protected int doGetRefreshIntervalTicks() {
return placeholder.getRefreshIntervalTicks();
}
-
+
@Override
protected @Nullable String doGetReplacement(Player player, @Nullable String argument) {
return placeholder.getReplacement(player, argument);
}
-
+
}
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderExpansion.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderExpansion.java
index 8c78296a..2d407d47 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderExpansion.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderExpansion.java
@@ -13,15 +13,15 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.Nullable;
public abstract class PlaceholderExpansion {
-
+
private final PluginName pluginName;
private final PlaceholderIdentifier identifier;
-
+
public PlaceholderExpansion(Plugin plugin, String identifier) {
this.pluginName = new PluginName(plugin);
this.identifier = new PlaceholderIdentifier(identifier);
}
-
+
public PluginName getPluginName() {
return pluginName;
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java
index c1a7d574..429ec7be 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java
@@ -24,10 +24,10 @@ import java.util.ArrayList;
import java.util.List;
public class PlaceholderRegistry {
-
+
private final Table placeholderExpansions;
private Runnable changeListener;
-
+
public PlaceholderRegistry() {
this.placeholderExpansions = HashBasedTable.create();
}
@@ -39,7 +39,7 @@ public class PlaceholderRegistry {
public void registerIndividualPlaceholderReplacer(Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplacer placeholderReplacer) {
registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, placeholderReplacer));
}
-
+
public void registerIndividualPlaceholder(Plugin plugin, String identifier, IndividualPlaceholder placeholder) {
registerIndividualPlaceholderFactory(plugin, identifier, (String argument) -> placeholder);
}
@@ -52,38 +52,38 @@ public class PlaceholderRegistry {
public void registerGlobalPlaceholderReplacer(Plugin plugin, String identifier, int refreshIntervalTicks, PlaceholderReplacer placeholderReplacer) {
registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, placeholderReplacer));
}
-
+
public void registerGlobalPlaceholder(Plugin plugin, String identifier, Placeholder placeholder) {
registerGlobalPlaceholderFactory(plugin, identifier, (String argument) -> placeholder);
}
-
+
public void registerGlobalPlaceholderFactory(Plugin plugin, String identifier, PlaceholderFactory factory) {
PlaceholderExpansion expansion = new GlobalPlaceholderExpansion(plugin, identifier, factory);
registerExpansion(expansion);
}
-
+
private void registerExpansion(PlaceholderExpansion expansion) {
placeholderExpansions.put(expansion.getIdentifier(), expansion.getPluginName(), expansion);
changeListener.run();
}
-
+
public void unregisterAll(Plugin plugin) {
placeholderExpansions.column(new PluginName(plugin)).clear();
-
+
changeListener.run();
}
public void unregister(Plugin plugin, String identifier) {
placeholderExpansions.remove(new PlaceholderIdentifier(identifier), new PluginName(plugin));
-
+
changeListener.run();
}
-
+
public @Nullable PlaceholderExpansion find(PlaceholderOccurrence textOccurrence) {
PluginName pluginName = textOccurrence.getPluginName();
PlaceholderIdentifier identifier = textOccurrence.getIdentifier();
-
+
if (pluginName != null) {
// Find exact entry if plugin name is specified
return placeholderExpansions.get(identifier, pluginName);
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderExceptionHandler.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderExceptionHandler.java
index c515f6d7..6466e3da 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderExceptionHandler.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderExceptionHandler.java
@@ -22,16 +22,16 @@ class PlaceholderExceptionHandler {
this.tickClock = tickClock;
this.lastErrorLogByPlaceholderExpansion = new WeakHashMap<>();
}
-
+
void handle(PlaceholderException exception) {
PlaceholderExpansion placeholderExpansion = exception.getPlaceholderExpansion();
Long lastErrorLog = lastErrorLogByPlaceholderExpansion.get(placeholderExpansion);
long currentTick = tickClock.getCurrentTick();
-
+
if (lastErrorLog != null && currentTick - lastErrorLog < 20) {
return; // Avoid spamming the console too frequently
}
-
+
lastErrorLogByPlaceholderExpansion.put(placeholderExpansion, currentTick);
Log.warning("The placeholder \"" + placeholderExpansion.getIdentifier() + "\""
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderTracker.java
index 4f8bf1a3..f275996a 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderTracker.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/PlaceholderTracker.java
@@ -56,7 +56,7 @@ public class PlaceholderTracker {
public @Nullable String updateAndGetIndividualReplacement(PlaceholderOccurrence placeholderOccurrence, Player player) {
return updateAndGetReplacement(placeholderOccurrence, player, true);
}
-
+
private @Nullable String updateAndGetReplacement(PlaceholderOccurrence placeholderOccurrence, Player player, boolean individual) {
try {
TrackedPlaceholder trackedPlaceholder = getTrackedPlaceholder(placeholderOccurrence);
@@ -85,13 +85,13 @@ public class PlaceholderTracker {
private TrackedPlaceholder createTrackedPlaceholder(PlaceholderOccurrence placeholderOccurrence) throws PlaceholderException {
PlaceholderExpansion placeholderExpansion = registry.find(placeholderOccurrence);
StandardPlaceholder placeholder;
-
+
if (placeholderExpansion != null) {
placeholder = placeholderExpansion.createPlaceholder(placeholderOccurrence.getArgument());
} else {
placeholder = null;
}
-
+
if (placeholder == null) {
return new TrackedNullPlaceholder(placeholderExpansion);
} else if (placeholder.isIndividual()) {
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedGlobalPlaceholder.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedGlobalPlaceholder.java
index 43accd24..9b278351 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedGlobalPlaceholder.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedGlobalPlaceholder.java
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class TrackedGlobalPlaceholder extends TrackedPlaceholder {
-
+
private final ReplacementHolder replacementHolder;
TrackedGlobalPlaceholder(@NotNull StandardPlaceholder placeholder, @NotNull PlaceholderOccurrence placeholderOccurrence) {
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedPlaceholder.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedPlaceholder.java
index faa32d34..e6b0d176 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedPlaceholder.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/tracking/TrackedPlaceholder.java
@@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
abstract class TrackedPlaceholder {
-
+
private final @Nullable PlaceholderExpansion source;
TrackedPlaceholder(@Nullable PlaceholderExpansion source) {
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/FileUtils.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/FileUtils.java
index 2c9e6cb6..7e08d680 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/FileUtils.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/FileUtils.java
@@ -9,7 +9,7 @@ import java.nio.file.Path;
public class FileUtils {
-
+
public static String getExtension(String fileName) {
int lastFullStop = fileName.lastIndexOf('.');
if (lastFullStop >= 0) {
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/NMSVersion.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/NMSVersion.java
index 4ed3c34e..4a944f5f 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/NMSVersion.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/NMSVersion.java
@@ -17,7 +17,7 @@ import java.util.regex.Pattern;
* The NMS version is the name of the main package under net.minecraft.server, for example "v1_13_R2".
*/
public enum NMSVersion {
-
+
// Not using shorter method reference syntax here because it initializes the class, causing a ClassNotFoundException
v1_8_R2(packetSettings -> new me.filoghost.holographicdisplays.nms.v1_8_R2.VersionNMSManager(packetSettings)),
v1_8_R3(packetSettings -> new me.filoghost.holographicdisplays.nms.v1_8_R3.VersionNMSManager(packetSettings)),
@@ -33,9 +33,9 @@ public enum NMSVersion {
v1_16_R1(packetSettings -> new me.filoghost.holographicdisplays.nms.v1_16_R1.VersionNMSManager(packetSettings)),
v1_16_R2(packetSettings -> new me.filoghost.holographicdisplays.nms.v1_16_R2.VersionNMSManager(packetSettings)),
v1_16_R3(packetSettings -> new me.filoghost.holographicdisplays.nms.v1_16_R3.VersionNMSManager(packetSettings));
-
+
private static final NMSVersion CURRENT_VERSION = extractCurrentVersion();
-
+
private final NMSManagerConstructor nmsManagerConstructor;
NMSVersion(NMSManagerConstructor nmsManagerConstructor) {
@@ -59,7 +59,7 @@ public enum NMSVersion {
return null; // Unknown version
}
}
-
+
public static boolean isValid() {
return CURRENT_VERSION != null;
}
@@ -77,7 +77,7 @@ public enum NMSVersion {
private interface NMSManagerConstructor {
NMSManager create(ProtocolPacketSettings protocolPacketSettings);
-
+
}
-
+
}
diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/VersionUtils.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/VersionUtils.java
index 04d4a598..31a00e01 100644
--- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/VersionUtils.java
+++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/util/VersionUtils.java
@@ -19,21 +19,21 @@ public class VersionUtils {
private static int compare(String version1, String version2) throws NumberFormatException {
String[] version1Split = Strings.split(version1, ".");
String[] version2Split = Strings.split(version2, ".");
-
+
int longest = Math.max(version1Split.length, version2Split.length);
-
+
// Default value is 0 (for elements not explicitly set)
int[] version1NumbersArray = new int[longest];
int[] version2NumbersArray = new int[longest];
-
+
for (int i = 0; i < version1Split.length; i++) {
version1NumbersArray[i] = Integer.parseInt(version1Split[i]);
}
-
+
for (int i = 0; i < version2Split.length; i++) {
version2NumbersArray[i] = Integer.parseInt(version2Split[i]);
}
-
+
for (int i = 0; i < longest; i++) {
int diff = version1NumbersArray[i] - version2NumbersArray[i];
if (diff > 0) {
@@ -42,8 +42,8 @@ public class VersionUtils {
return -1;
}
}
-
+
return 0;
}
-
+
}
diff --git a/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/api/v2/V2TouchableLineAdapterTest.java b/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/api/v2/V2TouchableLineAdapterTest.java
index 08ea643b..64ed9458 100644
--- a/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/api/v2/V2TouchableLineAdapterTest.java
+++ b/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/api/v2/V2TouchableLineAdapterTest.java
@@ -29,7 +29,7 @@ class V2TouchableLineAdapterTest {
newLine.setTouchHandler(newTouchHandler);
v2Line.setTouchHandler(null);
-
+
assertThat(v2Line.getTouchHandler()).isNull();
assertThat(newLine.getTouchHandler()).isNull();
}
@@ -39,7 +39,7 @@ class V2TouchableLineAdapterTest {
APITextLine newLine = new APITextLine(hologram, "");
TextLine v2Line = newLine.getV2Adapter();
ExampleV2TouchHandler v2TouchHandler = new ExampleV2TouchHandler();
-
+
v2Line.setTouchHandler(v2TouchHandler);
newLine.setTouchHandler(null);
@@ -53,7 +53,7 @@ class V2TouchableLineAdapterTest {
ExampleV2TouchHandler v2TouchHandler = new ExampleV2TouchHandler();
v2Line.setTouchHandler(v2TouchHandler);
-
+
assertThat(v2Line.getTouchHandler()).isSameAs(v2TouchHandler);
}
@@ -62,9 +62,9 @@ class V2TouchableLineAdapterTest {
APITextLine newLine = new APITextLine(hologram, "");
TextLine v2Line = newLine.getV2Adapter();
ExampleNewTouchHandler newTouchHandler = new ExampleNewTouchHandler();
-
+
newLine.setTouchHandler(newTouchHandler);
-
+
assertThat(v2Line.getTouchHandler()).isNotNull();
}
@@ -96,12 +96,12 @@ class V2TouchableLineAdapterTest {
APITextLine newLine = new APITextLine(hologram, "");
TextLine v2Line = newLine.getV2Adapter();
ExampleV2TouchHandler v2TouchHandler = new ExampleV2TouchHandler();
-
+
v2Line.setTouchHandler(v2TouchHandler);
TouchHandler newTouchHandlerA = newLine.getTouchHandler();
v2Line.setTouchHandler(v2TouchHandler);
TouchHandler newTouchHandlerB = newLine.getTouchHandler();
-
+
assertThat(newTouchHandlerA).isSameAs(newTouchHandlerB);
}
@@ -128,7 +128,7 @@ class V2TouchableLineAdapterTest {
com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler v2TouchHandlerA = v2Line.getTouchHandler();
newLine.setTouchHandler(new ExampleNewTouchHandler());
com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler v2TouchHandlerB = v2Line.getTouchHandler();
-
+
assertThat(v2TouchHandlerA).isNotSameAs(v2TouchHandlerB);
}
@@ -150,9 +150,9 @@ class V2TouchableLineAdapterTest {
APITextLine newLine = new APITextLine(hologram, "");
TextLine v2Line = newLine.getV2Adapter();
ExampleV2TouchHandler v2TouchHandler = new ExampleV2TouchHandler();
-
+
v2Line.setTouchHandler(v2TouchHandler);
-
+
TouchHandler newTouchHandler = newLine.getTouchHandler();
v2Line.setTouchHandler(null); // This also clears the adapter
newLine.setTouchHandler(newTouchHandler); // Return to the initial value
@@ -167,9 +167,9 @@ class V2TouchableLineAdapterTest {
APITextLine newLine = new APITextLine(hologram, "");
TextLine v2Line = newLine.getV2Adapter();
ExampleNewTouchHandler newTouchHandler = new ExampleNewTouchHandler();
-
+
newLine.setTouchHandler(newTouchHandler);
-
+
com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler v2TouchHandler = v2Line.getTouchHandler();
v2Line.setTouchHandler(null); // This also clears the adapter
v2Line.setTouchHandler(v2TouchHandler); // Return to the initial value
@@ -186,8 +186,8 @@ class V2TouchableLineAdapterTest {
public void onTouch(@NotNull Player player) {}
}
-
-
+
+
private static class ExampleV2TouchHandler implements com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler {
@Override
diff --git a/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholdersTest.java b/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholdersTest.java
index de0d50fa..c8baf047 100644
--- a/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholdersTest.java
+++ b/plugin/src/test/java/me/filoghost/holographicdisplays/plugin/placeholder/parsing/StringWithPlaceholdersTest.java
@@ -23,11 +23,11 @@ class StringWithPlaceholdersTest {
void replacements(String input, String expectedOutput) {
boolean expectedContainsPlaceholders = expectedOutput.contains("#");
StringWithPlaceholders s = new StringWithPlaceholders(input);
-
+
assertThat(s.replacePlaceholders(occurrence -> "#")).isEqualTo(expectedOutput);
assertThat(s.containsPlaceholders()).isEqualTo(expectedContainsPlaceholders);
}
-
+
static Stream replacementsTestArguments() {
return Stream.of(
Arguments.of("", ""),
@@ -40,7 +40,7 @@ class StringWithPlaceholdersTest {
Arguments.of("abc p}", "abc p}") // Placeholder without opening tag
);
}
-
+
@Test
void skipReplacing() {
String input = "{p} a {p} b {p}";
@@ -52,16 +52,16 @@ class StringWithPlaceholdersTest {
@MethodSource("parsingTestArguments")
void parsing(String input, String expectedPluginName, String expectedIdentifier, String expectedArgument) {
StringWithPlaceholders s = new StringWithPlaceholders(input);
-
+
List placeholders = new ArrayList<>();
s.replacePlaceholders(occurrence -> {
placeholders.add(occurrence); // Just save occurrences
return null;
});
assertThat(placeholders).hasSize(1);
-
+
PlaceholderOccurrence placeholder = placeholders.get(0);
-
+
if (expectedPluginName != null) {
assertThat(placeholder.getPluginName()).hasToString(expectedPluginName);
} else {
diff --git a/pom.xml b/pom.xml
index 9ec47749..75cd6d66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
plugin
example
-
+
spigot-repo
@@ -51,18 +51,18 @@
nms-repo
https://repo.codemc.io/repository/nms/
-
+
dmulloy2-repo
https://repo.dmulloy2.net/repository/public/
-
+
placeholderapi-repo
https://repo.extendedclip.com/content/repositories/placeholderapi/
-
+
@@ -70,13 +70,13 @@
holographicdisplays-api
${project.version}
-
+
${project.groupId}
holographicdisplays-common
${project.version}
-
+
${project.groupId}
holographicdisplays-legacy-api-v1
@@ -88,79 +88,79 @@
holographicdisplays-legacy-api-v2
${project.version}
-
+
${project.groupId}
holographicdisplays-config
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-interfaces
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_8_r2
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_8_r3
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_9_r1
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_9_r2
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_10_r1
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_11_r1
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_12_r1
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_13_r1
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_13_r2
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_14_r1
${project.version}
-
+
${project.groupId}
holographicdisplays-nms-v1_15_r1
@@ -184,7 +184,7 @@
holographicdisplays-nms-v1_16_r3
${project.version}
-
+
org.spigotmc
spigot-api
@@ -197,7 +197,7 @@
-
+
com.comphenix.protocol
ProtocolLib
@@ -211,13 +211,13 @@
2.8.1
provided
-
+
org.bstats
bstats-bukkit-lite
1.7
-
+
me.filoghost.updatechecker
updatechecker
@@ -264,7 +264,7 @@
clean package
-
+
@@ -280,7 +280,7 @@
-
+
org.apache.maven.plugins
maven-javadoc-plugin
@@ -300,13 +300,13 @@
build-helper-maven-plugin
3.2.0
-
+
org.apache.maven.plugins
maven-shade-plugin
3.2.3
-
+
org.apache.maven.plugins
maven-enforcer-plugin
@@ -318,7 +318,7 @@
directory-maven-plugin
0.3.1
-
+
org.apache.maven.plugins
maven-checkstyle-plugin
@@ -332,7 +332,7 @@
-
+
org.apache.maven.plugins