Bukkit Maintenance Mode

Any help topics that don't fit in the current categories can go here.
Post Reply
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Bukkit Maintenance Mode

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:48 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Bukkit Maintenance Mode

Post 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.
	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;
	}
	@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 :(");
		}
	}
Instead of checking the player rank like I do here you would probably want to check the player list.
Image
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Bukkit Maintenance Mode

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Bukkit Maintenance Mode

Post 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.
Image
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Bukkit Maintenance Mode

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Bukkit Maintenance Mode

Post 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.
Image
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Bukkit Maintenance Mode

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Bukkit Maintenance Mode

Post 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 :)
Image
DomanoSV
Posts: 1
Joined: Wed Jun 27, 2012 11:49 pm

Re: Bukkit Maintenance Mode

Post 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 :(
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Bukkit Maintenance Mode

Post 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
Image
Post Reply