Created
May 17, 2020 18:23
-
-
Save riftrsps/b8cf0fce7809eb09a061c0b783cb0b94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Skill { | |
public boolean itemOnItem(Player p, int itemId, int otherItem) { | |
if(!prepared(p)) | |
return false; | |
return handleItemOnItem(p, itemId, otherItem); | |
} | |
public boolean objectClick(Player p, int objectId, int clickIndex) { | |
if(!prepared(p)) | |
return false; | |
return handleObjectClick(p, objectId, clickIndex); | |
} | |
public boolean prepared(Player p) { | |
if(playerBusy(p)) { | |
p,sendMessage("Please stop what you are doing first."); | |
return false; | |
} | |
if(!hasLevelRequirements(p)) { | |
p.sendMessage("You do not have the level requirements for this."); | |
return false; | |
} | |
if(!hasItemRequirements(p)) { | |
p.sendMessage("You do not have the items required for this."); | |
return false; | |
} | |
return true; | |
} | |
private boolean playerBusy(Player p) { | |
return ...; | |
} | |
protected abstract boolean hasLevelRequirement(Player p); | |
protected abstract boolean hasItemRequirements(Player p); | |
protected boolean handleItemOnItem(Player p, int itemId, int otherItem) { return false; } | |
protected boolean handleObjectClick(Player p, int objectId, int clickIndex) { rerurn false; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment