Update Progress Message.

Discussion in 'Plugin Development' started by StephenTheHero, May 31, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    StephenTheHero

    Hello developers!

    Firstly, I'm using this: https://forums.bukkit.org/threads/u...ant-auto-updating-for-your-plugins-new.96681/

    Right, I'm trying to get it so when a player does "/___ Update" it'll download the new update which I've done but I want it so when it is downloading the new update it'll show a progress of the download, just like the updater already does in the console but I want it sent to the player.

    Like this but I want it in-game (sent to the player):
    [​IMG]
     
  2. Offline

    AoH_Ruthless

    StephenTheHero
    If you look at the source code, specifically line 327, you'll see where it announces it. Here, print a message to a player or something. So you can try adding a player argument in the method and use player.sendMessage("Downloading update: " + percent + "% of " + fileLength + " bytes.");

    However, you will need to add relatively unused player arguments in many other methods then.
     
  3. Offline

    StephenTheHero

    Oh, I forgot about that! Thanks dude :)

    AoH_Ruthless Ugh, I'm actually finding no way to do this still...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 1, 2016
  4. Offline

    AoH_Ruthless

  5. Offline

    StephenTheHero

    I don't know how to tell you what I've done so far :p sorry, I've just tired xD
     
  6. Offline

    AoH_Ruthless

    StephenTheHero
    If you can't follow that, I can't possibly help you any further.

    To clarify:

    Add a player parameter into the method containing line 327, and then player.sendMessage(<message to send> right after line 327);. If you add a player parameter, you might have to add a player parameter to other methods to compensate.
     
  7. Offline

    StephenTheHero

    Yea dude, no idea... Wouldn't that just send that message to every player in the server?? I want it so just the player that does the command gets the messages.

    I basically need spoon-fed with the right code.
     
  8. StephenTheHero Just send it to the person who sent the message. :/
    sender.sendMessage("Stuff");

    Or am I mistaking what you are confused about?
     
  9. Offline

    StephenTheHero


    AoH_Ruthless The command won't be in the file, the command is in another class not the Updater class and if I put sender.sendMessage("Stuff"); in there I'll have to add a command in there and it just wouldn't work... if I just put sender.sendMessage("Stuff"); in the updater class, there is just going to be errors and if I can a player thing then it'll send it to everyone on the server! I don't know how to do this, this is why I'm here but your just saying to add "sender.sendMessage("Stuff");" and I have no idea where at I have no idea what else to add because "sender." would just returns errors, you see what I mean... your not helping by just saying to do this when I don't know how to do it! sorry...


    xYourFreindx Like I said in OP I'm just trying to make it so when the updater is downloading a update it'll send a message to the player that did "/___ update" saying about the progress of the update just like it does in the console but I want it sent to the player that does the command too.
     
  10. Offline

    AoH_Ruthless

    StephenTheHero
    To remove errors on your sender variable, add a CommandSender sender parameter. This isn't complicated. I recommend you learn Java before asking Java-related questions. This isn't a Bukkit question any longer.
     
  11. Offline

    StephenTheHero


    So, your basically telling me to do something like this:
    [​IMG]
     
  12. Offline

    AoH_Ruthless

    StephenTheHero
    Lol not at all. That wouldn't even remotely work; I have no idea how that even got into your head.
    You can't put a method in another method ... welcome to OOP.
    You also aren't following code conventions (CS, CMD)
     
  13. Offline

    StephenTheHero

    "add a CommandSender sender parameter." Your not telling me anything else?! your not showing me any examples or anything, your seriously not helping at all...
     
  14. Offline

    AoH_Ruthless

    StephenTheHero
    Well if you recall from my previous messages in this thread, I said add the player parameter to your method. I didn't realize you needed a CommandSender, so I didn't clarify. Sorry.

    Add a CommandSender parameter to the Updater method. This is the method that contains line 327. A parameter is an argument you input a method. For example, the parameters of a public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) is a CommandSender, a Command, a String, and a String array respectively.

    I am purposely not giving you the answer because you have to figure this out. I am not going to hand you the answer if it is not necessary.
     
  15. Offline

    StephenTheHero


    I've been trying to figure this out, why do you think I'm here? to get answers! not for someone just to give me hints or whatever...
    [​IMG]
     
  16. Offline

    AoH_Ruthless

    StephenTheHero
    I didn't say to define a new player like that ... You could only send it to one player at any time then, and that would be hoping they are online. I said to add a player parameter in the method. Read my post.

    I'm not giving you hints or whatever, I have told you the answer in a clearcut fashion several times already. Your limited understanding of Java is preventing you from proceeding any further.
     
  17. Offline

    StephenTheHero

    Your seriously not helping at all...

    AoH_Ruthless I'm sorry if I'm a beginner but how can you expect me to know what your going on about? this would of been a lot easier if you just actually gave me a some code to help me.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 1, 2016
  18. Offline

    AoH_Ruthless

    StephenTheHero
    I'm not telling you to stop coding, and I'm not chastising you for being a beginner: I am trying to tell you that you should stop trying Bukkit right now and you should go work with Java to learn the fundamentals.


    "Have patience. All things are difficult before they become easy." - Saadi.

    If I gave you the code, you would never learn.
     
    Commander9292 likes this.
  19. Offline

    mactown21

    StephenTheHero Yea what AoH_Ruthless said, You may want to go look at the basic steps of java before trying to do this, or you will get stuck and every part and will need help. Giving the code to you will not help you understand anything at all. Keep trying, search things online that could help you with what you need. Once you get the hang of it and understand you will understand how to do the plugin update method, and will understand what you have done wrong. This is kindof advanced of automatically updating your plugin.
     
  20. Offline

    StephenTheHero





    I've added:
    private void saveFile(File folder, String file, String link, CommandSender CS) {
    to line 303 and added:
    CS.sendMessage("Downloading update: " + percent + "% of " + fileLength + " bytes.");
    after line 327

    and It doesn't work, actually it just does this
    [​IMG]

    but it does actually download the new update it just says that error and it doesn't say the download progress in-game, the updater just thinks its failed the download but if I reload the server the new update is downloaded and loaded etc. so basically now the updater downloads the new update but thinks it hasn't and returns the fail message and also doesn't say the progress of the download in-game.
    [​IMG]

    so now what? sorry for covering my plugins name :(
     
  21. Offline

    AoH_Ruthless

    StephenTheHero
    I don't see why you covered the name up but you didn't do it well: "Found new update: UUID v1.0" :p

    It's weird that it's not working. I'll try looking into it and get back to you, it might take time though.
     
  22. Offline

    StephenTheHero

    Oh yea, I forgot about that bit xDD it doesn't matter anyway lol
     
  23. Offline

    AoH_Ruthless

    StephenTheHero
    Are you sure it's a problem with the Updater? Paste your main class or whereever you attempt to notify the player. Was the updater working fine before you added the CommandSender parameter?
     
  24. Offline

    StephenTheHero

    Yea, If I remove the two lines I put into the Updater.class it works perfectly fine :p
     
  25. Offline

    StephenTheHero

    AoH_Ruthless You found a way yet?

    I still need help on this :/
     
Thread Status:
Not open for further replies.

Share This Page