Minecraft PC IP: play.cubecraft.net

Max ♠

Forum Expert
Feb 20, 2016
1,420
2,940
344
24
North pole
Hi,

I made a forum addon to display a users rank when they post a message.

Sidenote:This is not a suggestion, please, dont link me to the suggestion thread, thanks.

What it does:

upload_2018-2-25_20-3-41.png


How to install:
Firefox, Chrome, MS Edge, lot of other browsers:
- Install the tampermonkey addon
- Go here
- Press the install button
- Install the script
- Go to this thread (or any other), press allow when it prompts you about cross-domain whatever (used to retrieve ranks from a database)
- Enjoy

Safari, Internet explorer:
- Lol nope

Code:
Code:
// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.cubecraft.net/threads/*
// @grant        GM_xmlhttpRequest
// ==/UserScript==

var mcNamesObj = $(".playerUsername");
var datastring = "";

for(var i = 0; i < mcNamesObj.length; i++) {
    name = mcNamesObj[i].innerHTML;
    if(datastring == "") {
        datastring += "usernames[]=" + name;
    } else {
        datastring += "&&usernames[]=" + name;
    }
}

GM_xmlhttpRequest({
    method: "POST",
    url: "https://www.landviz.nl/host/cc_ranks/getRank.php",
    data: datastring,
    headers: {
        "Content-Type": "application/x-www-form-urlencoded"
    },
    onload: function(res) {
        ranks = res.responseText.split(",");

        for(var i = 0; i < ranks.length; i++) {
            $($(mcNamesObj[i]).parentsUntil(".messageUserInfo")[2]).find(".userText").find(".userTitle").html(ranks[i] + " Rank");
        }
    }
});

How it works (for people who can't read JS & want to know the backend):
When you open a thread, the script looks for all minecraft usernames and sends them to my website in a post array (fancy word for your browser sending a letter to my site requesting some info), the ranks are retrieved from my database and send back to the browser. If a users isnt stored in the database, his name gets stored without a rank attached, every 10-20 seconds my old pc will go through all users that have no rank set and apply the appropriate ranks. It will say Unknown Rank instead of letting you wait for my old pc to go through them)

(ALL DATA IS STORED IN MY DATABASE AND NOT RETRIEVED FROM CUBECRAFTS DATABASE, I DO NOT HAVE ACCES TO ANY OF CUBECRAFTS DATABASES OR ANY OTHER SPECIAL SERVICES, RANKS ARE GOTTEN FROM STORE.CUBECRAFT.NET AND THEN STORED IN MY DATABASE)

This does not work on profile pages, if you're looking for something to do, feel free to implement this feature or create a new script for it, send a POST array with usernames[] index to retrieve someones rank in the same order as in the array, there is no duplication checking.

I will not show any backend code for security reasons, if you require to see the backend (as a staff member) to make sure I'm not stealing credentials or whatever, start a conversation :]

Disclaimer: I'm not affiliated with cubecraft in any way, please dont sue me

@Luzario you got a special "rank" btw ;]

Oh and a few other people got a fancier "rank"

Idk how to end this,

bye

This is now an official feature, removed the backend, addon will no longer work

 
Last edited:
Members Online

Team online

Latest profile posts

coolzombiee wrote on Darwin7's profile.
Thank you for the follow! I didn’t notice lol take one back
coolzombiee wrote on Lyriie's profile.
Was community games happening when I saw you , itzjuan, and nightmare in the lobby, with a bunch of other people?
Only nine more "haha's" till I get to 1,000 funnies.
1000048948.png
Reesle wrote on treegirl0194's profile.
Happy Birthday! 🎂
Reesle wrote on Pro Gamer672's profile.
Happy Birthday! 🎉
Top Bottom