mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2025-02-16 20:41:25 +01:00
Added: Cooldowns can now be started at death
This commit is contained in:
parent
7210596473
commit
a64cccc3c2
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="D:/Downloads/df/bukkit-1.4.6-R0.3.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Games/Minecraft/server/bukkit-1.4.7-R1.0.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Downloads/df/Vault.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: boosCooldowns
|
||||
main: cz.boosik.boosCooldown.boosCoolDown
|
||||
version: 3.1.3
|
||||
version: 3.2.0
|
||||
authors: [LordBoos (ingame name boosik)]
|
||||
softdepend: [Vault]
|
||||
description: >
|
||||
@ -60,6 +60,9 @@ permissions:
|
||||
booscooldowns.nolimit:
|
||||
description: Player wont be affected by limiting.
|
||||
default: false
|
||||
booscooldowns.start.cooldowns.death.exception:
|
||||
description: Player's cooldowns wont be started on death.
|
||||
default: false
|
||||
booscooldowns.nolimit./command:
|
||||
description: Command "/command" will not be affected by limits for users with this permission.
|
||||
default: false
|
||||
|
Binary file not shown.
@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
@ -48,6 +49,7 @@ public class boosConfigManager {
|
||||
conf.addDefault("options.options.clear_on_restart", false);
|
||||
conf.addDefault("options.options.clear_uses_on_death", false);
|
||||
conf.addDefault("options.options.clear_cooldowns_on_death", false);
|
||||
conf.addDefault("options.options.start_cooldowns_on_death", false);
|
||||
conf.addDefault("options.options.command_logging", false);
|
||||
conf.addDefault("options.options.command_signs", false);
|
||||
conf.addDefault("options.options.enable_limits", true);
|
||||
@ -484,6 +486,22 @@ public class boosConfigManager {
|
||||
}
|
||||
return lim;
|
||||
}
|
||||
|
||||
public static String getCooldownsGrp(Player player) {
|
||||
String cooldown;
|
||||
if (player.hasPermission("booscooldowns.cooldown2")) {
|
||||
cooldown = "cooldown2";
|
||||
} else if (player.hasPermission("booscooldowns.cooldown3")) {
|
||||
cooldown = "cooldown3";
|
||||
} else if (player.hasPermission("booscooldowns.cooldown4")) {
|
||||
cooldown = "cooldown4";
|
||||
} else if (player.hasPermission("booscooldowns.cooldown5")) {
|
||||
cooldown = "cooldown5";
|
||||
} else {
|
||||
cooldown = "cooldown";
|
||||
}
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
public static ConfigurationSection getLimits(Player player) {
|
||||
String lim = getLimGrp(player);
|
||||
@ -491,6 +509,15 @@ public class boosConfigManager {
|
||||
.getConfigurationSection("commands.limits." + lim);
|
||||
return uses;
|
||||
}
|
||||
|
||||
public static Set<String> getCooldownsList(Player player) {
|
||||
String cool = getCooldownsGrp(player);
|
||||
boosCoolDown.log.info("Cooldown group: "+cool);
|
||||
ConfigurationSection cooldownsList;
|
||||
cooldownsList = conf.getConfigurationSection("commands.cooldowns." + cool);
|
||||
Set<String> cooldowns = cooldownsList.getKeys(false);
|
||||
return cooldowns;
|
||||
}
|
||||
|
||||
public static ConfigurationSection getAliases() {
|
||||
ConfigurationSection aliases = conf
|
||||
@ -519,4 +546,8 @@ public class boosConfigManager {
|
||||
public static boolean getLimitsEnabled() {
|
||||
return conf.getBoolean("options.options.enable_limits", true);
|
||||
}
|
||||
|
||||
public static boolean getStartCooldownsOnDeath() {
|
||||
return conf.getBoolean("options.options.start_cooldowns_on_death", false);
|
||||
}
|
||||
}
|
||||
|
@ -576,8 +576,9 @@ public class boosCoolDownListener<a> implements Listener {
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
private void onPlayerDeath(PlayerDeathEvent event) {
|
||||
if (!boosConfigManager.getCleanCooldownsOnDeath()
|
||||
&& !boosConfigManager.getCleanUsesOnDeath())
|
||||
return;
|
||||
&& !boosConfigManager.getCleanUsesOnDeath()
|
||||
&& !boosConfigManager.getStartCooldownsOnDeath()){
|
||||
return;}
|
||||
Entity entity = event.getEntity();
|
||||
if (entity != null && entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
@ -596,6 +597,11 @@ public class boosCoolDownListener<a> implements Listener {
|
||||
.toLowerCase());
|
||||
}
|
||||
}
|
||||
if (player != null){
|
||||
if (boosConfigManager.getStartCooldownsOnDeath()) {
|
||||
boosCoolDownManager.startAllCooldowns(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,4 +403,12 @@ public class boosCoolDownManager {
|
||||
return uses;
|
||||
}
|
||||
|
||||
public static void startAllCooldowns(Player player) {
|
||||
for (String a : boosConfigManager.getCooldownsList(player)) {
|
||||
coolDown(player, a);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: boosCooldowns
|
||||
main: cz.boosik.boosCooldown.boosCoolDown
|
||||
version: 3.1.3
|
||||
version: 3.2.0
|
||||
authors: [LordBoos (ingame name boosik)]
|
||||
softdepend: [Vault]
|
||||
description: >
|
||||
@ -60,6 +60,9 @@ permissions:
|
||||
booscooldowns.nolimit:
|
||||
description: Player wont be affected by limiting.
|
||||
default: false
|
||||
booscooldowns.start.cooldowns.death.exception:
|
||||
description: Player's cooldowns wont be started on death.
|
||||
default: false
|
||||
booscooldowns.nolimit./command:
|
||||
description: Command "/command" will not be affected by limits for users with this permission.
|
||||
default: false
|
||||
|
Loading…
Reference in New Issue
Block a user