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

Commands: auto-generate description and usage #59

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/scopes/Config_files.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

769 changes: 0 additions & 769 deletions .idea/workspace.xml

This file was deleted.

2 changes: 2 additions & 0 deletions src/main/java/fr/lataverne/votereward/VoteReward.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.lataverne.votereward;

import fr.lataverne.votereward.commands.VoteRewardCommand;
import fr.lataverne.votereward.commands.VoteRewardConsoleCommand;
import fr.lataverne.votereward.managers.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
Expand Down Expand Up @@ -88,6 +89,7 @@ public void onEnable() {
this.chatResponseManager = new ChatResponseManager(this);

new VoteRewardCommand();
new VoteRewardConsoleCommand();

Listener eventListener = new EventListener(this);
Bukkit.getPluginManager().registerEvents(eventListener, this);
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/fr/lataverne/votereward/commands/AdminCommand.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/fr/lataverne/votereward/commands/BagCommand.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package fr.lataverne.votereward.commands;

import fr.lataverne.votereward.commands.common.ConfirmCommand;
import fr.lataverne.votereward.commands.votereward.AdminCommand;
import fr.lataverne.votereward.commands.votereward.BagCommand;
import fr.lataverne.votereward.commands.votereward.TopVoteCommand;
import fr.lataverne.votereward.commands.votereward.VoteCommand;
import fr.lataverne.votereward.utils.commands.CompositeCommand;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

Expand All @@ -18,12 +24,10 @@ protected boolean execute(@NotNull CommandSender sender, @NotNull String label,

@Override
protected void setup() {
new BagCommand(this);
new AdminCommand(this);
new ConfirmCommand(this);
new TopVoteCommand(this);
new VoteCommand(this);

new AddVoteConsoleCommand(this);
this.addChildren(new BagCommand(this));
this.addChildren(new AdminCommand(this));
this.addChildren(new ConfirmCommand(this));
this.addChildren(new TopVoteCommand(this));
this.addChildren(new VoteCommand(this));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import fr.lataverne.votereward.objects.Bag;
import fr.lataverne.votereward.objects.rewards.Reward;
import fr.lataverne.votereward.objects.votes.Vote;
import fr.lataverne.votereward.utils.commands.CompositeCommand;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
Expand All @@ -14,10 +15,10 @@
import java.time.LocalDate;
import java.util.List;

public class AddVoteConsoleCommand extends CompositeCommand {
public class VoteRewardConsoleCommand extends CompositeCommand {

protected AddVoteConsoleCommand(@NotNull CompositeCommand parent) {
super(parent, "addVote");
public VoteRewardConsoleCommand() {
super("votereward-console", "vr-console", "vrc");
}

@Override
Expand Down Expand Up @@ -59,7 +60,9 @@ protected boolean execute(@NotNull CommandSender sender, @NotNull String label,
" voted but he has never played on the server");
}
} else {
return this.parent.execute(sender, label, args);
sender.sendMessage(this.plugin.getConfig()
.getString("messages.error.no-permission")
.replace("[permission]", this.getPermission()));
}

return true;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package fr.lataverne.votereward.commands;
package fr.lataverne.votereward.commands.common;

import fr.lataverne.votereward.utils.commands.CompositeCommand;
import fr.lataverne.votereward.utils.commands.ConfirmableCommand;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.bukkit.Bukkit;
Expand All @@ -15,7 +17,7 @@ public class ConfirmCommand extends CompositeCommand {

private final Map<CommandSender, Pair<BukkitTask, Runnable>> toBeConfirmed = new HashMap<>();

protected ConfirmCommand(@NotNull CompositeCommand parent) {
public ConfirmCommand(@NotNull CompositeCommand parent) {
super(parent, "confirm");
}

Expand Down
Loading