Class CooldownSender
java.lang.Object
net.flectone.pulse.platform.sender.CooldownSender
Sends cooldown messages to players and checks cooldown bypass permissions.
Usage example:
CooldownSender cooldownSender = flectonePulse.get(CooldownSender.class);
Cooldown cooldown = new Cooldown(5000, true); // 5 second cooldown
PermissionSetting permissionByPass = new PermissionSetting("myplugin.bypass", false);
if (cooldownSender.sendIfCooldown(player, Pair.of(cooldown, permissionByPass))) {
// Player is on cooldown, action should be blocked
}
- Since:
- 1.6.0
-
Constructor Summary
ConstructorsConstructorDescriptionCooldownSender(PermissionChecker permissionChecker, CooldownChecker cooldownChecker, CooldownRepository cooldownRepository, MessagePipeline messagePipeline, TimeFormatter timeFormatter, EventDispatcher eventDispatcher, FileFacade fileFacade, SocialService socialService) -
Method Summary
Modifier and TypeMethodDescriptionbooleansendIfCooldown(FEntity entity, Optional<org.apache.commons.lang3.tuple.Pair<Cooldown, PermissionSetting>> optionalCooldown, String cooldownOwner) Checks if an entity is on cooldown and sends a cooldown message if applicable.booleansendIfCooldown(FEntity entity, org.apache.commons.lang3.tuple.Pair<Cooldown, PermissionSetting> cooldownPermission, String cooldownOwner) Checks if a player is on cooldown and sends a formatted cooldown message.
-
Constructor Details
-
CooldownSender
@Inject public CooldownSender(PermissionChecker permissionChecker, CooldownChecker cooldownChecker, CooldownRepository cooldownRepository, MessagePipeline messagePipeline, TimeFormatter timeFormatter, EventDispatcher eventDispatcher, FileFacade fileFacade, SocialService socialService)
-
-
Method Details
-
sendIfCooldown
public boolean sendIfCooldown(FEntity entity, Optional<org.apache.commons.lang3.tuple.Pair<Cooldown, PermissionSetting>> optionalCooldown, String cooldownOwner) Checks if an entity is on cooldown and sends a cooldown message if applicable. Only sends messages to players, not other entities.- Parameters:
entity- the entity to checkoptionalCooldown- optional pair of cooldown and permission settingscooldownOwner- name of the owner that checks cooldown- Returns:
- true if cooldown message was sent, false otherwise
-
sendIfCooldown
public boolean sendIfCooldown(FEntity entity, org.apache.commons.lang3.tuple.Pair<Cooldown, PermissionSetting> cooldownPermission, String cooldownOwner) Checks if a player is on cooldown and sends a formatted cooldown message.- Parameters:
entity- the entity to checkcooldownPermission- pair of cooldown settings and bypass permissioncooldownOwner- name of the owner that checks cooldown- Returns:
- true if cooldown message was sent, false otherwise
-