Jump to content
  • 0

Question

Posted (edited)

hello i need help for this code, anyone help me ?

 

https://imgur.com/a/X6PVB

 

code:

 

<spoiler>

 

/*
 * 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 net.sf.l2j.gameserver.communitybbs.Manager;

import com.mchange.v1.util.MapUtils;

import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.datatables.ClanTable;
import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.datatables.RecipeTable;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
import net.sf.l2j.gameserver.model.L2Clan;
import net.sf.l2j.gameserver.model.L2ManufactureItem;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.TradeList;
import net.sf.l2j.gameserver.model.TradeList.TradeItem;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.ClanHall;
import net.sf.l2j.gameserver.model.item.RecipeList;
import net.sf.l2j.gameserver.model.item.kind.Item;
import net.sf.l2j.gameserver.model.item.type.CrystalType;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.RadarControl;
import net.sf.l2j.gameserver.util.Util;

public class RegionBBSManager extends TopBBSManager
{
	// @formatter:off
	private static final int[][] _towns = new int[][] { {1010005, 19, 21}, {1010006, 20, 22}, {1010007, 22, 22}, {1010013, 22, 19}, {1010023, 24, 18}, {1010049, 23, 24}, {1010199, 24, 16}, {1010200, 21, 16}, {1010574, 22, 13}};
	private static final String[] _regionTypes = { "&$596;", "&$597;", "&$665;" };
	private static final String[] _grade = { "&$1291;", "&$1292;", "&$1293;", "&$1294;", "&$1295;", "S80 Grade", "S84 Grade" };
	private static final int SELLER_PER_PAGE = 12;
	
	private static final String _pageRegionTpl = "data/html/CommunityBoard/region/bbs_regiontpl.htm";
	private static final String _pageRegionSTpl = "data/html/CommunityBoard/region/bbs_region_stpl.htm";
	private static final String _pageRegionStoreTpl = "data/html/CommunityBoard/region/bbs_region_storetpl.htm";
	private static final String _pageRegionList = "data/html/CommunityBoard/region/bbs_region_list.htm";
	private static final String _pageRegionSelers = "data/html/CommunityBoard/region/bbs_region_sellers.htm";
	private static final String _pageRegionView = "data/html/CommunityBoard/region/bbs_region_view.htm";
	// @formatter:on
		
	//protected RegionBBSManager()
	//{
	//}
	
	public static RegionBBSManager getInstance()
	{
		return SingletonHolder._instance;
	}
	
	@Override
	public void parseCmd(String command, L2PcInstance player)
	{
        StringTokenizer st = new StringTokenizer(command, ";");
		
		if (command.equals("_bbsloc"))
		{
			String tpl = HtmCache.getInstance().getHtm(_pageRegionTpl);
			StringBuilder rl = new StringBuilder("");
			
			for (int townId = 0; townId < _towns.length; townId++)
			{
				int[] town = _towns[townId];
				
				String reg = tpl.replace("%region_bypass%", "_bbsregion;" + String.valueOf(townId));
				reg = reg.replace("%region_name%", HtmlUtils.htmlNpcString(town[0]));
				reg = reg.replace("%region_desc%", "&$498;: &$1157;, &$1434;, &$645;.");
				reg = reg.replace("%region_type%", "l2ui.bbs_folder");
				int sellers = 0;
				
				int rx = town[1];
				int ry = town[2];
				int offset = 0;
				
				for (L2PcInstance seller : L2World.getInstance().getAllPlayers().values())
				{
					int tx = MapUtils.regionX(seller);
					int ty = MapUtils.regionY(seller);
					
					if ((tx >= (rx - offset)) && (tx <= (rx + offset)) && (ty >= (ry - offset)) && (ty <= (ry + offset)))
					{
						if (seller.getPrivateStoreType() != 0)
						{
							sellers++;
						}
					}
				}
				reg = reg.replace("%sellers_count%", String.valueOf(sellers));
				rl.append(reg);
			}
			
			String html = HtmCache.getInstance().getHtm(_pageRegionList);
			html = html.replace("%REGION_LIST%", rl.toString());
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsregion"))
		{
			st.nextToken();
			String tpl = HtmCache.getInstance().getHtm(_pageRegionTpl);
			int townId = Integer.parseInt(st.nextToken());
			StringBuilder rl = new StringBuilder("");
			int[] town = _towns[townId];
			
			for (int type = 0; type < _regionTypes.length; type++)
			{
				String reg = tpl.replace("%region_bypass%", "_bbsreglist;" + townId + ";" + type + ";1;0;");
				reg = reg.replace("%region_name%", _regionTypes[type]);
				reg = reg.replace("%region_desc%", _regionTypes[type] + ".");
				reg = reg.replace("%region_type%", "l2ui.bbs_board");
				int sellers = 0;
				
				int rx = town[1];
				int ry = town[2];
				int offset = 0;
				
				for (L2PcInstance seller : L2World.getInstance().getAllPlayers().values())
				{
					int tx = MapUtils.regionX(seller);
					int ty = MapUtils.regionY(seller);
					
					if ((tx >= (rx - offset)) && (tx <= (rx + offset)) && (ty >= (ry - offset)) && (ty <= (ry + offset)))
					{
						if ((type == 0) && ((seller.getPrivateStoreType() == 1) || (seller.getPrivateStoreType() == 8)))
						{
							sellers++;
						}
						else if ((type == 1) && (seller.getPrivateStoreType() == 3))
						{
							sellers++;
						}
						else if ((type == 2) && (seller.getPrivateStoreType() == 5))
						{
							sellers++;
						}
					}
				}
				
				reg = reg.replace("%sellers_count%", String.valueOf(sellers));
				rl.append(reg);
			}
			
			String html = HtmCache.getInstance().getHtm(_pageRegionList);
			html = html.replace("%REGION_LIST%", rl.toString());
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsreglist"))
		{
			st.nextToken();
			int townId = Integer.parseInt(st.nextToken());
			int type = Integer.parseInt(st.nextToken());
			int page = Integer.parseInt(st.nextToken());
			int byItem = Integer.parseInt(st.nextToken());
			String search = st.hasMoreTokens() ? st.nextToken().toLowerCase() : "";
			int[] town = _towns[townId];
			
			List<L2PcInstance> sellers = getSellersList(townId, type, search, byItem == 1);
			
			int start = (page - 1) * SELLER_PER_PAGE;
			int end = Math.min(page * SELLER_PER_PAGE, sellers.size());
			
			String html = HtmCache.getInstance().getHtm(_pageRegionSelers);
			
			if (page == 1)
			{
				html = html.replace("%ACTION_GO_LEFT%", "");
				html = html.replace("%GO_LIST%", "");
				html = html.replace("%NPAGE%", "1");
			}
			else
			{
				html = html.replace("%ACTION_GO_LEFT%", "bypass _bbsreglist;" + townId + ";" + type + ";" + (page - 1) + ";" + byItem + ";" + search);
				html = html.replace("%NPAGE%", String.valueOf(page));
				StringBuilder goList = new StringBuilder("");
				for (int i = page > 10 ? page - 10 : 1; i < page; i++)
				{
					goList.append("<td><a action=\"bypass _bbsreglist;").append(townId).append(";").append(type).append(";").append(i).append(";").append(byItem).append(";").append(search).append("\"> ").append(i).append(" </a> </td>\n\n");
				}
				
				html = html.replace("%GO_LIST%", goList.toString());
			}
			
			int pages = Math.max(sellers.size() / SELLER_PER_PAGE, 1);
			if (sellers.size() > (pages * SELLER_PER_PAGE))
			{
				pages++;
			}
			
			if (pages > page)
			{
				html = html.replace("%ACTION_GO_RIGHT%", "bypass _bbsreglist;" + townId + ";" + type + ";" + (page + 1) + ";" + byItem + ";" + search);
				int ep = Math.min(page + 10, pages);
				StringBuilder goList = new StringBuilder("");
				for (int i = page + 1; i <= ep; i++)
				{
					goList.append("<td><a action=\"bypass _bbsreglist;").append(townId).append(";").append(type).append(";").append(i).append(";").append(byItem).append(";").append(search).append("\"> ").append(i).append(" </a> </td>\n\n");
				}
				
				html = html.replace("%GO_LIST2%", goList.toString());
			}
			else
			{
				html = html.replace("%ACTION_GO_RIGHT%", "");
				html = html.replace("%GO_LIST2%", "");
			}
			
			StringBuilder seller_list = new StringBuilder("");
			String tpl = HtmCache.getInstance().getHtm(_pageRegionSTpl);
			
			for (int i = start; i < end; i++)
			{
				L2PcInstance seller = sellers.get(i);
				TradeList tl = null;
				if (seller.getPrivateStoreType() == PrivateStoreType.BUY)
				{
					tl = seller.getBuyList();
				}
				else
				{
					tl = seller.getSellList();
				}
				
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				
				if ((tl == null) && (cl == null))
				{
					continue;
				}
				
				String stpl = tpl;
				stpl = stpl.replace("%view_bypass%", "bypass _bbsregview;" + townId + ";" + type + ";" + page + ";" + seller.getObjectId() + ";" + byItem + ";" + search);
				stpl = stpl.replace("%seller_name%", seller.getName());
				String title = "N/A";
				if (type == 0)
				{
					title = (tl != null) && (tl.getTitle() != null) && !tl.getTitle().isEmpty() ? tl.getTitle() : "N/A";
				}
				else if (type == 1)
				{
					title = (tl != null) && (tl.getTitle() != null) && !tl.getTitle().isEmpty() ? tl.getTitle() : "N/A";
				}
				else if ((type == 2) && (seller.getPrivateStoreType() == PrivateStoreType.MANUFACTURE))
				{
					title = (cl != null) && (seller.getStoreName() != null) && !seller.getStoreName().isEmpty() ? seller.getStoreName() : "-";
				}
				
				title = title.replace("<", "");
				title = title.replace(">", "");
				title = title.replace("&", "");
				title = title.replace("$", "");
				
				if (title.isEmpty())
				{
					title = "N/A";
				}
				
				stpl = stpl.replace("%seller_title%", title);
				
				seller_list.append(stpl);
			}
			
			html = html.replace("%SELLER_LIST%", seller_list.toString());
			html = html.replace("%search_bypass%", "_bbsregsearch_" + townId + "_" + type);
			html = html.replace("%TREE%", "&nbsp;>&nbsp;<a action=\"bypass _bbsregion;" + townId + "\"><font color=\"aa9977\"> " + HtmlUtils.htmlNpcString(town[0]) + "</font></a>&nbsp;>&nbsp;" + _regionTypes[type]);
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsregview"))
		{
			st.nextToken();
			int townId = Integer.parseInt(st.nextToken());
			int type = Integer.parseInt(st.nextToken());
			int page = Integer.parseInt(st.nextToken());
			int objectId = Integer.parseInt(st.nextToken());
			int byItem = Integer.parseInt(st.nextToken());
			String search = st.hasMoreTokens() ? st.nextToken().toLowerCase() : "";
			int[] town = _towns[townId];
			
			L2PcInstance seller = L2World.getInstance().getPlayer(objectId);
			if ((seller == null) || (seller.getPrivateStoreType() == PrivateStoreType.NONE))
			{
				parseCmd("_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search, player);
				return;
			}
			
			String title = "-";
			String tpl = HtmCache.getInstance().getHtm(_pageRegionStoreTpl);
			StringBuilder sb = new StringBuilder("");
			
			if (type < 2)
			{
				TradeList sl = type == 0 ? seller.getSellList() : seller.getBuyList();
				
				if (sl == null)
				{
					parseCmd("_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search, player);
					return;
				}
				
				if ((type == 0) && (sl.getTitle() != null) && !sl.getTitle().isEmpty())
				{
					title = sl.getTitle();
				}
				else if ((type == 1) && (sl.getTitle() != null) && !sl.getTitle().isEmpty())
				{
					title = sl.getTitle();
				}
				
				for (TradeItem ti : sl.getItems())
				{
					Item item = ItemTable.getInstance().getTemplate(ti.getItem().getItemId());
					if (item != null)
					{
						String stpl = tpl.replace("%item_name%", ti.getItem().getName() + (ti.getItem().isEquipable() && (ti.getEnchant() > 0) ? " +" + ti.getEnchant() : ""));
						stpl = stpl.replace("%item_img%", item.getIcon());
						stpl = stpl.replace("%item_count%", String.valueOf(ti.getCount()));
						stpl = stpl.replace("%item_price%", String.format("%,3d", ti.getPrice()).replace(" ", ","));
						
						String desc = "";
						if (item.getCrystalType() != CrystalType.NONE)
						{
							desc = _grade[item.getCrystalType().getId() - 1];
							desc += item.getCrystalCount() > 0 ? " Crystals: " + item.getCrystalCount() + ";&nbsp;" : ";&nbsp;";
						}
						
						if (item.isEquipable())
						{
					    //removed elements
						}
						if (item.isStackable())
						{
							desc += "Stackable;&nbsp;";
						}
						
						// FIXME
						/**
						 * if (item.isSealedItem()) { desc += "Sealed;&nbsp;"; } if (item.isShadowItem()) { desc += "Shadow item;&nbsp;"; } if (item.isTimeItem()) { desc += "Temporal;&nbsp;"; }
						 */
						
						stpl = stpl.replace("%item_desc%", desc);
						sb.append(stpl);
					}
				}
			}
			else
			{
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				if (cl == null)
				{
					parseCmd("_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search, player);
					return;
				}
				
				if ((title = seller.getStoreName()) == null)
				{
					title = "-";
				}
				
				for (L2ManufactureItem mi : seller.getManufactureItems().values())
				{
					RecipeList rec = RecipeTable.getInstance().getRecipeByItemId(mi.getRecipeId() - 1);
					if (rec == null)
					{
						continue;
					}
					Item item = ItemTable.getInstance().getTemplate(rec.getId());
					if (item == null)
					{
						continue;
					}
					String stpl = tpl.replace("%item_name%", item.getName());
					stpl = stpl.replace("%item_img%", item.getIcon());
					stpl = stpl.replace("%item_count%", "N/A");
					stpl = stpl.replace("%item_price%", String.format("%,3d", mi.getCost()).replace(" ", ","));
					String desc = "";
					if (item.getCrystalType() != CrystalType.NONE)
					{
						desc = _grade[item.getCrystalType().getId() - 1] + (item.getCrystalCount() > 0 ? " Crystals: " + item.getCrystalCount() + ";&nbsp;" : ";&nbsp;");
					}
					
					if (item.isStackable())
					{
						desc = "Stackable;&nbsp;";
					}
					
					// FIXME
					/**
					 * if (item.isSealedItem()) { desc += "Sealed;&nbsp;"; }
					 */
					
					stpl = stpl.replace("%item_desc%", desc);
					sb.append(stpl);
				}
			}
			
			String html = HtmCache.getInstance().getHtm(_pageRegionView);
			
			html = html.replace("%sell_type%", _regionTypes[type]);
			
			title = title.replace("<", "");
			title = title.replace(">", "");
			title = title.replace("&", "");
			title = title.replace("$", "");
			if (title.isEmpty())
			{
				title = "-";
			}
			html = html.replace("%title%", title);
			html = html.replace("%char_name%", seller.getName());
			html = html.replace("%object_id%", String.valueOf(seller.getObjectId()));
			html = html.replace("%STORE_LIST%", sb.toString());
			html = html.replace("%list_bypass%", "_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search);
			html = html.replace("%TREE%", "&nbsp;>&nbsp;<a action=\"bypass _bbsregion;" + townId + "\">" + HtmlUtils.htmlNpcString(town[0]) + "</a>&nbsp;>&nbsp;<a action=\"bypass _bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + "\">" + _regionTypes[type] + "</a>&nbsp;>&nbsp;" + seller.getName());
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsregtarget"))
		{
			st.nextToken();
			int objectId = Integer.parseInt(st.nextToken());
			L2PcInstance seller = L2World.getInstance().getPlayer(objectId);
			if (seller != null)
			{
				player.sendPacket(new RadarControl(0, 2, seller.getLoc().getX(), seller.getLoc().getY(), seller.getLoc().getZ()));
				
				if (player.getKnownList().getKnownObject(seller.getObjectId()) != null)
				{
					player.setTarget(seller);
					seller.broadcastRelationChanged();
				}
			}
			else
			{
				player.sendPacket(ActionFailed.STATIC_PACKET);
			}
		}
		
		return;
	}
	
	@SuppressWarnings("synthetic-access")
	private static List<L2PcInstance> getSellersList(int townId, int type, String search, boolean byItem)
	{
		List<L2PcInstance> list = new LinkedList<>();
		int town[] = _towns[townId];
		int rx = town[1];
		int ry = town[2];
		int offset = 0;
		
		for (L2PcInstance seller : L2World.getInstance().getAllPlayers().values())
		{
			int tx = MapUtils.regionX(seller);
			int ty = MapUtils.regionY(seller);
			
			if ((tx >= (rx - offset)) && (tx <= (rx + offset)) && (ty >= (ry - offset)) && (ty <= (ry + offset)))
			{
				TradeItem[] tl = null;
				if (seller.getPrivateStoreType() == PrivateStoreType.BUY)
				{
					tl = seller.getBuyList().getItems();
				}
				else
				{
					tl = seller.getSellList().getItems();
				}
				
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				if (seller.getPrivateStoreType() != PrivateStoreType.NONE)
				{
					if ((type == 0) && (tl != null) && ((seller.getPrivateStoreType() == PrivateStoreType.SELL) || (seller.getPrivateStoreType() == PrivateStoreType.PACKAGE_SELL)))
					{
						list.add(seller);
					}
					else if ((type == 1) && (tl != null) && (seller.getPrivateStoreType() == PrivateStoreType.BUY))
					{
						list.add(seller);
					}
					else if ((type == 2) && (cl != null) && (seller.getPrivateStoreType() == PrivateStoreType.MANUFACTURE))
					{
						list.add(seller);
					}
				}
			}
		}
		
		if (!search.isEmpty() && !list.isEmpty())
		{
			List<L2PcInstance> s_list = new LinkedList<>();
			for (L2PcInstance seller : list)
			{
				TradeList tl = null;
				if (seller.getPrivateStoreType() == PrivateStoreType.BUY)
				{
					tl = seller.getBuyList();
				}
				else
				{
					tl = seller.getSellList();
				}
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				if (byItem)
				{
					if (((type == 0) || (type == 1)) && (tl != null))
					{
						TradeItem[] sl = type == 0 ? seller.getSellList().getItems() : seller.getBuyList().getItems();
						if (sl != null)
						{
							for (TradeItem ti : sl)
							{
								Item item = ItemTable.getInstance().getTemplate(ti.getItem().getItemId());
								if ((item != null) && (item.getName() != null) && item.getName().toLowerCase().contains(search))
								{
									s_list.add(seller);
									break;
								}
							}
						}
					}
					else if ((type == 2) && (cl != null))
					{
						for (L2ManufactureItem mi : seller.getManufactureItems().values())
						{
							RecipeList recipe = RecipeTable.getInstance().getRecipeList(mi.getRecipeId() - 1);
							if (recipe != null)
							{
								Item item = ItemTable.getInstance().getTemplate(recipe.getId());
								if ((item != null) && (item.getName() != null) && item.getName().toLowerCase().contains(search))
								{
									s_list.add(seller);
									break;
								}
							}
						}
					}
				}
				else if ((type == 0) && (tl != null) && (tl.getTitle() != null) && tl.getTitle().toLowerCase().contains(search))
				{
					s_list.add(seller);
				}
				else if ((type == 1) && (tl != null) && (tl.getTitle() != null) && tl.getTitle().toLowerCase().contains(search))
				{
					s_list.add(seller);
				}
				else if ((type == 2) && (cl != null) && (seller.hasManufactureShop()) && (seller.getStoreName() != null) && seller.getStoreName().toLowerCase().contains(search))
				{
					s_list.add(seller);
				}
			}
			list = s_list;
		}
		
		if (!list.isEmpty())
		{
			L2PcInstance[] players = new L2PcInstance[list.size()];
			list.toArray(players);
			Arrays.sort(players, new PlayersComparator<L2PcInstance>());
			list.clear();
			list.addAll(Arrays.asList(players));
		}
		
		return list;
	}
	
	@Override
	protected String getFolder()
	{
		return "region/";
	}
	
	public void parsewrite(String url, String arg1, String arg2, String arg3, String arg4, String arg5, L2PcInstance player)
	{
		StringTokenizer st = new StringTokenizer(url, "_");
		String cmd = st.nextToken();
		if ("bbsregsearch".equals(cmd))
		{
			int townId = Integer.parseInt(st.nextToken());
			int type = Integer.parseInt(st.nextToken());
			String byItem = "Item".equals(arg4) ? "1" : "0";
			
			if (arg3 == null)
			{
				arg3 = "";
			}
			
			arg3 = arg3.replace("<", "");
			arg3 = arg3.replace(">", "");
			arg3 = arg3.replace("&", "");
			arg3 = arg3.replace("$", "");
			
			if (arg3.length() > 30)
			{
				arg3 = arg3.substring(0, 30);
			}
			
			parseCmd("_bbsreglist;" + townId + ";" + type + ";1;" + byItem + ";" + arg3, player);
		}
	}
	
	private static class PlayersComparator<T> implements Comparator<T>
	{
		@Override
		public int compare(Object o1, Object o2)
		{
			if ((o1 instanceof L2PcInstance) && (o2 instanceof L2PcInstance))
			{
				L2PcInstance p1 = (L2PcInstance) o1;
				L2PcInstance p2 = (L2PcInstance) o2;
				return p1.getName().compareTo(p2.getName());
			}
			return 0;
		}
	}
	
	private static class SingletonHolder
	{
		protected static final RegionBBSManager _instance = new RegionBBSManager();
	}
}

 

</spoiler>

Edited by L2shaken

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

(about the code)

 

Hint: Google the error.

Hint2: Does MapUtils have regionX/regionY methods?

My Java is bad but ... hopefully ur English aint that bad tho.

Edited by bravetobe
  • 0
Posted (edited)

First time I see com.mchange being used apart of C3P0 db pooler, lol. You probably messed up imports, it's supposed to be MapRegionTable (MapRegionData on latest aCis) which holds regionX/Y.

 

You should rework the whole thing, the stuff you do with towns zone and checking distance is black magic.

 

You only have to use getTown(int x, int y, int z) to get the townId where the player is currently is (if zone is null, then returns -1).

 

PS : it's faster to iterate all players and feed a map with all infos (you only need count, so it's a Map<Integer, Integer>), rather than iterate all towns, which iterate each time all players (10 towns and 3000 onlines players = 30000 iterations).

 

PS2 : since I saw a HtmUtils, you probably messed up imports. I don't know which sources you are using.

Edited by Tryskell

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • tratando de crear un GvE tengo problemas con el scripts como no se mucho de esto me estoy ayudando con IA pero no puedo salir de este bache      [06:19:43]  WARN Quest GvE_AI not found! [06:19:45]  WARN Quest GvE_AI not found! [06:19:50]  WARN Quest GvE_AI not found! [06:25:51]  WARN Quest GvE_AI not found!
    • ## [1.5.5] - 2026-02-02   ### ✨ New Features - **Discord Login**: You can now sign in with your Discord account. Admins enable and configure Discord login in **cpadmin → Users** (Discord auth settings: Client ID, Client Secret, Redirect URI). If you already have an account with the same email (e.g. forum, Google, or legacy), signing in with Discord links to that account so you keep one profile. Discord login is available on Add Server, My Servers, Vote page, and Premium Ads booking. - **Setup Links**: In **cpadmin → Users**, both Google and Discord login settings now include direct links to their official developer portals (Google Cloud Console and Discord Developer Portal) for easier OAuth app setup.   ### 🔒 Security - **Email Required for Registration**: New user registration via OAuth (Forum, Google, Discord) now requires a valid email address. If the OAuth provider doesn't provide an email (e.g. unverified Discord email), registration is rejected with a clear message. This prevents anonymous accounts and ensures all users can receive important notifications.   ### 🔄 Improvements - **User Auth Badges**: In **cpadmin → Users**, the Registered Members table now shows auth method badges: **Forum**, **Google**, **Discord**, or **Legacy**. Users can have multiple badges if they've linked multiple login methods. - **Server Info Labels**: Translated server info labels (Owner Name, Language, Server Location) are now properly localized in all 5 languages (English, Spanish, Portuguese, Greek, Russian).   ---   ## [1.5.4] - 2026-02-01   ### ✨ New Features - **Google Login**: You can now sign in with your Google account. Admins enable and configure Google login in **cpadmin → Users** (Google auth settings: Client ID, Client Secret, Redirect URI). If you already have an account with the same email (e.g. forum or legacy), signing in with Google links to that account so you keep one profile. The login menu (navbar and login prompts) offers **Login with Forum Account**, **Login with Google** (when enabled), and **Create Forum Account**. Google login is available on Add Server, My Servers, Profile Settings, Vote page, and Premium Ads booking. - **Ban/Unban Members**: In **cpadmin → Users**, admins can ban or unban registered members. Banned users see a full-page message: "Sorry, you are banned from using this site." When a user is banned, all their servers are set to inactive. - **Moderator Activity Log**: **cpadmin → Moderators** now records when a moderator or admin enters the CPAdmin panel (e.g. "Moderator X entered CPAdmin panel at &lt;time&gt;") and when they change any cpadmin settings (only write actions are logged; read-only use is not). - **Clear Moderator Logs**: Admins can clear all moderator activity log entries via a **Clear logs** button with confirmation. Logs are shown at 100 per page with pagination. - **Filter by Moderator**: In the Moderator Activity Log, a **Filter by moderator** dropdown lets you view activity for a specific moderator or "All moderators." - **cpadmin → Users Tab**: New **Users** tab in the admin panel with Registered Members list (paginated), Google auth settings card, and per-user Ban/Unban and server links.   ### 🔄 Improvements - **cpadmin → Servers**: Each server name in the servers table is now clickable and opens that server’s info page. - **cpadmin → Users – Servers column**: The servers count/list is clickable and opens a small modal listing that user’s servers; each server name in the modal links to the server info page. - **cpadmin → Users – Search**: A search bar above the Registered Members table lets you search by **username**, **email**, or **server name**. Results are filtered on the server (paginated); clearing the search resets the list. - **Moderator Activity Log**: Pagination shows "Showing X–Y of Z" and "Page N of M" with Previous/Next when there are more than 100 entries. - **Login UI**: Login options (Forum, Google, Create account) are shown in a consistent dropdown and in modals (Add Server, My Servers, Vote, Premium Ads) for a clearer sign-in experience. - **Vote Page – Unauthenticated**: When you must log in to vote, the page now shows "Vote for [Server Name]" as the main heading and presents login options in a compact section.   ---   ## [1.5.3] - 2026-01-30   ### ✨ New Features - **File Logs in Admin Panel**: Admins can now view CodeIgniter PHP logs (api/writable/logs) directly in **cpadmin → Logs**. Select a date to view the log file, refresh to reload, or delete all log files to free up space.   ### 🔄 Improvements - **Cache System**: Full cache audit and improvements — when you clear cache in cpadmin, both backend and frontend caches are cleared. Server listings, My Servers, pricing, ad config, and chronicles all refresh with fresh data. New paid servers now appear in listings and My Servers immediately. - **Admin Panel – Server Rates**: Server rates in the admin servers table now display in compact format (e.g. x10000 → x10k, x100000 → x100k, x1000000 → x1m) for easier scanning. Hover to see the full value.
    • WTB High Five source running on Salvation/Fafurion client
    • MoMoProxy has updated more static residential proxies for USA location, anyone interested in can view: https://momoproxy.com/static-residential-proxies
  • 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..