mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2025-02-17 04:51:23 +01:00
Update for 1.1R5
This commit is contained in:
parent
4a7c0839c5
commit
a8ee1a24ed
@ -1,92 +1,105 @@
|
||||
package cz.boosik.boosCooldown;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class boosConfigManager {
|
||||
|
||||
protected static boosCoolDown bCoolDown;
|
||||
protected static Configuration conf;
|
||||
protected File confFile;
|
||||
private static YamlConfiguration conf;
|
||||
private static File confFile;
|
||||
static List<String> players = new LinkedList<String>();
|
||||
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public boosConfigManager(boosCoolDown boosCoolDown) {
|
||||
this.bCoolDown = boosCoolDown;
|
||||
confFile = new File(boosCoolDown.getDataFolder(), "config.yml");
|
||||
conf = new YamlConfiguration();
|
||||
conf.options().copyDefaults(true);
|
||||
conf.addDefault("commands.cooldowns.cooldown./spawn", 60);
|
||||
conf.addDefault("commands.cooldowns.cooldown./home", 30);
|
||||
conf.addDefault("commands.cooldowns.cooldown2./home", 40);
|
||||
conf.addDefault("commands.cooldowns.cooldown3./home", 90);
|
||||
conf.addDefault("commands.cooldowns.cooldown4./home", 99);
|
||||
conf.addDefault("commands.cooldowns.cooldown5./home", 542);
|
||||
conf.addDefault("commands.warmups.warmup./give", 60);
|
||||
conf.addDefault("commands.warmups.warmup./home", 20);
|
||||
conf.addDefault("commands.warmups.warmup2./home", 40);
|
||||
conf.addDefault("commands.warmups.warmup3./home", 90);
|
||||
conf.addDefault("commands.warmups.warmup4./home", 99);
|
||||
conf.addDefault("commands.warmups.warmup5./home", 542);
|
||||
conf.addDefault("commands.prices.price./spawn", 10);
|
||||
conf.addDefault("commands.prices.price./home", 20);
|
||||
conf.addDefault("commands.prices.price2./home", 40);
|
||||
conf.addDefault("commands.prices.price3./home", 90);
|
||||
conf.addDefault("commands.prices.price4./home", 99);
|
||||
conf.addDefault("commands.prices.price5./home", 542);
|
||||
conf.addDefault("commands.options.cancel_warmup_on_damage", false);
|
||||
conf.addDefault("commands.options.cancel_warmup_on_move", false);
|
||||
conf.addDefault("commands.options.cancel_warmup_on_sneak", false);
|
||||
conf.addDefault("commands.options.cancel_warmup_on_sprint", false);
|
||||
conf.addDefault("commands.options.clear_on_restart", false);
|
||||
conf.addDefault("commands.options.unit_seconds", "seconds");
|
||||
conf.addDefault("commands.options.unit_minutes", "minutes");
|
||||
conf.addDefault("commands.options.unit_hours", "hours");
|
||||
conf.addDefault(
|
||||
"commands.options.message_warmup_cancelled_by_damage",
|
||||
"&6Warm-ups have been cancelled due to receiving damage.&f");
|
||||
conf.addDefault(
|
||||
"commands.options.message_warmup_cancelled_by_move",
|
||||
"&6Warm-ups have been cancelled due to moving.&f");
|
||||
conf.addDefault(
|
||||
"commands.options.message_warmup_cancelled_by_sprint",
|
||||
"&6Warm-ups have been cancelled due to sprinting.&f");
|
||||
conf.addDefault(
|
||||
"commands.options.message_warmup_cancelled_by_sneak",
|
||||
"&6Warm-ups have been cancelled due to sneaking.&f");
|
||||
// conf.addDefault(
|
||||
// "commands.options.message_warmup_cancelled_by_death",
|
||||
// "&6Warm-ups have been cancelled due to death.&f");
|
||||
conf.addDefault("commands.options.message_cooldown",
|
||||
"&6Wait&e &seconds& &unit&&6 before you can use command&e &command& &6again.&f");
|
||||
conf.addDefault("commands.options.message_warmup",
|
||||
"&6Wait&e &seconds& &unit&&6 before command&e &command& &6has warmed up.&f");
|
||||
conf.addDefault("commands.options.message_warmup_alreadystarted",
|
||||
"&6Warm-Up process for&e &command& &6has already started.&f");
|
||||
conf.addDefault("commands.options.paid_error",
|
||||
"&6An error has occured:&e %s");
|
||||
conf.addDefault("commands.options.paid_for_command_message",
|
||||
"&6Price of&e &command& &6was&e %s &6and you now have&e %s");
|
||||
|
||||
File f = new File(boosCoolDown.getDataFolder(), "config.yml");
|
||||
conf = null;
|
||||
|
||||
if (f.exists()) {
|
||||
conf = new Configuration(f);
|
||||
conf.load();
|
||||
|
||||
} else {
|
||||
this.confFile = new File(boosCoolDown.getDataFolder(), "config.yml");
|
||||
this.conf = new Configuration(confFile);
|
||||
conf.setProperty("commands.cooldowns.cooldown./spawn", 60);
|
||||
conf.setProperty("commands.cooldowns.cooldown./home", 30);
|
||||
conf.setProperty("commands.cooldowns.cooldown2./home", 40);
|
||||
conf.setProperty("commands.cooldowns.cooldown3./home", 90);
|
||||
conf.setProperty("commands.cooldowns.cooldown4./home", 99);
|
||||
conf.setProperty("commands.cooldowns.cooldown5./home", 542);
|
||||
conf.setProperty("commands.warmups.warmup./give", 60);
|
||||
conf.setProperty("commands.warmups.warmup./home", 20);
|
||||
conf.setProperty("commands.warmups.warmup2./home", 40);
|
||||
conf.setProperty("commands.warmups.warmup3./home", 90);
|
||||
conf.setProperty("commands.warmups.warmup4./home", 99);
|
||||
conf.setProperty("commands.warmups.warmup5./home", 542);
|
||||
conf.setProperty("commands.prices.price./spawn", 10);
|
||||
conf.setProperty("commands.prices.price./home", 20);
|
||||
conf.setProperty("commands.prices.price2./home", 40);
|
||||
conf.setProperty("commands.prices.price3./home", 90);
|
||||
conf.setProperty("commands.prices.price4./home", 99);
|
||||
conf.setProperty("commands.prices.price5./home", 542);
|
||||
conf.setProperty("commands.options.cancel_warmup_on_damage", false);
|
||||
conf.setProperty("commands.options.cancel_warmup_on_move", false);
|
||||
conf.setProperty("commands.options.cancel_warmup_on_sneak", false);
|
||||
conf.setProperty("commands.options.cancel_warmup_on_sprint", 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_by_damage",
|
||||
"&6Warm-ups have been cancelled due to receiving damage.&f");
|
||||
conf.setProperty(
|
||||
"commands.options.message_warmup_cancelled_by_move",
|
||||
"&6Warm-ups have been cancelled due to moving.&f");
|
||||
conf.setProperty(
|
||||
"commands.options.message_warmup_cancelled_by_sprint",
|
||||
"&6Warm-ups have been cancelled due to sprinting.&f");
|
||||
conf.setProperty(
|
||||
"commands.options.message_warmup_cancelled_by_sneak",
|
||||
"&6Warm-ups have been cancelled due to sneaking.&f");
|
||||
// conf.setProperty(
|
||||
// "commands.options.message_warmup_cancelled_by_death",
|
||||
// "&6Warm-ups have been cancelled due to death.&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");
|
||||
conf.setProperty("commands.options.paid_error",
|
||||
"&6An error has occured:&e %s");
|
||||
conf.setProperty("commands.options.paid_for_command_message",
|
||||
"&6Price of&e &command& &6was&e %s &6and you now have&e %s");
|
||||
conf.save();
|
||||
if (confFile.exists()) {
|
||||
try {
|
||||
conf.load(confFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
conf.save(confFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static void load() {
|
||||
conf.load();
|
||||
try {
|
||||
conf.load(confFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static void reload() {
|
||||
|
@ -8,36 +8,23 @@ import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
import util.boosChat;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
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;
|
||||
public static Configuration confusers;
|
||||
private static Permission permissions = null;
|
||||
private static Economy economy = null;
|
||||
@SuppressWarnings("unused")
|
||||
private static Vault vault = null;
|
||||
private static boolean usingVault = false;
|
||||
private static boolean usingEconomy = false;
|
||||
private static boolean usingPermissions = false;
|
||||
private PluginManager pm;
|
||||
@SuppressWarnings("static-access")
|
||||
public void onEnable() {
|
||||
pdfFile = this.getDescription();
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
@ -45,18 +32,16 @@ public class boosCoolDown extends JavaPlugin {
|
||||
+ pdfFile.getVersion() + " by " + pdfFile.getAuthors()
|
||||
+ " is enabled!");
|
||||
|
||||
boosConfigManager boosConfigManager = new boosConfigManager(this);
|
||||
new boosConfigManager(this);
|
||||
boosConfigManager.load();
|
||||
conf = boosConfigManager.conf;
|
||||
boosCoolDownManager boosCoolDownManager = new boosCoolDownManager(this);
|
||||
new boosCoolDownManager(this);
|
||||
boosCoolDownManager.load();
|
||||
pm = getServer().getPluginManager();
|
||||
registerEvents();
|
||||
pm.registerEvents(new boosCoolDownListener(this), this);
|
||||
initializeVault();
|
||||
if (boosConfigManager.getClearOnRestart()) {
|
||||
boosCoolDownManager.clear();
|
||||
}
|
||||
confusers = boosCoolDownManager.confusers;
|
||||
|
||||
}
|
||||
|
||||
@ -142,29 +127,9 @@ public class boosCoolDown extends JavaPlugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void registerEvents(){
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener,
|
||||
Event.Priority.Lowest, this);
|
||||
if (boosConfigManager.getCancelWarmUpOnDamage()) {
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener,
|
||||
Event.Priority.Normal, this);
|
||||
}
|
||||
if (boosConfigManager.getCancelWarmupOnMove()) {
|
||||
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener,
|
||||
Event.Priority.Normal, this);
|
||||
}
|
||||
if (boosConfigManager.getCancelWarmupOnSprint()){
|
||||
pm.registerEvent(Event.Type.PLAYER_TOGGLE_SPRINT, playerListener, Event.Priority.Normal, this);
|
||||
}
|
||||
if(boosConfigManager.getCancelWarmupOnSneak()){
|
||||
pm.registerEvent(Event.Type.PLAYER_TOGGLE_SNEAK, playerListener, Event.Priority.Normal, this);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeVault() {
|
||||
Plugin x = this.getServer().getPluginManager().getPlugin("Vault");
|
||||
if (x != null & x instanceof Vault) {
|
||||
vault = (Vault) x;
|
||||
log.info("[" + pdfFile.getName() + "]"
|
||||
+ " found [Vault] searching for economy plugin.");
|
||||
log.info("[" + pdfFile.getName() + "]"
|
||||
|
@ -1,14 +1,14 @@
|
||||
package cz.boosik.boosCooldown;
|
||||
|
||||
import javax.xml.bind.Marshaller.Listener;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
|
||||
import util.boosChat;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class boosCoolDownEntityListener extends EntityListener {
|
||||
public class boosCoolDownEntityListener extends Listener {
|
||||
@SuppressWarnings("unused")
|
||||
private final boosCoolDown plugin;
|
||||
|
||||
|
@ -1,93 +1,93 @@
|
||||
package cz.boosik.boosCooldown;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
import util.boosChat;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class boosCoolDownManager {
|
||||
|
||||
protected static boosCoolDown bCoolDown;
|
||||
protected static Configuration confusers;
|
||||
protected File usersConfigFile;
|
||||
private static YamlConfiguration confusers;
|
||||
private static File confFile;
|
||||
|
||||
public boosCoolDownManager(boosCoolDown bCoolDown) {
|
||||
boosCoolDownManager.bCoolDown = bCoolDown;
|
||||
File confFile = new File(bCoolDown.getDataFolder(), "users.yml");
|
||||
confFile = new File(bCoolDown.getDataFolder(), "users.yml");
|
||||
|
||||
confusers = null;
|
||||
confusers = new YamlConfiguration();
|
||||
|
||||
if (confFile.exists()) {
|
||||
confusers = new Configuration(confFile);
|
||||
confusers.load();
|
||||
try {
|
||||
confusers.load(confFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
confFile = new File(bCoolDown.getDataFolder(), "users.yml");
|
||||
confusers = new Configuration(confFile);
|
||||
confusers.save();
|
||||
try {
|
||||
confFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void load() {
|
||||
confusers.load();
|
||||
}
|
||||
|
||||
static void reload() {
|
||||
load();
|
||||
try {
|
||||
confusers.load(confFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static void save() {
|
||||
confusers.save();
|
||||
try {
|
||||
confFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static void clear() {
|
||||
List<String> players = new LinkedList<String>();
|
||||
List<String> cooldown = new LinkedList<String>();
|
||||
List<String> warmup = new LinkedList<String>();
|
||||
try {
|
||||
players.addAll(confusers.getKeys("users."));
|
||||
} catch (Exception e) {
|
||||
ConfigurationSection userSection = confusers.getConfigurationSection("users");
|
||||
if (userSection == null)
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
while (i < players.size()) {
|
||||
for (String user : userSection.getKeys(false)) {
|
||||
// clear cooldown
|
||||
cooldown.clear();
|
||||
if (confusers.getKeys("users." + players.get(i) + ".cooldown") != null) {
|
||||
cooldown.addAll(confusers.getKeys("users." + players.get(i)
|
||||
+ ".cooldown"));
|
||||
ConfigurationSection cooldown = confusers.getConfigurationSection("users."+user+".cooldown");
|
||||
if (cooldown != null) {
|
||||
for (String key : cooldown.getKeys(false)) {
|
||||
confusers.set("users."+user+".cooldown."+key, null);
|
||||
}
|
||||
}
|
||||
int j = 0;
|
||||
while (j < cooldown.size()) {
|
||||
confusers.removeProperty("users." + players.get(i)
|
||||
+ ".cooldown." + cooldown.get(j));
|
||||
j++;
|
||||
}
|
||||
confusers.removeProperty("users." + players.get(i) + ".cooldown");
|
||||
confusers.set("users."+user+".cooldown", null);
|
||||
|
||||
// clear warmup
|
||||
warmup.clear();
|
||||
if (confusers.getKeys("users." + players.get(i) + ".warmup") != null) {
|
||||
warmup.addAll(confusers.getKeys("users." + players.get(i)
|
||||
+ ".warmup"));
|
||||
ConfigurationSection warmup = confusers.getConfigurationSection("users."+user+".warmup");
|
||||
if (warmup != null) {
|
||||
for (String key : warmup.getKeys(false)) {
|
||||
confusers.set("users."+user+".warmup."+key, null);
|
||||
}
|
||||
}
|
||||
int k = 0;
|
||||
while (k < warmup.size()) {
|
||||
confusers.removeProperty("users." + players.get(i) + ".warmup."
|
||||
+ warmup.get(k));
|
||||
k++;
|
||||
}
|
||||
confusers.removeProperty("users." + players.get(i) + ".warmup");
|
||||
confusers.set("users." + user + ".warmup", null);
|
||||
|
||||
confusers.removeProperty("users." + players.get(i));
|
||||
i++;
|
||||
confusers.set("users." + user, null);
|
||||
}
|
||||
save();
|
||||
load();
|
||||
@ -218,24 +218,9 @@ public class boosCoolDownManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void cancelCoolDowns(Player player) {
|
||||
List<String> cooldown = new LinkedList<String>();
|
||||
cooldown.clear();
|
||||
cooldown.addAll(confusers.getKeys("users." + player.getName()
|
||||
+ ".cooldown"));
|
||||
int j = 0;
|
||||
while (j < cooldown.size()) {
|
||||
confusers.removeProperty("users." + player.getName() + ".cooldown."
|
||||
+ cooldown.get(j));
|
||||
j++;
|
||||
}
|
||||
confusers.removeProperty("users." + player.getName() + ".cooldown");
|
||||
}
|
||||
|
||||
static void cancelCooldown(Player player, String pre){
|
||||
confusers.removeProperty("users." + player.getName() + ".cooldown." + pre);
|
||||
confusers.save();
|
||||
confusers.set("users." + player.getName() + ".cooldown." + pre, null);
|
||||
}
|
||||
|
||||
static boolean checkCoolDownOK(Player player, String pre, String message) {
|
||||
@ -319,9 +304,9 @@ public class boosCoolDownManager {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
|
||||
currTime = sdf.format(cal.getTime());
|
||||
confusers.setProperty("users." + player.getName() + ".cooldown." + pre,
|
||||
confusers.set("users." + player.getName() + ".cooldown." + pre,
|
||||
currTime);
|
||||
confusers.save();
|
||||
save();
|
||||
}
|
||||
|
||||
static Date getCurrTime() {
|
||||
@ -371,9 +356,8 @@ public class boosCoolDownManager {
|
||||
|
||||
static void setWarmUpOK(Player player, String pre, String message) {
|
||||
pre = pre.toLowerCase();
|
||||
confusers
|
||||
.setProperty("users." + player.getName() + ".warmup." + pre, 1);
|
||||
confusers.save();
|
||||
confusers.set("users." + player.getName() + ".warmup." + pre, 1);
|
||||
save();
|
||||
}
|
||||
|
||||
static boolean checkWarmUpOK(Player player, String pre, String message) {
|
||||
@ -389,24 +373,13 @@ public class boosCoolDownManager {
|
||||
|
||||
static void removeWarmUpOK(Player player, String pre, String message) {
|
||||
pre = pre.toLowerCase();
|
||||
confusers
|
||||
.removeProperty("users." + player.getName() + ".warmup." + pre);
|
||||
confusers.save();
|
||||
confusers.set("users." + player.getName() + ".warmup." + pre, null);
|
||||
save();
|
||||
}
|
||||
|
||||
static void removeWarmUp(Player player, String pre, String message) {
|
||||
pre = pre.toLowerCase();
|
||||
confusers
|
||||
.removeProperty("users." + player.getName() + ".warmup." + pre);
|
||||
confusers.save();
|
||||
}
|
||||
|
||||
static void removeWarmUps(Player player) {
|
||||
for (String key : confusers.getKeys()) {
|
||||
if (key.startsWith("users." + player.getName() + ".warmup.")) {
|
||||
confusers.removeProperty(key);
|
||||
confusers.save();
|
||||
}
|
||||
}
|
||||
confusers.set("users." + player.getName() + ".warmup." + pre, null);
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,11 @@ package cz.boosik.boosCooldown;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.xml.bind.Marshaller.Listener;
|
||||
|
||||
import org.bukkit.Location;
|
||||
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.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
@ -14,8 +15,7 @@ import util.boosChat;
|
||||
|
||||
//import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class boosCoolDownPlayerListener extends PlayerListener {
|
||||
public class boosCoolDownPlayerListener extends Listener {
|
||||
private final boosCoolDown plugin;
|
||||
private static ConcurrentHashMap<String, Location> playerloc = new ConcurrentHashMap<String, Location>();
|
||||
private static ConcurrentHashMap<String, String> playerworld = new ConcurrentHashMap<String, String>();
|
||||
@ -24,7 +24,6 @@ public class boosCoolDownPlayerListener extends PlayerListener {
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
|
@ -33,18 +33,18 @@ public class boosWarmUpTimer extends TimerTask {
|
||||
boosCoolDownManager.setWarmUpOK(player, pre, message);
|
||||
boosWarmUpManager.removeWarmUpProcess(player.getName() + "@"
|
||||
+ pre);
|
||||
boosCoolDownPlayerListener.clearLocWorld(player);
|
||||
boosCoolDownListener.clearLocWorld(player);
|
||||
player.chat(pre + message);
|
||||
} else if (player.isOnline() && player.isDead() && boosWarmUpManager.hasWarmUps(player)){
|
||||
boosCoolDownManager.removeWarmUp(player, pre, message);
|
||||
boosWarmUpManager.removeWarmUpProcess(player.getName() + "@"
|
||||
+ pre);
|
||||
boosCoolDownPlayerListener.clearLocWorld(player);
|
||||
boosCoolDownListener.clearLocWorld(player);
|
||||
} else if (!player.isOnline() && boosWarmUpManager.hasWarmUps(player)){
|
||||
boosCoolDownManager.removeWarmUp(player, pre, message);
|
||||
boosWarmUpManager.removeWarmUpProcess(player.getName() + "@"
|
||||
+ pre);
|
||||
boosCoolDownPlayerListener.clearLocWorld(player);
|
||||
boosCoolDownListener.clearLocWorld(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: boosCooldown
|
||||
main: cz.boosik.boosCooldown.boosCoolDown
|
||||
version: 2.0.3
|
||||
version: 2.1.0
|
||||
author: boosik
|
||||
softdepend: [Vault, iConomy 4 & 5 & 6, BOSEconomy 6 & 7, EssentialsEcon, 3Co, MultiCurrency, MineConomy, eWallet, EconXP]
|
||||
description: >
|
||||
|
@ -14,7 +14,6 @@ public class boosChat {
|
||||
static List<String> Colors = new LinkedList<String>();
|
||||
static Server server;
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public boosChat(Server server) {
|
||||
Colors.add("&black&"); Colors.add("&darkblue&"); Colors.add("&darkgreen&");
|
||||
Colors.add("&darkaqua&"); Colors.add("&darkred&"); Colors.add("&purple&");
|
||||
@ -26,7 +25,7 @@ public class boosChat {
|
||||
Colors.add("&5"); Colors.add("&6"); Colors.add("&7"); Colors.add("&8"); Colors.add("&9");
|
||||
Colors.add("&a"); Colors.add("&b"); Colors.add("&c"); Colors.add("&d"); Colors.add("&e");
|
||||
Colors.add("&f");
|
||||
this.server = server;
|
||||
boosChat.server = server;
|
||||
}
|
||||
|
||||
static String replaceColorCodes(String line) {
|
||||
|
Loading…
Reference in New Issue
Block a user