add popup in skins proxy
This commit is contained in:
parent
c93a360d09
commit
87bc15ec80
|
@ -82,7 +82,7 @@ func skin_proxy_main(ctx context.Context, args []string) error {
|
|||
}
|
||||
return
|
||||
}
|
||||
process_packet_skins(out_path, pk)
|
||||
process_packet_skins(conn, out_path, pk)
|
||||
|
||||
if err = conn.WritePacket(pk); err != nil {
|
||||
return
|
||||
|
|
12
skins.go
12
skins.go
|
@ -136,8 +136,9 @@ func write_skin(output_path, name string, skin protocol.Skin) {
|
|||
var skin_filter_player string // who to filter
|
||||
var skin_players = make(map[string]string)
|
||||
var skin_player_counts = make(map[string]int)
|
||||
var processed_skins = make(map[string]bool)
|
||||
|
||||
func process_packet_skins(out_path string, pk packet.Packet) {
|
||||
func process_packet_skins(conn *minecraft.Conn, out_path string, pk packet.Packet) {
|
||||
switch _pk := pk.(type) {
|
||||
case *packet.PlayerSkin:
|
||||
name := skin_players[_pk.UUID.String()]
|
||||
|
@ -156,8 +157,15 @@ func process_packet_skins(out_path string, pk packet.Packet) {
|
|||
if name == "" {
|
||||
name = player.UUID.String()
|
||||
}
|
||||
if _, ok := processed_skins[name]; ok {
|
||||
continue
|
||||
}
|
||||
write_skin(out_path, name, player.Skin)
|
||||
skin_players[player.UUID.String()] = name
|
||||
processed_skins[name] = true
|
||||
if conn != nil {
|
||||
send_popup(conn, fmt.Sprintf("%s Skin was Saved", name))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,6 +214,6 @@ func skin_main(ctx context.Context, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
process_packet_skins(out_path, pk)
|
||||
process_packet_skins(nil, out_path, pk)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/sandertv/gophertunnel/minecraft"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||
)
|
||||
|
||||
func send_popup(conn *minecraft.Conn, text string) {
|
||||
conn.WritePacket(&packet.Text{
|
||||
TextType: packet.TextTypePopup,
|
||||
Message: text,
|
||||
})
|
||||
}
|
5
world.go
5
world.go
|
@ -373,10 +373,7 @@ func handleConn(ctx context.Context, conn *minecraft.Conn, listener *minecraft.L
|
|||
panic(err)
|
||||
}
|
||||
}
|
||||
conn.WritePacket(&packet.Text{
|
||||
TextType: packet.TextTypePopup,
|
||||
Message: fmt.Sprintf("%d chunks loaded", len(world_state.chunks)),
|
||||
})
|
||||
send_popup(conn, fmt.Sprintf("%d chunks loaded", len(world_state.chunks)))
|
||||
}
|
||||
|
||||
if err := conn.WritePacket(pk); err != nil {
|
||||
|
|
Loading…
Reference in New Issue