mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 19:35:00 -04:00
TabList: header and footer
This commit is contained in:
parent
341c29f8cf
commit
f25ec3b5b1
@ -91,7 +91,6 @@ public class Minosoft {
|
|||||||
case OTHER:
|
case OTHER:
|
||||||
path += ".minosoft/";
|
path += ".minosoft/";
|
||||||
break;
|
break;
|
||||||
//ToDo: Mac, Other
|
|
||||||
}
|
}
|
||||||
File folder = new File(path);
|
File folder = new File(path);
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
if (!folder.exists() && !folder.mkdirs()) {
|
||||||
|
@ -47,6 +47,9 @@ public class Player {
|
|||||||
HashMap<Integer, Inventory> inventories = new HashMap<>();
|
HashMap<Integer, Inventory> inventories = new HashMap<>();
|
||||||
boolean spawnConfirmed = false;
|
boolean spawnConfirmed = false;
|
||||||
|
|
||||||
|
TextComponent tabHeader;
|
||||||
|
TextComponent tabFooter;
|
||||||
|
|
||||||
public Player(MojangAccount acc) {
|
public Player(MojangAccount acc) {
|
||||||
this.acc = acc;
|
this.acc = acc;
|
||||||
// create our own inventory without any properties
|
// create our own inventory without any properties
|
||||||
@ -216,4 +219,20 @@ public class Player {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TextComponent getTabHeader() {
|
||||||
|
return tabHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTabHeader(TextComponent tabHeader) {
|
||||||
|
this.tabHeader = tabHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextComponent getTabFooter() {
|
||||||
|
return tabFooter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTabFooter(TextComponent tabFooter) {
|
||||||
|
this.tabFooter = tabFooter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Codename Minosoft
|
||||||
|
* Copyright (C) 2020 Moritz Zwerger
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.game.datatypes.TextComponent;
|
||||||
|
import de.bixilon.minosoft.logging.Log;
|
||||||
|
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.InPacketBuffer;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.PacketHandler;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||||
|
|
||||||
|
public class PacketTabHeaderAndFooter implements ClientboundPacket {
|
||||||
|
TextComponent header;
|
||||||
|
TextComponent footer;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(InPacketBuffer buffer, ProtocolVersion v) {
|
||||||
|
switch (v) {
|
||||||
|
case VERSION_1_8:
|
||||||
|
header = buffer.readTextComponent();
|
||||||
|
footer = buffer.readTextComponent();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void log() {
|
||||||
|
Log.protocol(String.format("Received tab list header: %s", header.getColoredMessage()));
|
||||||
|
Log.protocol(String.format("Received tab list footer: %s", footer.getColoredMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketHandler h) {
|
||||||
|
h.handle(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextComponent getHeader() {
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextComponent getFooter() {
|
||||||
|
return footer;
|
||||||
|
}
|
||||||
|
}
|
@ -479,4 +479,9 @@ public class PacketHandler {
|
|||||||
|
|
||||||
public void handle(PacketServerDifficulty pkg) {
|
public void handle(PacketServerDifficulty pkg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handle(PacketTabHeaderAndFooter pkg) {
|
||||||
|
connection.getPlayer().setTabHeader(pkg.getHeader());
|
||||||
|
connection.getPlayer().setTabFooter(pkg.getFooter());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,7 @@ public abstract class Protocol implements ProtocolInterface {
|
|||||||
packetClassMapping.put(Packets.Clientbound.PLAY_DISPLAY_SCOREBOARD, PacketScoreboardDisplayScoreboard.class);
|
packetClassMapping.put(Packets.Clientbound.PLAY_DISPLAY_SCOREBOARD, PacketScoreboardDisplayScoreboard.class);
|
||||||
packetClassMapping.put(Packets.Clientbound.PLAY_MAP_DATA, PacketMapData.class);
|
packetClassMapping.put(Packets.Clientbound.PLAY_MAP_DATA, PacketMapData.class);
|
||||||
packetClassMapping.put(Packets.Clientbound.PLAY_SERVER_DIFFICULTY, PacketServerDifficulty.class);
|
packetClassMapping.put(Packets.Clientbound.PLAY_SERVER_DIFFICULTY, PacketServerDifficulty.class);
|
||||||
|
packetClassMapping.put(Packets.Clientbound.PLAY_LIST_HEADER_AND_FOOTER, PacketTabHeaderAndFooter.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProtocolVersion getLowestVersionSupported() {
|
public static ProtocolVersion getLowestVersionSupported() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user