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

    • Interlude x15 –  No soy el administrador de este servidor, pero es un nuevo proyecto que está muy bien configurado — ¡solo necesita una comunidad! Si estás buscando una experiencia nueva, equilibrada y emocionante en Interlude, este es el lugar. ¡Participa! Únete al servidor Trae tu clan o equipo ¡Ayuda a que el servidor crezca!   Fecha de Apertura 16 de Mayo de 2025 Horario de Apertura 19:00 GMT-3 Versión del Juego Interlude Versión de la Interfaz Classic (protocolo 166) Rates de EXP y SP Dinámicos Niveles 1 al 19: EXP 15, SP 10 Niveles 20 al 39: EXP 13, SP 7 Niveles 40 al 51: EXP 11, SP 3 Niveles 52 al 60: EXP 9, SP 3 Niveles 61 al 75: EXP 7, SP 1.5 Niveles 76+: EXP 2, SP 1 Otros Rates Adena: x1 Chance de Drop: x1 Chance de Spoil: x1 Cantidad de SealStone: x2 RB XP/SP: x3 RB Drop: x2 Configuraciones Únicas Hasta 3 cuentas por PC (2 gratis + 1 paga) Sistema de Enchant skill desactivado Sistema de Augment weapon desactivado Mana potion: efecto de 2000, reutilización de 15 segundos Sin auto-learn skill SP y Book para aprender skills Quests 1ª y 2ª Transferencia de Clase por Adena 3ª Transferencia de Clase por 700 Halisha Marks Subclase custom: solo hablar con las cajas de los 4 jefes Nobles Retail Recompensa de Transferencia de Profesión Recibe un ticket de 1ª profesión (artículos del starter pack) Recibe un ticket de 2ª profesión (Montura de Clase) Mejoras en el Auto-farm Hemos reestructurado la IA del auto-farm Corregida la zona de caza Configuraciones de alcance de la caza automática Clanes y Alianzas Máximo de miembros por clan: 25 miembros Máximo de clanes por alianza: 1 clan El clan ya inicia nivel 8, sin reputación y sin skills Comandos Dentro del Juego .cfg - Para ajustar configuraciones del juego .instancezone - Verificar el tiempo de instancias .sellbuff - Para comenzar a vender buffs .topclan - Para verificar el top clan .acp - Para usar el sistema de auto potion Bono de EXP Extra en la Party 6 miembros: 20% 7 miembros: 30% 8 miembros: 40% 9 miembros: 50% NPC Buff Duración: 1 hora Total de buffs: 24 + 4 (Divine Inspiration) Buffs básicos sin protección y sin profecías   Join  >> DISCORD <<    
    • 🚀 MoMoProxy Static Residential Proxies For Sale!     🔹 Stable, secure & high-anonymity 🔹 >10Mbps speed, <10ms latency 🔹 99.99% uptime & static IPs 🔹 Unlimited traffic & connections 🌍 30M+ clean residential IPs ✅ Whitelist & user/pass auth 💳 Flexible plans (7/30/90 days) 💰 From $3/IP (Pay-per-IP) 🔥 Perfect for: ✔️ Ad verification ✔️ E-commerce/social media ✔️ Data scraping ✔️ Anti-detect browsers 🆓 Start free trial today! 🔗 [Insert Link] #Proxy #ResidentialProxies #WebScraping #DigitalMarketing   1/ Why Choose MoMoProxy? ✅ Global ISP network (30M+ IPs) ✅ Dedicated dashboard for easy management ✅ 24/7 stable operation ✅ HTTP(S)/SOCKS5 support 2/ Use Cases: 📊 Ad fraud detection 🛒 Sneaker copping & e-com 📱 Social media automation 🌐 Travel aggregation & more! 3/ Get Started in 4 Steps: A. Pick MoMoProxy B. Grab your IP credentials C. Configure your tool D. Enjoy unlimited sessions!   https://momoproxy.com/static-residential-proxies https://momoproxy.com/static-residential-proxies https://momoproxy.com/static-residential-proxies    
    • ➡ Discount for your purchase: MAY2025 (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • ➡ Discount for your purchase: MAY2025 (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • Special offer until end of the month, don't lose it. 250  include datapack and patch latest.
  • Topics

×
×
  • Create New...