[SOLVED] [Service] Economy Service Problem

Sponge Build: snapshot 2.1
Forge Build: forge-1.8-11.14.3.1487
Java Version: jre 1.8

Hi, I’ve tryed to make an economy service but it doesnt work…

My classes:
Main & BalanceCommand

Logs:
[21:35:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftfo
rge.fml.common.launcher.FMLServerTweaker
[21:35:33] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minec
raftforge.fml.common.launcher.FMLServerTweaker
[21:35:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.f
ml.common.launcher.FMLServerTweaker
[21:35:34] [main/INFO] [FML]: Forge Mod Loader version 8.99.180.1487 for Minecra
ft 1.8 loading
[21:35:34] [main/INFO] [FML]: Java is Java HotSpot™ 64-Bit Server VM, version
1.8.0_51, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java
jre1.8.0_51
[21:35:34] [main/INFO] [FML]: Loading tweaker org.spongepowered.asm.launch.Mixin
Tweaker from sponge-1.8-1487-2.1DEV-0.jar
[21:35:34] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftfo
rge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:35:34] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepower
ed.asm.launch.MixinTweaker
[21:35:34] [main/INFO] [mixin]: SpongePowered MIXIN Subsystem Version=0.4.4 Sour
ce=file:/C:/Users/Hugo/Desktop/Serveur%20Sponge/mods/sponge-1.8-1487-2.1DEV-0.ja
r Env=SERVER
[21:35:34] [main/INFO] [mixin]: Adding new token provider org.spongepowered.mod.
SpongeCoremod$TokenProvider to MixinEnvironment[PREINIT]
[21:35:35] [main/INFO] [mixin]: Adding new token provider org.spongepowered.mod.
SpongeCoremod$TokenProvider to MixinEnvironment[DEFAULT]
[21:35:35] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftfo
rge.fml.common.launcher.FMLDeobfTweaker
[21:35:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.f
ml.common.launcher.FMLInjectionAndSortingTweaker
[21:35:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.f
ml.common.launcher.FMLInjectionAndSortingTweaker
[21:35:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.f
ml.relauncher.CoreModManager$FMLPluginWrapper
[21:35:39] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certi
ficate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[21:35:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.f
ml.relauncher.CoreModManager$FMLPluginWrapper
[21:35:39] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.as
m.launch.MixinTweaker
[21:35:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.f
ml.common.launcher.FMLDeobfTweaker
[21:35:42] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftfo
rge.fml.common.launcher.TerminalTweaker
[21:35:42] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepower
ed.asm.mixin.MixinEnvironment$EnvironmentStateTweaker
[21:35:42] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.f
ml.common.launcher.TerminalTweaker
[21:35:42] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.as
m.mixin.MixinEnvironment$EnvironmentStateTweaker
[21:35:54] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecra
ft.server.MinecraftServer}
[21:36:10] [Server thread/INFO]: Starting minecraft server version 1.8
[21:36:10] [Server thread/INFO] [MinecraftForge]: Attempting early MinecraftForg
e initialization
[21:36:10] [Server thread/INFO] [FML]: MinecraftForge v11.14.3.1487 Initialized
[21:36:10] [Server thread/INFO] [FML]: Replaced 204 ore recipies
[21:36:10] [Server thread/INFO] [MinecraftForge]: Completed early MinecraftForge
initialization
[21:36:15] [Server thread/INFO] [FML]: Found 0 mods from the command line. Injec
ting into mod discoverer
[21:36:15] [Server thread/INFO] [FML]: Searching C:\Users\Hugo\Desktop\Serveur S
ponge\mods for mods
[21:36:16] [Server thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to
load
[21:36:18] [Server thread/INFO] [FML]: Attempting connection with missing mods [
mcp, FML, Forge, Sponge, essentials] at CLIENT
[21:36:18] [Server thread/INFO] [FML]: Attempting connection with missing mods [
mcp, FML, Forge, Sponge, essentials] at SERVER
[21:36:19] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
[21:36:19] [Server thread/INFO] [FML]: Found 384 ObjectHolder annotations
[21:36:19] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[21:36:19] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[21:36:19] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of
0
[21:36:20] [Server thread/INFO] [FML]: Applying holder lookups
[21:36:20] [Server thread/INFO] [FML]: Holder lookups applied
[21:36:20] [Server thread/INFO] [FML]: Injecting itemstacks
[21:36:20] [Server thread/INFO] [FML]: Itemstack injection complete
[21:36:20] [Server thread/INFO]: Loading properties
[21:36:20] [Server thread/INFO]: Default game type: SURVIVAL
[21:36:20] [Server thread/INFO]: Generating keypair
[21:36:21] [Server thread/INFO]: Starting Minecraft server on *:25565
[21:36:21] [Server thread/ERROR] [Sponge]: [Plugin Class: com.sosoh.essentials.M
ain][Handler: Initalization]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
at org.spongepowered.mod.plugin.SpongeModPluginContainer.handleModStateE
vent(SpongeModPluginContainer.java:126) [SpongeModPluginContainer.class:1.8-1487
-2.1DEV-0+unknown-b0.git-unknown]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [mine
craft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraf
t_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(
LoadController.java:212) [LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(Lo
adController.java:190) [LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [mine
craft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraf
t_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(L
oadController.java:119) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:731)
[Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.finishServerLoading(FM
LServerHandler.java:97) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStarted(FMLCom
monHandler.java:360) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(Dedicated
Server.java:210) [po.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [M
inecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_51]
Caused by: java.lang.NullPointerException
at com.sosoh.essentials.commands.economy.BalanceCommand.(BalanceCo
mmand.java:17) ~[BalanceCommand.class:?]
at com.sosoh.essentials.Main.Initalization(Main.java:118) ~[Main.class:?
]
… 32 more
[21:36:21] [Server thread/INFO] [FML]: Injecting itemstacks
[21:36:21] [Server thread/INFO] [FML]: Itemstack injection complete
[21:36:23] [Server thread/INFO] [FML]: Forge Mod Loader has successfully loaded
5 mods
[21:36:23] [Server thread/INFO]: Preparing level “world”
[21:36:23] [Server thread/INFO] [FML]: Injecting existing block and item data in
to this server instance
[21:36:23] [Server thread/INFO] [FML]: Applying holder lookups
[21:36:23] [Server thread/INFO] [FML]: Holder lookups applied
[21:36:23] [Server thread/INFO] [FML]: Loading dimension 0 (world) (net.minecraf
t.server.dedicated.DedicatedServer@38c012bc)
[21:36:24] [Server thread/INFO] [FML]: Loading dimension 1 (DIM1) (net.minecraft
.server.dedicated.DedicatedServer@38c012bc)
[21:36:24] [Server thread/INFO] [FML]: Loading dimension -1 (DIM-1) (net.minecra
ft.server.dedicated.DedicatedServer@38c012bc)
[21:36:24] [Server thread/INFO]: Preparing start region for level -1
[21:36:25] [Server thread/INFO]: Preparing spawn area: 27%
[21:36:26] [Server thread/INFO]: Preparing start region for level 1
[21:36:26] [Server thread/INFO]: Done (3,161s)! For help, type “help” or “?”
[21:36:26] [Server thread/INFO] [essentials]: [Essentials] Plugin Initialized
[21:36:29] [Server thread/WARN]: Can’t keep up! Did the system time change, or i
s the server overloaded? Running 2978ms behind, skipping 59 tick(s)

The EconomyService is not currently implemented. Follow the Pull Request here.

I’ve created classes:

EconomyService & SimpleEconomyService

You are registering the balance command before you register your economy.

1 Like

I have still the same error.

Can you please post your updated code?

Here it is!

You never set your access variable to equal anything

It’s static and I don’t need to, it’s just for accessing my methods from others classes… Before I created my Economy Service, nothing was bugging even with “public static Main access” equaling nothing.

instead of trying to get your EconomyService instance by hooking into your main class do it in the EconomyService class instead.

public static EconomyService instance = new EconomyService();

public static EconomyService getInstance(){
    return instance;
}

this way you can hook into it by doing

EconomyService.getInstance().whatEverMethodYouWant()

If you set the access variable in the start of your initialization event, it would work. I just tested this in my own plugin to verify.

1 Like

I cannot instance it: http://pastebin.com/XkfCUEBv

I’m not trying to be rude, but if you tried what I suggested your problem would be eliminated.

You cant instantiate an interface so instead just do

public static EconomyService instance; 

and include a constructor

public EconomyService(){
    instance = this;
}

instead of

public static EconomyService instance = new EconomyService();

It isn’t initialized… Why don’t I use the SimpleEconomyService ?

The whole point of interfaces are so you can implement them in other classes and use that group of inherited methods inside your new class, you shouldn’t be trying to get an instance of it whether its in the main class of inside the EconomyService class.

Step 1: Learn Java
Step 2: Understand error messages and stack traces
Step 3: Learn SpongeAPI

Could you also take the huge long log in the first post and take it to a paste in? It makes the actual post easier to read