Jump to content
  • 0

misterelax

Question

hello mates

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.gameserver.model.entity;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Calendar;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Logger;

import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2FactTeleporterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2TpFlagInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.util.Broadcast;
import com.l2jserver.util.StringUtil;

/**
 * @author Laikeriz
 */
public class FactionMaps
{
	private final static Logger _log = Logger.getLogger(FactionMaps.class.getName());
	
	public static Map<Integer, String> _all_maps = new HashMap<>();
	
	public static int _mapId = 0;
	public static String _mapName = "";
	public static int _maps_count = 0;
	public static boolean _voting = false;
	public static int[] _mapVotes = new int[10];
	public static String[] _mapNames = new String[10];
	private static long _nextMapIn = 0;
	
	
	public static boolean isVoting()
	{
		return _voting;
	}
	
	public static int getMapId()
	{
		return _mapId;
	}
	
	public static String getMapName()
	{
		return _mapName;
	}
	
	public static String getDelayUntilVoting()
	{
		long trim = _nextMapIn - Calendar.getInstance().getTimeInMillis();
		int h = 0;
		int m = 0;
		int s = 0;
		int k = 1 / 2;
		
		if ((trim / 3600000) >= 1)
		{
			h = Math.round((trim / 3600000) - k);
			trim -= h * 3600000;
		}
		if ((trim / 60) >= 1)
		{
			m = Math.round((trim / 60000) - k);
			trim -= m * 60000;
		}
		if ((trim / 1000) >= 1)
		{
			s = Math.round((trim / 1000) - k);
		}
		return h + "h. " + m + "m. " + s + "s.";
	}
	
	@SuppressWarnings("resource")
	public static void loadCurrentMap()
	{
		Connection con = null;
		try
		{
			con = ConnectionFactory.getInstance().getConnection();
			PreparedStatement stmt = con.prepareStatement("SELECT mapId,map_name FROM faction_maps WHERE current=1");
			ResultSet rset = stmt.executeQuery();
			while (rset.next())
			{
				_mapId = rset.getInt("mapId");
				_mapName = rset.getString("map_name");
			}
			rset.close();
			stmt.close();
			// Put all maps in FastMap
			PreparedStatement stmt_all = con.prepareStatement("SELECT mapId,map_name FROM faction_maps");
			ResultSet rset_all = stmt_all.executeQuery();
			while (rset_all.next())
			{
				_all_maps.put(rset_all.getInt("mapId"), rset_all.getString("map_name"));
			}
			rset_all.close();
			stmt_all.close();
		}
		catch (Exception e)
		{
			_log.warning("Load current map: " + e);
		}
		finally
		{
			try
			{
				con.close();
			}
			catch (Exception e)
			{
			}
		}
		ThreadPoolManager.getInstance().scheduleGeneral(() -> endVoting(true), 1000);
	}
	
	public static void beginVoting()
	{
		for (L2TpFlagInstance flag : L2FactTeleporterInstance._tpBlueFlags)
		{
			flag.deleteMe();
		}
		for (L2TpFlagInstance flag : L2FactTeleporterInstance._tpRedFlags)
		{
			flag.deleteMe();
		}
		L2FactTeleporterInstance._tpBlueFlags.clear();
		L2FactTeleporterInstance._tpRedFlags.clear();
		for (L2PcInstance player : L2World.getInstance().getAllPlayers().values())
		{
			player.setVotedForMap(false);
		}
		Broadcast.toAllOnlinePlayers("Voting for next faction map has begun. It will end in 60 seconds.");
		_voting = true;
		
		NpcHtmlMessage html = new NpcHtmlMessage(1);
		final StringBuilder tb = StringUtil.startAppend(3500, "<html><title>Faction Maps</title><body><center>");
		tb.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32 align=left><br>");
		Connection con = null;
		try
		{
			con = ConnectionFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT * FROM faction_maps WHERE current=0");
			ResultSet rset = statement.executeQuery();
			for (int r = 0; r < _mapVotes.length; r++)
			{
				_mapVotes[r] = 0;
			}
			while (rset.next())
			{
				
				tb.append("<button value=\"" + rset.getString("map_name") + "\" action=\"bypass -h voteformap_" + rset.getInt("mapId") + "\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
				_mapNames[rset.getInt("mapId")] = rset.getString("map_name");
			}
			rset.close();
			statement.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			try
			{
				con.close();
			}
			catch (Exception e)
			{
				_log.info("Couldn't set player faction:" + " " + e);
			}
		}
		tb.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left></center></body></html>");
		
		html.setHtml(tb.toString());
		for (L2PcInstance player : L2World.getInstance().getAllPlayers().values())
		{
			player.sendPacket(html);
		}
		try
		{
			Thread.sleep(60000);
		}
		catch (Exception e)
		{
		}
		endVoting(false);
	}
	
	@SuppressWarnings("resource")
	public static void endVoting(boolean onLoad)
	{
		_nextMapIn = Calendar.getInstance().getTimeInMillis() + 250000;
		if (!onLoad)
		{
			_voting = false;
			int mostVotes = 0;
			int mostMapId = 0;
			for (int i = 0; i < _mapVotes.length; i++)
			{
				if (_mapVotes[i] > mostVotes)
				{
					mostVotes = _mapVotes[i];
					mostMapId = i;
				}
			}
			
			if (mostVotes == 0)
			{
				mostMapId = 2;
			}
			_mapName = _mapNames[mostMapId];
			_mapId = mostMapId;
			Broadcast.toAllOnlinePlayers("Voting for faction maps has ended.");
			Broadcast.toAllOnlinePlayers("The next map will be: " + _mapName);
			L2TpFlagInstance.spawnFlags();
			
			@SuppressWarnings("resource")
			Connection con = null;
			try
			{
				con = ConnectionFactory.getInstance().getConnection();
				PreparedStatement statement = null;
				statement = con.prepareStatement("UPDATE faction_maps SET current=0");
				statement.execute();
				statement = con.prepareStatement("UPDATE faction_maps SET current=1 WHERE mapId=?");
				statement.setInt(1, _mapId);
				statement.execute();
				statement.close();
			}
			catch (Exception e)
			{
				_log.warning("End voting: " + e);
			}
			finally
			{
				try
				{
					con.close();
				}
				catch (Exception e)
				{
				}
			}
		}
		int durat = 4 * 60 * 1000;
		try
		{
			Thread.sleep(durat);
		}
		catch (Exception e)
		{
		}
		beginVoting();
	}
	
	public static int getNextMap(int mapid)
	{
		if (_mapId < _maps_count)
		{
			return _mapId + 1;
		}
		return 1;
	}
	
	public static class ValueComparator implements Comparator<Object>
	{
		Map<L2PcInstance, Integer> base;
		
		public ValueComparator(Map<L2PcInstance, Integer> base1)
		{
			this.base = base1;
		}
		
		@Override
		public int compare(Object a, Object b)
		{
			if (base.get(a) < base.get(b))
			{
				return 1;
			}
			else if (base.get(a) == base.get(b))
			{
				return 0;
			}
			else
			{
				return -1;
			}
		}
	}
	
	public static void voteForMap(int mapId)
	{
		_mapVotes[mapId] = _mapVotes[mapId] + 1;
	}
	
}

.So im trying to adapt DarthVaders script for factionmap,l2factteleporter and l2tpflaginstance on h5 l2j.So far everything work perfect except voting.The window as you can see is working but when i press any button window just close and nothing happen.When voting ends and next map load it seems to be the same so i believe is something wrong with bypass,but i cant figured out .Any help/idea?

post-162349-0-45864700-1474471343_thumb.png

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

oh!!forgot to upload...

/*
 * Copyright (C) 2004-2015 L2J Server
 * 
 * This file is part of L2J Server.
 * 
 * L2J Server is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * L2J Server is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.gameserver.network.clientpackets;

import java.util.StringTokenizer;
import java.util.logging.Level;

import com.l2jserver.Config;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.data.xml.impl.AdminData;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.enums.PlayerAction;
import com.l2jserver.gameserver.handler.AdminCommandHandler;
import com.l2jserver.gameserver.handler.BypassHandler;
import com.l2jserver.gameserver.handler.CommunityBoardHandler;
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Hero;
import com.l2jserver.gameserver.model.events.EventDispatcher;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcManorBypass;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerBypass;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.util.Broadcast;
import com.l2jserver.gameserver.util.GMAudit;
import com.l2jserver.gameserver.util.Util;

/**
 * RequestBypassToServer client packet implementation.
 * @author HorridoJoho
 */
public final class RequestBypassToServer extends L2GameClientPacket
{
	private static final String _C__23_REQUESTBYPASSTOSERVER = "[C] 23 RequestBypassToServer";
	// FIXME: This is for compatibility, will be changed when bypass functionality got an overhaul by NosBit
	private static final String[] _possibleNonHtmlCommands =
	{
		"_bbs",
		"bbs",
		"_mail",
		"_friend",
		"_match",
		"_diary",
		"_olympiad?command",
		"manor_menu_select"
	};
	
	// S
	private String _command;
	
	@Override
	protected void readImpl()
	{
		_command = readS();
	}
	
	@Override
	protected void runImpl()
	{
		final L2PcInstance activeChar = getClient().getActiveChar();
		if (activeChar == null)
		{
			return;
		}
		
		if (_command.isEmpty())
		{
			_log.warning("Player " + activeChar.getName() + " sent empty bypass!");
			activeChar.logout();
			return;
		}
		
		boolean requiresBypassValidation = true;
		for (String possibleNonHtmlCommand : _possibleNonHtmlCommands)
		{
			if (_command.startsWith(possibleNonHtmlCommand))
			{
				requiresBypassValidation = false;
				break;
			}
		}
		
		int bypassOriginId = 0;
		if (requiresBypassValidation)
		{
			bypassOriginId = activeChar.validateHtmlAction(_command);
			if (bypassOriginId == -1)
			{
				_log.warning("Player " + activeChar.getName() + " sent non cached bypass: '" + _command + "'");
				return;
			}
			
			if ((bypassOriginId > 0) && !Util.isInsideRangeOfObjectId(activeChar, bypassOriginId, L2Npc.INTERACTION_DISTANCE))
			{
				// No logging here, this could be a common case where the player has the html still open and run too far away and then clicks a html action
				return;
			}
		}
		
		if (!getClient().getFloodProtectors().getServerBypass().tryPerformAction(_command))
		{
			return;
		}
		
		try
		{
			if (_command.startsWith("admin_"))
			{
				String command = _command.split(" ")[0];
				
				IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(command);
				
				if (ach == null)
				{
					if (activeChar.isGM())
					{
						activeChar.sendMessage("The command " + command.substring(6) + " does not exist!");
					}
					_log.warning(activeChar + " requested not registered admin command '" + command + "'");
					return;
				}
				
				if (!AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel()))
				{
					activeChar.sendMessage("You don't have the access rights to use this command!");
					_log.warning("Character " + activeChar.getName() + " tried to use admin command " + command + ", without proper access level!");
					return;
				}
				
				if (AdminData.getInstance().requireConfirm(command))
				{
					activeChar.setAdminConfirmCmd(_command);
					ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.S1);
					dlg.addString("Are you sure you want execute command " + _command.substring(6) + " ?");
					activeChar.addAction(PlayerAction.ADMIN_COMMAND);
					activeChar.sendPacket(dlg);
				}
				else
				{
					if (Config.GMAUDIT)
					{
						GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", _command, (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"));
					}
					
					ach.useAdminCommand(_command, activeChar);
				}
			}
			else if (_command.startsWith("voteformap_"))
			{
				
				int mapId = Integer.parseInt(_command.split("_")[1]);
				FactionMaps.voteForMap(mapId);
				activeChar.sendMessage("Your vote was added.");
				activeChar.setVotedForMap(true);
			}
			else if (CommunityBoardHandler.getInstance().isCommunityBoardCommand(_command))
			{
				CommunityBoardHandler.getInstance().handleParseCommand(_command, activeChar);
			}
			else if (_command.equals("come_here") && activeChar.isGM())
			{
				comeHere(activeChar);
			}
			
			else if (_command.startsWith("npc_"))
			{
				int endOfId = _command.indexOf('_', 5);
				String id;
				if (endOfId > 0)
				{
					id = _command.substring(4, endOfId);
				}
				else
				{
					id = _command.substring(4);
				}
				if (Util.isDigit(id))
				{
					L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
					
					if ((object != null) && object.isNpc() && (endOfId > 0) && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
					{
						((L2Npc) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1));
					}
				}
				
				activeChar.sendPacket(ActionFailed.STATIC_PACKET);
			}
			else if (_command.startsWith("item_"))
			{
				int endOfId = _command.indexOf('_', 5);
				String id;
				if (endOfId > 0)
				{
					id = _command.substring(5, endOfId);
				}
				else
				{
					id = _command.substring(5);
				}
				try
				{
					final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(Integer.parseInt(id));
					if ((item != null) && (endOfId > 0))
					{
						item.onBypassFeedback(activeChar, _command.substring(endOfId + 1));
					}
					
					activeChar.sendPacket(ActionFailed.STATIC_PACKET);
				}
				catch (NumberFormatException nfe)
				{
					_log.log(Level.WARNING, "NFE for command [" + _command + "]", nfe);
				}
			}
			else if (_command.startsWith("_match"))
			{
				String params = _command.substring(_command.indexOf("?") + 1);
				StringTokenizer st = new StringTokenizer(params, "&");
				int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
				int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
				int heroid = Hero.getInstance().getHeroByClass(heroclass);
				if (heroid > 0)
				{
					Hero.getInstance().showHeroFights(activeChar, heroclass, heroid, heropage);
				}
			}
			
			else if (_command.startsWith("_diary"))
			{
				String params = _command.substring(_command.indexOf("?") + 1);
				StringTokenizer st = new StringTokenizer(params, "&");
				int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
				int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
				int heroid = Hero.getInstance().getHeroByClass(heroclass);
				if (heroid > 0)
				{
					Hero.getInstance().showHeroDiary(activeChar, heroclass, heroid, heropage);
				}
			}
			else if (_command.startsWith("_olympiad?command"))
			{
				int arenaId = Integer.parseInt(_command.split("=")[2]);
				final IBypassHandler handler = BypassHandler.getInstance().getHandler("arenachange");
				if (handler != null)
				{
					handler.useBypass("arenachange " + (arenaId - 1), activeChar, null);
				}
			}
			else if (_command.startsWith("manor_menu_select"))
			{
				final L2Npc lastNpc = activeChar.getLastFolkNPC();
				if (Config.ALLOW_MANOR && (lastNpc != null) && lastNpc.canInteract(activeChar))
				{
					final String[] split = _command.substring(_command.indexOf("?") + 1).split("&");
					final int ask = Integer.parseInt(split[0].split("=")[1]);
					final int state = Integer.parseInt(split[1].split("=")[1]);
					final boolean time = split[2].split("=")[1].equals("1");
					EventDispatcher.getInstance().notifyEventAsync(new OnNpcManorBypass(activeChar, lastNpc, ask, state, time), lastNpc);
				}
			}
			else
			{
				final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);
				if (handler != null)
				{
					if (bypassOriginId > 0)
					{
						L2Object bypassOrigin = activeChar.getKnownList().getKnownObjects().get(bypassOriginId);
						if ((bypassOrigin != null) && bypassOrigin.isInstanceTypes(InstanceType.L2Character))
						{
							handler.useBypass(_command, activeChar, (L2Character) bypassOrigin);
						}
						else
						{
							handler.useBypass(_command, activeChar, null);
						}
					}
					else
					{
						handler.useBypass(_command, activeChar, null);
					}
				}
				else
				{
					_log.warning(getClient() + " sent not handled RequestBypassToServer: [" + _command + "]");
				}
			}
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Exception processing bypass from player " + activeChar.getName() + ": " + _command, e);
			
			if (activeChar.isGM())
			{
				StringBuilder sb = new StringBuilder(200);
				sb.append("<html><body>");
				sb.append("Bypass error: " + e + "<br1>");
				sb.append("Bypass command: " + _command + "<br1>");
				sb.append("StackTrace:<br1>");
				for (StackTraceElement ste : e.getStackTrace())
				{
					sb.append(ste.toString() + "<br1>");
				}
				sb.append("</body></html>");
				// item html
				final NpcHtmlMessage msg = new NpcHtmlMessage(0, 1, sb.toString());
				msg.disableValidation();
				activeChar.sendPacket(msg);
			}
		}
		
		EventDispatcher.getInstance().notifyEventAsync(new OnPlayerBypass(activeChar, _command), activeChar);
	}
	
	/**
	 * @param activeChar
	 */
	private static void comeHere(L2PcInstance activeChar)
	{
		L2Object obj = activeChar.getTarget();
		if (obj == null)
		{
			return;
		}
		if (obj instanceof L2Npc)
		{
			L2Npc temp = (L2Npc) obj;
			temp.setTarget(activeChar);
			temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, activeChar.getLocation());
		}
	}
	
	@Override
	public String getType()
	{
		return _C__23_REQUESTBYPASSTOSERVER;
	}
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

    • 🌟 Welcome to the dawn of a new adventure in the realm of Lineage 2 Supreme! 🌟 Prepare yourself for an epic journey that transcends time and space. Our upcoming project promises to deliver the ultimate mid-rate experience, where heroes are forged and legends are born. Stay tuned for updates as we embark on this thrilling journey together. The realm of Lineage 2 awaits, and destiny beckons. Are you ready to answer the call? www.l2supreme.cc https://discord.com/invite/QA32rQ77nM
    • Official Website @>> https://www.eventbrite.com/e/biopeak-male-enhancement-reviews-warning-important-information-no-one-will-tell-you-tickets-894184589177   Biopeak Male Enhancement:- Considering the mind-boggling interest in their products, the organization needed to confine the quantity of units ready to move. We considered what compelled this sugary treat to surprise the world, and we discussed whether it satisfied our grand assumptions,    https://www.facebook.com/BiopeakMaleEnhancementInUS/ https://www.facebook.com/Get.BiopeakMaleEnhancementUS/   https://trybiopeakme.clubeo.com/calendar/2024/04/29/biopeak-male-enhancement-reviews-the-disturbing-biopeak-supplements-truth https://trybiopeakme.clubeo.com/calendar/2024/04/28/biopeak-male-enhancement-reviews-warning-important-information-no-one-will-tell-you https://trybiopeakme.clubeo.com/calendar/2024/04/28/biopeak-male-enhancement-reviews-truth-exposed-2024-biopeak-supplements-usa-for-men https://medium.com/@BiopeakMaleEnhancementBuyNow/biopeak-male-enhancement-reviews-revitalize-your-sexual-biopeak-supplements-health-with-1b0dcc117608 https://medium.com/@BiopeakMaleEnhancementBuyNow/biopeak-male-enhancement-reviews-warning-usa-ca-important-information-no-one-will-tell-you-f375f53b3cd9 https://medium.com/@BiopeakMaleEnhancementBuyNow/biopeak-male-enhancement-reviews-truth-exposed-2024-is-biopeak-supplements-it-scam-or-real-9b8fc49be4c3 https://medium.com/@BiopeakMaleEnhancementBuyNow/be-informed-biopeak-male-enhancement-reviews-on-scam-alert-this-enhancement-for-male-female-2d49c8f9ec17   Nexalyn Norway Official Links   https://www.facebook.com/NexalynInNorway/ https://www.facebook.com/NexalynNorway/ https://nexalyn-norway.company.site/ https://nexalyn-norway.jimdosite.com/ https://nexalyn-norway-1.jimdosite.com/   https://infogram.com/nexalyn-norway-reviews-advarsel-viktig-informasjon-ingen-vil-fortelle-deg-1h0n25oyjvynz4p?live https://medium.com/@NexalynNorway/nexalyn-norway-reviews-truth-exposed-2024-nexalyn-tablet-iceland-for-men-ad3f06ce6c83 https://medium.com/@NexalynNorway/nexalyn-norway-reviews-2024-er-nexalyn-tablet-iceland-lovlig-eller-svindel-ac2a9a8506d3 https://medium.com/@NexalynNorway/nexalyn-norway-reviews-revitalisere-din-nexalyn-tablet-seksuelle-helse-med-a0d44852760c https://bonniedgrafh.clubeo.com/calendar/2024/04/26/nexalyn-norway-reviews-does-it-really-work https://bonniedgrafh.clubeo.com/calendar/2024/04/26/nexalyn-norway-reviews-revitalisere-din-nexalyn-tablet-seksuelle-helse-med https://bonniedgrafh.clubeo.com/calendar/2024/04/27/nexalyn-norway-reviews-advarsel-viktig-informasjon-ingen-vil-fortelle-deg https://bonniedgrafh.clubeo.com/calendar/2024/04/26/nexalyn-norway-reviews-testo-booster-pills-real-buyers-alert https://medium.com/@NexalynNorway/v%C3%A6r-informert-nexalyn-norway-reviews-om-svindelvarsel-denne-forbedringen-for-mannlig-og-kvinnelig-f52047570116
    • WELCOME TO THE BOXID MARKETPLACE THE BOXID is the best place to buy accounts in bulk. Also on THE BOXID there are any services for digital marketing and arbitrage! We offer cheap accounts and provide flexible prices, discounts and bonuses for loyal customers. If you want to make a bulk order, specify the quantity of items in the checkout form or contact our manager and ask for help with your bulk purchase. We sell social media at the most affordable price! https://theboxid.com/category/accounts/
    • Hello, I am adapting it to acis 401, and when I run it in the game it tells me: No rights defined for admin command 'admin_search'. Admin tried to use admin command 'admin_search', but has no access to use it.   Also try to adapt it in AdminAdmin.java with else in the last lines using it as admin_buscar (buscar = search in spanish) and I get the same error: No rights defined for admin command 'admin_buscar'. Admin tried to use admin command 'admin_search', but has no access to use it. I have the AdminSearch.java like this: package net.sf.l2j.gameserver.handler.admincommandhandlers; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; import net.sf.l2j.commons.lang.StringUtil; import net.sf.l2j.commons.math.MathUtil; import net.sf.l2j.gameserver.data.xml.ItemData; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.WorldObject; import net.sf.l2j.gameserver.model.actor.Player; import net.sf.l2j.gameserver.model.item.kind.Item; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; public class AdminSearch implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_search" }; private static final int PAGE_LIMIT = 15; @Override public void useAdminCommand(String command, Player activeChar) { if (command.startsWith("admin_search")) { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); if (!st.hasMoreTokens()) { final NpcHtmlMessage html = new NpcHtmlMessage(0); html.setFile("data/html/admin/search.htm"); html.replace("%items%", ""); html.replace("%pages%", ""); activeChar.sendPacket(html); } else { final String item = st.nextToken(); int page = 1; if (st.hasMoreTokens()) { try { page = Integer.parseInt(st.nextToken()); } catch (NumberFormatException e) { page = 1; } } results(activeChar, item, page); } } return; } private static void results(Player activeChar, String item, int page) { final NpcHtmlMessage html = new NpcHtmlMessage(0); html.setFile("data/html/admin/search.htm"); //List<Item> items = new ArrayList<>();//no sirvio List<Object> items = Arrays.asList(ItemData.getInstance().getAllItems()); for (Object itemName : items) if (itemName != null) if (((WorldObject) itemName).getName().toLowerCase().contains(item.toLowerCase())) items.add(itemName); if (items.isEmpty()) { html.replace("%items%", "<tr><td>No items found with word " + item + ".</td></tr>"); html.replace("%pages%", ""); activeChar.sendPacket(html); return; } final int max = Math.min(100, MathUtil.countPagesNumber(items.size(), PAGE_LIMIT)); items = items.subList((page - 1) * PAGE_LIMIT, Math.min(page * PAGE_LIMIT, items.size())); final StringBuilder sb = new StringBuilder(); for (Object itemName : items) { String actualName = getFontedWord(item, ((WorldObject) itemName).getName()); StringUtil.append(sb, "<tr><td>", actualName, " (", ((Item) itemName).getItemId(), ")", "</td></tr>"); } html.replace("%items%", sb.toString()); sb.setLength(0); for (int i = 0; i < max; i++) { final int pagenr = i + 1; if (page == pagenr) StringUtil.append(sb, pagenr, "&nbsp;"); else StringUtil.append(sb, "<a action=\"bypass -h admin_search ", item, " ", pagenr, "\">", pagenr, "</a>&nbsp;"); } html.replace("%pages%", sb.toString()); activeChar.sendPacket(html); } private static String getFontedWord(String word, String tt) { int position = tt.toLowerCase().indexOf(word.toLowerCase()); StringBuilder str = new StringBuilder(tt); String font = "<FONT COLOR=\"LEVEL\">"; str.insert(position, font); str.insert(position + (font.length() + word.length()), "</FONT>"); return str.toString(); } @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } Can someone give me a hand and tell me what I'm doing wrong?  
    • Contact me: Disrcord : https://discord.gg/fJ5geYMu Skype: pparik2451 Email: golbergsoft@gmail.com You are welcome
  • Topics

×
×
  • Create New...