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

    • new synchronized movement with neoengine obstacle correction I reported bugs to you and you completely ignored me because of my nationality. Yes, you were arrogant towards me. I sent you many questions on your forum and you didn't even thank me or say anything about it. I stopped using your updates a long time ago and focused on fixing my own aCis because you intentionally break the code. Just buy versions 401 to 409; you intentionally broke a lot of things for "IDIOTS" to buy from you. Anyway, our conversation ends here. Good luck with renaming and organizing; that probably makes you more money than fixing the basics. With this debug I created valid notes for monsters and NPCs, fixing the maxZ that you broke, and also corrected fly/water movements, making them more efficient. I only spent 2 months and I'm using Geoengine l2.j   NOTE: I'm not selling my GeoEngine, don't waste your time sending messages!
    • I'm on that same situation, but hey after almost 3600 commits it's almost playable! 😛
    • Probably due to poor choice of container handling items, you should test other types.   If it's not due to container, it can be whatever method impacting inventory, such as sort/filter/integrity checks. Bad synchronization can also grealty impact performance.   Another thing to check is about packet sending, you should use L2PHX to explore what is actually sent.
    • how do I make it so that you only deal damage to a mob if you have the right items equipped, like jewels, belt, underwear, bracelet, so if you don't have one of those items equipped, you don't deal any damage to the mob thanks
    • I always welcome bug reports and never ban ppl - until proven leaker - not sure where the "arrogant" part comes from, I would like to know what exactly let you think that (quote me please, and not 12y old quotes as the other frog meme dude). I request bug reports to be properly detailed, otherwise it's a waste of time. Other than that, I don't see where I have been arrogant. I got proper discussions with many ppl, not sure why you wouldn't be one of them.   I got 76 bug reports in my list (21 on forums, 55 on gitlab).   I have a single bug report regarding lvl 4 clan quest, which has to be tested since it's not even clear about what is supposed to be broken. Seven Signs was never reworked and is basically L2J based (we got a rework branch to test/commit with reworked AIs). Geoengine got no specific issues (at my knowledge), pathfinding was reworked lately to be way more performant, and I still try to improve performance using some pool system. Movement was partially fixed in latest 410, and probably will get another rework soon (notably reverting to the task wallclock).   "I" surely didn't spend 12y over geoengine - Hasha cared about geoengine during rev 334 / 354 / 390 / 395 and 397. It is solely his work, and always tagged as it. He was rewarded with money for his work, and almost a decade of aCis access.   aCis is a community work, things tagged with Tryskell is my work, the leftover is someone else work. 22 ppl worked as developers in this project over 14 years.   I would gladly accept whatever list of fixes/reports you have to share. You will even be rewarded (you probably know about cookie system), as anyone else sharing bug report or fixes.   My main concerns lately is the lack of decent L2OFF IL data, it is my main bottleneck actually. If you're aware about decent L2OFF data to parse, let me know.   Eventually reach me over Discord to speak, I don't want to continue the offtopic over that help request.
  • 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..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock