mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Adds new perm for bypassing delayed commands.
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1136
This commit is contained in:
parent
332967950f
commit
05a4b2d2c7
@ -74,7 +74,8 @@ public abstract class DelayedTeleportCommand extends CompositeCommand implements
|
|||||||
* @param confirmed Runnable to be executed if successfully delayed.
|
* @param confirmed Runnable to be executed if successfully delayed.
|
||||||
*/
|
*/
|
||||||
public void delayCommand(User user, String message, Runnable confirmed) {
|
public void delayCommand(User user, String message, Runnable confirmed) {
|
||||||
if (getSettings().getDelayTime() < 1 || user.isOp() || user.hasPermission(getPermissionPrefix() + "mod.bypasscooldowns")) {
|
if (getSettings().getDelayTime() < 1 || user.isOp() || user.hasPermission(getPermissionPrefix() + "mod.bypasscooldowns")
|
||||||
|
|| user.hasPermission(getPermissionPrefix() + "mod.bypassdelays")) {
|
||||||
Bukkit.getScheduler().runTask(getPlugin(), confirmed);
|
Bukkit.getScheduler().runTask(getPlugin(), confirmed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -220,8 +220,18 @@ public class DelayedTeleportCommandTest {
|
|||||||
* Test method for {@link world.bentobox.bentobox.api.commands.DelayedTeleportCommand#delayCommand(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.Runnable)}.
|
* Test method for {@link world.bentobox.bentobox.api.commands.DelayedTeleportCommand#delayCommand(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.Runnable)}.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDelayCommandUserStringRunnablePerm() {
|
public void testDelayCommandUserStringRunnablePermBypassCooldowns() {
|
||||||
when(user.hasPermission(anyString())).thenReturn(true);
|
when(user.hasPermission(eq("nullmod.bypasscooldowns"))).thenReturn(true);
|
||||||
|
dtc.delayCommand(user, HELLO, command);
|
||||||
|
verify(sch).runTask(eq(plugin), eq(command));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test method for {@link world.bentobox.bentobox.api.commands.DelayedTeleportCommand#delayCommand(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.Runnable)}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDelayCommandUserStringRunnablePermBypassDelay() {
|
||||||
|
when(user.hasPermission(eq("nullmod.bypassdelays"))).thenReturn(true);
|
||||||
dtc.delayCommand(user, HELLO, command);
|
dtc.delayCommand(user, HELLO, command);
|
||||||
verify(sch).runTask(eq(plugin), eq(command));
|
verify(sch).runTask(eq(plugin), eq(command));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user