Jump to content

mlgmxyysd

Members
  • Posts

    16
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mlgmxyysd's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. If offline-mode server is not allowed, it is unable to set online-mode=false in server.prop.
  2. Yes, it is necessary to use unofficial login system in offline-mode server.
  3. And ClientTickEvent, PlayedLoggedInEvent dont have sendChatMessage() method.
  4. OKAY, I does not use /login command, replace /login to /exp ok? IS THIS OK? package org.meowcat.autocommadner; import net.minecraft.client.Minecraft; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.io.*; import java.lang.reflect.Method; import java.util.Properties; public class JoinEvent { private Properties prop = new Properties(); JoinEvent() { MinecraftForge.EVENT_BUS.register(this); FMLCommonHandler.instance().bus().register(this); } @SideOnly(Side.CLIENT) @SubscribeEvent public void PlayerJoinGame(TickEvent.ClientTickEvent event) throws IOException { try{ Class mc = Class.forName(Minecraft.class.getName()); Method[] methods = mc.getMethods(); for (Method method : methods){ Main.logger.info(method.getName()); } } catch (ClassNotFoundException e ) { e.printStackTrace(); } Minecraft.getMinecraft().player.sendChatMessage("/exp"); } }
  5. When player join a game (server/single), player will send a message(or command) automatically.
  6. Please don't get caught up in the secondary problem. I only want to solve NullPointerException.
  7. It may cause by network problem. package org.meowcat.autocommadner; import net.minecraft.client.Minecraft; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.io.*; import java.lang.reflect.Method; import java.util.Properties; public class JoinEvent { private Properties prop = new Properties(); JoinEvent() { MinecraftForge.EVENT_BUS.register(this); FMLCommonHandler.instance().bus().register(this); } @SideOnly(Side.CLIENT) @SubscribeEvent public void PlayerJoinGame(TickEvent.ClientTickEvent event) throws IOException { try{ Class mc = Class.forName(Minecraft.class.getName()); Method[] methods = mc.getMethods(); for (Method method : methods){ Main.logger.info(method.getName()); } } catch (ClassNotFoundException e ) { e.printStackTrace(); } File file = new File("config/user.properties"); if (!file.exists()) { Minecraft.getMinecraft().shutdown(); } InputStream in = new BufferedInputStream(new FileInputStream("config/user.properties")); prop.load(in); String password = prop.getProperty("Password"); String registered = prop.getProperty("IsRegistered"); if (!registered.equals("true")) { Minecraft.getMinecraft().player.sendChatMessage("/register " + password + " " + password); } else { Minecraft.getMinecraft().player.sendChatMessage("/login " + password); } } } java.lang.NullPointerException: Unexpected error at org.meowcat.autocommadner.JoinEvent.PlayerJoinGame(JoinEvent.java:42) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_18_JoinEvent_PlayerJoinGame_ClientTickEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:344) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1708) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1098) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398) at net.minecraft.client.main.Main.main(SourceFile:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) These are codes & errors
  8. It not work. When game inited(not join a game),force close by NullPointer.
  9. That is not main issue. I can replace by any command,it only is a placeholder.
  10. Auto send a command when player join game (server/single).
×
×
  • Create New...

Important Information

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