File tree Expand file tree Collapse file tree
src/main/java/cn/ussshenzhou/madparticle/command Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
3636mod_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
Original file line number Diff line number Diff line change 1414import net .minecraft .commands .CommandSourceStack ;
1515import net .minecraft .server .level .ServerPlayer ;
1616import 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 ;
1720import net .neoforged .neoforge .client .ClientCommandHandler ;
21+ import net .neoforged .neoforge .client .event .ClientPlayerNetworkEvent ;
1822
1923import java .util .Collection ;
2024import java .util .concurrent .ConcurrentHashMap ;
2327/**
2428 * @author USS_Shenzhou
2529 */
30+ @ EventBusSubscriber (value = Dist .CLIENT )
2631public 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 }
You can’t perform that action at this time.
0 commit comments