Bukkit Maintenance Mode
Bukkit Maintenance Mode
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:48 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Bukkit Maintenance Mode
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.
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
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Bukkit Maintenance Mode
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
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Bukkit Maintenance Mode
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
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:49 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Bukkit Maintenance Mode
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
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
EDIT**** Just saw how late i was on the reply sorry for revivng old thread
http://dev.bukkit.org/server-mods/maintenancemode/
https://github.com/DomanoSV/MaintenanceMode
DAVE
EDIT**** Just saw how late i was on the reply sorry for revivng old thread
Re: Bukkit Maintenance Mode
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