-
-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/command selectors #298
base: master
Are you sure you want to change the base?
Feature/command selectors #298
Conversation
Fix markup inconsistencies
Bump bukkit version to 1.13.2
//Check if mc version is higher than 1.13.1 (added in 1.13.2) | ||
if ((manager.mcMinorVersion > 13) || (manager.mcMinorVersion == 13 && manager.mcPatchVersion > 1)) { | ||
try { | ||
Entity entity = Bukkit.selectEntities(issuer.getIssuer(), lookup).get(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than blind look up 0 relying on errors, iterate and return on first player match instead, and lack of finding should fall through to the lines below.
And we can only run this selectEntities if the input starts with @
@@ -241,6 +241,20 @@ OnlinePlayer getOnlinePlayer(BukkitCommandIssuer issuer, String lookup, boolean | |||
Player player = ACFBukkitUtil.findPlayerSmart(issuer, lookup); | |||
//noinspection Duplicates | |||
if (player == null) { | |||
if (issuer.getManager() instanceof BukkitCommandManager) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already a bukkit context, this isn't really needed.
this.manager should already exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.manager returns a CommandManager
which does not have the version fields, however, i should probably be able to cast that safely right?
Iterate over the entitylist properly now
Adds command selector handling to
BukkitCommandContexts#getOnlinePlayer
However i'm not sure how to deal with @A or selectors that return more than one entity. So in this draft i just return the first entry. However this isn't an optimal solution, and also currently fails if there are no players