Jump to content
  • 0

Little Help With Captcha Code


Question

Posted (edited)

hello Mxc i need some help from who understands java since i'm a bit noob as you can see and i'll go crazy, i made a antibot captcha by levels of punishment and i have tried using these pieces of code to put a config to look for items in the player's inventory and if you have to delete them, but i get 5000 errors in the server console after the system try to delete the items.

 

this is the config.java:

			ANTIBOT_3_LEVEL_LISTITEMS_REMOVE = L2JModSettings.getBoolean("AntiBotLevel3ListItemsRemove", true);
			String[] AntibotRemoveItems = L2JModSettings.getString("AntibotRemoveItems", "").split(",");
			ANTIBOT_REMOVE_ITEMS_LIST = new ArrayList<>(AntibotRemoveItems.length);
			for (String id : AntibotRemoveItems)
			{
				ANTIBOT_REMOVE_ITEMS_LIST.add(Integer.parseInt(id));
			}

this is my antibot file ( piece of code):

					if (Config.ANTIBOT_3_LEVEL_LISTITEMS_REMOVE)
					{
						for (L2ItemInstance item : player.getInventory().getAllItemsByItemId2(Config.ANTIBOT_REMOVE_ITEMS_LIST))
						{
							if (item != null)
							{
								player.getInventory().destroyItem("Anti Bot", item, player, player);
							}
						}
						
					}
					
					break;

and this is the method that i created in pcinventory.java to check the list...:

	/**
	 * @param ANTIBOT_REMOVE_ITEMS_LIST
	 * @return
	 */
	public L2ItemInstance[] getAllItemsByItemId2(List<Integer> ANTIBOT_REMOVE_ITEMS_LIST)
	{
		return getAllItemsByItemId2(ANTIBOT_REMOVE_ITEMS_LIST);
	}

and this is the config.ini:

# Remove the list of items listed below on third level punishment?
AntiBotLevel3ListItemsRemove = True

# Remove the list of items listed below on third level punishment
# Example 6673,3470 (festival adena, gold bars)
AntibotRemoveItems = 6673,3470

i am getting the errors in the method getAllItemsByItemId2() , if someone can give me a hand 's take will be thankful ,thanks in advance.

Edited by b0rto

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

Your method is calling itself, leading to a permanent loop (server processes it until it ends into a stackoverflow).

 

What you want to do is to loop over all items (generic existing method), retrieve their ids and compare id with whatever id from the list (I added ArrayUtil.contains for such case on aCis, dunno if you got a similar thing on whatever project you use). If it's positive, you delete the item.

 

Take inspiration from "castle circlet removal" custom.

Edited by Tryskell

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Good Luck!
    • My repository  https://github.com/gawric/Unity-Client-for-L2J
    • Project based on lucera2 Chronicle: Interlude Starting level: 80 Max level: 95 EXP/SP: x160 DROP:X1 RAID:X1 SAFE+7 MAX+25 Farm Aresa Cave of Trials Hellbound Night Instance - Elven Fortress from 10pm to 11pm PvP Areas Gludin Village - max item level 1 Garden of Eva - max items 3 lvl Hellbound Town - No restrictions *PvP Rewards enchant scrolls PVP SKILLS: - 1 lvl > 1000 pvps > Evo Magic Barrier - 2 lvl > 2000 pvps > Evo Shield - 3 lvl > 5000 pvps > Evo Might/Empower - 4 lvl > 10000 pvps > Evo Health - 5 lvl > 15000 pvps > Evo Bererker - 6 lvl > 20000 pvps > Evo Valor - Note: You need to restart to earn the skill! - Announcing your rank level on entering. - PvP Skills available only on the main class! - The buffs can be stucked from all levels! Custom Items Armors 5 lvls 1 lvl epic armor 2 lvl dynasty armor 3 lvl Vesper armor 4 lvl Titanium Armor 5 lvl Bloody Armor Weapons 6 lvls 1 lvl monster weapons 2 lvl dynasty weapons 3 lvl vesper weapons 4 lvl divine weapons (good for farm) 5 lvl weapons titanium weapons 6 lvl Raid & God weapons *Raid weapons can be earned only from RAIDS! * Raids and god weapons have the same stats. Jews Normal and Relic Accessories 1 & 2 lvl. Tattoos 1 & 2 lvl *2 lvl tattos can be enchanted. On each enchant adding atak speed, cast, hp, p.atk, m.atk, health depends on the tattoo. Enchant bonuses on weapon armors on weapon vary from +16 to +25 on armors +16 evo aura/ +18 bonus stas ENCHANT RATES BLESSED SCROLLS: -5% after every enchant EVO SCROLLS: +5% more chance than BLESSED EVO EPIC SCROLLS: +5% more chance and on fail the enchant stays the same DIVINE SCROLL: Only for divine weapons. 100% success rate. GOD SCROLL: 100% success rate. Only for God/raid weps/bloody armor. Farm and Economy Full custom farm mobs Armor/Weapon +++ as possible drop Custom Coins Custom chests (appear after the mob is killed with %). You can earn additional rare rewards. 2 levels of custom chests for better rewards. L2 Evo Quest - Daily challange. You need to collect 20 Evo Quest coins. After finishing the quest you will get your dialy reward. - 7 Days reward (progressive) - 4 cycles reward (When you finish 4 weeks quests, you will be awarded with a rare coin. You can exchange this Rare Coin for: 3 lvl weapon +0, Heroic Coin (3 days), 2 level jews. - Added quest tracking day 1: Silver Coins - 1000, 1 Blessed Scroll Weapon day 2: Blue Eva - 500, 2 Blessed Scroll Armor day 3: Silver Coins - 1400, 5 Event Medals day 4: Festival Adena- 50, 3 Blessed Scroll Weapon day 5: Silver Coins 2000, 4 Blessed Scroll Armor day 6: Blue Eva - 2000, Event Medal: 8 day 7: Heroic Contract 1, Event Medal 15 * With heroic contract you can get 3 days hero from the Donate Services NPC. All raids removed. All party mobs drop raid and epic raid coins. All clans have the chance to get unlimited raids. We have 3 custom pvp raids in the pvp zones. Respawn 12h. EVENTS TVT CTF SQUASH EVENT NIGHT EVENT Custom NPCS Gatekeeper Custom Shop - all important items Buffer - all needed buffs GM Shop - all basic items Donate shop - all items that can be donated Night Instance - Special Event (every day 10pm to 11pm) +2GMT *type .time in game to see the server time. Quest Manager Skill enchant manager Letters collector (earn additional rewards for collecting words) About classes: All classes boosted PVE skill dmg All summoners classes boosted (pet instant 92lvl) + boosted skills on pet. Critical Damage restriction formula. Website: https://l2evo.net GRAND OPENING: 24.04.2025 8PM +2 GMT. DISCORD: https://discord.gg/3DcBVKhNnX  
    • Get A Free Trial NOW! Get A Free Trial NOW! Get A Free Trial NOW!
  • Topics

×
×
  • Create New...