Skip to content

Commit

Permalink
fix rejoin lost some properties
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Dec 14, 2023
1 parent 0af906f commit 479faa0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ public boolean isDisguised(@org.jetbrains.annotations.Nullable Entity target)
@Override
public boolean disguise(Player player, DisguiseWrapper<?> wrapper)
{
logger.info("Incoming wrapper is " + wrapper);
if (!(wrapper instanceof ServerDisguiseWrapper serverDisguiseWrapper)) return false;
if (disguiseWrapperMap.containsKey(player.getUniqueId())) return false;
if (disguiseWrapperMap.containsKey(player.getUniqueId()))
unDisguise(player);

disguiseWrapperMap.put(player.getUniqueId(), serverDisguiseWrapper);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import xiamomc.morph.misc.DisguiseState;
import xiamomc.morph.utilities.NbtUtils;

import java.util.Objects;
import java.util.UUID;

public class ServerDisguiseWrapper extends DisguiseWrapper<ServerDisguise>
Expand Down Expand Up @@ -155,7 +156,17 @@ public ServerDisguise copyInstance()
@Override
public DisguiseWrapper<ServerDisguise> clone()
{
return new ServerDisguiseWrapper(this.copyInstance(), (ServerBackend) getBackend());
var newInstance = new ServerDisguiseWrapper(this.copyInstance(), (ServerBackend) getBackend());
newInstance.mergeCompound(this.getCompound());

newInstance.shouldDisplayCustomEquipment = this.shouldDisplayCustomEquipment;
newInstance.setFakeEquipments(this.equipment);

newInstance.armorStandShowArms = this.armorStandShowArms;
newInstance.armorStandSmall = this.armorStandSmall;
newInstance.armorStandNoBasePlate = this.armorStandNoBasePlate;

return newInstance;
}

/**
Expand Down Expand Up @@ -303,8 +314,10 @@ public Player getBindingPlayer()

private SingleWatcher bindingWatcher;

public void setRenderParameters(Player newBinding, SingleWatcher bindingWatcher)
public void setRenderParameters(@NotNull Player newBinding, @NotNull SingleWatcher bindingWatcher)
{
Objects.requireNonNull(bindingWatcher, "Null Watcher!");

bindingPlayer = newBinding;
this.bindingWatcher = bindingWatcher;

Expand Down

0 comments on commit 479faa0

Please sign in to comment.