Solved Set Gamemode without the message

Discussion in 'Plugin Development' started by bluegru, Oct 16, 2013.

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

    bluegru

    How can i change a players gamemode without the message "your game mode has been updated" ?
     
  2. Offline

    PolarCraft

    Try this.
    Code:java
    1. Player player = (Player)sender;
    2. if (cmd.getName().equalsIgnoreCase("gm")) {
    3. if (player.hasPermission("gm")) {
    4. player.setGameMode(null);
    5. }
    6. }
     
  3. Offline

    The_Doctor_123

    PolarCraft
    Won't that throw an exception? Even if it didn't, what would it do?
     
  4. Offline

    bluegru

    PolarCraft Nope, don't work

    I want to change the Gamemode of a player to survival without sending the default gamemode change message "your game mode has been updated"
     
  5. Offline

    PolarCraft

    Yeah sorry was going to fast :p Try this.
    Code:java
    1. if (cmd.getName().equalsIgnoreCase("gm")) {
    2. Player player = (Player)sender;
    3. if (player.getGameMode() == GameMode.CREATIVE)
    4. {
    5. player.setGameMode(GameMode.SURVIVAL);
    6. }
    7. else if ((player.getGameMode() == GameMode.ADVENTURE) || (player.getGameMode() == GameMode.SURVIVAL))
    8. {
    9. player.setGameMode(GameMode.CREATIVE);
    10. }

    [EDIT] Then you would have to modify the bukkit api. Which is not supported.
     
  6. Offline

    bluegru

    ehm, that isn't what I want,
    This code changes the gamemode to creative if the player is not creative
    and if the player is creative, it changes the gamemode to survival.

    I just want a
    Code:java
    1. player.setGamemode(GameMode.SURVIVAL);

    Without the message "your game mode has been updated"
     
  7. Offline

    PolarCraft

    "[EDIT] Then you would have to modify the bukkit api. Which is not supported."
     
  8. Offline

    bluegru

    :'(

    thx for the help
     
  9. Offline

    Luke_Lax

    Wouldn't it be possible to listen out for that message being sent and then cancelling the event?
     
  10. Offline

    ferrybig

    the message is generated client side, you cant change it
     
    elraro likes this.
  11. Offline

    elraro

    This. Solved?
     
  12. Offline

    PolarCraft

    elraro "[EDIT] Then you would have to modify the bukkit api. Which is not supported." "the message is generated client side, you cant change it" Sorry you will not be able to change it sorry. But for now this is solved. I hope.
     
  13. Offline

    Chinwe

    I think you would be able to cancel the message with ProtocolLib actually, though it seems like a lot of hassle for this small task :confused:
     
  14. Offline

    jimbo8

    I think Chinwe is right.

    It should be possible with ProtocolLib, but yeah, much work for this little thing.
     
  15. Offline

    bluegru

    ok,
    thx for the help
     
  16. Offline

    Jamesthatguy

    What are you talking about? The bukkit api has nothing to do with client side gamemode changing messages...
     
  17. Offline

    PolarCraft

  18. Offline

    Jamesthatguy

    Well that moderator really needs to either learn what bukkit actually does or needs to word his statements better.
     
  19. Offline

    PolarCraft

  20. Offline

    redytedy

    Possible Idea : Get chat right when command is executed, then resend it so that the client appears to have the same chat without the message.
     
  21. Offline

    PolarCraft

    redytedy Um do you even know bukkit api? All you can do is tell bukkit to send code to server-side(server-player).
     
  22. Offline

    redytedy

    PolarCraft Yes I do know bukkit API... Simply send the chat the player has previously had and the gamemode message will be gone on there screen (0r further up in chat so that they won't see it). And if you didn't notice, sending players messages is server-player and is definitely part of the Bukkit API. This idea would be similar to how chat-UIs work.
     
  23. Offline

    PolarCraft

    redytedy Yes but the server is being told to do so. But you can not change the default minecraft coding.
     
  24. Offline

    redytedy

    PolarCraft
    Please read the post closer and you might understand :oops:. Once again, the chat is RESENT. So, yes the player does receive the message, but they only receive it for a split second then it disappears.
     
  25. Offline

    PolarCraft

    redytedy then post your 'test code' and i will test it.
     
Thread Status:
Not open for further replies.

Share This Page