Skip to content

Commit

Permalink
Minor fixes, permission modifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
dscalzi committed Nov 25, 2018
1 parent a2fe9e4 commit dace17b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 47 deletions.
41 changes: 23 additions & 18 deletions ZipExtractor-Bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,27 @@ permissions:
description: Allow usage of /ZipExtractor forceterminate
zipextractor.admin.reload:
description: Allow usage of /ZipExtractor reload
zipextractor.admin.*:
default: OP
description: Access to administrator commands.
zipextractor.*:
description: Full access to ZipExtractor.
children:
zipextractor.harmless.notify: true
zipextractor.admin.use: true
zipextractor.admin.extract: true
zipextractor.admin.compress: true
zipextractor.admin.override.extract: true
zipextractor.admin.override.compress: true
zipextractor.admin.src: true
zipextractor.admin.dest: true
zipextractor.admin.setsrc: true
zipextractor.admin.setdest: true
zipextractor.harmless.status: true
zipextractor.admin.plugindir: true
zipextractor.admin.terminate: true
zipextractor.admin.forceterminate: true
zipextractor.admin.reload: true
zipextractor.admin.*:
description: Access to administrator commands.
children:
zipextractor.admin.use: true
zipextractor.admin.extract: true
zipextractor.admin.compress: true
zipextractor.admin.override.extract: true
zipextractor.admin.override.compress: true
zipextractor.admin.src: true
zipextractor.admin.dest: true
zipextractor.admin.setsrc: true
zipextractor.admin.setdest: true
zipextractor.admin.plugindir: true
zipextractor.admin.terminate: true
zipextractor.admin.forceterminate: true
zipextractor.admin.reload: true
zipextractor.harmless.*:
description: Access to harmless commands.
children:
zipextractor.harmless.notify: true
zipextractor.harmless.status: true
Original file line number Diff line number Diff line change
Expand Up @@ -340,32 +340,6 @@ public void formatWarnList(BaseCommandSender sender, int page, PageList<String>
sender.sendMessage(s);
sender.sendMessage(footer);
}

public String getExtendedHelp() {
StringBuilder h = new StringBuilder();

final String listPrefix = cPrimary + " " + BULLET + " ";

h.append(prefix + cPrimary + " Command List - <Required> [Optional]\n");
h.append(listPrefix + "/ZipExtractor help [cmd] " + cTrim + "- View command list or info.\n");
h.append(listPrefix + "/ZipExtractor extract " + cTrim + "- Extract the specified file.\n");
h.append(listPrefix + "/ZipExtractor compress " + cTrim + "- Compress the specified file.\n");
h.append(listPrefix + "/ZipExtractor src [-absolute] " + cTrim + "- View the source filepath.\n");
h.append(listPrefix + "/ZipExtractor dest [-absolute] " + cTrim + "- View the destination filepath.\n");
h.append(listPrefix + "/ZipExtractor setsrc <path> " + cTrim + "- Set the source's filepath.\n");
h.append(listPrefix + "/ZipExtractor setdest <path> " + cTrim + "- Set the destination's filepath.\n");
h.append(listPrefix + "/ZipExtractor status " + cTrim + "- View the executor's status.\n");
h.append(listPrefix + "/ZipExtractor plugindir " + cTrim + "- Get the plugin's full filepath.\n");
h.append(listPrefix + "/ZipExtractor terminate " + cTrim
+ "- Shutdown the plugin's executor and allow all outstanding tasks to complete.\n");
h.append(listPrefix + "/ZipExtractor forceterminate " + cTrim
+ "- Immediately shutdown the plugin's executor and terminate all outstanding tasks.\n");
h.append(listPrefix + "/ZipExtractor reload " + cTrim + "- Reload the config.yml.\n");
h.append(listPrefix + "/ZipExtractor version " + cTrim + "- View plugin version info.\n");

return h.toString();

}

public void commandList(BaseCommandSender sender, int page) {
final String listPrefix = cPrimary + " " + BULLET + " ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.source.CommandBlockSource;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.serializer.TextSerializers;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

Expand Down Expand Up @@ -495,7 +494,7 @@ public Optional<Text> getShortDescription(CommandSource source) {

@Override
public Optional<Text> getHelp(CommandSource source) {
return Optional.of(TextSerializers.FORMATTING_CODE.deserialize(mm.getExtendedHelp()));
return Optional.of(Text.of("Run /ZipExtractor to view usage."));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void onGamePreInitialization(GamePreInitializationEvent e){
MessageManager.initialize(this);
ZServicer.initalize(ConfigManager.getInstance().getMaxQueueSize(), ConfigManager.getInstance().getMaxPoolSize());

Sponge.getCommandManager().register(this, new MainExecutor(this), Arrays.asList("zipexteactor", "ze"));
Sponge.getCommandManager().register(this, new MainExecutor(this), Arrays.asList("zipextractor", "ze"));
}


Expand All @@ -106,6 +106,7 @@ public void onPostInit(GamePostInitializationEvent event) {
if (ops.isPresent()) {
Builder opdb = ops.get().newDescriptionBuilder(this);
if (opdb != null) {
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Full access to ZipExtractor.")).id(plugin.getId()).register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Access to administrator commands.")).id(plugin.getId() + ".admin").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor.")).id(plugin.getId() + ".admin.use").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor extract.")).id(plugin.getId() + ".admin.extract").register();
Expand All @@ -120,6 +121,7 @@ public void onPostInit(GamePostInitializationEvent event) {
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor terminate.")).id(plugin.getId() + ".admin.terminate").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor forceterminate.")).id(plugin.getId() + ".admin.forceterminate").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor reload.")).id(plugin.getId() + ".admin.reload").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Access to harmless commands.")).id(plugin.getId() + ".harmless").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("User will be notified if the plugin broadcasts a message.")).id(plugin.getId() + ".harmless.notify").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor status.")).id(plugin.getId() + ".harmless.status").register();
}
Expand Down

0 comments on commit dace17b

Please sign in to comment.