[ADMIN/FUN] GamemodeTimer

Discussion in 'Archived: Plugin Requests' started by greaperc4, Jul 13, 2012.

?

If u approve this plugin choose approve.

Poll closed Jul 20, 2012.
  1. Approve

    6 vote(s)
    85.7%
  2. Disapprove

    1 vote(s)
    14.3%
  1. Plugin category: Administration/Fun

    Suggested name: GamemodeTimer/GTimer

    What I want: That u can change the player his gamemode with a timer,
    so as a Example: /gtimer greaperc4 1d.
    So this mean that i have 1 day creative.

    Ideas for commands: /gtimer [player] [time]
    [time] : 1d / 1h / 1m / 1s.
    U can do 2 day or more its what u want.
    The time can be: 1 day / 1 hour / 1 minute / 1 second. Shorter is easier.

    Ideas for permissions: gtimer.switch

    When I'd like it by: tomorrow
     
  2. Offline

    Konkz

    Just do 2000 seconds etc
    Not 1 day, more flexible
     
  3. you can do everything 1 day is easier for other people u can even do 2000 seconds its ur choice ;)
     
  4. Offline

    Konkz

    If I was not busy than I'd do it...
    Good luck anyway
     
  5. So you can make one?

    Please can someone make this plugin?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  6. Offline

    np98765

    Please wait 12 hours before bumping.
     
  7. Offline

    Kodfod

    Good idea! If anyone makes it tag me in the post so i can get a DL!
     
  8. Offline

    Edge209

    You can do this with OnTime. http://dev.bukkit.org/server-mods/ontime/pages/rewards/
    It takes a little work to set it up, but once that is done it is only 1 command for each player when you want to schedule the event which will toggle them out of creative.

    In the rewards.yml you need to define a creative mode command reward, like this:

    commands:
    - creative: 'creative [player]'

    Then from the console or in game add the reward:
    / ontime rewards add command 0 0 0 creative

    Then make it an individual reward so it is never granted automatically. ( the 1 below is the reward Id )
    / ontime rewards indi 1

    Then after you have given someone creative mode, you can make it switch off in the future by setting a "reward" for the player from the console or in game.

    (ontime rewards set <playername> [real/delta] <rewardID> <days> <hours> <minutes>)

    / ontime rewards set greaperc4 real 1 1 0 0

    The above command will be in real time, so it will toggle them back in 1 day (24 hrs), no matter how much time they were on the server.

    Or

    /ontime rewards set greaperc4 delta 1 0 1 0

    This command is in terms of playtime, so it would toggle them back after they ave been on the server for one hour. This could be one straight hour, or it could be 4 logins of 15 min each over a week or month, for example.

    Check out the plugin commands and rewards pages for more details and explanation.
     
  9. no sorry i want it just a easier plugin so i can learn from it to
    so if someones make it and will post the source, then i can learn from it to for later ;)
     
  10. Offline

    evilmidget38

    greaperc4
    If this still hasn't been made in roughly 2 weeks(when I finish my current, rather large project), then I can do this for you. This would be a great feature for an SMP server I plan on opening anyway.
     
  11. Offline

    fredghostkyle1

    THIS IS COOL! bump

    I would like this plugin, tag me in the post when ur done!
     

  12. What's with you bumping? It hasn't even been 12 hour's
    You did this to like 5 thread's.
    YOU BROKE THE RULES! LIKE DUH 5 TIMES
     
  13. Please Approve this plugin its so awesome
     
  14. Offline

    Kodfod

    I guess i will take a break from teams and work on this.

    Wish me luck greaperc4
     
  15. THANK U SO MUCH but can u send the source to :D ??
     
  16. Offline

    Kodfod

    sure can!
     
  17. Offline

    fredghostkyle1

    Approved!!!!!!!!!!!!!! lol
     
  18. thanks u so much :D
     
  19. Offline

    Kodfod

    FINISHED!!!

    Here it is:

    Command: /gmtimer [player] [seconds]

    Download

    Source:
    Code:JAVA
    1.  
    2. package me.kodfod.gmt;
    3.  
    4. import java.util.logging.Logger;
    5.  
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.GameMode;
    8. import org.bukkit.command.Command;
    9. import org.bukkit.command.CommandSender;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.event.EventHandler;
    12. import org.bukkit.event.Listener;
    13. import org.bukkit.event.player.PlayerLoginEvent;
    14. import org.bukkit.plugin.java.JavaPlugin;
    15.  
    16. public class Main extends JavaPlugin implements Listener {
    17.  
    18. Logger log = Logger.getLogger("Minecraft");
    19.  
    20. @Override
    21. public void onDisable() {
    22. log.info(this.getName() + " Disabled");
    23. }
    24.  
    25. @Override
    26. public void onEnable() {
    27. log.info(this.getName() + " Enabled");
    28. }
    29.  
    30. @Override
    31. public boolean onCommand(CommandSender sender, Command cmd,
    32. String commandLabel, String[] args) {
    33. if (cmd.getName().equalsIgnoreCase("gmTimer")) {
    34.  
    35. if (sender.hasPermission("gmt.use")) {
    36. long seconds = Integer.parseInt(args[1]);
    37. long sec = seconds * 20;
    38. final Player playerc = getServer().getPlayer(args[0]);
    39. final String playern = playerc.getName();
    40. if (playerc.getGameMode() == GameMode.SURVIVAL) {
    41. sender.sendMessage(ChatColor.AQUA + "[GMT]: You set "
    42. + playern + "'s Game Mode to Creative for: "
    43. + seconds + " Seconds!");
    44. playerc.sendMessage(ChatColor.AQUA
    45. + "[GMT]: Your Game Mode Was Set To Creative For "
    46. + seconds + " Seconds.");
    47. playerc.setGameMode(GameMode.CREATIVE);
    48. this.getServer().getScheduler()
    49. .scheduleAsyncDelayedTask(this, new Runnable() {
    50.  
    51. @Override
    52. public void run() {
    53. playerc.sendMessage(ChatColor.AQUA
    54. + "[GMT]: You lost Creative.");
    55. playerc.setGameMode(GameMode.SURVIVAL);
    56. }
    57. }, sec);
    58. return true;
    59. } else {
    60. sender.sendMessage(ChatColor.AQUA + "[GMT]: You Set "
    61. + playern + "'s Game Mode To Creative For "
    62. + seconds + " More Seconds!");
    63. playerc.sendMessage(ChatColor.AQUA
    64. + "[GMT]: You Will Lose you Creative Mode in "
    65. + seconds + " Seconds.");
    66. this.getServer().getScheduler()
    67. .scheduleAsyncDelayedTask(this, new Runnable() {
    68.  
    69. @Override
    70. public void run() {
    71. playerc.sendMessage(ChatColor.AQUA
    72. + "[GMT]: You lost Creative.");
    73. playerc.setGameMode(GameMode.SURVIVAL);
    74. }
    75. }, sec);
    76. return true;
    77. }
    78. }
    79. }
    80. return false;
    81. }
    82.  
    83. @EventHandler
    84. public void onLogin(PlayerLoginEvent e) {
    85. GameMode mode = e.getPlayer().getGameMode();
    86. Player player = e.getPlayer();
    87.  
    88. if (mode.equals(GameMode.CREATIVE)) {
    89. player.setGameMode(GameMode.SURVIVAL);
    90. } else {
    91. return;
    92. }
    93. }
    94. }
    95.  


    Should I Put it on BukkitDev and plugin submissions?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  20. THATS SO AWESOME and if u want to
     
  21. Offline

    Edge209

    This is nice and definitely to the point, but there one thing to consider. If you stop your server for any reason while players are in creative, they will never be put back if they join again later. They will be creative forever unless you put them back by hand. To fix this, you could save all of the players set in a hash table or array, and then in the plugin disable, run through that table and turn off their creative before the server stops.
     
  22. Offline

    Kodfod

    Or, set all players to survival. I thought of it, just didnt do anything. I will fix this issue.

    Fixed, and released it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  23. can u send link where u released it :D

    Kodfod where did u released it?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  24. Offline

    Kodfod

    I haven't yet. Let me get that set up now.
     
  25. Offline

    Omnitv

    This plugin will be useful move it to the dev :3
     
  26. Offline

    Kodfod

    If you want to you can, just give me credit where it is due =)
     
  27. Offline

    Omnitv

    Cool but how about greaperc4 the guy w/the idea.
     
  28. Offline

    Kodfod

    I Don't Care Hehe. It's all you guys
     

Share This Page