Jump to content

scripting_meme.jpg


Recommended Posts

Posted
public enum Task {

	OPEN_BANK("Open bankies") {

		@Override
		public boolean validate(Bot bot) {
			return !bot.bank.isOpen();
		}

		@Override
		public int execute(Bot bot) throws InterruptedException {
		
			if (bot.bank.open()) {
				bot.logger.debug("*YAY*");
			}
		
			return 250;
		}
		
	}
	
	;

	private final String name;

	private Task(String name) {
		this.name = name;
	}

	public abstract boolean validate(Bot bot);
	public abstract int execute(Bot bot) throws InterruptedException;

	@Override
	public String toString() {
		return name;
	}
}

 

Posted
1 hour ago, liverare said:

public enum Task {

	OPEN_BANK("Open bankies") {

		@Override
		public boolean validate(Bot bot) {
			return !bot.bank.isOpen();
		}

		@Override
		public int execute(Bot bot) throws InterruptedException {
		
			if (bot.bank.open()) {
				bot.logger.debug("*YAY*");
			}
		
			return 250;
		}
		
	}
	
	;

	private final String name;

	private Task(String name) {
		this.name = name;
	}

	public abstract boolean validate(Bot bot);
	public abstract int execute(Bot bot) throws InterruptedException;

	@Override
	public String toString() {
		return name;
	}
}

 

 

Bank open() checks if your bank is already open, so you're still calling the same code twice. Not like it matters much though ? 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...