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

    • With EA Sports FC 27 officially announced, many players are hoping to get their hands on a coveted Closed Beta code. The FC 27 beta gives fans an early opportunity to test new gameplay features, modes, and updates before the game's full release. Ultimate Team is expected to be one of the most anticipated modes, giving players an early look at the in-game economy and how valuable FIFA 27 coins may be at launch. While there's no guaranteed way to receive a beta invitation, there are several steps you can take to maximize your chances. These methods have helped many players receive beta codes in previous years, and they're still the best options heading into FC 27.     1. Enable EA Email Communications The first and most important step is to make sure EA can actually contact you. Log in to your EA account and head to Communication Preferences. Here, you'll find options related to emails about products, events, and promotions. Make sure to: • Turn on promotional emails. • Set email frequency to "Any Time" instead of monthly updates. • Save your changes. EA typically sends Closed Beta invitations via email, so if these settings are disabled, you could miss your chance entirely.   2. Add FC Games to Your Favorite Titles Under your EA account preferences, you'll find a section for favorite games. Add any football-related EA titles you play, including: • EA Sports FC 26 • EA Sports FC 27 (if available) • EA Play • Other EA football games This helps EA understand your interests and may improve your chances of being selected for football-related tests.   3. Select Your Preferred Platforms Another useful step is updating your preferred gaming platforms. Choose all the systems you actively use, such as: • PlayStation 5 • Xbox Series X|S • PC • Nintendo Switch 2 There's no official confirmation that selecting more platforms increases your odds, but it doesn't hurt to ensure EA knows where you can participate in the beta. Just remember: if you don't own a particular console, there's little point in selecting it.   4. Verify Your Email Address Double-check that the email address associated with your EA account is verified. An unverified email could prevent important messages from reaching you, including beta invitations. It only takes a few seconds to confirm, and it's one of the easiest things to overlook.   5. Link Your Gaming Accounts Make sure your EA account is connected to the platforms you play on. Common account links include: • PlayStation Network • Xbox Network • Steam • Epic Games • Nintendo Account Having your accounts linked ensures your profile is fully set up and ready if you're selected for the FC 27 beta.   6. Consider Joining EA's Playtesting Program If you're interested in testing games beyond FC 27, consider signing up for EA's playtesting program. EA occasionally invites players to participate in early tests for upcoming titles. While joining doesn't guarantee you'll receive an FC 27 beta code, it can improve your chances of being considered for future playtests. Players selected for EA playtests are usually notified via email, so keeping your communication settings enabled remains essential.     Is There a Guaranteed Way to Get an FC 27 Beta Code? Unfortunately, no. EA selects participants based on a variety of factors, and luck still plays a significant role. Even players who have received beta codes in previous years aren't guaranteed to get one again. That said, following the steps above gives you the best possible chance: 1. Enable EA email communications. 2. Set email frequency to "Any Time." 3. Add FC titles to your favorite games. 4. Select your active gaming platforms. 5. Verify your email address. 6. Link your platform accounts. 7. Join EA's playtesting program.   When Does the EA Sports FC 27 Closed Beta Begin? If selected, players may receive their invitations around July 31, so keep an eye on your inbox and check your spam folder regularly. The Closed Beta is scheduled to kick off on August 5 and will remain available until August 25. This gives invited participants nearly three weeks to explore the game and provide feedback to EA. Compared to past beta tests, this is a relatively lengthy testing period, suggesting that EA is placing a strong emphasis on collecting player impressions and identifying potential issues ahead of the official release. Below are the launch and closing times for major regions around the world: Region / Time Zone EA FC 27 Closed Beta Start Date & Times EA FC 27 Closed Beta End Date & Times Pacific Time (PT) 10:00 AM—August 5 10:00 AM—August 25 Central Time (CT) 12:00 PM—August 5 12:00 PM—August 25 Eastern Time (ET) 1:00 PM—August 5 1:00 PM—August 25 Brasilia Time (BRT) 2:00 PM—August 5 2:00 PM—August 25 British Summer Time (BST) 6:00 PM—August 5 6:00 PM—August 25 Central European Summer Time (CEST) 7:00 PM—August 5 7:00 PM—August 25 China Standard Time (CST) 1:00 AM—August 6 1:00 AM—August 26 Korean Standard Time (KST) 2:00 AM—August 6 2:00 AM—August 26 Japan Standard Time (JST) 2:00 AM—August 6 2:00 AM—August 26 Australian Eastern Time (AET) 3:00 AM—August 6 3:00 AM—August 26 New Zealand Standard Time (NZST) 5:00 AM—August 6 5:00 AM—August 26   Which Modes Are Included in the Closed Beta? EA is using the FC 27 Closed Beta to evaluate several of the game's most important experiences before launch. Participants may gain access to popular modes such as Ultimate Team, Career Mode, and Clubs, as well as The Grounds, a brand-new addition making its debut in FC 27. Because multiple game modes are being tested simultaneously, the extended beta period gives players ample time to try different features and report their findings.   Final Thoughts Getting an EA Sports FC 27 Closed Beta code isn't guaranteed, but spending a few minutes optimizing your EA account settings can make a big difference. Every year, thousands of players receive invitations, and many of them simply have their accounts properly configured and ready to go. If you're lucky enough to get a code, you'll be among the first players to experience FC 27's new gameplay changes and features before launch. Until then, keep an eye on your inbox, stay patient, and good luck—you might be kicking off your FC 27 journey sooner than expected.
    • If you need in L2off i can hook you up! many people know me here and the work i offer. Live example https://l2exalta.org
    • Almost 16 years, you never know when a random Korean finds this topic and shares it.
    • Update: Version 3.1.2: * Improved compaction: deleting even a few textures now always reduces the file (previously small deletions could still slightly grow some packages, such as fonts); Version 3.1.1: * Deleting textures now actually shrinks the package: on save it is automatically compacted, reclaiming the space of the deleted textures (format and encryption preserved); Version 3.1.0: * La2Tools now checks for updates on startup and lets you know when a newer version is available on the site; Version 3.0.9: * Fixed textures that appeared blank in some clients (their object carries an embedded shader the reader mis-parsed) — they now decode and display correctly; * ShaderCode is now editable: Texture Properties → Material → ShaderCode shows the texture's real HLSL shader (was a fixed placeholder before); edit it and Apply — works across client formats (Interlude-era through Essence 542); Version 3.0.8: * BMP now imports as a native format, like UnrealEd: 8-bit BMP becomes a P8 (paletted) texture with a real Engine.Palette, 24/32-bit becomes RGBA8, 16-bit becomes G16; * Compress to P8 — adaptive 256-color palette (median-cut quantization); P8 is also selectable as an import "Convert to" target; * Copy / Cut / Paste now works for P8 (paletted) textures; * Non-power-of-two textures are highlighted in red (tiles and table) with a tooltip; new "Fix texture size" menu item pads them to a power of two while keeping the displayed size; * Reads "broken" packages that were tampered to block editors (corrupted size fields) — the client still loads them and now so does La2Tools; * "Repair package" — shown only for a tampered package (its tab is marked red) and restores the corrupted size fields; * Added client license 30 support (reads and imports its textures); * Import dialog now auto-resizes to fit its content; Version 3.0.7: * Import: the file name is now parsed smartly — package.group.name automatically fills the Group and Name fields (the package prefix is ignored); * Import: live name validation with an inline hint and tooltip — OK is blocked until the name is valid (allows - + ' etc., forbids only characters illegal in file names); * Import: textures whose size is not a power of two are now auto-padded for ALL formats (DDS/TGA/BMP too, not only PNG/JPG/GIF) — padded to a power of two with UClamp/VClamp preserving the original display size; * Texture filter now has a clear (×) button; * Light theme: visible Chrome-style tab outlines; Version 3.0.6: * "Save as..." — toolbar button and tab-menu item: save a package under a new name to any folder, choosing the format (Old/New) and Lineage2Ver121 encryption; the tab switches to the saved file; * Tab right-click menu reworked: Save, Save as... and Settings on top; Copy path and Open in Explorer at the bottom; Version 3.0.5: * Animation grouping now follows AnimNext links instead of frame names — chains group correctly with any naming (mixed prefixes, non-sequential or 0-/1-based numbers); * GIF import: animation parameters (frame rate) and TotalFrameNum are now written only to the first frame, the rest keep just the AnimNext link — matches the game's own format; same fix applied to "Create animation"; Version 3.0.4: * Clipboard <-> Explorer: Ctrl+C in the browser then Ctrl+V in Explorer pastes the textures as files; copy files in Explorer then Ctrl+V in the browser imports them; * Rename a package right from Package settings (handles Lineage2Ver121 re-keying); * Hotkeys: F1 (About), F2 (rename), F5 (reload from disk, asks if unsaved), Delete, Enter (Properties), Ctrl+W (close tab); * The application icon now appears in the title bar of every dialog and sub-window; * Fixed flipped preview when importing TGA files;  Download (Installer) |  Download (Portable)
    • Hello! I am creating a new L2 Editor version with most bugs fixed and new features added. PM me for more info!
  • 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..