21 Commits

Author SHA1 Message Date
Govindas 64054f9079 api-version to 1.13 to help 1.13+ servers. will still work on 1.12 and below. 2021-10-24 09:33:12 +03:00
Govindas 044b09e511 Update README.md 2021-10-20 18:00:52 +03:00
Govindas 06c660f085 Update README.md 2021-10-20 18:00:50 +03:00
Govindas 288dffba6f Update README.md 2021-10-20 18:00:50 +03:00
Govindas ee9ed4af11 improve code according to intellij tips 2021-10-20 18:00:49 +03:00
Govindas 2a1007d52f Merge branch 'master' of https://github.com/Govindass/Skooldown 2021-10-20 18:00:49 +03:00
Govindas 87b056f999 simplify this 2021-10-20 18:00:48 +03:00
Govindas ee034405fd Create README.md 2021-10-20 18:00:48 +03:00
Govindas 1e03b937b0 Don't register same syntax twice 2021-10-20 18:00:47 +03:00
Govindas d3f886bb74 refactor 2021-10-20 18:00:47 +03:00
Govindas 0ce89e192c why extra space here 2021-10-20 18:00:46 +03:00
Govindas b1e078493a support reloads by stopping cleanuptimer 2021-10-20 18:00:45 +03:00
Govindas b18fc1f8cf refactor & thread-safe cooldowns 2021-10-20 18:00:41 +03:00
Govindas bca1fab175 Refactor the addon, remove features that I've decided to be unneeded. 2020-11-02 10:37:42 +02:00
Govindas 3feb9ef1b0 Update CleanupTimer.java 2020-10-30 12:25:56 +02:00
Govindas bbf4d62855 Remove old comment 2020-04-24 09:27:20 +03:00
Govindas 51a6e36e1f Some more work.. 2020-02-27 15:58:17 +02:00
Govindas c8ad91bd49 Finish event cooldowns! woo 2020-02-24 20:13:11 +02:00
Govindas c119e8216a Starting work on event cooldowns... 2020-02-16 17:13:31 +02:00
Govindas 5bca29176b Initial commit 2020-02-15 17:39:44 +02:00
Govindas 8e604aa324 Initial commit 2020-02-15 17:36:49 +02:00
4 changed files with 54 additions and 6 deletions
+47
View File
@@ -0,0 +1,47 @@
# 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<String, Long>(); public static ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<>();
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%", "(create|start) [a] cooldown %string% for %timespan%"); Skript.registerEffect(EffStartCooldown.class, "(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 it = Skooldown.cooldowns.entrySet().iterator(); Iterator<Map.Entry<String, Long>> it = Skooldown.cooldowns.entrySet().iterator();
i = 0; i = 0;
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next(); Map.Entry<String, Long> pair = it.next();
long value = (long) pair.getValue(); long value = pair.getValue();
if (value < System.currentTimeMillis()) { if (value < System.currentTimeMillis()) {
i++; i++;
+1
View File
@@ -3,3 +3,4 @@ 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