2020-02-15 15:39:44 +00:00
package lt.govindas.skooldown ;
import ch.njol.skript.Skript ;
import ch.njol.skript.lang.ExpressionType ;
2020-02-24 18:13:11 +00:00
import ch.njol.skript.lang.util.SimpleEvent ;
import ch.njol.skript.lang.util.SimpleExpression ;
import ch.njol.skript.registrations.EventValues ;
import ch.njol.skript.util.Getter ;
2020-02-15 15:39:44 +00:00
import ch.njol.skript.util.Timespan ;
2020-02-24 18:13:11 +00:00
import com.google.common.collect.ArrayListMultimap ;
import com.google.common.collect.Multimap ;
import com.sun.applet2.AppletParameters ;
2020-02-16 15:13:31 +00:00
import lt.govindas.skooldown.conditions.CondIsCooldownOver ;
2020-02-24 18:13:11 +00:00
import lt.govindas.skooldown.effects.EffEndCooldown ;
2020-02-15 15:39:44 +00:00
import lt.govindas.skooldown.effects.EffStartCooldown ;
2020-02-24 18:13:11 +00:00
import lt.govindas.skooldown.events.CooldownEndEvent ;
import lt.govindas.skooldown.events.EvtCooldown ;
2020-02-15 15:39:44 +00:00
import lt.govindas.skooldown.expressions.ExprCooldown ;
2020-02-24 18:13:11 +00:00
import lt.govindas.skooldown.expressions.ExprCooldownData ;
2020-02-16 15:13:31 +00:00
import lt.govindas.skooldown.utilities.CleanupTimer ;
2020-02-24 18:13:11 +00:00
import org.bukkit.entity.Player ;
2020-02-15 15:39:44 +00:00
import org.bukkit.plugin.java.JavaPlugin ;
2020-02-24 18:13:11 +00:00
import lt.govindas.skooldown.utilities.Timer ;
2020-02-15 15:39:44 +00:00
import java.util.HashMap ;
public final class Skooldown extends JavaPlugin {
public static HashMap < String , Long > cooldowns = new HashMap < String , Long > ( ) ;
2020-02-24 18:13:11 +00:00
public static HashMap < String , Timer > eventCooldowns = new HashMap < String , Timer > ( ) ;
2020-02-15 15:39:44 +00:00
@Override
public void onEnable ( ) {
2020-02-24 18:13:11 +00:00
Skript . registerEffect ( EffStartCooldown . class , " (create|start) [a] cooldown %string% for %timespan% " , " (create|start) [a] (1¦event) cooldown %string% [with data %-string%] for %timespan% " ) ;
Skript . registerEffect ( EffEndCooldown . class , " (reset|stop|delete|clear) [(1¦event)] cooldown %string% [with data %-string%] " ) ;
2020-04-24 06:27:20 +00:00
Skript . registerCondition ( CondIsCooldownOver . class , " [(1¦event)] cooldown %string% [with data %-string%] (is|has) (finished|over|done) " , " [the] [(1¦event)] cooldown %string% [with data %-string%] is(n't| not) unfinished) " , " [the] [(1¦event)] cooldown %string% [with data %-string%] is(n't| not) (finished|over|done) " , " [the] [(1¦event)] cooldown %string% [with data %-string%] is unfinished " ) ;
2020-02-24 18:13:11 +00:00
Skript . registerExpression ( ExprCooldown . class , Timespan . class , ExpressionType . PROPERTY , " [(1¦event)] cooldown %string% [with data %-string%] " ) ;
2020-04-24 06:27:20 +00:00
2020-02-24 18:13:11 +00:00
Skript . registerEvent ( " Cooldown End " , EvtCooldown . class , CooldownEndEvent . class , " (finish|end|complete) of cooldown %string% " ) ;
Skript . registerExpression ( ExprCooldownData . class , String . class , ExpressionType . SIMPLE , " cooldown data " ) ;
EventValues . registerEventValue ( CooldownEndEvent . class , String . class , new Getter < String , CooldownEndEvent > ( ) {
@Override
public String get ( CooldownEndEvent e ) {
return e . getData ( ) ;
}
} , 0 ) ;
2020-02-15 15:39:44 +00:00
getLogger ( ) . info ( " [Skooldown] Plugin enabled! " ) ;
2020-02-16 15:13:31 +00:00
new CleanupTimer ( ) ;
2020-02-15 15:39:44 +00:00
}
@Override
public void onDisable ( ) {
getLogger ( ) . info ( " [Skooldown] Plugin disabled! " ) ;
}
}