Jump to content
  • 0

[Help]Problem with Java code


manos2864

Question

Hey guys....

I try to put this java code in my server : http://www.maxcheaters.com/forum/index.php?topic=148257.0 and i put it :)

But when i wear S grade armor/weapon and i take out after i cant wear again any armor/weapon/jewel and in gameserver window say:

 

Client: [Character: Lougkraaaaaa[268479809] - Account: manos2864 - IP: 127.0.0.1

] - Failed running: [C] 14 UseItem - L2J Server Version: ${l2j.revision} - DP Re

vision: ${l2jdp.revision} ; null

java.lang.NullPointerException

       at com.l2jserver.gameserver.network.clientpackets.UseItem.runImpl(UseIte

m.java:103)

       at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run

(L2GameClientPacket.java:93)

       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source

)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

       at java.lang.Thread.run(Unknown Source)

 

 

Some guys in greek section told me maybe i make something wrong.... and they try to help me with teamviewer but nothing happen!! Code had problem... Can someone fix this code pls!!! Or give me another code (i want olympiad only with A grade armor/weapons/jewels)

I use l2jserver Epilogue (Compile)

 

Link to comment
Share on other sites

Recommended Posts

  • 0

i add only your code but nothing happen.... when i participate in olympiad it allow me enter with s grade armor / weapon

 

enter is 1 thing playing is another

Link to comment
Share on other sites

  • 0

enter is 1 thing playing is another

:O What you mean??

 

**EDIT**

Try this,

UseItem.java

import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.Olympiad;
import net.sf.l2j.gameserver.handler.IItemHandler;

L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);

		if (item == null)
                               return;

+                      int lolz0r = item.getItem().getCrystalType();
+                      if (activeChar.isInOlympiadMode() || Olympiad.getInstance().isRegisteredInComp(activeChar) || +activeChar.getOlympiadGameId() > 0)
+                      {
+                            if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)
+                            {
+        	                  activeChar.sendMessage("You may only use items up to Grade A in the Grand Olympiad Games.");
+                                  return;
+                            }
+                      }

Olympiad.java

public class Olympiad
{
/**
 *
 * @author  ascharot
 * 
 */
+      private int _objectId;
private class OlympiadGameTask implements Runnable
{
	public L2OlympiadGame _game = null;

if (!_inCompPeriod)
       {
           sm = new SystemMessage(SystemMessageId.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS);
           noble.sendPacket(sm);
           return false;
       }

+      L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);
+      int lolz0r = item.getItem().getCrystalType();
+      if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)
+      {
+          noble.sendMessage("You cannot use S grade equipment at the Grand Olympiad games.");
+          return false;
+      }

 

in useitem.java --->where i must add the import?? (my useitem.java)-->http://pastebin.com/5WY4ZVKs

and in olympiad.java i cant find where i must add this code

+      private int _objectId;

my olympiad.java-->http://pastebin.com/2GsdGYFR

 

and

+      L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);

+      int lolz0r = item.getItem().getCrystalType();

+      if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)

has problem :S

Link to comment
Share on other sites

  • 0

Not sure about epilogue,try this:

 

import com.l2jserver.Config;

import com.l2jserver.gameserver.GameTimeController;

+import com.l2jserver.gameserver.model.olympiad.Olympiad;

:O What you mean??

 

**EDIT**

in useitem.java --->where i must add the import?? (my useitem.java)-->http://pastebin.com/5WY4ZVKs

and in olympiad.java i cant find where i must add this code

+      private int _objectId;

my olympiad.java-->http://pastebin.com/2GsdGYFR

 

and

+      L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);

+      int lolz0r = item.getItem().getCrystalType();

+      if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)

has problem :S

Private int _object...you can add it here:

 

public class Olympiad
{
        private int _objectId;
protected static final Logger _log = Logger.getLogger(Olympiad.class.getName());
protected static final Logger _logResults = Logger.getLogger("olympiad");

Has problem?what do you mean?

Link to comment
Share on other sites

  • 0

L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);

int lolz0r = item.getItem().getCrystalType();

if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)

{

 

It say

L2iteminstance cannot be resolve to a type

and

multiple markers at this line: l2item cannot be resolve

Link to comment
Share on other sites

  • 0

Add the import for l2iteminstance in Olympiad.java.

Multiple markerS? Oo?It works normally for me...

Add the import i told you,and check it again.

how i will add import for l2iteminstance in olympiad.java??? com.l2jserver.gameserver.model.l2iteminstance;???

 

EDIT

ok i add the import i solve the problem with l2iteminstance.... but not with multiple markers :S

Link to comment
Share on other sites

  • 0

how i will add import for l2iteminstance in olympiad.java??? com.l2jserver.gameserver.model.l2iteminstance;???

 

EDIT

ok i add the import i solve the problem with l2iteminstance.... but not with multiple markers :S

Instead of this:if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)

try this:if (lolz0r == L2Item.CRYSTAL_S)

 

Compile,login to check if it works and i ll modify it for s80 and s84.

Link to comment
Share on other sites

  • 0

Instead of this:if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)

try this:if (lolz0r == L2Item.CRYSTAL_S)

 

Compile,login to check if it works and i ll modify it for s80 and s84.

I put this if (lolz0r == L2Item.CRYSTAL_S) but again say L2item cannot be  resolve

Link to comment
Share on other sites

  • 0

I put this if (lolz0r == L2Item.CRYSTAL_S) but again say L2item cannot be  resolve

lol,import for l2item doesnt exist either.import com.l2jserver.gameserver.templates.item.L2Item;

Revert my previous post and add the import.

Link to comment
Share on other sites

  • 0

olympiad not work :S

and in gameserver(window) say:

[Character: [Admin]Imperfect[268479864] - Account: manos2864 - IP: 192.168.0.137

] sent bad RequestBypassToServer: "npc_268463562_OlympiadNoble 5"

java.lang.NullPointerException

        at com.l2jserver.gameserver.model.olympiad.Olympiad.registerNoble(Olympi

ad.java:478)

        at com.l2jserver.gameserver.model.actor.instance.L2OlympiadManagerInstan

ce.onBypassFeedback(L2OlympiadManagerInstance.java:119)

        at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.

runImpl(RequestBypassToServer.java:143)

        at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run

(L2GameClientPacket.java:93)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source

)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        at java.lang.Thread.run(Unknown Source)

Link to comment
Share on other sites

  • 0

In Olympiad.java,change the code to be like this:

      L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);
      int lolz0r = item.getItem().getCrystalType();
      if (item != null)
      {
          if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)
          {
              noble.sendMessage("You cannot use S grade equipment at the Grand Olympiad games.");
              return false;
          }
      }

Link to comment
Share on other sites

  • 0

In Olympiad.java,change the code to be like this:

     L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);
     int lolz0r = item.getItem().getCrystalType();
     if (item != null)
     {
         if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)
         {
             noble.sendMessage("You cannot use S grade equipment at the Grand Olympiad games.");
             return false;
         }
     }

this will fix my error?

EDIT

 

     L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);
     int lolz0r = item.getItem().getCrystalType();
     if (item != null)
     {
         if (lolz0r == L2Item.CRYSTAL_S || lolz0r == L2Item.CRYSTAL_S80 || lolz0r == L2Item.CRYSTAL_S84)
         {
             noble.sendMessage("You cannot use S grade equipment at the Grand Olympiad games.");
             return false;
         }
     }

when i put in the end the }then in if (item != null) say redudant null check:the variable item cannot be null at this location but if i delete } then everything its ok

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



  • Posts

    • Be host here, read the conversation, and at least try to be objective. I did ALL the coding, spent my time, debuging and testing. I was in touch with customer and using his server and game files to test if all works fine. It did, he knew it, we were communicating about this all the time, so it's not like I was taking piss and did nothing.  I did the design, but not finish on time. His server is still - and will be, on BETA. It was 100% custom work, for what I did, 50 euro is laughable. I wasn't disrespectful ant any point of our conversation, even after customer bailed out. I won't be refunding in full, I already refunded 100 euro. I also stated the reasons. I have right to do so after all the time, just like customer has rights to bail at any point. I don't care who's friend he is, who he is talking to on private messages to force his opinion.   I'm no longer a teenager or a studnet. In 90% of time I deliver on time. I took Celestine's advice and NOT stating something will be deliver in 1h (even tho it would be). Now I inform, I need few days. And everything is gooing good. Read my topic. I've started to ask customers to leave my a feedback, even tho it's not mandatory and nobody cares about mxc feedback anymore. But for every 30 transactions, if one doesn't go well, I'm taking shit and comments like "he NEVER delivers, ban him!", from all-time haterZ of mine. I don't care about those, but that's the reality here. If someone doesn't like my work, I'm not forcing anyone to contact me or use my work. I already gave my explanation, I already stated my reasons, I won't be refunding 50 euro. That's all from me. Take care
    • He gave a predetermined time frame for completion (2 weeks), he didn't deliver, he should refund the full amount, it's as simple as that. Honestly Ave has probably the best updater out there, the download speed is amazing since it has bz2 compression support, his designs are great, etc. I don't understand why he insists on taking so long to deliver every single time. His procrastination is bringing him down.
    • Dont be unfair, he spend time and he almost made it... he should thank for some money that got back
    • @Ave Your client still wants his 50$ back resolve the issue with him.
    • Thank You for using my support 🤟  
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock