Jump to content
  • 0

[Help]Problem with Java code


Question

Posted

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)

 

Recommended Posts

  • 0
Posted

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

  • 0
Posted

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

  • 0
Posted

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?

  • 0
Posted

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

  • 0
Posted

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.

  • 0
Posted

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

  • 0
Posted

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.

  • 0
Posted

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

  • 0
Posted

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.

  • 0
Posted

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)

  • 0
Posted

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;
          }
      }

  • 0
Posted

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

  • 0
Posted

i edit my previous reply pls check it... if its something serious

Very well,delete it and have a try.

Guest
This topic is now closed to further replies.



  • Posts

    • My official facebook profile!: https://www.facebook.com/spectrumL2 Specifications: Revamped L2JACIS revision FROM the core Private project!!! Revision that has been receiving corrections for over 3 years!!! Events already installed in the revision: TVT CTF KTB PARTY FARM SPOIL EVENT CRAZY RATES TOURNAMENT TIME ZONE (INSTANCE) All working correctly!!! SIEGE ESSENTIAL FEATURES: Walls fix Gates fix Flags fix 100% functional: OLYMPIADS: Implemented settings Hero receives enchanted Weapons with equal status PvP Weapons Optional /true/false Hero can acquire all Hero Weapons Optional true/false OTHER IMPLEMENTATIONS: Teleport fixed (directly to Giran) Teleport effect classic Vip skins vip collor name Pack NPCs with effect already configured BOSES already configured Mobs already configured CLASS BALANCE SPECIAL SYSTEM We have a SPECIAL system developed for Class Balance with only 1 digit in XML %tage of configurable debuffs Player limitation system in BOSES or PvP zones BS blocking system in FLEG zones or events Among others dozens of improvements made in the review... price: 390 USD !  OBS: WE CAN CHANGE THE BANNER AND NAME OF THE SERVICE TO THE ONE OF YOUR PREFERENCE BUT THE SETTINGS MUST BE KEPT ANY CHANGES REQUIRE ADDITION        
    • Server is Online – 1,000+ Active Players! We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players! Clans can now benefit from VIP Access to help you catch up faster. 🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!  
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
  • 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