Skip to content

Commit

Permalink
misc: 一些调整
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Dec 16, 2023
1 parent b0eff61 commit 4ce9900
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/xiamomc/morph/backends/fallback/NilBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public boolean disguise(Player player, DisguiseWrapper<?> rawWrapper)
if (!(rawWrapper instanceof NilWrapper wrapper))
return false;

if (playerFallbackWrapperMap.containsKey(player))
unDisguise(player);

playerFallbackWrapperMap.put(player, wrapper);
return true;
}
Expand All @@ -84,6 +87,10 @@ public boolean disguise(Player player, DisguiseWrapper<?> rawWrapper)
public boolean unDisguise(Player player)
{
var wrapper = playerFallbackWrapperMap.getOrDefault(player, null);

if (wrapper != null)
wrapper.dispose();

playerFallbackWrapperMap.remove(player);

return true;
Expand Down

0 comments on commit 4ce9900

Please sign in to comment.