Filled PvP message disabler in certain worlds

Discussion in 'Archived: Plugin Requests' started by TNTUP, Jun 11, 2014.

  1. Offline

    TNTUP

    Plugin category: Misc
    Suggested name: NoPvPMsg

    What I want: I want to disable death messages in a world eg: Minigames, leaving other worlds enabled deathmessages. I don't need custom death messages, not a feature I need atm.

    Idea in the config:

    worlds: #worlds listed here wont print out death messages in the chat
    - minijeu

    I have many worlds (world, nether, end, minigames, creative, skyblock and shops) Adding "minigames" in the config will prevent any death messages to be shown in the chat.

    Ideas for commands: /npm reload - Reloads the config

    Ideas for permissions:


    nopvpmsg.bypass - Prints death messages even if the world "minigames" is blocked to not show death messages from this world.
    nopvpmsg.reload - Permission to reload the config

    When I'd like it by: ASAP

    EDIT: added command reload and permission
     
  2. Offline

    TNTUP

    bumpy thread, need this plugin :)
     
  3. Offline

    TNTUP

    Bump again, I need it for PvP purposes, not to spam other worlds
     
  4. Offline

    TNTUP

    third bump :(
     
  5. Offline

    TNTUP

    Bump... I need it if anyone wants to take it
     
  6. Offline

    ChipDev

    What worlds...?
    I'll make it if you tell me :D
     
  7. Offline

    Onlineids

  8. Offline

    TNTUP

    In "minijeu", letting me incase adding other worlds that I want to disable PVP msg kills in that world, and good idea Onlineids a config would be better so I can add worlds
     
  9. Offline

    TNTUP



    ^^ this comment answers you :D Cant wait
     
  10. Offline

    ChipDev

    Ok! Im just starting, gimmie till' Wednesday, then you could rage. :p
     
  11. Offline

    TNTUP

    lool ChipDev, many thanks if you do it^^ Hope to see it done!
     
  12. Offline

    ChipDev

    Conclusion:
    /pvpmsg off : Sets no pvp message to the world you are in. Vice versa /pvpmsg on
     
  13. Offline

    TNTUP

    ok, doing that will add itself in the config? If so, sweet!
     
  14. Offline

    ChipDev

    Hehe just tested the plugin and i killed myself in the world i set it in, config set etc. why wasn't it working?
    I didn't event code what to do with the info in the config, lololol :p
     
    TNTUP likes this.
  15. Offline

    TNTUP

    lol nice, would like to see it in action, PM the IP? Tell me if it does save that in a config so maybe I could add more worlds to prevent PVP kills messages

    EDIT: its late here, 3AM, ill go sleep, ill check the topic as soon I woke XD


    Question, that plugin will fulfill my request what I requested? If I do /pvpmsg off, does it will turn it off in the world where I am? Eg: SpamWorldPVPkills or the one I want, minijeu. It should be Multiverse compatible :D

    YOUR AVATAR is so cute

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  16. Offline

    ChipDev

    Thx I made it :)
    Yes, suiting your needs. :p
    Im going to change it around a little,
    /pvpmsg (if the pvp msg is on, it will turn off vice versa.)
     
  17. Offline

    TNTUP


    Cool =D
     
  18. Offline

    ChipDev

    Finished the code, testing' time!
    To others who want to learn code:
    Code:java
    1. package Com.chip;
    2. /*
    3. Package ^ (Pathway to get to the code/class)
    4. */
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.event.entity.PlayerDeathEvent;
    11. import org.bukkit.plugin.java.JavaPlugin;
    12. /*
    13. *Importing ^ (Get code from bukkit to use)
    14. */
    15. public class PvpDisabler extends JavaPlugin implements Listener {
    16. /*
    17. *Saying class name, extending Javaplugin & Importing listener
    18. */
    19. String Prefix = ChatColor.GREEN + "[" + ChatColor.BLUE + "NoPvpMsg" + ChatColor.GREEN + "] ";
    20. String blue = ChatColor.BLUE + "";
    21. String red = ChatColor.RED + "";
    22. String green = ChatColor.GREEN + "";
    23. String bold = ChatColor.BOLD + "";
    24. String reset = ChatColor.RESET + "";
    25. /*
    26. * Using some nice techniques to not have to do
    27. * ChatColor.(COLOR) to color. just use red etc.
    28. */
    29.  
    30. public void onEnable() {
    31. getServer().getConsoleSender().sendMessage(Prefix + "Enabled!");
    32. /*
    33. * In the console (You can see), it sends a enable message.
    34. */
    35. }
    36. public void onDisable() {
    37. getServer().getConsoleSender().sendMessage(Prefix + "Disabled!");
    38. /*
    39. * Vice versa enable message.
    40. */
    41. }
    42. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    43. if(cmd.getName().equalsIgnoreCase("pvpmsg")) {
    44. Player player = (Player) sender;
    45. if(!getConfig().contains(player.getWorld().toString())) {
    46. getConfig().set(player.getWorld().toString(), 0);
    47. saveConfig();
    48. player.sendMessage(Prefix + green + "Pvp message disabled in:" + red + bold + player.getWorld() + reset + green + "!");
    49. }
    50. if(getConfig().contains(player.getWorld().toString())) {
    51. getConfig().set(player.getWorld().toString(), null);
    52. saveConfig();
    53. player.sendMessage(Prefix + green + "Pvp message enabled in:" + red + bold + player.getWorld() + reset + green + "!");
    54. }
    55. }
    56. return true;
    57. /*
    58. * All this stuff is ordered like:
    59. * 1) Checking when player types a command
    60. * 2) If the command = "pvpmsg" when caps doesn't matter
    61. * 3) If the world is NOT in the config (! stands for not.)
    62. * 4) Add world to config (that the player is in)
    63. * 5) Send the message to the player that it (Pvpmessages) are disabled.
    64. * -----
    65. * Vice versa with if it contains, remove and pvpmessages are enabled message.
    66. */
    67. }
    68. public void onPlayerDeathEvent(PlayerDeathEvent e) {
    69. Player player = e.getEntity();
    70. if (e.getEntity() instanceof Player){
    71. if(getConfig().contains(player.getWorld().toString())) {
    72. e.setDeathMessage(null);
    73. }
    74.  
    75. }
    76. }
    77. /*
    78. * 1 ) If a entity dies(I would do player, but it requires entity, thats why the next code checks if it is a player)
    79. * 2 ) If the entity is a player
    80. * 3 ) If the world that they are in is In the config
    81. * 4 ) Set the death message to nothing (null or "")
    82. */
    83. }
    84.  

    As you can see, bukkit doesn't take that much work to code the base of what you want, its mostly the other stuff that takes time, all that you need is e.setDeathMessage(null); :p

    Sorry I'm stalling this, Im busy :p
    EDIT; Oh, let me add reload and bypass.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
    TNTUP likes this.
  19. Offline

    TNTUP

    That would be nice, :D thanks
     
  20. Offline

    ChipDev

    OhNu! Toatz frogot about this.. Ill test now.
     
  21. Offline

    TNTUP

    Ok^^
     
  22. Offline

    TNTUP


    any updates, supposed to be ready at Wed its Sunday atm :p (I guess theres unexpected issues)
     
  23. Offline

    ChipDev

    Sorry, very bust ATM, trying to make 5 plugins :( sorry for the inconvenience,
    Bump to other devs that could make it faster.
    srry
     
    TNTUP likes this.
  24. Offline

    TNTUP

    well, you said you did the code but its not tested, is compiled? I could try myself with my other premium alts
     
  25. Offline

    ChipDev

    Yes. Just finished, testing now with my alts :) should be done in 10minutes!
     
  26. Offline

    TNTUP

    sweet! :D

    EDIT: lol 10 minutes :p Ill check the post tomorrow
     
  27. Offline

    TNTUP

  28. Offline

    TNTUP

    Quite been a week I haven't got your answer, ChipDev
     
  29. Offline

    ChipDev

    Sorry, lost all my stuff in eclipse :( Have to ask another dev.
    ;(
     
  30. Online

    timtower Administrator Administrator Moderator

Share This Page