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
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.
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.
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
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.
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
FINISHED!!! Here it is: Command: /gmtimer [player] [seconds] Download Source: Code:JAVA package me.kodfod.gmt; import java.util.logging.Logger; import org.bukkit.ChatColor;import org.bukkit.GameMode;import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;import org.bukkit.event.player.PlayerLoginEvent;import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener { Logger log = Logger.getLogger("Minecraft"); @Override public void onDisable() { log.info(this.getName() + " Disabled"); } @Override public void onEnable() { log.info(this.getName() + " Enabled"); } @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("gmTimer")) { if (sender.hasPermission("gmt.use")) { long seconds = Integer.parseInt(args[1]); long sec = seconds * 20; final Player playerc = getServer().getPlayer(args[0]); final String playern = playerc.getName(); if (playerc.getGameMode() == GameMode.SURVIVAL) { sender.sendMessage(ChatColor.AQUA + "[GMT]: You set " + playern + "'s Game Mode to Creative for: " + seconds + " Seconds!"); playerc.sendMessage(ChatColor.AQUA + "[GMT]: Your Game Mode Was Set To Creative For " + seconds + " Seconds."); playerc.setGameMode(GameMode.CREATIVE); this.getServer().getScheduler() .scheduleAsyncDelayedTask(this, new Runnable() { @Override public void run() { playerc.sendMessage(ChatColor.AQUA + "[GMT]: You lost Creative."); playerc.setGameMode(GameMode.SURVIVAL); } }, sec); return true; } else { sender.sendMessage(ChatColor.AQUA + "[GMT]: You Set " + playern + "'s Game Mode To Creative For " + seconds + " More Seconds!"); playerc.sendMessage(ChatColor.AQUA + "[GMT]: You Will Lose you Creative Mode in " + seconds + " Seconds."); this.getServer().getScheduler() .scheduleAsyncDelayedTask(this, new Runnable() { @Override public void run() { playerc.sendMessage(ChatColor.AQUA + "[GMT]: You lost Creative."); playerc.setGameMode(GameMode.SURVIVAL); } }, sec); return true; } } } return false; } @EventHandler public void onLogin(PlayerLoginEvent e) { GameMode mode = e.getPlayer().getGameMode(); Player player = e.getPlayer(); if (mode.equals(GameMode.CREATIVE)) { player.setGameMode(GameMode.SURVIVAL); } else { return; } }} Should I Put it on BukkitDev and plugin submissions? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
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.
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.
can u send link where u released it Kodfod where did u released it? EDIT by Moderator: merged posts, please use the edit button instead of double posting.