mirror of
https://github.com/ArthurDanjou/WitchRush.git
synced 2026-01-28 19:00:32 +01:00
Soon done inshallah
This commit is contained in:
@@ -6,6 +6,7 @@ import net.berrygames.witchrush.listeners.ListenersManager;
|
|||||||
import net.berrygames.witchrush.team.TeamManager;
|
import net.berrygames.witchrush.team.TeamManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@@ -63,6 +64,19 @@ public class WitchRush extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setConf(String path, Object value){
|
||||||
|
this.conf.set(path, value);
|
||||||
|
try {
|
||||||
|
this.conf.save(this.file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileConfiguration getConf(){
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
System.out.println("*-*-*-*-*-*-*-*");
|
System.out.println("*-*-*-*-*-*-*-*");
|
||||||
@@ -72,18 +86,14 @@ public class WitchRush extends JavaPlugin {
|
|||||||
System.out.println("*-*-*-*-*-*-*-*");
|
System.out.println("*-*-*-*-*-*-*-*");
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
|
|
||||||
for(Player pls : Bukkit.getOnlinePlayers()){
|
Bukkit.getOnlinePlayers().forEach(pls -> pls.kickPlayer(ChatColor.RED+"Le serveur redémarre"));
|
||||||
pls.kickPlayer(ChatColor.RED+"Le serveur redémarre");
|
Bukkit.getWorld("world").getEntities().forEach(en -> en.remove());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
public FileConfiguration getMode() {
|
|
||||||
return conf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TeamManager getTeamManager() {
|
public TeamManager getTeamManager() {
|
||||||
return teamManager;
|
return teamManager;
|
||||||
|
|||||||
@@ -23,35 +23,35 @@ public class LocationsCMD implements CommandExecutor {
|
|||||||
case "bleu":
|
case "bleu":
|
||||||
switch (args[1].toLowerCase()){
|
switch (args[1].toLowerCase()){
|
||||||
case "shop":
|
case "shop":
|
||||||
WitchRush.get().getMode().set("teams.bleu.shop.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.bleu.shop.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.bleu.shop.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.bleu.shop.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.bleu.shop.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.bleu.shop.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.bleu.shop.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.bleu.shop.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.bleu.shop.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.bleu.shop.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "spawn":
|
case "spawn":
|
||||||
WitchRush.get().getMode().set("teams.bleu.spawn.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.bleu.spawn.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.bleu.spawn.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.bleu.spawn.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.bleu.spawn.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.bleu.spawn.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.bleu.spawn.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.bleu.spawn.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.bleu.spawn.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.bleu.spawn.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "upgrade":
|
case "upgrade":
|
||||||
WitchRush.get().getMode().set("teams.bleu.upgrade.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.bleu.upgrade.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.bleu.upgrade.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.bleu.upgrade.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.bleu.upgrade.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.bleu.upgrade.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.bleu.upgrade.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.bleu.upgrade.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.bleu.upgrade.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.bleu.upgrade.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "boss":
|
case "boss":
|
||||||
WitchRush.get().getMode().set("teams.bleu.boss.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.bleu.boss.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.bleu.boss.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.bleu.boss.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.bleu.boss.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.bleu.boss.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.bleu.boss.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.bleu.boss.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.bleu.boss.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.bleu.boss.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -62,35 +62,35 @@ public class LocationsCMD implements CommandExecutor {
|
|||||||
case "vert":
|
case "vert":
|
||||||
switch (args[1].toLowerCase()){
|
switch (args[1].toLowerCase()){
|
||||||
case "shop":
|
case "shop":
|
||||||
WitchRush.get().getMode().set("teams.vert.shop.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.vert.shop.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.vert.shop.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.vert.shop.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.vert.shop.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.vert.shop.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.vert.shop.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.vert.shop.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.vert.shop.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.vert.shop.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "spawn":
|
case "spawn":
|
||||||
WitchRush.get().getMode().set("teams.vert.spawn.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.vert.spawn.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.vert.spawn.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.vert.spawn.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.vert.spawn.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.vert.spawn.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.vert.spawn.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.vert.spawn.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.vert.spawn.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.vert.spawn.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "upgrade":
|
case "upgrade":
|
||||||
WitchRush.get().getMode().set("teams.vert.upgrade.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.vert.upgrade.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.vert.upgrade.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.vert.upgrade.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.vert.upgrade.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.vert.upgrade.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.vert.upgrade.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.vert.upgrade.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.vert.upgrade.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.vert.upgrade.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "boss":
|
case "boss":
|
||||||
WitchRush.get().getMode().set("teams.vert.boss.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.vert.boss.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.vert.boss.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.vert.boss.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.vert.boss.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.vert.boss.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.vert.boss.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.vert.boss.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.vert.boss.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.vert.boss.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -101,35 +101,35 @@ public class LocationsCMD implements CommandExecutor {
|
|||||||
case "jaune":
|
case "jaune":
|
||||||
switch (args[1].toLowerCase()){
|
switch (args[1].toLowerCase()){
|
||||||
case "shop":
|
case "shop":
|
||||||
WitchRush.get().getMode().set("teams.jaune.shop.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.jaune.shop.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.jaune.shop.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.jaune.shop.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.jaune.shop.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.jaune.shop.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.jaune.shop.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.jaune.shop.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.jaune.shop.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.jaune.shop.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "spawn":
|
case "spawn":
|
||||||
WitchRush.get().getMode().set("teams.jaune.spawn.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.jaune.spawn.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.jaune.spawn.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.jaune.spawn.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.jaune.spawn.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.jaune.spawn.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.jaune.spawn.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.jaune.spawn.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.jaune.spawn.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.jaune.spawn.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "upgrade":
|
case "upgrade":
|
||||||
WitchRush.get().getMode().set("teams.jaune.upgrade.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.jaune.upgrade.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.jaune.upgrade.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.jaune.upgrade.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.jaune.upgrade.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.jaune.upgrade.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.jaune.upgrade.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.jaune.upgrade.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.jaune.upgrade.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.jaune.upgrade.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "boss":
|
case "boss":
|
||||||
WitchRush.get().getMode().set("teams.jaune.boss.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.jaune.boss.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.jaune.boss.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.jaune.boss.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.jaune.boss.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.jaune.boss.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.jaune.boss.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.jaune.boss.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.jaune.boss.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.jaune.boss.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -140,35 +140,35 @@ public class LocationsCMD implements CommandExecutor {
|
|||||||
case "rouge":
|
case "rouge":
|
||||||
switch (args[1].toLowerCase()){
|
switch (args[1].toLowerCase()){
|
||||||
case "shop":
|
case "shop":
|
||||||
WitchRush.get().getMode().set("teams.rouge.shop.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.rouge.shop.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.rouge.shop.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.rouge.shop.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.rouge.shop.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.rouge.shop.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.rouge.shop.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.rouge.shop.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.rouge.shop.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.rouge.shop.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "spawn":
|
case "spawn":
|
||||||
WitchRush.get().getMode().set("teams.rouge.spawn.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.rouge.spawn.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.rouge.spawn.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.rouge.spawn.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.rouge.spawn.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.rouge.spawn.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.rouge.spawn.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.rouge.spawn.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.rouge.spawn.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.rouge.spawn.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "upgrade":
|
case "upgrade":
|
||||||
WitchRush.get().getMode().set("teams.rouge.upgrade.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.rouge.upgrade.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.rouge.upgrade.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.rouge.upgrade.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.rouge.upgrade.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.rouge.upgrade.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.rouge.upgrade.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.rouge.upgrade.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.rouge.upgrade.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.rouge.upgrade.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
case "boss":
|
case "boss":
|
||||||
WitchRush.get().getMode().set("teams.rouge.boss.x", player.getLocation().getX());
|
WitchRush.get().setConf("teams.rouge.boss.x", player.getLocation().getX());
|
||||||
WitchRush.get().getMode().set("teams.rouge.boss.y", player.getLocation().getY());
|
WitchRush.get().setConf("teams.rouge.boss.y", player.getLocation().getY());
|
||||||
WitchRush.get().getMode().set("teams.rouge.boss.z", player.getLocation().getZ());
|
WitchRush.get().setConf("teams.rouge.boss.z", player.getLocation().getZ());
|
||||||
WitchRush.get().getMode().set("teams.rouge.boss.yaw", player.getLocation().getYaw());
|
WitchRush.get().setConf("teams.rouge.boss.yaw", player.getLocation().getYaw());
|
||||||
WitchRush.get().getMode().set("teams.rouge.boss.pitch", player.getLocation().getPitch());
|
WitchRush.get().setConf("teams.rouge.boss.pitch", player.getLocation().getPitch());
|
||||||
player.sendMessage("Location ajoutée !");
|
player.sendMessage("Location ajoutée !");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class GameManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
new HealthRunnable().runTaskTimer(WitchRush.get(), 0L, 20L);
|
new HealthRunnable().runTaskTimer(WitchRush.get(), 0L, 20L);
|
||||||
}, 10 * 20);
|
}, 3 * 20 * 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import net.berrygames.witchrush.WitchRush;
|
|||||||
import net.berrygames.witchrush.game.GameState;
|
import net.berrygames.witchrush.game.GameState;
|
||||||
import net.berrygames.witchrush.team.TeamsInfos;
|
import net.berrygames.witchrush.team.TeamsInfos;
|
||||||
import net.berrygames.witchrush.team.TeamManager;
|
import net.berrygames.witchrush.team.TeamManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Witch;
|
import org.bukkit.entity.Witch;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -31,7 +33,7 @@ public class DamageEvent implements Listener {
|
|||||||
player.sendMessage("§cVous ne pouvez pas tuer votre boss !");
|
player.sendMessage("§cVous ne pouvez pas tuer votre boss !");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*for(TeamsInfos infos : TeamsInfos.values()){
|
for(TeamsInfos infos : TeamsInfos.values()){
|
||||||
if(teamManager.getTeamBoss(infos).getWitch().equals(witch)){
|
if(teamManager.getTeamBoss(infos).getWitch().equals(witch)){
|
||||||
Bukkit.getOnlinePlayers().forEach(pls -> {
|
Bukkit.getOnlinePlayers().forEach(pls -> {
|
||||||
if(teamManager.getPlayerTeam(pls).equals(infos)){
|
if(teamManager.getPlayerTeam(pls).equals(infos)){
|
||||||
@@ -40,7 +42,7 @@ public class DamageEvent implements Listener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
break;
|
break;
|
||||||
case VILLAGER:
|
case VILLAGER:
|
||||||
if(e.getDamager() instanceof Player) e.setCancelled(true);
|
if(e.getDamager() instanceof Player) e.setCancelled(true);
|
||||||
|
|||||||
@@ -34,19 +34,16 @@ public class EntityDeath implements Listener {
|
|||||||
teamInfos = teamInfosList;
|
teamInfos = teamInfosList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(witch.getCustomName());
|
|
||||||
System.out.println(witch.getName());
|
|
||||||
System.out.println(teamManager.getTeamBoss(teamInfos).getWitch().getCustomName());
|
|
||||||
System.out.println(teamManager.getTeamBoss(teamInfos).getWitch().getName());
|
|
||||||
if(teamManager.getTeamBoss(teamInfos).getWitch().equals(witch)){
|
if(teamManager.getTeamBoss(teamInfos).getWitch().equals(witch)){
|
||||||
Bukkit.broadcastMessage(WitchRush.prefix()+" Le boss des"+teamInfos.getChatColor()+teamInfos.getTeamName()+"s §dest mort");
|
Bukkit.broadcastMessage(WitchRush.prefix()+" Le boss des "+teamInfos.getChatColor()+teamInfos.getTeamName().toUpperCase()+"s §dest mort");
|
||||||
TeamsInfos finalTeamInfos = teamInfos;
|
final TeamsInfos finalTeamInfos = teamInfos;
|
||||||
Bukkit.getOnlinePlayers().forEach(pls -> {
|
Bukkit.getOnlinePlayers().forEach(pls -> {
|
||||||
pls.playSound(pls.getLocation(), Sound.ENTITY_WITHER_DEATH, 1.0f, 1.0f);
|
pls.playSound(pls.getLocation(), Sound.ENTITY_WITHER_DEATH, 1.0f, 1.0f);
|
||||||
if(teamManager.isPlayerInTeam(pls, finalTeamInfos)){
|
if(teamManager.isPlayerInTeam(pls, finalTeamInfos)){
|
||||||
pls.sendMessage("Votre boss est mort !");
|
pls.sendMessage("§4Votre boss est mort !");
|
||||||
pls.sendMessage("Ne mourrez pas");
|
pls.sendMessage("§4Ne mourrez pas");
|
||||||
pls.sendTitle("§cAttention","Votre boss est mort !");
|
pls.sendTitle("§cAttention","§c§oVotre boss est mort !");
|
||||||
|
teamManager.getBossEntityMap().remove(finalTeamInfos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class PlayerChat implements Listener {
|
|||||||
Bukkit.getOnlinePlayers().forEach(playerOnline -> {
|
Bukkit.getOnlinePlayers().forEach(playerOnline -> {
|
||||||
final TeamsInfos teamInfos = WitchRush.get().getTeamManager().getPlayerTeam(player);
|
final TeamsInfos teamInfos = WitchRush.get().getTeamManager().getPlayerTeam(player);
|
||||||
if(WitchRush.get().getTeamManager().getPlayerTeam(playerOnline).equals(teamInfos)){
|
if(WitchRush.get().getTeamManager().getPlayerTeam(playerOnline).equals(teamInfos)){
|
||||||
playerOnline.sendMessage("§7["+teamInfos.getChatColor()+teamInfos.getTeamName()+"§7] "
|
playerOnline.sendMessage("§7["+teamInfos.getChatColor()+teamInfos.getIDName()+"§7] "
|
||||||
+WitchRush.get().getTeamManager().getPlayerTeam(playerOnline).getChatColor()
|
+WitchRush.get().getTeamManager().getPlayerTeam(playerOnline).getChatColor()
|
||||||
+player.getDisplayName()+" §7» §f"+message.replace("!","§r"));
|
+player.getDisplayName()+" §7» §f"+message.replace("!","§r"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class PlayerJoin implements Listener {
|
|||||||
player.sendMessage("§7Seuls les autres spectateurs voient vos messages !");
|
player.sendMessage("§7Seuls les autres spectateurs voient vos messages !");
|
||||||
player.sendMessage(" ");
|
player.sendMessage(" ");
|
||||||
e.setJoinMessage(null);
|
e.setJoinMessage(null);
|
||||||
|
witchPlayer.setSpectator(true);
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
player.setLevel(0);
|
player.setLevel(0);
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class PlayerQuit implements Listener {
|
|||||||
e.setQuitMessage(null);
|
e.setQuitMessage(null);
|
||||||
break;
|
break;
|
||||||
case GAME:
|
case GAME:
|
||||||
|
if(witchPlayer.isSpectator()) return;
|
||||||
e.setQuitMessage(
|
e.setQuitMessage(
|
||||||
WitchRush.prefix()+"§e"+player.getName()+
|
WitchRush.prefix()+"§e"+player.getName()+
|
||||||
" §da quitté la partie §7(§d"+
|
" §da quitté la partie §7(§d"+
|
||||||
|
|||||||
@@ -55,46 +55,40 @@ public class TeamManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInLife(final TeamsInfos teamInfos) {
|
public boolean isInLife(final TeamsInfos teamInfos) {
|
||||||
if(getBossEntityMap().containsKey(teamInfos)){
|
return getBossEntityMap().containsKey(teamInfos);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getBossLocation(final TeamsInfos teamInfos) {
|
public Location getBossLocation(final TeamsInfos teamInfos) {
|
||||||
return new Location(Bukkit.getWorld("world"),
|
return new Location(Bukkit.getWorld("world"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".boss.x"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".boss.x"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".boss.y"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".boss.y"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".boss.z"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".boss.z"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".boss.yaw"),
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".boss.yaw"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".boss.pitch"));
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".boss.pitch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getShopLocation(final TeamsInfos teamInfos) {
|
public Location getShopLocation(final TeamsInfos teamInfos) {
|
||||||
return new Location(Bukkit.getWorld("world"),
|
return new Location(Bukkit.getWorld("world"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".shop.x"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".shop.x"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".shop.y"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".shop.y"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".shop.z"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".shop.z"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".shop.yaw"),
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".shop.yaw"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".shop.pitch"));
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".shop.pitch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getUpgradeLocation(final TeamsInfos teamInfos) {
|
public Location getUpgradeLocation(final TeamsInfos teamInfos) {
|
||||||
return new Location(Bukkit.getWorld("world"),
|
return new Location(Bukkit.getWorld("world"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".upgrade.x"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".upgrade.x"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".upgrade.y"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".upgrade.y"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".upgrade.z"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".upgrade.z"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".upgrade.yaw"),
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".upgrade.yaw"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".upgrade.pitch"));
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".upgrade.pitch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getTeamLocation(final TeamsInfos teamInfos) {
|
public Location getTeamLocation(final TeamsInfos teamInfos) {
|
||||||
return new Location(Bukkit.getWorld("world"),
|
return new Location(Bukkit.getWorld("world"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".spawn.x"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".spawn.x"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".spawn.y"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".spawn.y"),
|
||||||
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".spawn.z"),
|
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".spawn.z"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".spawn.yaw"),
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".spawn.yaw"),
|
||||||
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".spawn.pitch"));
|
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".spawn.pitch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerInTeam(final Player player, final TeamsInfos teamInfos) {
|
public boolean isPlayerInTeam(final Player player, final TeamsInfos teamInfos) {
|
||||||
@@ -103,9 +97,7 @@ public class TeamManager {
|
|||||||
|
|
||||||
public boolean playerHaveTeam(final Player player) {
|
public boolean playerHaveTeam(final Player player) {
|
||||||
for (final TeamsInfos teamInfos : TeamsInfos.values()) {
|
for (final TeamsInfos teamInfos : TeamsInfos.values()) {
|
||||||
if (this.playerTeamList.get(teamInfos) != null && this.playerTeamList.get(teamInfos).contains(player)) {
|
return isPlayerInTeam(player, teamInfos);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import org.bukkit.Color;
|
|||||||
|
|
||||||
public enum TeamsInfos {
|
public enum TeamsInfos {
|
||||||
|
|
||||||
VERT(0,"Vert", "vert", "§a", (short)13, Color.GREEN),
|
VERT(0,"Vert", "vert", "§a", (short)13, Color.GREEN, 23),
|
||||||
BLEU(1,"Bleu", "bleu", "§b", (short)11, Color.BLUE),
|
BLEU(1,"Bleu", "bleu", "§b", (short)11, Color.BLUE, 19),
|
||||||
JAUNE(2,"Jaune", "jaune", "§e", (short)4, Color.YELLOW),
|
JAUNE(2,"Jaune", "jaune", "§e", (short)4, Color.YELLOW, 21),
|
||||||
ROUGE(3,"Rouge", "rouge", "§c", (short)14, Color.RED),
|
ROUGE(3,"Rouge", "rouge", "§c", (short)14, Color.RED, 25),
|
||||||
;
|
;
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
@@ -17,14 +17,16 @@ public enum TeamsInfos {
|
|||||||
private String chatColor;
|
private String chatColor;
|
||||||
private short dataClay;
|
private short dataClay;
|
||||||
private Color color;
|
private Color color;
|
||||||
|
private int slotGUI;
|
||||||
|
|
||||||
TeamsInfos(int id, String IDName, String teamName, String chatColor, short dataClay, Color color) {
|
TeamsInfos(int id, String IDName, String teamName, String chatColor, short dataClay, Color color, int slotGUI) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.IDName = IDName;
|
this.IDName = IDName;
|
||||||
this.teamName = teamName;
|
this.teamName = teamName;
|
||||||
this.chatColor = chatColor;
|
this.chatColor = chatColor;
|
||||||
this.dataClay = dataClay;
|
this.dataClay = dataClay;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
this.slotGUI = slotGUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIDName() {
|
public String getIDName() {
|
||||||
@@ -51,6 +53,10 @@ public enum TeamsInfos {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSlotGUI() {
|
||||||
|
return slotGUI;
|
||||||
|
}
|
||||||
|
|
||||||
public static TeamsInfos getTeamInfosByIDName(final String ID) {
|
public static TeamsInfos getTeamInfosByIDName(final String ID) {
|
||||||
for (final TeamsInfos teamInfos : values()) {
|
for (final TeamsInfos teamInfos : values()) {
|
||||||
if (teamInfos.getIDName().equalsIgnoreCase(ID)) {
|
if (teamInfos.getIDName().equalsIgnoreCase(ID)) {
|
||||||
|
|||||||
@@ -15,33 +15,30 @@ public class TeamsMenu {
|
|||||||
|
|
||||||
public TeamsMenu(Player player) {
|
public TeamsMenu(Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
inventory = Bukkit.createInventory(null, 4 * 9, WitchRush.prefix()+"Teams");
|
inventory = Bukkit.createInventory(null, 5 * 9, WitchRush.prefix()+"Teams");
|
||||||
|
|
||||||
for(int i = 0; i < 9; i++){
|
for(int i = 0; i < 9; i++){
|
||||||
inventory.setItem(i, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
inventory.setItem(i, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
||||||
}
|
}
|
||||||
for(int i = 45; i < 54; i++){
|
for(int i = 36; i < 45; i++){
|
||||||
inventory.setItem(i, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
inventory.setItem(i, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
||||||
}
|
}
|
||||||
inventory.setItem(9, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
inventory.setItem(9, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
||||||
inventory.setItem(17, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
inventory.setItem(17, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
||||||
inventory.setItem(36, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
inventory.setItem(27, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
||||||
inventory.setItem(44, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
inventory.setItem(35, new ItemFactory(Material.STAINED_GLASS_PANE).withName("").withColor(DyeColor.PINK).done());
|
||||||
|
|
||||||
inventory.setItem(40, new ItemFactory(Material.DOUBLE_PLANT).withName("§dTeam Random").done());
|
inventory.setItem(31, new ItemFactory(Material.DOUBLE_PLANT).withName("§dTeam Random").done());
|
||||||
|
|
||||||
for(int i = 0; i < TeamsInfos.values().length; i++){
|
for(TeamsInfos infos : TeamsInfos.values()){
|
||||||
for(int slot = 10; slot < 17; slot++){
|
inventory.setItem(infos.getSlotGUI(), new ItemFactory(Material.WOOL)
|
||||||
inventory.setItem(slot, new ItemFactory(Material.WOOL).withName(TeamsInfos.getTeamInfosByID(i).getTeamName()).done());
|
.withName(infos.getChatColor()+infos.getTeamName())
|
||||||
}
|
.withColor(infos.getColor())
|
||||||
for(int slot = 19; slot < 26; slot++){
|
.done());
|
||||||
inventory.setItem(slot, new ItemFactory(Material.WOOL).withName(TeamsInfos.getTeamInfosByID(i).getTeamName()).done());
|
|
||||||
}
|
|
||||||
inventory.setItem(30, new ItemFactory(Material.WOOL).withName(TeamsInfos.getTeamInfosByID(i).getTeamName()).done());
|
|
||||||
inventory.setItem(32, new ItemFactory(Material.WOOL).withName(TeamsInfos.getTeamInfosByID(i).getTeamName()).done());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inventory.setItem(49, new ItemFactory(Material.BARRIER).withName("§cFermer").done());
|
|
||||||
|
inventory.setItem(40, new ItemFactory(Material.BARRIER).withName("§cFermer").done());
|
||||||
player.openInventory(inventory);
|
player.openInventory(inventory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.berrygames.witchrush.tools;
|
package net.berrygames.witchrush.tools;
|
||||||
|
|
||||||
|
import org.bukkit.Color;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@@ -48,6 +49,11 @@ public class ItemFactory {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemFactory withColor(final Color color) {
|
||||||
|
this.item.setDurability((short) DyeColor.getByColor(color).getWoolData());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemFactory withOwner(final String owner) {
|
public ItemFactory withOwner(final String owner) {
|
||||||
if (this.item.getType().equals((Object)Material.SKULL_ITEM)) {
|
if (this.item.getType().equals((Object)Material.SKULL_ITEM)) {
|
||||||
this.item.setDurability((short)3);
|
this.item.setDurability((short)3);
|
||||||
|
|||||||
Reference in New Issue
Block a user