Spigot Plugin Development - 12 - Cooldowns

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น • 60

  • @arch1ve017
    @arch1ve017 2 ปีที่แล้ว +41

    I love how he keeps his voice serious while saying "so the command is /fart"

  • @trueprotocol7467
    @trueprotocol7467 2 ปีที่แล้ว +9

    the burp caught me by surprise lol

  • @hytalePvP
    @hytalePvP 2 ปีที่แล้ว +15

    You can make a class "CooldownCommand" and then inherit from it. So you don't have to write that code every time a command needs cooldown.

  • @sourcelocation
    @sourcelocation 2 ปีที่แล้ว +6

    amazing explanation, thanks

    • @KodySimpson
      @KodySimpson  2 ปีที่แล้ว

      Glad it was helpful!

  • @memzynothere
    @memzynothere ปีที่แล้ว +1

    omg finally a good spigot youtuber

  • @RenderDragon
    @RenderDragon 2 ปีที่แล้ว +1

    Oh sorry me, just second ago TH-cam sent me notification about this video... You are great

    • @KodySimpson
      @KodySimpson  2 ปีที่แล้ว

      Yeah its called giving early access to all of my members, the thing I say at the end of every single video. In reference to the comment you left on my other video

  • @smokinglife8980
    @smokinglife8980 ปีที่แล้ว

    Anyone that does not want to have to code the cooldown everytime you need one you can make a timerutil class were you can start, stop, and keep track of a certain players cooldown pretty easily and pretty much is the same thing he did here but in its own class and there should be methods to start, stop and get the current time remaining

  • @ВіталікБритан-х7ч
    @ВіталікБритан-х7ч 2 ปีที่แล้ว +2

    There are no ready-made plugins for cool down commands, relative to status for example.
    vip - /heal cooldown is 300s.
    premium - /heal cooldown is 10s.
    LuckPerms?
    Essentials?
    How to do that?
    ps. For server) I planned to try to make a server, and I had enough coding when I was making a mod)

  • @DavidV11
    @DavidV11 ปีที่แล้ว

    Thank you man, finally I have cooldown for my kits, not as a command

  • @anthonystrange7553
    @anthonystrange7553 2 ปีที่แล้ว

    Yaay, thx for this video, it's helped me a lot!

  • @Sparka64
    @Sparka64 ปีที่แล้ว +1

    is there a way to fit all of this into one variable? dont wanna make like 10 different hashmaps for cooldowns.

  • @trashhh5259
    @trashhh5259 4 หลายเดือนก่อน

    Kody burps are the best

  • @ybacornae7851
    @ybacornae7851 2 ปีที่แล้ว

    Cannot invoke "java.lang.Long.longValue()" because the return value of "java.util.HashMap.get(Object)" is null when the code activates

  • @Skillek
    @Skillek 2 ปีที่แล้ว

    can you add the , before e.g. 5 and after 301? like 5,301

  • @ПлатонКлюкин-ы8у
    @ПлатонКлюкин-ы8у 2 ปีที่แล้ว +1

    1:06 Чё рыгаем?

    • @EUG800
      @EUG800 2 ปีที่แล้ว

      ni che

  • @Mxchyyyy
    @Mxchyyyy 2 ปีที่แล้ว +1

    nice video!

  • @ThecubeofworldBESTMEMES
    @ThecubeofworldBESTMEMES 2 ปีที่แล้ว +1

    1:07 genius AHHAHAHAHhahahah

  • @darklife5618
    @darklife5618 2 ปีที่แล้ว

    How Do You Get The Greater Than Or Equal To Sign? I tried but it says illegal character

  • @lambdaspg1389
    @lambdaspg1389 2 ปีที่แล้ว

    What font do you use in your ide

  • @vetox2845
    @vetox2845 2 ปีที่แล้ว +1

    👍

  • @thomb.9013
    @thomb.9013 2 ปีที่แล้ว +1

    Why is this 10h ago? Why so late compared to the rest?
    Edit: lmao I got solution using a hahsmap too, code a problem? Use a hashmap!

  • @markloving11
    @markloving11 2 ปีที่แล้ว +1

    #kodyforpresident2022

  • @lamola4414
    @lamola4414 2 ปีที่แล้ว

    Why are the milliseconds now in negative

    • @BryanSich
      @BryanSich 2 ปีที่แล้ว +3

      hey u prob found a solution by now lol but just in case anyone else sees this in the future, when you compress the code to avoid repeating the lines you have to make sure the computation calculates the difference between the milliseconds first and after that you substract the 10000. I did mine with seconds so here is how.
      (10000 - (System.currentTimeMillis() - cooldown.get(p.getUniqueId())) ) / 1000

  • @marcelooo1329
    @marcelooo1329 2 ปีที่แล้ว +1

    Hey kody! Is it possible to change the time into seconds? Milliseconds just look annoying for me

    • @KodySimpson
      @KodySimpson  2 ปีที่แล้ว

      Yep, said this in the vid a couple of times. You have the code in front of you, 1000 ms is 1 second

    • @marcelooo1329
      @marcelooo1329 2 ปีที่แล้ว

      @@KodySimpson yea but what I meant just realized I didn't explain it good enough. What I meant was can I change it so it shows how many seconds till they can run the command again not milliseconds becasue it looks ugly

    • @mrproxima1824
      @mrproxima1824 2 ปีที่แล้ว +2

      @@marcelooo1329 Just divide these miliseconds by 1000 and round that if you want to

    • @duckking404
      @duckking404 2 ปีที่แล้ว +2

      yeah just divide it by 1000 then you get seconds

    • @Skillek
      @Skillek 2 ปีที่แล้ว

      @@duckking404 but how?

  • @dani3l3_
    @dani3l3_ 2 ปีที่แล้ว +1

    I think you can do this with BukkitRunnable, for example every 10 ms you can decrease the time. The only issue is that if you set the delay of the runnable to 1ms the server becomes kinda laggy sometimes

    • @KodySimpson
      @KodySimpson  2 ปีที่แล้ว +1

      Yeah, I was thinking about showing that but it seemed kinda like overkill cuz a hashmap seems to work perfectly

    • @KodySimpson
      @KodySimpson  2 ปีที่แล้ว +1

      or whatever data structure

    • @McMasterProGenius
      @McMasterProGenius 2 ปีที่แล้ว +2

      BukkitRunnables kinda lag the server by just a tiny bit

    • @HonestAuntyElle
      @HonestAuntyElle 2 ปีที่แล้ว +2

      There's no point of using a bukkitrunnable for a cooldown unless you want the notification. Just store the instant/tick it started, and check that next check, or schedule a reminder to tell people when it's up.

    • @HonestAuntyElle
      @HonestAuntyElle 2 ปีที่แล้ว

      The ideal method would be using a cache that expires, to prevent memory leaks for public servers that don't restart for like a month or more.

  • @terrificking
    @terrificking 2 ปีที่แล้ว +1

    can u make a video on how to make custom ranks like OWNER,ADMIN etc and also get persnol cool commands only for ranked player. And a nick feature when u type /nick it changes your name which is above your head (username) and in the chat like hypixel has plz? im trying to make a server

    • @Jmiltxn
      @Jmiltxn 2 ปีที่แล้ว

      Yes

    • @meteryx1361
      @meteryx1361 ปีที่แล้ว

      The per rank commands are simple with permissions from earlier videos

  • @hdfsyu
    @hdfsyu 2 ปีที่แล้ว +1

    second