Format source

This commit is contained in:
Shevchik
2014-03-06 21:50:59 +04:00
parent e838c79941
commit 9f9eca6fae
4 changed files with 16 additions and 25 deletions

View File

@@ -16,25 +16,19 @@ public class CommandRestrict implements Listener {
}
@EventHandler(priority=EventPriority.LOWEST)
public void onPlayerCommand(PlayerCommandPreprocessEvent event)
{
public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
String playercommand = event.getMessage().toLowerCase();
if (plugin.getPlayerSitData().isSitting(player))
{
if (plugin.sitDisableAllCommands)
{
if (plugin.getPlayerSitData().isSitting(player)) {
if (plugin.sitDisableAllCommands) {
event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted);
return;
}
for (String disabledCommand : plugin.sitDisabledCommands)
{
if (disabledCommand.startsWith(playercommand))
{
for (String disabledCommand : plugin.sitDisabledCommands) {
if (disabledCommand.startsWith(playercommand)) {
String therest = playercommand.replace(disabledCommand, "");
if (therest.isEmpty() || therest.startsWith(" "))
{
if (therest.isEmpty() || therest.startsWith(" ")) {
event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted);
return;