Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 64054f9079 | |||
| 044b09e511 | |||
| 06c660f085 | |||
| 288dffba6f | |||
| ee9ed4af11 | |||
| 2a1007d52f | |||
| 87b056f999 | |||
| ee034405fd | |||
| 1e03b937b0 | |||
| d3f886bb74 | |||
| 0ce89e192c | |||
| b1e078493a | |||
| b18fc1f8cf | |||
| bca1fab175 | |||
| 3feb9ef1b0 | |||
| bbf4d62855 | |||
| 51a6e36e1f | |||
| c8ad91bd49 | |||
| c119e8216a | |||
| 5bca29176b | |||
| 8e604aa324 |
@@ -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++;
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user