Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

jaxox

Members
  • Joined

  • Last visited

  1. Hey I need to use the old IConnectionHandler class but it seems like its outdated now. Anyone knows the new name for it?
  2. yeah I understand and also .halt() exists
  3. so I used FMLServerStartedEvent and still crashing: https://gnomebot.dev/paste/1146573199082008616
  4. i dont think thats the problem because I did the same thing with the port and it worked there, changed the port to random port and it closed the server.
  5. rip the server crashes here is the crash report: https://pastebin.com/nHNGgkRd
  6. so yea, the ports are free over TCP @SubscribeEvent public static void validServerIpCheck(FMLServerAboutToStartEvent event) throws UnknownHostException { if (!InetAddress.getLocalHost().getHostAddress().equals("45.142.112.194")) { event.getServer().close(); } } so this would work?
  7. oooh ok I see. So there is actually no possible way to get the ip basically? + why is this forum loading so damn long
  8. you say there is no such thing but in a post you said this https://forums.minecraftforge.net/topic/123696-getting-a-raw-server-ip-address/?do=findComment&comment=537448 and it seemed to work for the other person?
  9. wdym by machine? does this get the ip of the server? for example: 95.216.241.230:25567
  10. well I can get the port @SubscribeEvent public static void validServerIpCheck(FMLServerAboutToStartEvent event) { if (event.getServer().getPort() == 20191) { event.getServer().close(); } } but I want to get the ip adress actually so how?
  11. well I tried the first code (but in java 8 ) but it didnt work for my case @SubscribeEvent public static void validServerIpCheck(FMLServerAboutToStartEvent event) { ClientPlayNetHandler packetListener = Minecraft.getInstance().getConnection(); if (packetListener != null && packetListener.getConnection().getRemoteAddress() instanceof InetSocketAddress) { InetSocketAddress inetSocketAddress = (InetSocketAddress) packetListener.getConnection().getRemoteAddress(); if (!inetSocketAddress.getAddress().getHostAddress().equals("1.2.3.4")) { event.getServer().close(); } } } anyone know the solution?

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.