1. Welcome to the Brawl website! Feel free to look around our forums. Join our growing community by typing /register in-game!

[Speed Coding #2] - Phantom

Discussion in 'Hardcore Games' started by Algelier, Jan 1, 2017.

Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...
  1. Algelier

    Algelier Former Staff Member.

    Joined:
    Sep 29, 2013
    Messages:
    1,811
    Ratings:
    +1,108
    Hello everyone!
    As suggested by @RyGuy on the last speed coding, here's the phantom!

    Code:


    Note: I forgot to rename the feather.

    Render (turn on the sound for better quality):


    P.S.: Camel & Spiderman are also done.

    Please tell me what Hardcore Games kit you want me to code next below!
    Algelier.
     
    • Like Like x 2
    #1 Algelier, Jan 1, 2017
    Last edited: Jan 1, 2017
  2. Signatured

    Signatured War 2.0 Developer

    Joined:
    Sep 13, 2013
    Messages:
    3,819
    Ratings:
    +1,402
    I suggest for your next video you look into using polymorphism and inheritance when creating classes. You could create a abstract HardcoreKit class with all the methods most of your classes need (for example onUse), and when you create for example Phantom class, you can make it extend HardcoreKit which handles the registering of the listeners, the special items, etc.

    Don't get me wrong, you look like you know what you're doing with the bukkit API and have a good knowledge of java, I'm just trying to push you towards better practices when doing this kind of stuff. Good luck with your coding adventures :smile:
     
    • Like Like x 1
    • Friendly Friendly x 1
  3. Eil

    Eil Ex-Raid // Perm. Ban Manager
    Retired Staff

    Joined:
    Dec 22, 2014
    Messages:
    1,798
    Ratings:
    +711
    Is what you just explained there Object Oriented Programming? Or is this something completely different?
     
  4. Algelier

    Algelier Former Staff Member.

    Joined:
    Sep 29, 2013
    Messages:
    1,811
    Ratings:
    +1,108
    Yes of course, but for a little plugin like this I don't really have to, as it's only practice and sharing the hidden face of a server. However if one day I code the whole HG server, then I'll do what you suggested me to do!
    By the way, thanks for the support! That's much appreciated!
    Inheritance is one of the founding principles of Object Oriented Programming (therefore Java).
     
  5. MattM1PVP

    MattM1PVP Ex-HG Staff Member

    Joined:
    May 22, 2015
    Messages:
    2,148
    Ratings:
    +705
    WARNING: ENGLISH LANGUAGE COMING THROUGH

    Nice job, do kangaroo next? :smile:
     
  6. Lacota

    Lacota Member

    Joined:
    May 17, 2015
    Messages:
    48
    Ratings:
    +12
    At 3:20 (among a few other places), why are you using Long.valueOf (and longValue() earlier)? As well as doing stuff like 1.0F rather than just 1f (without the decimal and tenths). It was just interesting to see that being used when it's not necessary.

    Also, you might want to consider using a few Java 8 functions (particularly lamba expressions). By that I mean rather than doing:
    for(Player player : Bukkit.getOnlinePlayers()) player.sendMessage("test");

    You can use the more efficient (and better looking):
    Bukkit.getOnlinePlayers().forEach(player -> player.sendMessage("test"));

    Other than that, nice tutorial. You seem to be really interested in programming.
     
  7. IronRaven

    IronRaven Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    1,055
    Ratings:
    +343
    ftfy
     
  8. Lacota

    Lacota Member

    Joined:
    May 17, 2015
    Messages:
    48
    Ratings:
    +12
    You don't need to stream first to loop through the collection; only if you want to filter, map, collect, etc.
     
Loading...
Similar Threads Forum Date
[Speed Coding #1] - Lumberjack Hardcore Games Dec 19, 2016
[Speed Coding #2] - Soldier Capture the Flag Oct 27, 2016
[Speed Coding #1] - Archer Capture the Flag Oct 26, 2016
Re-coding Weapons Ideas May 15, 2017
Decoding WarZ to see why it's do addicting! MC-WarZ Apr 7, 2017
Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...