First steps

This commit is contained in:
Neptune Whitebear 2011-10-02 22:45:41 +02:00
parent 01be0c7e7f
commit af812e0f83
4 changed files with 24 additions and 0 deletions

View File

@ -34,10 +34,12 @@ public class boosConfigManager {
conf.setProperty("commands.cooldown./home", 30);
conf.setProperty("commands.warmup./give", 60);
conf.setProperty("commands.warmup./home", 20);
conf.setProperty("commands.options.cancel_warmup_on_damage", false);
conf.setProperty("commands.options.clear_on_restart", false);
conf.setProperty("commands.options.unit_seconds", "seconds");
conf.setProperty("commands.options.unit_minutes", "minutes");
conf.setProperty("commands.options.unit_hours", "hours");
conf.setProperty("commands.options.message_warmup_cancelled", "&6Warm-ups have been cancelled due to receiving damage.&f");
conf.setProperty("commands.options.message_cooldown", "&6Wait&e &seconds& &unit&&6 before you can use command&e &command& &6again.&f");
conf.setProperty("commands.options.message_warmup", "&6Wait&e &seconds& &unit&&6 before command&e &command& &6has warmed up.&f");
conf.setProperty("commands.options.message_warmup_alreadystarted", "&6Warm-Up process for&e &command& &6has already started.&f");
@ -70,6 +72,9 @@ public class boosConfigManager {
static String getCoolDownMessage() {
return conf.getString("commands.options.message_cooldown", "&6Wait&e &seconds& seconds&6 before you can use command&e &command& &6again.&f");
}
static String getWarmUpCancelledMessage() {
return conf.getString("commands.options.message_warmup_cancelled", "&6Warm-ups have been cancelled due to receiving damage.&f");
}
static String getWarmUpMessage() {
return conf.getString("commands.options.message_warmup", "&6Wait&e &seconds& seconds&6 before command&e &command& &6has warmed up.&f");
}
@ -88,4 +93,8 @@ public class boosConfigManager {
static boolean getClearOnRestart() {
return conf.getBoolean("commands.options.clear_on_restart", false);
}
static boolean getCancelWarmUpOnDamage() {
return conf.getBoolean("commands.options.cancel_warmup_on_damage", false);
}
}

View File

@ -19,6 +19,7 @@ import java.util.logging.Logger;
public class boosCoolDown extends JavaPlugin {
private final boosCoolDownPlayerListener playerListener = new boosCoolDownPlayerListener(this);
private final boosCoolDownEntityListener entityListener = new boosCoolDownEntityListener(this);
public static final Logger log = Logger.getLogger("Minecraft");
public static PluginDescriptionFile pdfFile;
public static Configuration conf;
@ -42,6 +43,9 @@ public class boosCoolDown extends JavaPlugin {
conf = boosConfigManager.conf;
boosCoolDownManager boosCoolDownManager = new boosCoolDownManager(this);
boosCoolDownManager.load();
if(boosConfigManager.getCancelWarmUpOnDamage()) {
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.Normal, this);
}
if (boosConfigManager.getClearOnRestart() == true) {
boosCoolDownManager.clear();
} else {

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerMoveEvent;
//import org.bukkit.event.entity.EntityDamageEvent;

View File

@ -59,4 +59,14 @@ public class boosWarmUpManager {
public static void cancelWarmUps(Player player) {
removeWarmUpProcess(player.getName());
}
public static boolean hasWarmUps(Player player) {
boosChat.sendMessageToServer( "haswarmup" );
for(String key: playercommands.keySet()) {
if(key.startsWith(player.getName())) {
return true;
}
}
return false;
}
}