Page 1 of 1

Bukkit Maintenance Mode

Posted: Wed Apr 04, 2012 9:19 pm
by Samuel98
Content Deleted

Re: Minecraft / Bukkit Plugin Tutorials

Posted: Wed Apr 04, 2012 9:21 pm
by Samuel98
Content Deleted

Re: Bukkit Maintenance Mode

Posted: Thu Apr 05, 2012 12:54 pm
by jacek
I have done a video on how to store a list of player names so use that for the text file bit.

Then for the other bit you need to store a field that will be either true or false depending on if the server is maintenance mode, I have something similar for my server so these should give you a few pointers.

[syntax=java] public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
if (SomethingCraftRank.ADMIN.isPlayer(sender) == false){
sender.sendMessage(ChatColor.RED + "you do not have permission to use this command.");
return true;
}

if (args.length != 1){
sender.sendMessage(ChatColor.RED + "Usage: /lockout [on/off]");
return true;
}

if (args[0].equalsIgnoreCase("on")){
plugin.lockout = true;

for (Player player : plugin.server.getOnlinePlayers()){
if (player.hasPermission("somethingcraft.guest")){
player.kickPlayer("The whitelist has been enabled, sorry :(");
}
}

sender.sendMessage(ChatColor.GREEN + "LockOut Mode Enabled !");
}else{
plugin.lockout = false;

sender.sendMessage(ChatColor.GREEN + "LockOut Mode Disabled !");
}

return true;
}[/syntax]

[syntax=php] @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerLogin(PlayerLoginEvent event){
if (event.getResult() != Result.ALLOWED) return;

if (plugin.lockout && SomethingCraftRank.GUEST.isPlayer(event.getPlayer())){
event.disallow(Result.KICK_WHITELIST, "Server temporarly whitelisted :(");
}
}[/syntax]
Instead of checking the player rank like I do here you would probably want to check the player list.

Re: Bukkit Maintenance Mode

Posted: Fri Apr 06, 2012 10:14 pm
by Samuel98
Content Deleted

Re: Bukkit Maintenance Mode

Posted: Fri Apr 06, 2012 10:40 pm
by jacek
Yeah it's possible, you would need to save the value to a file somehow, you could just make it part of the config file.

Re: Bukkit Maintenance Mode

Posted: Fri Apr 06, 2012 10:42 pm
by Samuel98
Content Deleted

Re: Bukkit Maintenance Mode

Posted: Fri Apr 06, 2012 11:47 pm
by jacek
SamzRulez wrote:the thing is i dont know how todo config cause i forgot to watch ur tutorial and i cant find it now.

Search my channel for "bukkit config" I'm pretty sure it's still there.

Re: Bukkit Maintenance Mode

Posted: Fri Apr 06, 2012 11:52 pm
by Samuel98
Content Deleted

Re: Bukkit Maintenance Mode

Posted: Sun Apr 08, 2012 12:47 am
by jacek
SamzRulez wrote:Nope thats what i meant you removed it a while back.

Ah okay, that should be next on my list then.

Maybe take a look at a few of the recent config related topics in this section ? There are a lot of code examples in there.

I could always write a quick text guide if they don't help :)

Re: Bukkit Maintenance Mode

Posted: Wed Jun 27, 2012 11:52 pm
by DomanoSV
Hey guyz i believe i have an answer for you, i have actually made such a plugin, if you wish to see the code heres my github hope this helps you out.

http://dev.bukkit.org/server-mods/maintenancemode/

https://github.com/DomanoSV/MaintenanceMode

DAVE :mrgreen:

EDIT**** Just saw how late i was on the reply sorry for revivng old thread :(

Re: Bukkit Maintenance Mode

Posted: Thu Jun 28, 2012 12:32 pm
by jacek
DomanoSV wrote:EDIT**** Just saw how late i was on the reply sorry for revivng old thread :(

It's okay since you added somethign useful :D