1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Detecting GUI Type. Possible?

Discussion in 'Development' started by Pizzahaet, Jun 27, 2017.

  1. Pizzahaet

    Pizzahaet Spider

    Messages:
    9
    GitHub:
    pizzahaet
    Ok so you know how in the game settings you can choose between the Pocket GUI or the Classic GUI right? I am attempting to make a plugin that deals with a custom chest inventory where the contents look best using the Classic GUI. I have the plan on what I am going to do with it when it determines if Pocket GUI is true, I am going to block the container from being opened by the player with the Pocket GUI then send a title&subtitle telling them that they must change to Classic GUI in their game settings.

    Screenshot_20170627-184934.png




    SERIOUS NOTE:
    Please do not judge me. I am saying not to judge me because I have been called things like a fake dev, and such, I just wish to learn and make my server most advanced as possible, while being fast and fun at the same time!
     
    Last edited by a moderator: Jun 28, 2017
    kazuya and Muqsit like this.
  2. MK500

    MK500 Slime

    Messages:
    77
    GitHub:
    markkrueg
    Yes, it is possible to determine the Craft UI at login, as this data exists in the login packet. I have modified LoginPacket.php and Player.php to allow me to capture and display clientData["UIProfile"] in my log; so what you are trying to do should be possible with modifications to PMMP.

    I'm not sure if it would be possible for a plugin to access this information without modifications to the server.
     
  3. Pizzahaet

    Pizzahaet Spider

    Messages:
    9
    GitHub:
    pizzahaet
    What I need is the plugin to be able to access this information with server modification
     
  4. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23
    Of course it's possible without modifications... Don't encourage people to modify the PMMP source code.

    Just use DataPacketReceiveEvent, check if the packet is a login packet, and get the information from there. The ui profile is located in $packet->clientData["UIProfile"];
     
  5. Zayd

    Zayd Witch

    Messages:
    55
    GitHub:
    ZaydPE
    The UIProfile => $value should be the integer 1, or 2. This can show you their GUI... however, nothing stops them from changing it ingame
     
  6. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23
    Yeah, the LoginPacket only checks what it is when they LOGIN to the server, you'd have to have the players reconnect with the other gui to check if it updated.
     
  7. Pizzahaet

    Pizzahaet Spider

    Messages:
    9
    GitHub:
    pizzahaet
    Is it possible to have it check when the player attempts to open a custom chest inventory?
    Then from there cancel the opening of the custom chest inventory followed with a title?
     
  8. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23
    Save the players ui profile in an array with their username ($packet->username), then use it when you need it
     
  9. Pizzahaet

    Pizzahaet Spider

    Messages:
    9
    GitHub:
    pizzahaet
    I think I might just do it upon join/login then kick the player if the UI is incorrect
     
    mal0ne_23 likes this.
  10. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Don't abuse the fonts, please. They only make it harder to read.
     
    Muqsit likes this.
  11. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Firstly, a serious note:
    DO not use this as some anti dupe mechanism, these values are CLIENT PROVIDED, even tho for the time begin no one have tried to spoof it, but it can be spoofed with effort if someone really want to screw you up

    Secondly, on how to:
    vardump login packet on packet receive event, the answer should be in your sight, something about UI profile

    Thirdly, on doing this:
    People WILL not like you you, it's like blocking mobile browser because your website looks best at a PC,
    Generally by doing this(blocking mobile browser) you already have earn yourself a place in /r/A*holeDesign as user agent was not meant for you to block people,
    But for you to create a more tailored support, like example: make another good look that works on mobile and if they are mobile give them the second view,
    at the very least: dont block them just toss them your PC view, maybe a notice bar explaining why this website look wonky
    Back to this situation:
    Instead of blocking them, you should just create a tailored view for each profiles, PS dont be scared to use the client's inv for pocketUI to create a PC chest like view
    If that's too much effort, just like tell them it look best on PC profile view then send them the chest anyways
    There's no real need to block them

    I hope no one take this too personally, after all you do what you want, i am just trying to say that, they players wont really like it, that's your server and your responsibility to treat them well, not mine
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.