-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add /whitelister list and /whitelister reload
- Loading branch information
Showing
6 changed files
with
138 additions
and
6 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/main/java/pro/kdray/scottybotwhitelist/Command/ListCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package pro.kdray.scottybotwhitelist.Command; | ||
|
||
import org.spongepowered.api.command.CommandResult; | ||
import org.spongepowered.api.command.CommandSource; | ||
import org.spongepowered.api.command.args.CommandContext; | ||
import org.spongepowered.api.command.spec.CommandExecutor; | ||
import pro.kdray.scottybotwhitelist.Utils; | ||
|
||
public class ListCommand implements CommandExecutor { | ||
@Override | ||
public CommandResult execute(CommandSource src, CommandContext args) { | ||
src.sendMessage(Utils.getUserList()); | ||
return CommandResult.success(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/pro/kdray/scottybotwhitelist/Command/ReloadCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package pro.kdray.scottybotwhitelist.Command; | ||
|
||
import org.spongepowered.api.command.CommandResult; | ||
import org.spongepowered.api.command.CommandSource; | ||
import org.spongepowered.api.command.args.CommandContext; | ||
import org.spongepowered.api.command.spec.CommandExecutor; | ||
import org.spongepowered.api.text.Text; | ||
import pro.kdray.scottybotwhitelist.Scottybotwhitelist; | ||
|
||
public class ReloadCommand implements CommandExecutor { | ||
@Override | ||
public CommandResult execute(CommandSource src, CommandContext args) { | ||
Scottybotwhitelist.reload(); | ||
src.sendMessage(Text.of("Reloaded plugin!")); | ||
return CommandResult.success(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/pro/kdray/scottybotwhitelist/MainCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package pro.kdray.scottybotwhitelist; | ||
|
||
import org.spongepowered.api.command.CommandException; | ||
import org.spongepowered.api.command.CommandResult; | ||
import org.spongepowered.api.command.CommandSource; | ||
import org.spongepowered.api.command.args.CommandContext; | ||
import org.spongepowered.api.command.spec.CommandExecutor; | ||
import org.spongepowered.api.text.Text; | ||
import org.spongepowered.api.world.Location; | ||
import org.spongepowered.api.world.World; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public class MainCommand implements CommandExecutor { | ||
|
||
@Override | ||
public CommandResult execute(CommandSource source, CommandContext arguments) throws CommandException { | ||
source.sendMessage(this.getUsage(source)); | ||
return CommandResult.success(); | ||
} | ||
|
||
public List<String> getSuggestions(CommandSource source, String arguments, @Nullable Location<World> targetPosition) throws CommandException { | ||
return new ArrayList<>(); | ||
} | ||
|
||
public boolean testPermission(CommandSource source) { | ||
return source.hasPermission("whitelister.whitelist"); | ||
} | ||
|
||
public Optional<Text> getShortDescription(CommandSource source) { | ||
return Optional.of(Text.of("Main command for ScottybotWhitelist")); | ||
} | ||
|
||
public Optional<Text> getHelp(CommandSource source) { | ||
return Optional.of(Text.of("There's not much needed here...")); | ||
} | ||
|
||
public Text getUsage(CommandSource source) { | ||
return Text.of("/whitelister <reload | list>"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters