Compare commits
No commits in common. "1.2.0" and "master" have entirely different histories.
|
@ -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
|
4
pom.xml
4
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>net.govindas</groupId>
|
||||
<artifactId>Skooldown</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<version>1.2.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<build>
|
||||
|
@ -90,4 +90,4 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -14,13 +14,13 @@ import java.util.Timer;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
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;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
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%");
|
||||
|
|
|
@ -19,12 +19,12 @@ public class CleanupTimer {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
Iterator it = Skooldown.cooldowns.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, Long>> it = Skooldown.cooldowns.entrySet().iterator();
|
||||
i = 0;
|
||||
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()) {
|
||||
i++;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
name: Skooldown
|
||||
main: net.govindas.skooldown.Skooldown
|
||||
version: 1.2.0
|
||||
version: 1.2.1
|
||||
author: Govindas
|
||||
depend: [Skript]
|
||||
depend: [Skript]
|
||||
api-version: 1.13
|
||||
|
|
Loading…
Reference in New Issue