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

when i delete } another problem created... here

{

_nonClassBasedRegisters.add(noble);

sm = new SystemMessage(SystemMessageId.YOU_HAVE_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_NO_CLASS_GAMES);

noble.sendPacket(sm);

}

     

return true;

(x) say syntax error , insert } to complete statement

  • 0
Posted
Index: java/com/l2jserver/gameserver/network/clientpackets/UseItem.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/UseItem.java	(revision 4167)
+++ java/com/l2jserver/gameserver/network/clientpackets/UseItem.java	(working copy)
@@ -97,6 +97,14 @@

		if (activeChar.getActiveTradeList() != null)
			activeChar.cancelActiveTrade();
+		
+		int weaponGrade = activeChar.getActiveWeaponItem().getCrystalType();
+		int armorGrade = activeChar.getActiveChestArmorItem().getCrystalType();
+		if (activeChar.isInOlympiadMode() && (weaponGrade == L2Item.CRYSTAL_A || armorGrade == L2Item.CRYSTAL_A))
+		{
+			activeChar.sendMessage("You cannot use A grade equipment at the Grand Olympiad games.");
+			return;
+		}

		// NOTE: disabled due to deadlocks
		// synchronized (activeChar.getInventory())
Index: java/com/l2jserver/gameserver/model/olympiad/Olympiad.java
===================================================================
--- java/com/l2jserver/gameserver/model/olympiad/Olympiad.java	(revision 4167)
+++ java/com/l2jserver/gameserver/model/olympiad/Olympiad.java	(working copy)
@@ -50,6 +50,7 @@
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.templates.StatsSet;
+import com.l2jserver.gameserver.templates.item.L2Item;
import com.l2jserver.util.L2FastList;

import javolution.util.FastMap;
@@ -482,6 +483,14 @@
		 * return false; }
		 */

+		int weaponGrade = noble.getActiveWeaponItem().getCrystalType();
+		int armorGrade = noble.getActiveChestArmorItem().getCrystalType();
+		if (weaponGrade == L2Item.CRYSTAL_A || armorGrade == L2Item.CRYSTAL_A)
+		{
+			noble.sendMessage("You cannot join the grand olympiad games using A grade equipment.");
+			return false;
+		}
+		
		if (!_inCompPeriod)
		{
			sm = new SystemMessage(SystemMessageId.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS);

  • 0
Posted

Index: java/com/l2jserver/gameserver/network/clientpackets/UseItem.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/UseItem.java	(revision 4167)
+++ java/com/l2jserver/gameserver/network/clientpackets/UseItem.java	(working copy)
@@ -97,6 +97,14 @@

		if (activeChar.getActiveTradeList() != null)
			activeChar.cancelActiveTrade();
+		
+		int weaponGrade = activeChar.getActiveWeaponItem().getCrystalType();
+		int armorGrade = activeChar.getActiveChestArmorItem().getCrystalType();
+		if (activeChar.isInOlympiadMode() && (weaponGrade == L2Item.CRYSTAL_A || armorGrade == L2Item.CRYSTAL_A))
+		{
+			activeChar.sendMessage("You cannot use A grade equipment at the Grand Olympiad games.");
+			return;
+		}

		// NOTE: disabled due to deadlocks
		// synchronized (activeChar.getInventory())
Index: java/com/l2jserver/gameserver/model/olympiad/Olympiad.java
===================================================================
--- java/com/l2jserver/gameserver/model/olympiad/Olympiad.java	(revision 4167)
+++ java/com/l2jserver/gameserver/model/olympiad/Olympiad.java	(working copy)
@@ -50,6 +50,7 @@
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.templates.StatsSet;
+import com.l2jserver.gameserver.templates.item.L2Item;
import com.l2jserver.util.L2FastList;

import javolution.util.FastMap;
@@ -482,6 +483,14 @@
		 * return false; }
		 */

+		int weaponGrade = noble.getActiveWeaponItem().getCrystalType();
+		int armorGrade = noble.getActiveChestArmorItem().getCrystalType();
+		if (weaponGrade == L2Item.CRYSTAL_A || armorGrade == L2Item.CRYSTAL_A)
+		{
+			noble.sendMessage("You cannot join the grand olympiad games using A grade equipment.");
+			return false;
+		}
+		
		if (!_inCompPeriod)
		{
			sm = new SystemMessage(SystemMessageId.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS);

with this code i cant wear any armor... :/ when i put out my armor i cant wear it again.... :S

  • 0
Posted

http://pastebin.com/yJp3EtZE <-- olympiad.java with code

I had no problems with that.

Anyway,since you use epilogue,you can get inspired by intrepid's post.

Add this.

       L2ItemInstance item = noble.getInventory().getItemByObjectId(_objectId);
       if (item.getItemGrade() > 4)
       {
               noble.sendMessage("You can't participate to Olympiad while holding a S grade Weapon.");
   		return false;
       }

  • 0
Posted

i delete this code from Olympiad.java

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;

         }

     }

and i replace this with this code

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

       if (item.getItemGrade() > 4)

       {

               noble.sendMessage("You can't participate to Olympiad while holding a S grade Weapon.");

    return false;

       }

but now it say The method getItemGrade() is undefined for the type l2ItemInstance

  • 0
Posted

Sry for double post but i am from yesterday... and no answer :S i am waiting so many hours... can someone tell me a solution pls?

[its not only for me this code... many guys want this... if someone help me to solve this problem... then i will add this code in the forum or someone else] (with credits)

  • 0
Posted

i fix it :) guys...!!! :D topic lock!!!! i read some topics for java codes... and i fix it !!! xaxa ooo nice!!! thanks for your help!!

locked.

Guest
This topic is now closed to further replies.



  • Posts

    • WIPE ! NEW SEASON GRAND OPENING FROM TODAY ! - 23/01/2026, FRIDAY, 20:00 +3 GMT !
    • https://vpslab.cloud/ Premium DDoS Protection now included with every server.
    • # Changelog - Public Updates   This changelog tracks user-facing updates and improvements to Top.MaxCheaters.com.   ---   ## [1.2.0] - 2026-01-XX   ### ⚡ Performance Improvements - **Faster Page Loads**: Implemented intelligent caching system that makes pages load significantly faster - **My Servers Page**: Now loads instantly when revisiting (no more loading delays) - **Main Page**: Server listings and filters now load faster on repeat visits - **Premium Ads**: Pricing information loads instantly - **Overall Performance**: Site now loads 60-80% faster with reduced server load   ### 🔄 Improvements - Pages now remember recent data, reducing wait times when navigating - Automatic cache refresh ensures you always see up-to-date information - Better user experience with instant page loads on repeat visits   ---   ## [1.1.1] - 2026-01-XX   ### 🐛 Bug Fixes - **VIP Server Filter**: Fixed "VIP L2 Servers" filter to correctly show all premium tier servers (VIP, Gold VIP, and Pinned) - **Ad Pricing Display**: Fixed ad pricing on Premium Ads page to automatically update when changed in admin panel   ### 🔄 Improvements - Ad pricing now syncs automatically across all pages - More accurate server filtering by tier   ---   ## [1.1.0] - 2026-01-XX   ### ✨ New Features - **Complete Chronicle List**: All chronicle options are now available in server forms and filters, including the latest Lineage 2 chronicles - **Improved Chronicle Display**: Server rows now show cleaner, shorter chronicle names for better readability   ### 🐛 Bug Fixes - **Chronicle Filter**: Fixed issue where "Infinite Odyssey" chronicle filter was not working correctly - **Missing Chronicles**: Fixed missing chronicle options in server creation and editing forms   ### 🔄 Improvements - Chronicle filters and dropdowns now stay in sync with the latest available chronicles - Better chronicle name formatting in server listings for improved visual clarity   ---   ## [1.0.0] - Initial Release   ### Features - 🎮 Server listings with multiple tiers (Normal, VIP, Gold VIP, Pinned) - 📊 Click tracking and server statistics - 🌍 Multi-language support (English, Spanish, Portuguese, Greek, Russian) - 💳 Payment system for premium server features - 🔐 Secure authentication system - 👑 Admin panel for server management - 📱 Fully responsive design for all devices - 🔍 Advanced filtering system (by chronicle, rate, server type, date) - 📅 Server opening date tracking - 🎯 Two viewing modes: By Date and By Votes (coming soon for all users)   ---   ## About This Changelog   This changelog focuses on updates that directly impact the user experience. Internal development changes and technical improvements are not included here.   For questions or feedback, please contact support.v
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..