2020-10-29 08:01:36 +00:00
package net.limework.rediskript.commands ;
2020-10-23 11:34:30 +00:00
2020-10-29 08:01:36 +00:00
import net.limework.rediskript.RediSkript ;
2020-10-23 14:21:32 +00:00
import org.bukkit.Bukkit ;
2020-10-23 11:34:30 +00:00
import org.bukkit.ChatColor ;
import org.bukkit.command.Command ;
import org.bukkit.command.CommandExecutor ;
import org.bukkit.command.CommandSender ;
import org.bukkit.entity.Player ;
2020-10-29 08:01:36 +00:00
public class CommandReloadRedis implements CommandExecutor {
2020-10-23 11:34:30 +00:00
private RediSkript plugin ;
2020-10-29 08:01:36 +00:00
public CommandReloadRedis ( RediSkript plugin ) {
2020-10-23 11:34:30 +00:00
this . plugin = plugin ;
}
@Override
public boolean onCommand ( CommandSender sender , Command cmd , String label , String [ ] args ) {
if ( sender instanceof Player ) {
2020-10-23 14:21:32 +00:00
//not using bungee TextComponent because it is not present in 1.8.8
sender . sendMessage ( ( ChatColor . translateAlternateColorCodes ( '&'
2020-10-23 13:49:25 +00:00
, " &2[&aRediSkript&a] &cThis command can only be executed in console. " ) ) ) ;
2020-10-23 11:34:30 +00:00
return true ;
}
2020-10-23 13:49:25 +00:00
plugin . getRm ( ) . reload ( ) ;
2020-10-23 14:21:32 +00:00
//not sending to sender, because this command can only be executed via console
2020-10-31 15:12:13 +00:00
Bukkit . getLogger ( ) . info ( ChatColor . translateAlternateColorCodes ( '&' , " &eReloaded via command! Note this command is not stable, it should only be used in urgent cases where you absolutely need to change config details without restarting the server. " ) ) ;
2020-10-23 14:21:32 +00:00
2020-10-23 11:34:30 +00:00
return false ;
}
}