Skip to content
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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
14 changes: 14 additions & 0 deletions bukkit/src/main/java/co/aikar/commands/BukkitCommandContexts.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Owner

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.

Copy link
Contributor Author

@DarkEyeDragon DarkEyeDragon Oct 15, 2020

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?

BukkitCommandManager manager = (BukkitCommandManager) issuer.getManager();
//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);
Copy link
Owner

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 @

if (entity instanceof Player) {
return new OnlinePlayer((Player) entity);
}
} catch (IllegalArgumentException e) {
throw new InvalidCommandArgument(false);
}
}
}
if (allowMissing) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/co/aikar/commands/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public synchronized CommandOperationContext peek() {

protected boolean usePerIssuerLocale = false;
protected List<IssuerLocaleChangedCallback<I>> localeChangedCallbacks = new ArrayList<>();
protected Set<Locale> supportedLanguages = new HashSet<>(Arrays.asList(Locales.ENGLISH, Locales.GERMAN, Locales.SPANISH, Locales.FRENCH, Locales.CZECH, Locales.PORTUGUESE, Locales.SWEDISH, Locales.NORWEGIAN_BOKMAAL, Locales.NORWEGIAN_NYNORSK, Locales.RUSSIAN, Locales.BULGARIAN, Locales.HUNGARIAN, Locales.TURKISH, Locales.JAPANESE));
protected Set<Locale> supportedLanguages = new HashSet<>(Arrays.asList(Locales.ENGLISH, Locales.DUTCH, Locales.GERMAN, Locales.SPANISH, Locales.FRENCH, Locales.CZECH, Locales.PORTUGUESE, Locales.SWEDISH, Locales.NORWEGIAN_BOKMAAL, Locales.NORWEGIAN_NYNORSK, Locales.RUSSIAN, Locales.BULGARIAN, Locales.HUNGARIAN, Locales.TURKISH, Locales.JAPANESE));
protected Map<MessageType, MF> formatters = new IdentityHashMap<>();
protected MF defaultFormatter;
protected int defaultHelpPerPage = 10;
Expand Down
47 changes: 47 additions & 0 deletions languages/core/acf-core_nl.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Copyright (c) 2016-2020 Daniel Ennis (Aikar) - MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
acf-core.permission_denied=Het spijt me, maar je hebt geen toegang om dit commando uit te voeren.
acf-core.permission_denied_parameter=Het spijt me, maar je hebt geen toegang om dit commando uit te voeren.
acf-core.error_generic_logged=Er is een fout opgetreden. Dit probleem is geregistreerd. Excuses voor het ongemak.
acf-core.unknown_command=Onbekend Commando, typ <c2>/help</c2>
acf-core.invalid_syntax=Gebruik: <c2>{command}</c2> <c3>{syntax}</c3>
acf-core.error_prefix=Fout: {message}
acf-core.error_performing_command=Het spijt me, maar er is een fout opgetreden bij het uitvoeren van dit commando.
acf-core.info_message={message}
acf-core.please_specify_one_of=Fout: Specificeer ��n van (<c2>{valid}</c2>).
acf-core.must_be_a_number=Fout: {num} moet een getal zijn.
acf-core.must_be_min_length=Fout: Moet minimaal {min} tekens lang zijn.
acf-core.must_be_max_length=Fout: Mag maximaal {max} tekens lang zijn.
acf-core.please_specify_at_most=Fout: Geef een waarde op van maximaal {max}.
acf-core.please_specify_at_least=Fout: Geef een waarde op van minstens {min}.
acf-core.not_allowed_on_console=Fout: De console kan deze opdracht niet uitvoeren.
acf-core.could_not_find_player=Fout: Kon geen speler vinden met de naam: <c2>{search}</c2>
acf-core.no_command_matched_search=Geen commando komt overeen met <c2>{zoeken}</c2>
acf-core.help_page_information=- Pagina <c2>{page}</c2> van <c2>{totalpages}</c2> (<c3>{results}</c3> resultaten) wordt weergegeven.
acf-core.help_no_results=Fout: Geen resultaten meer.
acf-core.help_format=<c1>{command}</c1> <c2>{parameters}</c2> <c3>{separator} {description}</c3>
acf-core.help_detailed_header=<c3>===</c3> <c1> Gedetailleerde hulp weergeven voor </c1><c2>{commandprefix}{command}</c2> <c3> ===</c3>
acf-core.help_detailed_command_format=<c1>{command}</c1> <c2>{parameters}</c2> <c3>{separator} {description}</c3>
acf-core.help_detailed_parameter_format=<c2>{syntaxorname}</c2>: <c3>{description}</c3>
acf-core.help_search_header=<c3>=== </c3><c1>Zoekresultaten voor</c1> <c2>{commandprefix} {command} {search}</c2><c3> ===</c3>
acf-core.help_header=<c3>=== </c3><c1>Hulp voor</c1> <c2>{commandprefix}{command}</c2><c3> ===</c3>
37 changes: 37 additions & 0 deletions languages/minecraft/acf-minecraft_nl.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Copyright (c) 2016-2020 Daniel Ennis (Aikar) - MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
acf-minecraft.invalid_world=Fout: Deze wereld bestaat niet.
acf-minecraft.you_must_be_holding_item=Fout: U moet een item in uw primaire hand hebben.
acf-minecraft.player_is_vanished_confirm=\
Waarschuwing: <c2>{vanished}</c2> is verdwenen. Onthul hun dekking niet! \n\
Om uw actie te bevestigen, voegt u <c2>:confirm</c2> toe aan het einde van hun naam. \n\
Vb: <c2>{verdwenen}: bevestigen</c2>
acf-minecraft.username_too_short=Fout: Gebruikersnaam te kort, moet minimaal drie tekens bevatten.
acf-minecraft.is_not_a_valid_name=Fout: <c2>{name}</c2> is geen geldige gebruikersnaam.
acf-minecraft.multiple_players_match=Fout: Meerdere spelers kwamen overeen met <c2>{search}</c2><c3>({all})</c3>, wees specifieker.
acf-minecraft.no_player_found_server=Geen speler die overeenkomt met <c2>{search}</c2> is online.
acf-minecraft.no_player_found_offline=Er is geen speler gevonden die overeenkomt met <c2>{search}</c2>.
acf-minecraft.no_player_found=Er is geen speler gevonden die overeenkomt met <c2>{search}</c2>.
acf-minecraft.location_please_specify_world=Fout: specificeer wereld. Voorbeeld: <c2>wereld:x,y,z</c2>.
acf-minecraft.location_please_specify_xyz=Fout: Specificeer de co�rdinaten x, y en z. Voorbeeld: <c2>wereld:x,y,z</c2>.
acf-minecraft.location_console_not_relative=Fout: De console mag geen relatieve co�rdinaten voor de locatie gebruiken.