Jump to content

scripting_meme.jpg


ThatGamerBlue

Recommended Posts

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;
	}
}

 

Link to comment
Share on other sites

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 ? 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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