12 Commits

Author SHA1 Message Date
Govindas 1296ddbf2c refactor 2021-04-09 13:19:58 +03:00
Govindas 18b2838fe5 why extra space here 2021-04-09 12:58:10 +03:00
Govindas 637415efe1 support reloads by stopping cleanuptimer 2021-04-09 12:56:18 +03:00
Govindas 0313f6512a refactor & thread-safe cooldowns 2021-04-09 12:50:14 +03:00
Govindass 2c4390998f Refactor the addon, remove features that I've decided to be unneeded. 2020-11-02 10:37:42 +02:00
Govindass c18a94ac38 Update CleanupTimer.java 2020-10-30 12:25:56 +02:00
Govindass 44eedb92c1 Remove old comment 2020-04-24 09:27:20 +03:00
Govindass e9479e59b1 Some more work.. 2020-02-27 15:58:17 +02:00
Govindass d337c93fe6 Finish event cooldowns! woo 2020-02-24 20:13:11 +02:00
Govindass ef58e4c075 Starting work on event cooldowns... 2020-02-16 17:13:31 +02:00
Govindass ecef1cb5f9 Initial commit 2020-02-15 17:39:44 +02:00
Govindass 189a66bc6f Initial commit 2020-02-15 17:36:49 +02:00
4 changed files with 6 additions and 54 deletions
-47
View File
@@ -1,47 +0,0 @@
# Skooldown
The koolest skript addon for cooldowns
With this addon you can create cooldowns with good performance, without worrying of deleting variables, etc.
Expired cooldowns will be automatically deleted in a very optimized way.
Everything is made with maximum performance in mind, you should be able to safely have millions of cooldowns running simultaneously.
# Syntaxes
Start a cooldown
```
(create|start) [a] cooldown %string% for %timespan%
Example: start cooldown "example%player%" for 45 seconds
```
Stop a cooldown
```
(reset|stop|delete|clear) cooldown %string%"
Example: stop cooldown "example%player%"
```
Check if cooldown is over
```
cooldown %string% (is|has) (finished|over|done)
cooldown %string% is(n't| not) unfinished)
cooldown %string% is(n't| not) (finished|over|done)
cooldown %string% is unfinished
Example:
cooldown "example%player%" is over
```
Display cooldown time
```
set {_cd} to cooldown "example%player%"
send "This cooldown will be over in %{_cd}%"
```
Extend/Reduce existing cooldown
```
add 5 seconds to cooldown "example%player%"
if cooldown "example%player%" is not higher than 5 seconds:
remove 5 seconds from cooldown "example%player%"
```
# Compatibility
- Should work on about any Minecraft version on which Skript works, cooldowns do not interact with Minecraft code in any way
- Incompatible with WolvSK addon cooldowns due to syntax conflict, just use Skooldown instead
@@ -14,13 +14,13 @@ import java.util.Timer;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public final class Skooldown extends JavaPlugin { public final class Skooldown extends JavaPlugin {
public static ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<>(); public static ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<String, Long>();
private Timer cleanupTimer; private Timer cleanupTimer;
@Override @Override
public void onEnable() { public void onEnable() {
Skript.registerAddon(this); Skript.registerAddon(this);
Skript.registerEffect(EffStartCooldown.class, "(create|start) [a] cooldown %string% for %timespan%"); Skript.registerEffect(EffStartCooldown.class, "(create|start) [a] cooldown %string% for %timespan%", "(create|start) [a] cooldown %string% for %timespan%");
Skript.registerEffect(EffEndCooldown.class, "(reset|stop|delete|clear) cooldown %string%"); Skript.registerEffect(EffEndCooldown.class, "(reset|stop|delete|clear) cooldown %string%");
@@ -19,12 +19,12 @@ public class CleanupTimer {
@Override @Override
public void run() { public void run() {
Iterator<Map.Entry<String, Long>> it = Skooldown.cooldowns.entrySet().iterator(); Iterator it = Skooldown.cooldowns.entrySet().iterator();
i = 0; i = 0;
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry<String, Long> pair = it.next(); Map.Entry pair = (Map.Entry) it.next();
long value = pair.getValue(); long value = (long) pair.getValue();
if (value < System.currentTimeMillis()) { if (value < System.currentTimeMillis()) {
i++; i++;
-1
View File
@@ -3,4 +3,3 @@ main: net.govindas.skooldown.Skooldown
version: 1.2.0 version: 1.2.0
author: Govindas author: Govindas
depend: [Skript] depend: [Skript]
api-version: 1.13