Adventure

Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
This commit is contained in:
Riley Park
2021-01-29 17:21:55 +01:00
parent 8888031206
commit 15081a5912
70 changed files with 3298 additions and 160 deletions

View File

@@ -33,7 +33,9 @@ public interface CommandBlock extends TileState {
* by default is "@".
*
* @return Name of this CommandBlock.
* @deprecated in favour of {@link #name()}
*/
@Deprecated // Paper
@NotNull
public String getName();
@@ -43,6 +45,28 @@ public interface CommandBlock extends TileState {
* same as setting it to "@".
*
* @param name New name for this CommandBlock.
* @deprecated in favour of {@link #name(net.kyori.adventure.text.Component)}
*/
@Deprecated // Paper
public void setName(@Nullable String name);
// Paper start
/**
* Gets the name of this CommandBlock. The name is used with commands
* that this CommandBlock executes. This name will never be null, and
* by default is a {@link net.kyori.adventure.text.TextComponent} containing {@code @}.
*
* @return Name of this CommandBlock.
*/
public net.kyori.adventure.text.@NotNull Component name();
/**
* Sets the name of this CommandBlock. The name is used with commands
* that this CommandBlock executes. Setting the name to null is the
* same as setting it to a {@link net.kyori.adventure.text.TextComponent} containing {@code @}.
*
* @param name New name for this CommandBlock.
*/
public void name(net.kyori.adventure.text.@Nullable Component name);
// Paper end
}

View File

@@ -12,12 +12,51 @@ import org.jetbrains.annotations.Nullable;
* Represents a captured state of either a SignPost or a WallSign.
*/
public interface Sign extends TileState, Colorable {
// Paper start
/**
* Gets all the lines of text currently on the {@link Side#FRONT} of this sign.
*
* @return List of components containing each line of text
* @deprecated A sign may have multiple writable sides now. Use {@link Sign#getSide(Side)} and {@link SignSide#lines()}.
*/
@NotNull
@Deprecated
public java.util.List<net.kyori.adventure.text.Component> lines();
/**
* Gets the line of text at the specified index on the {@link Side#FRONT}.
* <p>
* For example, getLine(0) will return the first line of text.
*
* @param index Line number to get the text from, starting at 0
* @throws IndexOutOfBoundsException Thrown when the line does not exist
* @return Text on the given line
* @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int)}.
*/
@NotNull
@Deprecated
public net.kyori.adventure.text.Component line(int index) throws IndexOutOfBoundsException;
/**
* Sets the line of text at the specified index on the {@link Side#FRONT}.
* <p>
* For example, setLine(0, "Line One") will set the first line of text to
* "Line One".
*
* @param index Line number to set the text at, starting from 0
* @param line New text to set at the specified index
* @throws IndexOutOfBoundsException If the index is out of the range 0..3
* @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int, net.kyori.adventure.text.Component)}.
*/
@Deprecated
public void line(int index, net.kyori.adventure.text.@NotNull Component line) throws IndexOutOfBoundsException;
// Paper end
/**
* Gets all the lines of text currently on the {@link Side#FRONT} of this sign.
*
* @return Array of Strings containing each line of text
* @deprecated A sign may have multiple writable sides now. Use {@link Sign#getSide(Side)} and {@link SignSide#getLines()}.
* @deprecated A sign may have multiple writable sides now. Use {@link Sign#getSide(Side)} and {@link SignSide#lines()}.
*/
@Deprecated(since = "1.20")
@NotNull
@@ -31,7 +70,7 @@ public interface Sign extends TileState, Colorable {
* @param index Line number to get the text from, starting at 0
* @return Text on the given line
* @throws IndexOutOfBoundsException Thrown when the line does not exist
* @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#getLine(int)}.
* @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int)}.
*/
@Deprecated(since = "1.20")
@NotNull
@@ -46,7 +85,7 @@ public interface Sign extends TileState, Colorable {
* @param index Line number to set the text at, starting from 0
* @param line New text to set at the specified index
* @throws IndexOutOfBoundsException If the index is out of the range 0..3
* @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#setLine(int, String)}.
* @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int, net.kyori.adventure.text.Component)}.
*/
@Deprecated(since = "1.20")
public void setLine(int index, @NotNull String line) throws IndexOutOfBoundsException;

View File

@@ -7,13 +7,48 @@ import org.jetbrains.annotations.NotNull;
* Represents a side of a sign.
*/
public interface SignSide extends Colorable {
// Paper start
/**
* Gets all the lines of text currently on the sign.
*
* @return List of components containing each line of text
*/
@NotNull
public java.util.List<net.kyori.adventure.text.Component> lines();
/**
* Gets the line of text at the specified index.
* <p>
* For example, getLine(0) will return the first line of text.
*
* @param index Line number to get the text from, starting at 0
* @throws IndexOutOfBoundsException Thrown when the line does not exist
* @return Text on the given line
*/
@NotNull
public net.kyori.adventure.text.Component line(int index) throws IndexOutOfBoundsException;
/**
* Sets the line of text at the specified index.
* <p>
* For example, setLine(0, "Line One") will set the first line of text to
* "Line One".
*
* @param index Line number to set the text at, starting from 0
* @param line New text to set at the specified index
* @throws IndexOutOfBoundsException If the index is out of the range 0..3
*/
public void line(int index, net.kyori.adventure.text.@NotNull Component line) throws IndexOutOfBoundsException;
// Paper end
/**
* Gets all the lines of text currently on this side of the sign.
*
* @return Array of Strings containing each line of text
* @deprecated in favour of {@link #lines()}
*/
@NotNull
@Deprecated // Paper
public String[] getLines();
/**
@@ -24,8 +59,10 @@ public interface SignSide extends Colorable {
* @param index Line number to get the text from, starting at 0
* @return Text on the given line
* @throws IndexOutOfBoundsException Thrown when the line does not exist
* @deprecated in favour of {@link #line(int)}
*/
@NotNull
@Deprecated // Paper
public String getLine(int index) throws IndexOutOfBoundsException;
/**
@@ -37,7 +74,9 @@ public interface SignSide extends Colorable {
* @param index Line number to set the text at, starting from 0
* @param line New text to set at the specified index
* @throws IndexOutOfBoundsException If the index is out of the range 0..3
* @deprecated in favour of {@link #line(int, net.kyori.adventure.text.Component)}
*/
@Deprecated // Paper
public void setLine(int index, @NotNull String line) throws IndexOutOfBoundsException;
/**