Jump to content
  • 0

Fastlist -> Arraylist Acis


Question

Posted (edited)

http://imgur.com/a/1oYgm

protected int getWinnerTeam()
	{
		ArrayList<EventTeam> t = new ArrayList<>();
		
		for (EventTeam team : teams.values())
		{
			if (t.size() == 0)
			{
				t.add(team);
				continue;
			}
			
			if (team.getScore() > t.getFirst().getScore())
			{
				t.clear();
				t.add(team);
				continue;
			}
			
			if (team.getScore() == t.getFirst().getScore())
				t.add(team);
		}
		
		if (t.size() > 1)
			return 0;
		
		return t.getFirst().getId();
	}

getFirst () must be replaced by what?

Edited by L2shaken

Recommended Posts

  • 0
Posted
protected int getWinnerTeam()
{
	final EventTeam team = teams.values().stream().sorted(Comparator.comparing(EventTeam::getScore).reversed()).findFirst().orElse(null);
	return team == null ? 0 : team.getId();
}

Exact same broken getWinnerTeam logic to java.

 

 

So much overhead for few calculations

  • 0
Posted (edited)

So much overhead for few calculations

You use reconnect system for your events?

public boolean onReconnect(final L2PcInstance player)

Btw what "list" you use to store id of the disconnected player and the set that you store teamId, Kills e.t.c ?

 

treemap ? 

Edited by AccessDenied
  • 0
Posted

You use reconnect system for your events?

public boolean onReconnect(final L2PcInstance player)

Btw what "list" you use to store id of the disconnected player and the set that you store teamId, Kills e.t.c ?

 

treemap ? 

 

None, my custom instance world manages it 

	@Override
	public boolean onReconnect(final L2PcInstance player)
	{
		final PlayerDriver playerDriver = getPlayerDriver(player);
		if (playerDriver == null || playerDriver.getEventAFKSeconds() > 200)
		{
			player.sendMessage("You have been kicked from this event for being inactive for more than 3 minutes.");
			IWorld.resetKnown(player);
			return false;
		}
		playerInject(player);
		return true;
	}
  • 0
Posted

 

None, my custom instance world manages it 

	@Override
	public boolean onReconnect(final L2PcInstance player)
	{
		final PlayerDriver playerDriver = getPlayerDriver(player);
		if (playerDriver == null || playerDriver.getEventAFKSeconds() > 200)
		{
			player.sendMessage("You have been kicked from this event for being inactive for more than 3 minutes.");
			IWorld.resetKnown(player);
			return false;
		}
		playerInject(player);
		return true;
	}

 

 

EventWorld.java

  • 0
Posted
IWorld.resetKnown(player);

AHAHHAHAHAHAAHAHAHAHAHAHAHAHAAHAHAHAHAHAAHAHAHAHAAHAHAHAAHAHAHAAHAHAHAHAHAHAAHAHAHAAHAHAHAHAAHAAHHAHAHHA

  • 0
Posted (edited)

What you mean more tricky ?

 

If team 1 and team 2 has same score it will return 0 anyway 

u have 5 teams and 2 of them have the highest same score... Both have to get rewards-claim the winner title.

 

so,based in what he wants to do(get the ID),he might need 2 ids (e.g stored in array and return it instead of int and thats a simple solution or "check for more than 1" -> more code).I m pretty sure that there is something better in l2j but IDC  :dat:

Easy stuff without "l2j" knowledge.

Sry no l2j here ,i m jealous ... no i m not YDB Kappa

Edited by bravetobe
  • 0
Posted
IWorld.resetKnown(player);

AHAHHAHAHAHAAHAHAHAHAHAHAHAHAAHAHAHAHAHAAHAHAHAHAAHAHAHAAHAHAHAAHAHAHAHAHAHAAHAHAHAAHAHAHAHAAHAAHHAHAHHA

 

 

you dont even know what that is :D

  • 0
Posted (edited)

This is a static method in an interface. One of the most non necessary features of Java 8.

 

Shows you never wrote unit tests ever in your life and you have no idea what DI is.

 

:D

 

You're a joke I give you that. I've been using static methods in interfaces since default methods came. IWorld is a hybrid interface consisted of default methods and a few static methods for caching on a global access. This hybrid interface is a "hack" that allows me to make an illusion of a virtuallu multiple inheritance which is not possible in Java (I have strong c++ background).

 

This way I can implement IWorld while extending another important class.

 

 

I am not here to teach you elfo, crawl back to your virgin nasty fatass C# mentor that told you that C# is the best

Edited by xxdem
  • 0
Posted

I never said it was the best way to do it :D

Even if you show him the finest code in the universe he will find something to disagree with.

  • 0
Posted (edited)

default methods became a thing in java 8 too.

 

"Hybrid interface" HAHAHAHHAHAHAHAHA

Writing default methods for a class that already is part of your source is so lame. 

 

"This way I can implement IWorld while extending another important class."

I won't even get into the trouble of explaining you why this is so wrong.

 

I'm pretty sure that if you have to do shit like this you don't even know what SOLID are.

 

Get out of my way incompetent developer. Go make some shitty google drive sync file system.

 

 

PS: I got news for you. I equally use C# and Java in a day to day basic in both Android, Spring, ASP.NET MVC and other scenarios. So what you are saying has no point.

I'm not judging Java. Java is amazing. I am judging you. You are a overrated piece of shit :D

 

Your but-hurt-ness level is paranoid.

 

Did I singed an agreement with myself that I will follow strict policies for my own free-time project that is mostly coded for fun and myself?Did I say anywhere that the above snippet is a tryhard piece of software that respects ALL GLOBAL STANDARDS that any retard is gonna bring on the table or anything? s

 

Well I didn't :D . So violations are made. Can't get it why it hurts you so much.

 

 

 

Retard.

Edited by xxdem
  • 0
Posted

Your but-hurt-ness level is paranoid.

 

Did I singed an agreement with myself that I will follow strict policies for my own free-time project that is mostly coded for fun? I didn't say anywhere that its coded tryhard mode or anything, so violations are made. Can't get it why it hurts you so much.

 

Well I didn't :D .

 

 

 

Retard.

It doesn't hurt me. It hurts you because you are poping out of nowhere to show off you "cool little ae event shit" and when someone trashes you to the ground you get all defensive and say it's coded for fun.

 

We are developers. We code for fun anyway. This doesn't mean we have to use it as an excuse.

 

Fuck it I'm out.

  • 0
Posted (edited)

It doesn't hurt me. It hurts you because you are poping out of nowhere to show off you "cool little ae event shit" and when someone trashes you to the ground you get all defensive and say it's coded for fun.

 

We are developers. We code for fun anyway. This doesn't mean we have to use it as an excuse.

 

Fuck it I'm out.

 

I've edited read again. Fun was a wrong word to say.

 

Showing off or helping? Get your shit straight mate.

Edited by xxdem

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

    • Tired of frantically switching between windows trying to find that specific Warlock who should be casting saves? Forgot which server you left your Warsmith on? This mod solves these problems! What it does: Turns the boring window title into an information panel: Server Name - Character Name [Class] Real-life examples: - ServerName - HardcoreFarm [Spoilerr] (who's been spoiling for 3 months already) - ServerName - ClericHelper [Buffer] (eternal buffer on standby) - ServerName - MainChar [Gladiator] (main character who's always AFK) Why you need this: For multiboxers - to avoid confusing where the DD is and where the healer is For the forgetful - if your memory is like a goldfish For streamers - viewers immediately see who's on screen For adults - when playing at work and need to quickly hide the window DLL only - no Interface files needed Installation (more complicated than making tea): 1. Download the DLL 2. Drop it into the System folder 3. Launch the client 4. Be amazed how you lived without this before!   Purchase Conditions: Price: 100$ Payment Method: USDT. How to Buy: Contact me on Telegram: @kiselevwv for a quick response. I will answer all your questions and provide additional information if needed. I guarantee functionality at the moment of sale and prompt assistance with setup after purchase.    
    • Hello Everyone   Wts adena  L2 REBORN C5 FRANZ x1 50kk stock 😉   Contact Discord :  topseller4081  
    • 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.
  • 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..