geforkt von Mirrors/Velocity
add method to clear header and footer
Dieser Commit ist enthalten in:
Ursprung
1f8c8dcd94
Commit
d65e4ed296
@ -60,8 +60,13 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage
|
|||||||
* @param header component with header
|
* @param header component with header
|
||||||
* @param footer component with footer
|
* @param footer component with footer
|
||||||
*/
|
*/
|
||||||
void setHeaderAndFooter(@NonNull Component header, @NonNull Component footer);
|
void setHeaderAndFooter(Component header, Component footer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears a header and footer for the player
|
||||||
|
*/
|
||||||
|
void clearHeaderAndFooter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnects the player with the reason
|
* Disconnects the player with the reason
|
||||||
* @param reason component with the reason
|
* @param reason component with the reason
|
||||||
|
@ -144,6 +144,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
connection.write(HeaderAndFooter.create(header, footer));
|
connection.write(HeaderAndFooter.create(header, footer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearHeaderAndFooter() {
|
||||||
|
connection.write(HeaderAndFooter.reset());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnect(Component reason) {
|
public void disconnect(Component reason) {
|
||||||
connection.closeWith(Disconnect.create(reason));
|
connection.closeWith(Disconnect.create(reason));
|
||||||
|
@ -11,6 +11,8 @@ import net.kyori.text.serializer.ComponentSerializers;
|
|||||||
|
|
||||||
public class HeaderAndFooter implements MinecraftPacket {
|
public class HeaderAndFooter implements MinecraftPacket {
|
||||||
|
|
||||||
|
private static final HeaderAndFooter RESET = new HeaderAndFooter("{\"translate\":\"\"}", "{\"translate\":\"\"}");
|
||||||
|
|
||||||
private String header;
|
private String header;
|
||||||
private String footer;
|
private String footer;
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ public class HeaderAndFooter implements MinecraftPacket {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(ByteBuf buf, Direction direction, int protocolVersion) {
|
public void decode(ByteBuf buf, Direction direction, int protocolVersion) {
|
||||||
// We dont handle this packet from backend
|
throw new UnsupportedOperationException("Decode is not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,4 +56,7 @@ public class HeaderAndFooter implements MinecraftPacket {
|
|||||||
return new HeaderAndFooter(json.serialize(header), json.serialize(footer));
|
return new HeaderAndFooter(json.serialize(header), json.serialize(footer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HeaderAndFooter reset() {
|
||||||
|
return RESET;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren