Untitled diff

Created Diff never expires
48 removals
50 lines
40 additions
41 lines
if(sub.equalsIgnoreCase("spawn")){
if(sub.equalsIgnoreCase("spawn")){
if(p.hasPermission("potpvp.spawn")){
if(p.hasPermission("potpvp.spawn")){
if (Main.instance.getConfig().getConfigurationSection("spawn") == null) {
FileConfiguration conf = Main.instance.getConfig();
if (conf.getConfigurationSection("spawn") == null) {
p.getPlayer().sendMessage("§cThe spawn has not yet been set!");
p.getPlayer().sendMessage("§cThe spawn has not yet been set!");
return true;
return true;
}
}
if(contadorempezado == false) {
if(listaDePlayersTeletransportando.contains(p.getUniqueId())){
contadorempezado = true;
conf.getString("messages.spawn-start-cooldown").replace("&", "§"); //Que es esto, no mensaje de "ya estas teletransportando"?
Main.instance.getConfig().getString("messages.spawn-start-cooldown").replace('&', '§');
return true;
new BukkitRunnable(){
}
@EventHandler
listaDePlayersTeletransportando.add(p.getUniqueId());
public void onMove(PlayerMoveEvent e){
conf.getString("messages.spawn-start-cooldown").replace('&', '§');
if(contadorempezado==true){
new BukkitRunnable(){
e.getPlayer().sendMessage(Main.instance.getConfig().getString("messages.spawn-cancel")
Location stored = p.getLocation().clone();
.replace('&', '§'));
public void run() {
this.cancel();
if(contador > 0) {
Location current = p.getLocation();
if(current.getX() != stored.getX() && current.getZ() != stored.getZ()) {
cancel(); //envia mensaje 'countdown cancelled'
return;
}
}
}
contador = contador-1;
public void run(){
DecimalFormat df = new DecimalFormat("#.#"); //si contador es un integer, no es necessario..
if(contador > 1) {
p.sendMessage(conf.getString("messages.spawn-cooldown").replace('&', '§')
contador = contador-1;
.replace("{time}", df.format(contador)));
DecimalFormat df = new DecimalFormat("#.#");
} else {
p.sendMessage(Bukkit.getPluginManager().getPlugin("PotPvP").getConfig()
this.cancel();
.getString("messages.spawn-cooldown").replace('&', '§')
conf.getString("messages.spawn").replace("&", "§");
.replace("{time}", df.format(contador)));
contador = conf.getInt("spawn-cooldown");
} else {
World w = Bukkit.getWorld(conf.getString("spawn.world"));
this.cancel();
double x = conf.getDouble("spawn.x");
Main.instance.getConfig().getString("messages.spawn").replace("&", "§");
double y = conf.getDouble("spawn.y");
contador = Main.instance.getConfig().getInt("spawn-cooldown");
double z = conf.getDouble("spawn.z");
World w = Bukkit.getWorld(Main.instance.getConfig().getString("spawn.world"));
p.teleport(new Location(w,x,y,z));
double x = Main.instance.getConfig().getDouble("spawn.x");
listaDePlayersTeletransportando.remove(p.getUniqueId());
double y = Main.instance.getConfig().getDouble("spawn.y");
double z = Main.instance.getConfig().getDouble("spawn.z");
p.teleport(new Location(w,x,y,z));
Bukkit.getScheduler().runTaskLater(Main.instance, new Runnable(){
@Override
public void run() {
contadorempezado = false;
}
}, Main.instance.getConfig().getInt("spawn-cooldown")*20L);
}
}
}
}.runTaskTimer(Main.instance, 20L, 20L);
}

}.runTaskTimer(Main.instance, 20L, 20L);

}else if(contadorempezado == true){
Main.instance.getConfig().getString("messages.spawn-start-cooldown").replace("&", "§");
}
}
}
}
}