Jump to content

Recommended Posts

Posted

 

Hi, could anyone help me with this problem?

I'm trying to register a simple command in my mod (server only)
and always from error

 

Main:
 

@Mod(modid = Version.MOD_ID, name = Version.NAME, version = Version.VERSION, acceptableRemoteVersions = "*", dependencies = "required-after:pixelmon")

public class NativeePixel {
  
	public PlayerStorage ps;
	public static World world;

	public static ArrayList lend = new ArrayList(Arrays.asList("Articuno", "Zapdos", "Moltres", "Mewtwo", "Mew",
			"Entei", "Raikou", "Suicune", "ho-oh", "Lugia", "Celebi", "regirock", "regice", "registeel", "latios",
			"latias", "Groudon", "Kyogre", "Rayquaza", "jirachi", "deoxys", "uxie", "azelf", "mesprit", "dialga",
			"palkia", "giratina", "cresselia", "darkrai", "manaphy", "phione", "heatran", "regigigas", "shaymin",
			"arceus", "victini", "cobalion", "terrakion", "virizion", "keldeo", "thundurus", "tornadus", "landorus",
			"zekrom", "reshiram", "kyurem", "genesect", "meloetta", "xerneas", "yveltal", "zygarde"));
	public static boolean isClient = true;
	@Mod.Instance("nativeepixelmon");
  
	public static NativeePixel instance;
	
	
	@Mod.EventHandler
	public void preinit(FMLPreInitializationEvent e) {
		
		FMLCommonHandler.instance().bus().register(new TickHandler());
		System.out.println("PreInitializationEvent.....");
		Configuration config = new Configuration(e.getSuggestedConfigurationFile());
		config.load();


	}

	@Mod.EventHandler
	public void init(FMLInitializationEvent e) {

		System.out.println("FMLInitializationEvent .....");
		isClient = e.getSide().isClient();

	}

	@Mod.EventHandler
	public void posinit(FMLPostInitializationEvent e) throws Exception {
		
		System.out.println("FMLPostInitializationEvent .....");


	}
	
	@Mod.EventHandler
	 public void serverLoad(FMLServerStartingEvent event)
	    {
	        System.out.println("=== FMLServerStartingEvent fired ===");
	        event.registerServerCommand(new CmdTest());
	    }

}

 

Class: 
 

public class CmdTest implements ICommand {


	@Override
	public int compareTo(Object arg0) {
		return 0;
	}

	@Override
	public String getCommandName() {
		return "nativee";
	}

	@Override
	public String getCommandUsage(ICommandSender sender) {
		return "/nativee";
	}

	@Override
	public List getCommandAliases() {
		List<String> aliases = new ArrayList();
		aliases.add("test2");
		aliases.add("test3");
		
		
		return aliases;
	}

	@Override
	public void processCommand(ICommandSender sender, String[] args) {
       if(sender instanceof EntityPlayer) {
    	   EntityPlayer p = (EntityPlayer) sender;
    	   System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaa");
    	   
       }

	}

	@Override
	public boolean canCommandSenderUseCommand(ICommandSender sender) {
		return true;
	}

	@Override
	public List addTabCompletionOptions(ICommandSender sender, String[] args) {
		return null;
	}

	@Override
	public boolean isUsernameIndex(String[] args, int ints) {
		return false;
	}

}

 

 

 

when I remove event.registerServerCommand(new CmdTest());  mod works

Posted

Class cmd:
 

import java.util.ArrayList;
import java.util.List;

import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;

public class CmdTest extends CommandBase 
{

@Override
public String getCommandName() {
	return "nativee";
}
@Override
public String getCommandUsage(ICommandSender sender) {
	return "/nativee";
}
@Override
public void processCommand(ICommandSender sender, String[] args) {

	System.out.println("CMD TESTE");
	
}
}

New main: 
 

@Mod(modid = Version.MOD_ID, name = Version.NAME, version = Version.VERSION, acceptableRemoteVersions = "*", dependencies = "required-after:pixelmon")

public class NativeePixel {
  
	@Mod.Instance("nativeepixelmon")
	public static NativeePixel instance;
	  
	@Mod.EventHandler
	public void preinit(FMLPreInitializationEvent e) {
		MinecraftForge.EVENT_BUS.register(new TickHandler());
		System.out.println("PreInitializationEvent");
		Configuration config = new Configuration(e.getSuggestedConfigurationFile());
		config.load();
	}

	@Mod.EventHandler
	public void init(FMLInitializationEvent e) {
		System.out.println("FMLInitializationEvent....");	
	}

	@Mod.EventHandler
	public void posinit(FMLPostInitializationEvent e) {

		System.out.println("FMLPostInitializationEvent INICIADO Do NativeeYT.....");
		MinecraftForge.EVENT_BUS.register(new apis());

	}

	@Mod.EventHandler
	public void serverLoad(FMLServerStartingEvent event) {
		System.out.println("=== FMLServerStartingEvent fired ===");
       event.registerServerCommand(new CmdTest());
	}
}

console erro: 
 

[12:02:28] [Server thread/INFO]: === FMLServerStartingEvent fired ===
[12:02:28] [Server thread/ERROR]: Fatal errors were detected during the transition from SERVER_ABOUT_TO_START to SERVER_STARTING. Loading cannot continue
[12:02:28] [Server thread/ERROR]: 
	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
	UCHIJAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
	UCHIJAAA	FML{7.10.99.99} [Forge Mod Loader] (Thermos1614.jar) 
	UCHIJAAA	Forge{10.13.4.1614} [Minecraft Forge] (Thermos1614.jar) 
	UCHIJAAA	kimagine{0.2} [KImagine] (minecraft.jar) 
	UCHIJAAA	pixelmon{3.5.0} [Pixelmon] (Pixelmon-1.7.10-3.5.1-universal.jar) 
	UCHIJAAE	nativeepixelmon{1.0} [Nativee Pixelmon] (Test.jar) 
[12:02:28] [Server thread/ERROR]: The following problems were captured during this phase
[12:02:28] [Server thread/ERROR]: Caught exception from nativeepixelmon
java.lang.AbstractMethodError
	at net.minecraft.command.CommandHandler.registerCommand(CommandHandler.java:154) ~[z.class:?]
	at net.minecraft.command.CommandHandler.func_71560_a(CommandHandler.java:143) ~[z.class:?]
	at cpw.mods.fml.common.event.FMLServerStartingEvent.registerServerCommand(FMLServerStartingEvent.java:45) ~[FMLServerStartingEvent.class:1.7.10-1614.58]
	at nativeepixel.NativeePixel.serverLoad(NativeePixel.java:186) ~[NativeePixel.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[FMLModContainer.class:1.7.10-1614.58]
	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[server-1.7.10.jar:?]
	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:1.7.10-1614.58]
	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:1.7.10-1614.58]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[server-1.7.10.jar:?]
	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:1.7.10-1614.58]
	at cpw.mods.fml.common.Loader.serverStarting(Loader.java:789) [Loader.class:1.7.10-1614.58]
	at cpw.mods.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:283) [FMLCommonHandler.class:1.7.10-1614.58]
	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:368) [lt.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:643) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
[12:02:28] [Server thread/ERROR]: A fatal exception occurred during the server starting event
cpw.mods.fml.common.LoaderException: java.lang.AbstractMethodError

	at cpw.mods.fml.common.LoadController.transition(LoadController.java:163) ~[LoadController.class:1.7.10-1614.58]
	at cpw.mods.fml.common.Loader.serverStarting(Loader.java:790) [Loader.class:1.7.10-1614.58]
	at cpw.mods.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:283) [FMLCommonHandler.class:1.7.10-1614.58]
	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:368) [lt.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:643) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
Caused by: java.lang.AbstractMethodError
	at net.minecraft.command.CommandHandler.registerCommand(CommandHandler.java:154) ~[z.class:?]
	at net.minecraft.command.CommandHandler.func_71560_a(CommandHandler.java:143) ~[z.class:?]
	at cpw.mods.fml.common.event.FMLServerStartingEvent.registerServerCommand(FMLServerStartingEvent.java:45) ~[FMLServerStartingEvent.class:1.7.10-1614.58]
	at nativeepixel.NativeePixel.serverLoad(NativeePixel.java:186) ~[NativeePixel.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[FMLModContainer.class:1.7.10-1614.58]
	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[server-1.7.10.jar:?]
	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:1.7.10-1614.58]
	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:1.7.10-1614.58]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[server-1.7.10.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[server-1.7.10.jar:?]
	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:1.7.10-1614.58]
	at cpw.mods.fml.common.Loader.serverStarting(Loader.java:789) ~[Loader.class:1.7.10-1614.58]
	... 4 more
[12:02:28] [Server thread/INFO]: Applying holder lookups
[12:02:28] [Server thread/INFO]: Holder lookups applied
[12:02:28] [Server thread/INFO]: The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED. Errors may have been discarded.
[12:02:28] [Server thread/INFO]: The state engine was in incorrect state ERRORED and forced into state AVAILABLE. Errors may have been discarded.

 

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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