Skip to content

Commit 6d5b3c7

Browse files
committed
minor fix
1 parent 3cd03ab commit 6d5b3c7

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mod_name=MadParticle
3535
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
3636
mod_license=GNU GPL 3.0
3737
# The mod version. See https://semver.org/
38-
mod_version=26.1.2-8
38+
mod_version=26.1.2-9
3939
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
4040
# This should match the base package used for the mod sources.
4141
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

src/main/java/cn/ussshenzhou/madparticle/command/IndexedCommandManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
import net.minecraft.commands.CommandSourceStack;
1515
import net.minecraft.server.level.ServerPlayer;
1616
import net.minecraft.world.phys.Vec3;
17+
import net.neoforged.api.distmarker.Dist;
18+
import net.neoforged.bus.api.SubscribeEvent;
19+
import net.neoforged.fml.common.EventBusSubscriber;
1720
import net.neoforged.neoforge.client.ClientCommandHandler;
21+
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
1822

1923
import java.util.Collection;
2024
import java.util.concurrent.ConcurrentHashMap;
@@ -23,6 +27,7 @@
2327
/**
2428
* @author USS_Shenzhou
2529
*/
30+
@EventBusSubscriber(value = Dist.CLIENT)
2631
public class IndexedCommandManager {
2732
private static final BiMap<Integer, String> INDEXED_COMMANDS = Maps.synchronizedBiMap(HashBiMap.create());
2833
private static final ConcurrentHashMap<Integer, IndexedCommandPacket> CLIENT_BUFFER = new ConcurrentHashMap<>();
@@ -90,7 +95,8 @@ public static String getCommand(int index) {
9095
return INDEXED_COMMANDS.get(index);
9196
}
9297

93-
public static void clear() {
98+
@SubscribeEvent
99+
public static void onPlayerOut(ClientPlayerNetworkEvent.LoggingOut event) {
94100
INDEXED_COMMANDS.clear();
95101
CLIENT_BUFFER.clear();
96102
}

0 commit comments

Comments
 (0)