Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Help with VoteReward Receiving Concepts

Comments in 'Plugin Development' started by LDX, Oct 6, 2015.

  1. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    Hello, fellow PocketMine-MP plugin developers and intuitive forum users! Today I need help with a very specific issue: How should I give out rewards to players in the new version of VoteReward? Should I check all server lists when the player joins the game? Should I do that along with keeping the vote command? Should I just leave the vote command alone? Should I do something completely different? I need it to be a nice user experience all the way from server list owners, to server owners, to server players. I'm worried about this now because it would look pretty funny if a player joined the game after voting on five server lists and their chat looked like this:

    Code:
    Thanks for voting! You have received 4 diamonds and 10 tokens have been added to your account!
    LDX has voted and received cool rewards! Type /vote to learn more!
    Thanks for voting! You have received 4 diamonds and 10 tokens have been added to your account!
    LDX has voted and received cool rewards! Type /vote to learn more!
    Thanks for voting! You have received 4 diamonds and 10 tokens have been added to your account!
    LDX has voted and received cool rewards! Type /vote to learn more!
    Thanks for voting! You have received 4 diamonds and 10 tokens have been added to your account!
    LDX has voted and received cool rewards! Type /vote to learn more!
    Thanks for voting! You have received 4 diamonds and 10 tokens have been added to your account!
    LDX has voted and received cool rewards! Type /vote to learn more!
    This is my dilemma.

    Thanks,
    LDX
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I think it is best to use the Votifier way (using webhooks), but it appears that our Minecraft server lists don't support it.
  3. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    Even if they did, what if the server being voted for was offline? And when a player goes to vote, MCPE is usually closed in the background so they're no longer online.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    They don't need to be online. You can still edit an offline player's inventory.
    Or just cache the request and let the player claim it when join.
  5. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    But what about when the server itself is offline?
  6. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Then the server list could cache it and send it out later?
    LDX likes this.
  7. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    You guys are actually making a point here. There's a problem with all of this, though. Believe it or not, I'm trying to make myself do most of the work on this, not the server lists. Using my current method, creating an API for VoteReward to use is easy for them. I don't even know what a WebHook is, but it sounds complicated.
  8. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    So make this API of yours cache requests like I said. You could start a tiny HTTP server which responds to a POST request from the server list a player voted on. Wait.. is that basically what a WebHook is?
    Last edited: Oct 6, 2015
    LDX and Falk like this.
  9. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You would run an HTTP server and the websites supporting the plugin would send requests when a player vote was received. Although, you do have to provide some mechanism of resending old votes that isn't taxing on the server list. https://en.wikipedia.org/wiki/Webhook

    You could also look at how the BuyCraft API works as that system (although a bit more complicated that what you have) is pretty much bulletproof and accounts for offline servers and players. It uses polling and not Webhooks though.
  10. MinecraftList
    Offline

    MinecraftList New Member

    Joined:
    Sep 13, 2015
    Posts:
    15
    Minecraft User:
    MinecraftList
    Here are my 2 cents…
    For PC servers the “industry standard" is the Votifier plugin.

    http://dev.bukkit.org/bukkit-plugins/votifier/

    It is a considerably more complicated algorithm that requires rewriting the current voting API for server lists and the VoteRewards plugin.

    If LDX decides to rewrite his plugin, it is doable from the server list side, just as the current API provided by him is doable.
    However, it might be more tricky for the VoteRewards plugin itself, as it requires a complete rewrite.

    In any case, for PC servers there is no caching on the server list side. The server has to be online and the player has to be online to receive the vote. There are actually plugins using the votifier api that allow server owners to have the /vote command by saving all votes server side. The /vote command allows players to vote even when offline – I own a PC server and this was suggested multiple times by my community. However if the server is offline when a user votes then it is impossible to retrieve the votes.

    In general, I think the only actual difference for the player between the API we have now (and VoteRewards uses now) and the webhook style would be that the player does not have to type /vote in game.
    For the rest I am not sure what the advantages would be. One downside of votifier is chat spamming - if the player votes on multiple sites for a PC server on a list with a webhook api, he sees exactly the same notification in the chat for every vote. They appear one after another as he votes. With /vote I believe what you can do is either customize the message per website or sending only one message with the # of websites the player voted for. The other obvious downside is that when a server is offline or a player is offline, voting doesn’t work. As I said before, people have created plugins with votifiers api that save votes server side (with /vote capability), but that still doesn’t help servers that are offline.

    One thing we need to keep in mind is that we can’t force server owners to update the plugin. Therefore if LDX decides to rewrite the algorithm using webhooks then minecraftpocket-servers would need to have both types of API enabled, which may cause problems and confusion.

    I believe the current API has its advantages. It is easier to setup, for example, and out of the box it allows players to vote even when offline, something I imagine is more important for the PE community than the PC community. The way LDX plans for server owners to link servers to server lists is ingenious and requires much less setup than votifier. In the end, I personally support leaving the /vote command in.

    I have one more unrelated question - I am unfamiliar with how the proxy system works on PE. For the PC servers which require the player to be online, he would usually get the reward on the server he is on. And there is a Votifier plugin for BungeeCord, which is essentially the proxy system for PC servers. How does voting work for the hub servers in PE now?
    Last edited: Oct 7, 2015
    LDX likes this.
  11. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    I'm going to go ahead and just reply to this part of your post while I still have my train of thought on it...

    If all the servers in the network would simply use the same API key (or configuration file, soon), and all run the plugin, then they could simply add tokens or credits or money or whatever to the player's account, or they could register each server separately.
  12. lucasvitegui
    Offline

    lucasvitegui Active Member

    Joined:
    Apr 18, 2015
    Posts:
    191
    Minecraft User:
    lucasviteguiBR
    Would be interesting if it had a vote counter..
  13. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    I can very easily pool the items from all the websites, so only one message is displayed, and I already have plans to make that happen. The problem comes into play when server owners add their own commands to the configuration file, and those commands output messages.
  14. MinecraftList
    Offline

    MinecraftList New Member

    Joined:
    Sep 13, 2015
    Posts:
    15
    Minecraft User:
    MinecraftList
    Will splitting the config work? This is how I imagine it will look like:

    # The URL for players to go to so they can vote;
    Vote-URL: ""

    Rewards:
    # List of items to give players when they vote; Format: I:eek:Damage:Amount
    Items:
    - "264:0:5"
    - "265:0:3"
    - "364:0:5"
    # List of commands to execute when a player votes; EXECUTE ONCE FOR ALL CHECKED VOTING SITES Use {PLAYER} to get the player's name.
    Commands:
    - "say {PLAYER} voted with /vote and got cool rewards!"
    # List of commands to execute when a player votes; EXECUTE FOR EACH SITE Use {PLAYER} to get the player's name.
    CommandsPerSite:
    - "msg {player} Thanks for voting!"
    LDX likes this.
  15. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    That'll do it! Genius! Now that I have a plan, I can start development of the new version of the plugin itself.
  16. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    I believe this thread is done. If anyone else needs to say something, say it before the thread gets locked, or send it to me in a PM. :) Moderator can lock at their convenience now.
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    About the proxy thing, if anyone is interested in using the Hormones plugin that is W.I.P., there could be a Hormone type called VoteHormone whereas servers that have that player online will do something upon the player there.
    LDX likes this.

Share This Page

Advertisement