File tree Expand file tree Collapse file tree
velocity/src/main/java/com/convallyria/forcepack/velocity/handler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,16 +71,24 @@ public void setPack(final Player player, final ServerInfo serverInfo) {
7171 applying .add (player .getUniqueId ());
7272 task .set (builder .schedule ());
7373 }, () -> {
74+ final ResourcePackInfo appliedResourcePack = player .getAppliedResourcePack ();
7475 // This server doesn't have a pack set - send unload pack if enabled and if they already have one
75- if (player .getAppliedResourcePack () == null ) return ;
76+ if (appliedResourcePack == null ) return ;
77+
7678 final VelocityConfig unloadPack = plugin .getConfig ().getConfig ("unload-pack" );
7779 final boolean enableUnload = unloadPack .getBoolean ("enable" );
7880 if (!enableUnload ) return ;
7981
8082 final List <String > excluded = unloadPack .getStringList ("exclude" );
8183 if (excluded .contains (serverInfo .getName ())) return ;
8284
83- plugin .getPackByServer (ForcePackVelocity .EMPTY_SERVER_NAME ).ifPresent (empty -> empty .setResourcePack (player .getUniqueId ()));
85+ plugin .getPackByServer (ForcePackVelocity .EMPTY_SERVER_NAME ).ifPresent (empty -> {
86+ // If their current applied resource pack is the unloaded one, don't send it again
87+ // Checking URL rather than hash should be fine... it's simpler and should be unique.
88+ if (appliedResourcePack .getUrl ().equals (empty .getURL ())) return ;
89+
90+ empty .setResourcePack (player .getUniqueId ());
91+ });
8492 });
8593 }
8694}
You can’t perform that action at this time.
0 commit comments