-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added help command, fixed filter radius resetting, more faulty event …
…fixes
- Loading branch information
Showing
21 changed files
with
108 additions
and
13 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
45 changes: 43 additions & 2 deletions
45
src/main/java/com/karanumcoding/adamantineshield/commands/CommandMain.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 |
---|---|---|
@@ -1,17 +1,58 @@ | ||
package com.karanumcoding.adamantineshield.commands; | ||
|
||
import org.spongepowered.api.Sponge; | ||
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.text.format.TextColors; | ||
|
||
import com.karanumcoding.adamantineshield.commands.lookup.CommandFilter; | ||
import com.karanumcoding.adamantineshield.commands.lookup.CommandInspect; | ||
import com.karanumcoding.adamantineshield.commands.lookup.CommandLookup; | ||
import com.karanumcoding.adamantineshield.commands.pages.CommandNextPage; | ||
import com.karanumcoding.adamantineshield.commands.pages.CommandPage; | ||
import com.karanumcoding.adamantineshield.commands.pages.CommandPrevPage; | ||
import com.karanumcoding.adamantineshield.enums.Permissions; | ||
|
||
public class CommandMain implements CommandExecutor { | ||
|
||
@Override | ||
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { | ||
// TODO Auto-generated method stub | ||
return CommandResult.empty(); | ||
boolean hasAnyPermission = false; | ||
Text text = Text.of(TextColors.DARK_AQUA, "[AS] ", TextColors.YELLOW, "Available commands: ", Text.NEW_LINE); | ||
if (src.hasPermission(Permissions.LOOKUP.get())) { | ||
hasAnyPermission = true; | ||
text = Text.of(text, CommandInspect.getHelpEntry(), Text.NEW_LINE, CommandLookup.getHelpEntry(), Text.NEW_LINE); | ||
} | ||
if (src.hasPermission(Permissions.FILTER.get())) { | ||
hasAnyPermission = true; | ||
text = Text.of(text, CommandFilter.getHelpEntry(), Text.NEW_LINE); | ||
} | ||
if (src.hasPermission(Permissions.LOOKUP.get())) { | ||
text = Text.of(text, CommandPage.getHelpEntry(), Text.NEW_LINE, CommandNextPage.getHelpEntry(), Text.NEW_LINE, | ||
CommandPrevPage.getHelpEntry(), Text.NEW_LINE); | ||
} | ||
if (src.hasPermission(Permissions.PURGE.get())) { | ||
hasAnyPermission = true; | ||
text = Text.of(text, CommandPurge.getHelpEntry(), Text.NEW_LINE); | ||
} | ||
|
||
if (hasAnyPermission) { | ||
text = Text.of(text, getHelpEntry(), Text.NEW_LINE); | ||
} else { | ||
text = Text.of(TextColors.DARK_AQUA, "[AS] ", TextColors.YELLOW, "AdmantineShield v", | ||
Sponge.getPluginManager().getPlugin("adamantineshield").get().getVersion(), " by Karanum"); | ||
} | ||
|
||
src.sendMessage(text); | ||
return CommandResult.success(); | ||
} | ||
|
||
public static Text getHelpEntry() { | ||
return Text.of(TextColors.YELLOW, "/ashield help", TextColors.AQUA, " - Shows command help"); | ||
} | ||
|
||
} |
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
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
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
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
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
4 changes: 2 additions & 2 deletions
4
src/main/java/com/karanumcoding/adamantineshield/enums/Permissions.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
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