Skip to content

Commit

Permalink
Add command permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
cerus committed Oct 10, 2021
1 parent f421b24 commit 7735b4c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bukkit-17_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<artifactId>maps</artifactId>
<groupId>dev.cerus</groupId>
<version>1.0.2</version>
<version>1.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>dev.cerus.maps</groupId>
<artifactId>bukkit-17_R1</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>

<properties>
<maven.compiler.target>16</maven.compiler.target>
Expand Down
4 changes: 2 additions & 2 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<artifactId>maps</artifactId>
<groupId>dev.cerus</groupId>
<version>1.0.2</version>
<version>1.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>dev.cerus.maps</groupId>
<artifactId>common</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>

<properties>
<maven.compiler.target>16</maven.compiler.target>
Expand Down
4 changes: 2 additions & 2 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<artifactId>maps</artifactId>
<groupId>dev.cerus</groupId>
<version>1.0.2</version>
<version>1.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>dev.cerus.maps</groupId>
<artifactId>plugin</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>

<properties>
<maven.compiler.target>16</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Dependency;
import co.aikar.commands.annotation.Subcommand;
import dev.cerus.maps.api.MapColor;
Expand All @@ -18,12 +19,14 @@
import org.bukkit.map.MinecraftFont;

@CommandAlias("maps")
@CommandPermission("maps.command")
public class MapsCommand extends BaseCommand {

@Dependency
private VersionAdapter versionAdapter;

@Subcommand("createscreen")
@CommandPermission("maps.command.createscreen")
public void handleCreateScreen(final Player player) {
final ItemFrame startingFrame = player.getNearbyEntities(10, 10, 10).stream()
.filter(entity -> entity instanceof ItemFrame)
Expand Down Expand Up @@ -52,6 +55,7 @@ public void handleCreateScreen(final Player player) {
}

@Subcommand("testscreen")
@CommandPermission("maps.command.testscreen")
public void handleTestScreen(final Player player, final int id) {
final MapScreen mapScreen = MapScreenRegistry.getScreen(id);
if (mapScreen == null) {
Expand All @@ -74,19 +78,22 @@ public void handleTestScreen(final Player player, final int id) {
}

@Subcommand("removescreen")
@CommandPermission("maps.command.removescreen")
public void handleRemoveScreen(final Player player, final int id) {
MapScreenRegistry.removeScreen(id);
player.sendMessage("§aScreen was removed");
}

@Subcommand("listscreens")
@CommandPermission("maps.command.listscreens")
public void handleListScreens(final Player player) {
final Collection<Integer> screenIds = MapScreenRegistry.getScreenIds();
player.sendMessage("§6There are " + screenIds.size() + " map screens on this server");
player.sendMessage("§e" + Arrays.toString(screenIds.toArray(new Integer[0])));
}

@Subcommand("togglealgo")
@CommandPermission("maps.command.togglealgo")
public void handleToggleAlgo(final Player player, final int id) {
final MapScreen screen = MapScreenRegistry.getScreen(id);
if (screen == null) {
Expand All @@ -105,6 +112,7 @@ public void handleToggleAlgo(final Player player, final int id) {
}

@Subcommand("info")
@CommandPermission("maps.command.info")
public void handleInfo(final Player player, final int id) {
final MapScreen screen = MapScreenRegistry.getScreen(id);
if (screen == null) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>dev.cerus</groupId>
<artifactId>maps</artifactId>
<packaging>pom</packaging>
<version>1.0.2</version>
<version>1.0.3</version>
<modules>
<module>common</module>
<module>bukkit-17_R1</module>
Expand Down

0 comments on commit 7735b4c

Please sign in to comment.