Jump to content

Question

Posted (edited)

http://imgur.com/a/gZoEQ
 

protected L2PcInstance getPlayerWithMaxScore()
{
L2PcInstance max = players.head().getNext().getKey();

for (L2PcInstance player : players.keySet())
if (players.get(player)[2] > players.get(max)[2])
max = player;

return max;
}

I have this error, can someone tell me how to stay?

Edited by L2shaken

15 answers to this question

Recommended Posts

  • 0
Posted (edited)

http://imgur.com/a/gZoEQ

 

protected L2PcInstance getPlayerWithMaxScore()

{

L2PcInstance max = players.head().getNext().getKey();

 

for (L2PcInstance player : players.keySet())

if (players.get(player)[2] > players.get(max)[2])

max = player;

 

return max;

}

 

I have this error, can someone tell me how to stay?

create a method named head() and get the head of that HashMap  :dat:

 

 

BTW,u asked the same question in ur previous topic.

 

Tryskell answer u already and he gave u the code which u need:

 

EventTeam winner = null;
for (EventTeam team : teams.values())
      if (team.getScore() > ((winner == null) ? 0 : winner.getScore()))
             winner = team;


return winner;

If you got only 2 teams max, forever, it's easier to simply write both teams and compare team1 and team2 getScore().

 

If you can't complete or integrate what I wrote, simply forget to open a server for the next 6 months minimum and take time to learn Java.

 

PS : it's generally terrible to return a simple id, which means you must find back the associated team in one way or another after the getWinner(). It's far better then to take back the entire EventTeam which probably holds all useful informations, such as team compo, the score, the id, etc.

 

PS2 : I avoid to use or provide lambdas writting style, first because I don't want to seek the best writting style, second because lambdas is still shady for 90% of ppl, similar to maven vs ant, third because it's the most popular writting style and at least anyone will understand it.

 

Edited by bravetobe
  • 0
Posted (edited)

create a method named head() and get the head of that HashMap  :dat:

 

 

BTW,u asked the same question in ur previous topic.

 

Tryskell answer u already and he gave u the code which u need:

 

This code is part of the Phoenix Event Engine, I could not do it that way that Tryskell quoted.

Event Link: http://www.mediafire.com/file/ww4b3u0efs58t8q/Phoenix+Event+Engine+aCis.rar

Edited by L2shaken
  • 0
Posted (edited)

create a boolean kappa true

winner null

while loop it with hasNext()

if boolean ,get score and compare it with 0/1 whatever u want (if event has 1 player,do u want him to win?), and make him winner/max and change kappa to false.It supposed to get the first player and make him winner so u can compare it with the next players

else compare it with max score and set him winner

later on do what u want,u found the guy

 

P.S U need to declare properly too.not gonna code u

loop hasNext() -> iterator.

Also,i dont like hashmap.Thats how i would do it tho

Edited by bravetobe
  • 0
Posted

Get back when you finish the programming fundamentals course... especially the data structures. :lol:

  • 0
Posted (edited)

Get back when you finish the programming fundamentals course... especially the data structures. :lol:

wut mate...

 

show me the code,if u actually want to make a point and prove me wrong.

Thats what i said works.

 

I m not like Access ,just to let u know

Edited by bravetobe
  • 0
Posted

wut mate...

 

show me the code,if u actually want to make a point and prove me wrong.

Thats what i said works.

 

I m not like Access ,just to let u know

My suggestion was for the author of this topic. :lol:

  • 0
Posted

My suggestion was for the author of this topic. :lol:

For a moment i wanted to answer like " use dickHead() instead of head()" but then i would be immature ...

 

Thats what happens tho when u leech code .Next time i will do tho Kappa

mb

  • 0
Posted (edited)

bravetobe, next L2jDeveloper supporting Greek section, confirmed storka :lol:

Edited by SweeTs
  • 0
Posted

bravetobe, next L2jDeveloper supporting Greek section, confirmed storka :lol:

bravetobe he failed opening frozen 100% balanco PROFESSIONALA servidor and now he HATIRINO 

  • 0
Posted

bravetobe, next L2jDeveloper supporting Greek section, confirmed storka :lol:

all the way to the top,just give me privs to ban several plebs ... 

Fck hashmap tho.

 

Gate lyfe >ArrayList > 0 >HashMap > L2J developing for me :(

  • 0
Posted

:(

U got ur answer ...

 

Really if u dont know how to code it,go fckign tutorials for hashmap.Do this favor to urself and if u expect someone to spoonfood that dogsh1t,then stop l2jdeveloping

  • 0
Posted

If it's such a problem to adapt the code, why don't you simply use the javolution lib and be done with it, instead of creating a new topic for each method that doesn't exist on HashMap?

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

    • Hi. Can you describe the task in more detail? I think many people here work with IntelliJ IDEA.
    • https://jmp.sh/MaCC5Gqa Combat animation synchronization: Bow/Sword. Added arrow flight and sword-to-monster effects.
    • The holidays are over and we’re back to work (well… we never really stopped 🙂 ). The server has been online without a single restart since December 26, running smoothly and without issues. That’s because we care, and we’ll keep caring. Many of us remember the old days: helping new players, building clans from zero, catching up together, and having fun without rushing. With that spirit in mind, Newbie Bonuses are now live and we strongly encourage everyone to help newcomers catch up and enjoy the journey. L2Elixir was never about short-term hype. It’s about community, stability, and bringing back what made Lineage II special.   🎁 Newbie Bonuses Characters created since December 25 & all new players receive a Newbie Box (Return Hero) (Rune EXP/SP +50% for 5 days, Random 48-hour Costume) 2nd Class Transfer cost reduced from 3kk to 1kk — join Academies! 3rd Class Transfer enabled, available only for classes already in the Hall of Fame. 🛡️ Anti-Bot Implemented BOT-CHECKER v2, more checks, and general improvements. Added extra checks during PvP. New Auto-Check system for suspicious behavior (penalties apply if third-party software is detected). Fixed Bot Report Button not refreshing. ⚙️ General After critical errors or force disconnects, characters will remain No Carrier for a few minutes. Added Cursed Bone to Helvetia (QoL). Enabled on-screen Clan War kill notifications. Fixed buff store issues when entering characters. Fixed party drop owner calculation (please report any issues). 🧙 NPCs Harit Lizardman, Grunt, and Archer now level up SC up to stage 5. 🎉 Events Fixed trigger skills not working during Events. Fixed Health / Shield packs not disappearing in some cases. Fixed summon remaining time not refreshing after Events. Added a second Team vs Team map to reduce routine. Added another Save the King map. Christmas Event cleanup completed. Players in Observe Mode can no longer register for Events. 📜 Quests Fate’s Whisper Fixed and corrected messages. Enchanted B-grade weapons can now be exchanged as per retail. Added missing Social Victory animation on quest completion. 🗺️ Geodata Fixed falling issues in Castle zones.   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs
    • NEW SEASON START 23.01.2026 Get ready for the ultimate High Five adventure on L2Exoplanet.net!   • The last two previous Seasons are now merged into the Core Server. • The Core Server remains our main long-term world. • All future Seasonal Servers will be merged into Core after they end. • No characters or items will be lost – everything stays safe!     GRAND OPENING:  23.01.2026 at 20:00 GMT+1 BETA TEST:    16.01.2026    Client: High Five Rates: x10   Website: https://l2exoplanet.net Facebook: https://www.facebook.com/L2-Exoplanet-106811564103836 Discord: https://discord.gg/4fzhW7ZSPc         Game Rates    Experience: x10  Skill Points: x10  Adena: x5  Drop: x8  Spoil: x8  Quest: x5  Raid Boss Drop: x5  Fame: x2  Epaulette: x8  Manor: x8      Safe Enchant: +3  Maximum Enchant: +16  Normal Scroll Chance: 60%  Blessed Scroll Chance: 63%  Attribute Stone Chance: 50%  Attribute Crystal Chance: 30%      Game Settings    Multibox - 3 game clients per HWID  Autoloot  Autolearn Skills Auto Farm  NPC Buffer   Buff Slots (24+4/12)  Buff Duration (2h)  Olympiad Period 7days (new heroes appear every monday)  Seven Signs Period  Class Transfer for Adena  Max Sub-Class 3  Sub-Class Max Level 85  Essence Interface  Champions System  Vote Reward System  Dayli Reward System  PC Points Reward (500PC = 1 Donate Coin)      Epic Bosses Respawn Times     Queen Ant:  24 Hours +/- 4 Hours   Beleth: 3 Days +/- 8 Hours   Baium: 3 Days +/- 8 Hours   Antharas: 4 Days +/- 8 Hours   Valakas:  5 Days +/- 8 Hours     Instance Info     Normal Freya = 6 Players   Hard Freya = 12 Players   Frintezza = 6 Players   Zaken 83 Day = 6 Players   Zaken 60 Day = 6 Players   Zaken Nightly = 9 Players   Tiat = 6 Players   Beleth = 12 Players
  • 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