GrantedCommand.java

src/net/sourceforge/pain/logic/event/console/command/GrantedCommand.java · 898 B

From the archive pain_0_41.zip

Download the archive   « Back to the archive contents

package net.sourceforge.pain.logic.event.console.command;

import net.sourceforge.pain.logic.event.console.*;

import java.util.*;

public abstract class GrantedCommand extends CommandHandler {

	public boolean isAccessible() {
		if (!super.isAccessible()) {
			return false;
		}
		final Set grantedCommands = player.getGrantedCommands();
		if (grantedCommands.contains("_all")) {// implementor mark
			return true;
		}
		String grantedCommandClass = getClass().getName().substring(ConsoleInputEvent.COMMAND_PACKAGE.length());
		if (grantedCommands.contains(grantedCommandClass)) {
			return true;
		}
		return false;
	}

	/** Empty. subclasses should override this method to make some specific work here*/
	public void onGrantAdded() throws Exception {

	}

	/** Empty. subclasses should override this method to make some specific work here*/
	public void onGrantRemoved() throws Exception {
	}
}

Site Stats

Snippets: 1791
Codebases: 571