Merge pull request #164 from Crazy-Crew/ver/1.4

Fix some tab complete stuff (v1.3.1)
This commit is contained in:
Ryder Belserion 2023-11-27 16:13:35 -05:00 committed by GitHub
commit 9807a59a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 38 deletions

View File

@ -82,27 +82,11 @@ String hangarType = isBeta ? "Beta" : "Release"
String description = """
# Please take backups and report any bugs you find!
## Breaking Changes:
* Only supports 1.20+
* Permissions have changed, You can view the updated permissions @ https://docs.crazycrew.us/crazyauctions/info/commands/permissions
## Changes:
* Re-organized and cleaned up a large portion of the code, Functionality shouldn't change
* Added proper tab completion
* Added proper permissions to plugin.yml
* The permission for /crazyauctions reload is now crazyauctions.reload
* Add missing player names for the ah view <player> command
## Fixes:
* Fixed a permission check for the /ah gui
## Optimizations:
* Only use uuid for hashmap's / arrays as god intended.
## Warning:
* Data is still stored only using name's which is terrible but at the moment it's annoying to remove, It will change in the next few versions after some more clean up is made.
## Developers:
* Do not rely on any methods in CrazyAuctions as an API, it will constantly be refactored and moved around until told otherwise.
* Fix tab complete order
## Other:
* [Feature Requests](https://github.com/Crazy-Crew/${rootProject.name}/issues)

View File

@ -9,7 +9,7 @@ issues = https://github.com/Crazy-Crew/CrazyAuctions/issues
group = com.badbones69.crazyauctions
description = Auction off items in style.
version = 1.3
version = 1.3.1
apiVersion = 1.20
minecraftVersion = 1.20.2

View File

@ -1,8 +1,11 @@
package com.badbones69.crazyauctions.paper.commands;
import com.badbones69.crazyauctions.paper.CrazyAuctions;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@ -10,6 +13,8 @@ import java.util.Arrays;
import java.util.List;
public class AuctionTab implements TabCompleter {
private final CrazyAuctions plugin = CrazyAuctions.get();
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String commandLabel, String[] args) {
@ -28,23 +33,17 @@ public class AuctionTab implements TabCompleter {
if (hasPermission(sender, "bid")) completions.add("bid");
return StringUtil.copyPartialMatches(args[0], completions, new ArrayList<>());
} else if (args.length == 2) { // /crazyauctions arg0
switch (args[0].toLowerCase()) {
case "bid", "sell" -> completions.addAll(Arrays.asList("50", "100", "250", "500", "1000", "2500", "5000", "10000"));
case "view" -> completions.addAll(this.plugin.getServer().getOnlinePlayers().stream().map(Player::getName).toList());
}
return StringUtil.copyPartialMatches(args[1], completions, new ArrayList<>());
} else if (args.length == 3) { // /crazyauctions arg0 arg1
switch (args[0].toLowerCase()) {
case "bid", "sell" -> {
if (hasPermission(sender, "bid") || hasPermission(sender, "sell")) completions.addAll(Arrays.asList("50", "100", "250", "500", "1000", "2500", "5000", "10000"));
}
case "bid", "sell" -> completions.addAll(Arrays.asList("1", "2", "4", "8", "10", "20", "40", "64"));
}
return StringUtil.copyPartialMatches(args[2], completions, new ArrayList<>());
} else if (args.length == 4) { // /crazyauctions arg0 arg1 arg2
switch (args[0].toLowerCase()) {
case "bid", "sell" -> {
if (hasPermission(sender, "bid") || hasPermission(sender, "sell")) completions.addAll(Arrays.asList("50", "100", "250", "500", "1000", "2500", "5000", "10000"));
}
}
return StringUtil.copyPartialMatches(args[3], completions, new ArrayList<>());
}
return new ArrayList<>();

View File

@ -1,8 +0,0 @@
name: '${name}'
main: '${group}.CrazyAuctions'
version: '${version}'
api-version: '${apiVersion}'
description: '${description}'
bootstrapper: '${group}.CrazyStarter'