Fureniku / FlenixCitiesCore

Core Module for FlenixCities
6 stars 5 forks source link

NBullPonterExecption Debit card check money #7

Closed ph1823 closed 6 years ago

ph1823 commented 8 years ago

Hello, my mods use Flenix Core and a nullexceptionpointer has hat my codes : @SubscribeEvent @SideOnly(Side.SERVER) public void onServerTick(TickEvent.ServerTickEvent event) throws IOException {

        MinecraftServer mc1 = FMLServerHandler.instance().getServer();

        for(GameProfile g : mc1.func_152357_F()) { 
        EntityPlayer p = mc1.getEntityWorld().func_152378_a(g.getId());
       // double i1 = 0;
       //String d1 = co.uk.silvania.cities.econ.EconUtils.getBalance(p,  mc1.worldServers[0]) + "";
       // co.uk.silvania.cities.econ.EconUtils.debug(d1);
       // d1 = co.uk.silvania.cities.econ.DebitCardItem.checkCardOwner(p) + "";
       // co.uk.silvania.cities.econ.EconUtils.debug(d1);
      //co.uk.silvania.cities.econ.EconUtils.class.newInstance().createAccount();
     //.chargeAccountViaUUID(g.getId(), mc1.worldServers[0], (double) 1);
    double i = co.uk.silvania.cities.econ.DebitCardItem.checkCardOwner(p).contains("") ? co.uk.silvania.cities.econ.EconUtils.getBalance(p,  mc1.worldServers[0]) : 0;

         File f = new File("./plugins/GloryRP1/users/" + g.getName() + ".yml");

         if(!f.exists()) {
             f.createNewFile();
         }
        FileConfiguration fc = YamlConfiguration.loadConfiguration(f);

        fc.set("money", i);
        try {
            fc.save(f);
        } catch (IOException e) {

            e.printStackTrace();
        }

        }

}

Sorry for my english and than you help ! (in pâstebin : http://pastebin.com/cEJcBxuf )

Fureniku commented 8 years ago

If you're developing I recommend using the latest builds off my Jenkins, I've made done base changes to the EconUtils class and the methods don't require a world instance anymore :)

If you still get the NPE with that, give me the stack trace and I'll take a look

ci.silvaniastudios.com

Sent from my iPhone

On 15 Jan 2016, at 22:29, ph1823 notifications@github.com wrote:

Hello, my mods use Flenix Core and a nullexceptionpointer has hat my codes : @SubscribeEvent @SideOnly(SideSERVER) public void onServerTick(TickEventServerTickEvent event) throws IOException {

    MinecraftServer mc1 = FMLServerHandlerinstance()getServer();

    for(GameProfile g : mc1func_152357_F()) { 
    EntityPlayer p = mc1getEntityWorld()func_152378_a(ggetId());
   // double i1 = 0;
   //String d1 = couksilvaniacitieseconEconUtilsgetBalance(p,  mc1worldServers[0]) + "";
   // couksilvaniacitieseconEconUtilsdebug(d1);
   // d1 = couksilvaniacitieseconDebitCardItemcheckCardOwner(p) + "";
   // couksilvaniacitieseconEconUtilsdebug(d1);
  //couksilvaniacitieseconEconUtilsclassnewInstance()createAccount();
 //chargeAccountViaUUID(ggetId(), mc1worldServers[0], (double) 1);
double i = couksilvaniacitieseconDebitCardItemcheckCardOwner(p)contains("") ? couksilvaniacitieseconEconUtilsgetBalance(p,  mc1worldServers[0]) : 0;

     File f = new File("/plugins/GloryRP1/users/" + ggetName() + "yml");

     if(!fexists()) {
         fcreateNewFile();
     }
    FileConfiguration fc = YamlConfigurationloadConfiguration(f);

    fcset("money", i);
    try {
        fcsave(f);
    } catch (IOException e) {

        eprintStackTrace();
    }

    }

} Sorry for my english and than you help ! (in pâstebin : http://pastebincom/cEJcBxuf )

— Reply to this email directly or view it on GitHub.

ph1823 commented 8 years ago

Hello i always java.lang.NullPointerException my error : 11:42:04] [Server thread/INFO]: ph1823[/93.8.125.54:51408] logged in with entity id 299 at ([Ecole-RP] -295.5, 5.0, -738.5) [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/INFO]: Send data to ph1823 [11:42:04] [Server thread/ERROR]: Exception caught during firing event cpw.mods.fml.common.gameevent.TickEvent$ServerTickEvent@305c0ccf: java.lang.NullPointerException at co.uk.silvania.cities.econ.DebitCardItem.checkCardOwner(DebitCardItem.java:111) ~[DebitCardItem.class:?] at fr.ph1823.GloryRP.GloryRP.onServerTick(GloryRP.java:180) ~[GloryRP.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_84_GloryRP_onServerTick_ServerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:1.7.10-1517.169] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:1.7.10-1517.169] at cpw.mods.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:251) [FMLCommonHandler.class:1.7.10-1517.169] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:862) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_91] [11:42:04] [Server thread/ERROR]: Index: 4 Listeners: [11:42:04] [Server thread/ERROR]: 0: NORMAL [11:42:04] [Server thread/ERROR]: 1: ASM: com.flansmod.common.CommonTickHandler@717f0d2d tick(Lcpw/mods/fml/common/gameevent/TickEvent$ServerTickEvent;)V [11:42:04] [Server thread/ERROR]: 2: ASM: ic2.core.TickHandler@5161d19b onServerTick(Lcpw/mods/fml/common/gameevent/TickEvent$ServerTickEvent;)V [11:42:04] [Server thread/ERROR]: 3: ASM: com.pau101.fairylights.world.TickHandler@35285594 onTick(Lcpw/mods/fml/common/gameevent/TickEvent$ServerTickEvent;)V [11:42:04] [Server thread/ERROR]: 4: ASM: fr.ph1823.GloryRP.GloryRP@5c99a31c onServerTick(Lcpw/mods/fml/common/gameevent/TickEvent$ServerTickEvent;)V [11:42:04] [Server thread/ERROR]: 5: ASM: com.tlf.HN.event.HNEventHandlerCPW@12627fba tickEnd(Lcpw/mods/fml/common/gameevent/TickEvent$ServerTickEvent;)V [11:42:04] [Server thread/ERROR]: Encountered an unexpected exception java.lang.NullPointerException at co.uk.silvania.cities.econ.DebitCardItem.checkCardOwner(DebitCardItem.java:111) ~[DebitCardItem.class:?] at fr.ph1823.GloryRP.GloryRP.onServerTick(GloryRP.java:180) ~[GloryRP.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_84_GloryRP_onServerTick_ServerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:1.7.10-1517.169] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:1.7.10-1517.169] at cpw.mods.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:251) ~[FMLCommonHandler.class:1.7.10-1517.169] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:862) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_91] [11:42:04] [Server thread/ERROR]: This crash report has been saved to: /root/Mods/./crash-reports/crash-2016-01-16_10.42.04-server.txt [11:42:04] [Server thread/INFO]: Stopping server [11:42:04] [Server thread/INFO]: [EssentialsChat] Disabling EssentialsChat vPre2.14.1.3 [11:42:04] [Server thread/INFO]: [EssentialsSpawn] Disabling EssentialsSpawn vPre2.14.1.3 [11:42:04] [Server thread/INFO]: [EssentialsProtect] Disabling EssentialsProtect vPre2.14.1.3 [11:42:04] [Server thread/INFO]: [MineResetLite] Disabling MineResetLite v0.3.6 [11:42:04] [Server thread/INFO]: [MineResetLite] MineResetLite disabled [11:42:04] [Server thread/INFO]: [Essentials] Disabling Essentials vPre2.14.1.3 [11:42:04] [Server thread/INFO]: [Vault][Economy] Essentials Economy unhooked. [11:42:04] [Server thread/INFO]: [WorldGuard] Disabling WorldGuard v6.0.0-beta-02 [11:42:04] [Server thread/INFO]: [WorldGuard] Shutting down executor and waiting for any pending tasks... [11:42:04] [Server thread/INFO]: [Multiverse-Core] Disabling Multiverse-Core v2.4-b527 [11:42:04] [Server thread/INFO]: [Multiverse-Core] - Disabled [11:42:04] [Server thread/INFO]: [PermissionsEx] Disabling PermissionsEx v1.22.6 [11:42:04] [Server thread/INFO]: WEPIF: PermissionsEx detected! Using PermissionsEx for permissions. [11:42:04] [Server thread/INFO]: [Vault][Permission] PermissionsEx un-hooked. [11:42:04] [Server thread/INFO]: [Vault][Chat] PermissionsEx_Chat un-hooked. [11:42:04] [Server thread/INFO]: [Vault] Disabling Vault v1.4.1-b436 [11:42:04] [Server thread/INFO]: [GloryRP1] Disabling GloryRP1 v1.0 [11:42:04] [Server thread/INFO]: [MaxBans] Disabling MaxBans v2.3 [11:42:04] [Server thread/INFO]: [MaxBans] Disabling Maxbans... [11:42:04] [Server thread/INFO]: [MaxBans] Clearing buffer... [11:42:04] [Server thread/INFO]: [MaxBans] Cleared buffer... [11:42:04] [Server thread/INFO]: [WorldEdit] Disabling WorldEdit v5.5.8 [11:42:04] [Server thread/INFO]: Saving players [11:42:04] [Server thread/INFO]: ph1823 lost connection: Server closed [11:42:04] [Server thread/INFO]: ph1823 left the game. [11:42:04] [Server thread/INFO]: Saving worlds [11:42:04] [Server thread/INFO]: Saving chunks for level 'world'/Overworld [11:42:04] [Server thread/INFO]: Saving chunks for level 'DIM1'/The End [11:42:04] [Server thread/INFO]: Saving chunks for level 'DIM-1'/Nether [11:42:04] [Server thread/INFO]: Saving chunks for level 'Test'/Overworld [11:42:04] [Server thread/INFO]: Saving chunks for level 'Ecole-RP'/Overworld [11:42:04] [Server thread/INFO]: Unloading dimension 0 [11:42:04] [Server thread/INFO]: Unloading dimension -1 [11:42:04] [Server thread/INFO]: Unloading dimension 1 [11:42:04] [Server thread/INFO]: Unloading dimension 6 [11:42:04] [Server thread/INFO]: Unloading dimension 24 [11:42:04] [Server thread/INFO]: Applying holder lookups [11:42:04] [Server thread/INFO]: Holder lookups applied [11:42:04] [net.gliby.voicechat.common.networking.voiceservers.udp.UdpServer/INFO]: Udp Server closed normally. [11:42:04] [Server thread/INFO]: Stopped Voice Server. [11:42:04] [Server thread/INFO]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.

In pastebin : http://pastebin.com/JipwrXUZ

My code : @SubscribeEvent @SideOnly(Side.SERVER) public void onServerTick(TickEvent.ServerTickEvent event) throws IOException {

        MinecraftServer mc1 = FMLServerHandler.instance().getServer();

        for(GameProfile g : mc1.func_152357_F()) { 
        EntityPlayer p = mc1.getEntityWorld().func_152378_a(g.getId());

    double i =  co.uk.silvania.cities.econ.DebitCardItem.checkCardOwner(p) != null ? co.uk.silvania.cities.econ.EconUtils.getBalance(p) : 0;

         File f = new File("./plugins/GloryRP1/users/" + g.getName() + ".yml");

         if(!f.exists()) {
             f.createNewFile();
         }
        FileConfiguration fc = YamlConfiguration.loadConfiguration(f);

        fc.set("money", i);
        try {
            fc.save(f);
        } catch (IOException e) {

            e.printStackTrace();
        }

        }

}

In pastebin : http://pastebin.com/k7Tb5Atj And sorry for my english :/

Fureniku commented 8 years ago

Ah, I see why. The debit card's checkCardOwner method requires the player to already be holding a debit card - bad practice on my part. I've just changed it now, you'll need to pass an ItemStack argument and then the method will check if that's a valid debit card before continuing.

http://ci.silvaniastudios.com:8080/job/FlenixCitiesCore/114/

ph1823 commented 8 years ago

Hello now is in econmyutils :
[15:02:49] [Server thread/ERROR]: Exception caught during firing event cpw.mods.fml.common.gameevent.TickEvent$ServerTickEvent@142e72ea: java.lang.NullPointerException at co.uk.silvania.cities.econ.EconUtils.getBalance(EconUtils.java:593) ~[EconUtils.class:?] at fr.ph1823.GloryRP.GloryRP.onServerTick(GloryRP.java:173) ~[GloryRP.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_84_GloryRP_onServerTick_ServerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:1.7.10-1517.169] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:1.7.10-1517.169] at cpw.mods.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:251) [FMLCommonHandler.class:1.7.10-1517.169] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:862) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_91] In pastebin : http://pastebin.com/FEQfybah Sorry for my derangement.

ph1823 commented 8 years ago

Hello, the bug arrived on change world of server (teleport a player on a other world)

Fureniku commented 8 years ago

Can you link the source of your mod so I can fork it and try some stuff?

ph1823 commented 8 years ago

Hello, the project mod is disponible on GitHub : https://github.com/ph1823/GloryRP

ph1823 commented 8 years ago

Hello, onze up beacause on change world the server crash :( can you help me please?