Added potion effects on warmup, /bcd alias

This commit is contained in:
Boosik 2013-03-15 11:44:48 +01:00
parent e5c425b6b5
commit ca293fdd29
8 changed files with 30 additions and 2 deletions

View File

@ -1,6 +1,6 @@
name: boosCooldowns
main: cz.boosik.boosCooldown.boosCoolDown
version: 3.3.0
version: 3.4.0
authors: [LordBoos (ingame name boosik)]
softdepend: [Vault]
description: >
@ -9,6 +9,7 @@ commands:
booscooldowns:
description: Reload command.
usage: Use /booscooldowns reload, clearcooldowns <player>, clearwarmups <player> or clearuses <player>
aliases: bcd
permissions:
booscooldowns.exception:
description: Player wont be affected by plugin at all (no warmups, no cooldowns, no prices, no limits, no aliases).

View File

@ -522,6 +522,14 @@ public class boosConfigManager {
conf.addDefault("commands.warmups.warmup3./home", 90);
conf.addDefault("commands.warmups.warmup4./home", 99);
conf.addDefault("commands.warmups.warmup5./home", 542);
conf.addDefault("commands.warmupPotionEffects.effect./home",
"WEAKNESS@3");
conf.addDefault(
"commands.warmupPotionEffects.howto1",
"#You can use CONFUSION, DAMAGE_RESISTANCE, FAST_DIGGING, FIRE_RESISTANCE, HARM, HEAL, HUNGER, INCREASE_DAMAGE, INVISIBILITY, JUMP, NIGHT_VISION, POISON, REGENERATION, SLOW, SLOW_DIGGING, SPEED, WATER_BREATHING, WEAKNESS, WITHER");
conf.addDefault(
"commands.warmupPotionEffects.howto2",
"#After effect add @number, for example WEAKNESS@3 will apply weakness III to player for the duration of warmup.");
conf.addDefault("commands.prices.price./spawn", 10);
conf.addDefault("commands.prices.price./home", 20);
conf.addDefault("commands.prices.price2./home", 40);
@ -557,4 +565,12 @@ public class boosConfigManager {
public static int getSaveInterval() {
return conf.getInt("options.options.save_interval_in_minutes", 15);
}
public static String getPotionEffect(String pre) {
String effect = null;
pre = pre.toLowerCase();
effect = conf.getString("commands.warmupPotionEffects.effect." + pre,
effect);
return effect;
}
}

View File

@ -396,6 +396,7 @@ public class boosCoolDownListener<a> implements Listener {
if (boosCoolDownManager.checkCoolDownOK(player, pre, message)) {
boosWarmUpManager.startWarmUp(this.plugin, player, pre,
message, warmUpSeconds);
boosWarmUpManager.applyPotionEffect(player, pre, message, warmUpSeconds);
event.setCancelled(true);
return;
} else {

View File

@ -5,6 +5,7 @@ import java.util.Timer;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import util.boosChat;
@ -97,4 +98,12 @@ public class boosWarmUpManager {
boosChat.sendMessageToPlayer(player, msg);
}
}
public static void applyPotionEffect(Player player, String pre,
String message, int warmUpSeconds) {
String[] potion = boosConfigManager.getPotionEffect(pre).split("@");
PotionEffectType effect = PotionEffectType.getByName(potion[0]);
player.addPotionEffect(effect.createEffect(warmUpSeconds*40, Integer.parseInt(potion[1])-1), true);
}
}

View File

@ -1,6 +1,6 @@
name: boosCooldowns
main: cz.boosik.boosCooldown.boosCoolDown
version: 3.3.0
version: 3.4.0
authors: [LordBoos (ingame name boosik)]
softdepend: [Vault]
description: >
@ -9,6 +9,7 @@ commands:
booscooldowns:
description: Reload command.
usage: Use /booscooldowns reload, clearcooldowns <player>, clearwarmups <player> or clearuses <player>
aliases: bcd
permissions:
booscooldowns.exception:
description: Player wont be affected by plugin at all (no warmups, no cooldowns, no prices, no limits, no aliases).