Skip to content

Commit

Permalink
small fixes to commands, multi group, crafting block recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooy1 committed Sep 6, 2021
1 parent 192b6a1 commit d2b41e3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.mooy1</groupId>
<artifactId>InfinityLib</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
public final class AddonCommand extends ParentCommand implements TabExecutor, Listener {

private final String help;
private final String slashHelp;

public AddonCommand(String command) {
this(Objects.requireNonNull(AbstractAddon.instance().getCommand(command),
Expand All @@ -46,25 +45,22 @@ public AddonCommand(PluginCommand command) {
Events.registerListener(this);

help = "help" + command.getName();
slashHelp = "/" + help;

addSub(new InfoCommand(AbstractAddon.instance()));
addSub(new AliasesCommand(command));
}

// TODO test
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onServerCommand(ServerCommandEvent e) {
if (e.getCommand().toLowerCase(Locale.ROOT).startsWith(help)) {
e.setCommand(name());
}
}

// TODO test
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onPlayerCommand(PlayerCommandPreprocessEvent e) {
if (e.getMessage().toLowerCase(Locale.ROOT).startsWith(slashHelp)) {
e.setMessage("/" + name());
if (e.getMessage().toLowerCase(Locale.ROOT).startsWith(help)) {
e.setMessage(name());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class AliasesCommand extends SubCommand {

AliasesCommand(PluginCommand command) {
super("aliases", "lists the available aliases for this command");
message = "Aliases for /" + command.getName() + command.getAliases();
message = "Aliases for /" + command.getName() + ": " + command.getAliases();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

import io.github.thebusybiscuit.slimefun4.libraries.dough.common.ChatColors;

@ParametersAreNonnullByDefault
final class HelpCommand extends SubCommand {

Expand All @@ -20,7 +22,7 @@ final class HelpCommand extends SubCommand {
@Override
public void execute(CommandSender sender, String[] args) {
sender.sendMessage("");
sender.sendMessage("&7----------&b /" + command.fullName() + " Help &7----------");
sender.sendMessage(ChatColors.color("&7----------&b /" + command.fullName() + " Help &7----------"));
sender.sendMessage("");
for (SubCommand sub : command.available(sender)) {
sender.sendMessage("/" + sub.fullName() + ChatColor.YELLOW + " - " + sub.description());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*
* @author Mooy1
*/
// TODO check if it works in cheat mode
@ParametersAreNonnullByDefault
public final class MultiGroup extends FlexItemGroup {

Expand All @@ -48,7 +47,7 @@ public MultiGroup(String key, ItemStack item, int tier, ItemGroup... subGroups)

@Override
public boolean isVisible(Player p, PlayerProfile profile, SlimefunGuideMode mode) {
return true;
return mode == SlimefunGuideMode.SURVIVAL_MODE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class CraftingBlockRecipe {

boolean check(ItemStackSnapshot[] input) {
for (int i = 0; i < inputs.length; i++) {
if (!SlimefunUtils.isItemSimilar(input[i], inputs[i], true, true)) {
if (!SlimefunUtils.isItemSimilar(input[i], inputs[i], false, true)) {
return false;
}
}
Expand Down

0 comments on commit d2b41e3

Please sign in to comment.