Skip to content

Commit 4ef06d8

Browse files
committed
remove annoying updates in chat (RIPBOZO)
1 parent 6edb48b commit 4ef06d8

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

src/main/java/com/falsepattern/lib/internal/proxy/ClientProxy.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,15 @@
2020
*/
2121
package com.falsepattern.lib.internal.proxy;
2222

23-
import com.falsepattern.lib.internal.Share;
24-
import com.falsepattern.lib.internal.Tags;
2523
import com.falsepattern.lib.internal.impl.config.event.ClientEventHandlerPost;
2624
import com.falsepattern.lib.internal.impl.config.event.ClientEventHandlerPre;
2725
import com.falsepattern.lib.internal.impl.toast.GuiToastImpl;
28-
import com.falsepattern.lib.updates.UpdateChecker;
29-
import lombok.val;
3026

3127
import net.minecraft.client.Minecraft;
32-
import net.minecraft.client.entity.EntityPlayerSP;
33-
import net.minecraft.util.IChatComponent;
3428
import net.minecraftforge.common.MinecraftForge;
35-
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
3629
import cpw.mods.fml.common.event.FMLConstructionEvent;
3730
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
3831
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
39-
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
4032
import cpw.mods.fml.relauncher.Side;
4133
import cpw.mods.fml.relauncher.SideOnly;
4234

@@ -46,8 +38,6 @@
4638

4739
@SideOnly(Side.CLIENT)
4840
public class ClientProxy extends CommonProxy {
49-
private CompletableFuture<List<IChatComponent>> chatFuture;
50-
5141
@Override
5242
public void construct(FMLConstructionEvent e) {
5343
super.construct(e);
@@ -65,27 +55,5 @@ public void preInit(FMLPreInitializationEvent e) {
6555
public void postInit(FMLPostInitializationEvent e) {
6656
super.postInit(e);
6757
ClientEventHandlerPost.registerBus();
68-
chatFuture = updatesFuture.handleAsync((updates, exception) -> {
69-
if (exception != null || updates.isEmpty()) {
70-
return Collections.emptyList();
71-
}
72-
return UpdateChecker.updateListToChatMessages(Tags.MODNAME, updates);
73-
});
74-
}
75-
76-
@SubscribeEvent
77-
public void onSinglePlayer(EntityJoinWorldEvent e) {
78-
if (chatFuture == null || !(e.entity instanceof EntityPlayerSP)) {
79-
return;
80-
}
81-
val player = (EntityPlayerSP) e.entity;
82-
try {
83-
for (val line : chatFuture.get()) {
84-
player.addChatMessage(line);
85-
}
86-
chatFuture = null;
87-
} catch (Exception ex) {
88-
Share.LOG.warn(ex);
89-
}
9058
}
9159
}

src/main/java/com/falsepattern/lib/internal/proxy/CommonProxy.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@
4545
import java.util.concurrent.CompletableFuture;
4646

4747
public class CommonProxy {
48-
49-
protected CompletableFuture<List<ModUpdateInfo>> updatesFuture;
50-
5148
public void construct(FMLConstructionEvent e) {
5249
FalsePatternLib.NETWORK.registerMessage(SyncRequestHandler.class, SyncRequest.class, 0, Side.SERVER);
5350
FalsePatternLib.NETWORK.registerMessage(SyncReplyHandler.class, SyncReply.class, 1, Side.CLIENT);
@@ -58,7 +55,7 @@ public void preInit(FMLPreInitializationEvent e) {
5855
CommonEventHandlerPre.registerBus();
5956
if (LibraryConfig.ENABLE_UPDATE_CHECKER) {
6057
Share.LOG.info("Launching asynchronous update check.");
61-
updatesFuture = UpdateChecker.fetchUpdatesAsyncV2(FalsePatternLib.UPDATE_URL).thenApplyAsync(updates -> {
58+
UpdateChecker.fetchUpdatesAsyncV2(FalsePatternLib.UPDATE_URL).thenApplyAsync(updates -> {
6259
if (updates == null) {
6360
updates = Collections.emptyList();
6461
}
@@ -75,8 +72,6 @@ public void preInit(FMLPreInitializationEvent e) {
7572
Share.LOG.error("Failed to check for updates!", ex);
7673
return Collections.emptyList();
7774
});
78-
} else {
79-
updatesFuture = CompletableFuture.completedFuture(Collections.emptyList());
8075
}
8176
}
8277

0 commit comments

Comments
 (0)