mirror of
https://github.com/CosmicStar98/bedrocktool.git
synced 2024-06-01 19:25:14 +00:00
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
|
return
|
||||||
}
|
}
|
||||||
process_packet_skins(out_path, pk)
|
process_packet_skins(conn, out_path, pk)
|
||||||
|
|
||||||
if err = conn.WritePacket(pk); err != nil {
|
if err = conn.WritePacket(pk); err != nil {
|
||||||
return
|
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_filter_player string // who to filter
|
||||||
var skin_players = make(map[string]string)
|
var skin_players = make(map[string]string)
|
||||||
var skin_player_counts = make(map[string]int)
|
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) {
|
switch _pk := pk.(type) {
|
||||||
case *packet.PlayerSkin:
|
case *packet.PlayerSkin:
|
||||||
name := skin_players[_pk.UUID.String()]
|
name := skin_players[_pk.UUID.String()]
|
||||||
|
@ -156,8 +157,15 @@ func process_packet_skins(out_path string, pk packet.Packet) {
|
||||||
if name == "" {
|
if name == "" {
|
||||||
name = player.UUID.String()
|
name = player.UUID.String()
|
||||||
}
|
}
|
||||||
|
if _, ok := processed_skins[name]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
write_skin(out_path, name, player.Skin)
|
write_skin(out_path, name, player.Skin)
|
||||||
skin_players[player.UUID.String()] = name
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
process_packet_skins(out_path, pk)
|
process_packet_skins(nil, out_path, pk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
utils.go
Normal file
13
utils.go
Normal file
|
@ -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)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conn.WritePacket(&packet.Text{
|
send_popup(conn, fmt.Sprintf("%d chunks loaded", len(world_state.chunks)))
|
||||||
TextType: packet.TextTypePopup,
|
|
||||||
Message: fmt.Sprintf("%d chunks loaded", len(world_state.chunks)),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := conn.WritePacket(pk); err != nil {
|
if err := conn.WritePacket(pk); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user