Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #164 from Crazy-Crew/ver/1.4
Browse files Browse the repository at this point in the history
Fix some tab complete stuff (v1.3.1)
  • Loading branch information
ryderbelserion committed Nov 27, 2023
2 parents fddbcef + 93bbb8f commit 9807a59
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
20 changes: 2 additions & 18 deletions build.gradle
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -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
@@ -1,15 +1,20 @@
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;
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) {
Expand All @@ -28,23 +33,17 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman
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<>();
Expand Down
8 changes: 0 additions & 8 deletions paper/src/main/resources/paper-plugin.yml

This file was deleted.

0 comments on commit 9807a59

Please sign in to comment.