1212import CoflCore .commands .models .FlipData ;
1313import CoflCore .commands .models .SoundData ;
1414import CoflCore .events .*;
15+ import CoflCore .handlers .EventRegistry ;
1516import com .coflnet .gui .RenderUtils ;
1617import com .coflnet .gui .cofl .CoflBinGUI ;
1718import com .coflnet .gui .tfm .TfmBinGUI ;
5051public class CoflModClient implements ClientModInitializer {
5152 private KeyBinding bestflipsKeyBinding ;
5253
53- public static long LastClick = System .currentTimeMillis ();
54- public static final ExecutorService chatThreadPool = Executors .newFixedThreadPool (2 );
55- public static final ExecutorService tickThreadPool = Executors .newFixedThreadPool (2 );
56- public static long LastViewAuctionInvocation = Long .MIN_VALUE ;
57- public static String LastViewAuctionUUID = null ;
58- public static Pattern chatpattern = Pattern .compile ("a^" , 2 );
59- private static LinkedBlockingQueue <String > chatBatch = new LinkedBlockingQueue ();
60- private static LocalDateTime lastBatchStart = LocalDateTime .now ();
61-
6254 private String username = "" ;
6355 private static FlipData flipData = null ;
6456 private static Gson gson = new GsonBuilder ().excludeFieldsWithoutExposeAnnotation ().create ();
@@ -83,7 +75,7 @@ public void onInitializeClient() {
8375
8476 ClientTickEvents .END_CLIENT_TICK .register (client -> {
8577 if (bestflipsKeyBinding .wasPressed ()) {
86- onOpenBestFlip (username , true );
78+ EventRegistry . onOpenBestFlip (username , true );
8779 }
8880 });
8981
@@ -106,10 +98,6 @@ public void onInitializeClient() {
10698 })));
10799 });
108100
109- ClientCommandRegistrationCallback .EVENT .register ((dispatcher , registryAccess ) -> {
110-
111- });
112-
113101 ScreenEvents .AFTER_INIT .register ((client , screen , scaledWidth , scaledHeight ) -> {
114102 if (screen instanceof GenericContainerScreen gcs ) {
115103 System .out .println (gcs .getTitle ().getString ());
@@ -137,24 +125,6 @@ public static FlipData popFlipData(){
137125 return fd ;
138126 }
139127
140- public static void onOpenBestFlip (String username , boolean isInitialKeypress ) {
141- if (System .currentTimeMillis () - LastClick >= 300L ) {
142- FlipData f = CoflCore .flipHandler .fds .GetHighestFlip ();
143- System .out .println (f );
144- if (f != null ) {
145- CoflSkyCommand .processCommand (new String []{"openauctiongui" , f .Id , "true" }, username );
146- LastViewAuctionUUID = f .Id ;
147- LastViewAuctionInvocation = System .currentTimeMillis ();
148- LastClick = System .currentTimeMillis ();
149- String command = (new Gson ()).toJson ("/viewauction " + f .Id );
150- CoflCore .Wrapper .SendMessage (new JsonStringCommand (CommandType .Clicked , command ));
151- CoflSkyCommand .processCommand (new String []{"track" , "besthotkey" , f .Id , username }, username );
152- } else if (isInitialKeypress ) {
153- CoflSkyCommand .processCommand (new String []{"dialog" , "nobestflip" , username }, username );
154- }
155- }
156- }
157-
158128 @ Subscribe
159129 public void WriteToChat (OnWriteToChatReceive command ){
160130 MinecraftClient .getInstance ().inGameHud .getChatHud ().addMessage (ChatComponent (command .ChatMessage ));
@@ -189,8 +159,11 @@ public void onFlipReceive(OnFlipReceive event){
189159 EventBus .getDefault ().post (new OnChatMessageReceive (f .getMessages ()));
190160 CoflCore .flipHandler .fds .Insert (new FlipData (
191161 Arrays .stream (f .getMessages ())
192- .map (cm -> new ChatMessageData (cm .getText (), cm .getOnClick (), cm .getHover ()))
193- .toArray (ChatMessageData []::new ),
162+ .map (cm -> new ChatMessageData (
163+ cm .getText (),
164+ cm .getOnClick (),
165+ cm .getHover ())
166+ ).toArray (ChatMessageData []::new ),
194167 f .getId (),
195168 f .getWorth (),
196169 new SoundData (
0 commit comments