-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
191 additions
and
133 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
} | ||
|
||
allprojects { | ||
apply(plugin="java-library") | ||
apply(plugin="maven-publish") | ||
|
||
java { | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
groupId = project.group.toString() | ||
artifactId = project.name | ||
version = project.version.toString() | ||
|
||
from(components["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
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
19 changes: 19 additions & 0 deletions
19
doublejump-core/src/main/java/com/github/imdmk/doublejump/command/context/PlayerContext.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,19 @@ | ||
package com.github.imdmk.doublejump.command.context; | ||
|
||
import dev.rollczi.litecommands.context.ContextProvider; | ||
import dev.rollczi.litecommands.context.ContextResult; | ||
import dev.rollczi.litecommands.invocation.Invocation; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
public class PlayerContext implements ContextProvider<CommandSender, Player> { | ||
|
||
@Override | ||
public ContextResult<Player> provide(Invocation<CommandSender> invocation) { | ||
if (invocation.sender() instanceof Player player) { | ||
return ContextResult.ok(() -> player); | ||
} | ||
|
||
return ContextResult.error("Only player can use this command."); | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
...e/src/main/java/com/github/imdmk/doublejump/command/handler/MissingPermissionHandler.java
This file was deleted.
Oops, something went wrong.
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
30 changes: 30 additions & 0 deletions
30
...ump-core/src/main/java/com/github/imdmk/doublejump/command/handler/PermissionHandler.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,30 @@ | ||
package com.github.imdmk.doublejump.command.handler; | ||
|
||
import com.github.imdmk.doublejump.notification.NotificationSender; | ||
import com.github.imdmk.doublejump.notification.configuration.NotificationSettings; | ||
import com.github.imdmk.doublejump.text.Formatter; | ||
import dev.rollczi.litecommands.handler.result.ResultHandlerChain; | ||
import dev.rollczi.litecommands.invocation.Invocation; | ||
import dev.rollczi.litecommands.permission.MissingPermissions; | ||
import dev.rollczi.litecommands.permission.MissingPermissionsHandler; | ||
import org.bukkit.command.CommandSender; | ||
|
||
public class PermissionHandler implements MissingPermissionsHandler<CommandSender> { | ||
|
||
private final NotificationSettings notificationSettings; | ||
private final NotificationSender notificationSender; | ||
|
||
public PermissionHandler(NotificationSettings notificationSettings, NotificationSender notificationSender) { | ||
this.notificationSettings = notificationSettings; | ||
this.notificationSender = notificationSender; | ||
} | ||
|
||
@Override | ||
public void handle(Invocation<CommandSender> invocation, MissingPermissions missingPermissions, ResultHandlerChain<CommandSender> resultHandlerChain) { | ||
CommandSender sender = invocation.sender(); | ||
Formatter formatter = new Formatter() | ||
.placeholder("{PERMISSIONS}", missingPermissions.getPermissions()); | ||
|
||
this.notificationSender.send(sender, this.notificationSettings.missingPermissions, formatter); | ||
} | ||
} |
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
Oops, something went wrong.