Soon done inshallah

This commit is contained in:
BunSLaPatate
2018-10-13 19:52:09 +02:00
parent d38df66af5
commit 16fa9a695d
12 changed files with 161 additions and 149 deletions

View File

@@ -6,6 +6,7 @@ import net.berrygames.witchrush.listeners.ListenersManager;
import net.berrygames.witchrush.team.TeamManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
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
public void onDisable() {
System.out.println("*-*-*-*-*-*-*-*");
@@ -72,18 +86,14 @@ public class WitchRush extends JavaPlugin {
System.out.println("*-*-*-*-*-*-*-*");
super.onDisable();
for(Player pls : Bukkit.getOnlinePlayers()){
pls.kickPlayer(ChatColor.RED+"Le serveur redémarre");
}
Bukkit.getOnlinePlayers().forEach(pls -> pls.kickPlayer(ChatColor.RED+"Le serveur redémarre"));
Bukkit.getWorld("world").getEntities().forEach(en -> en.remove());
}
@Override
public File getFile() {
return file;
}
public FileConfiguration getMode() {
return conf;
}
public TeamManager getTeamManager() {
return teamManager;

View File

@@ -23,35 +23,35 @@ public class LocationsCMD implements CommandExecutor {
case "bleu":
switch (args[1].toLowerCase()){
case "shop":
WitchRush.get().getMode().set("teams.bleu.shop.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.bleu.shop.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.bleu.shop.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.bleu.shop.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.bleu.shop.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.bleu.shop.x", player.getLocation().getX());
WitchRush.get().setConf("teams.bleu.shop.y", player.getLocation().getY());
WitchRush.get().setConf("teams.bleu.shop.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.bleu.shop.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.bleu.shop.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "spawn":
WitchRush.get().getMode().set("teams.bleu.spawn.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.bleu.spawn.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.bleu.spawn.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.bleu.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.bleu.spawn.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.bleu.spawn.x", player.getLocation().getX());
WitchRush.get().setConf("teams.bleu.spawn.y", player.getLocation().getY());
WitchRush.get().setConf("teams.bleu.spawn.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.bleu.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.bleu.spawn.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "upgrade":
WitchRush.get().getMode().set("teams.bleu.upgrade.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.bleu.upgrade.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.bleu.upgrade.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.bleu.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.bleu.upgrade.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.bleu.upgrade.x", player.getLocation().getX());
WitchRush.get().setConf("teams.bleu.upgrade.y", player.getLocation().getY());
WitchRush.get().setConf("teams.bleu.upgrade.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.bleu.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.bleu.upgrade.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "boss":
WitchRush.get().getMode().set("teams.bleu.boss.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.bleu.boss.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.bleu.boss.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.bleu.boss.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.bleu.boss.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.bleu.boss.x", player.getLocation().getX());
WitchRush.get().setConf("teams.bleu.boss.y", player.getLocation().getY());
WitchRush.get().setConf("teams.bleu.boss.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.bleu.boss.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.bleu.boss.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
default:
@@ -62,35 +62,35 @@ public class LocationsCMD implements CommandExecutor {
case "vert":
switch (args[1].toLowerCase()){
case "shop":
WitchRush.get().getMode().set("teams.vert.shop.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.vert.shop.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.vert.shop.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.vert.shop.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.vert.shop.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.vert.shop.x", player.getLocation().getX());
WitchRush.get().setConf("teams.vert.shop.y", player.getLocation().getY());
WitchRush.get().setConf("teams.vert.shop.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.vert.shop.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.vert.shop.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "spawn":
WitchRush.get().getMode().set("teams.vert.spawn.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.vert.spawn.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.vert.spawn.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.vert.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.vert.spawn.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.vert.spawn.x", player.getLocation().getX());
WitchRush.get().setConf("teams.vert.spawn.y", player.getLocation().getY());
WitchRush.get().setConf("teams.vert.spawn.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.vert.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.vert.spawn.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "upgrade":
WitchRush.get().getMode().set("teams.vert.upgrade.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.vert.upgrade.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.vert.upgrade.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.vert.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.vert.upgrade.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.vert.upgrade.x", player.getLocation().getX());
WitchRush.get().setConf("teams.vert.upgrade.y", player.getLocation().getY());
WitchRush.get().setConf("teams.vert.upgrade.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.vert.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.vert.upgrade.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "boss":
WitchRush.get().getMode().set("teams.vert.boss.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.vert.boss.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.vert.boss.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.vert.boss.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.vert.boss.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.vert.boss.x", player.getLocation().getX());
WitchRush.get().setConf("teams.vert.boss.y", player.getLocation().getY());
WitchRush.get().setConf("teams.vert.boss.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.vert.boss.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.vert.boss.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
default:
@@ -101,35 +101,35 @@ public class LocationsCMD implements CommandExecutor {
case "jaune":
switch (args[1].toLowerCase()){
case "shop":
WitchRush.get().getMode().set("teams.jaune.shop.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.jaune.shop.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.jaune.shop.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.jaune.shop.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.jaune.shop.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.jaune.shop.x", player.getLocation().getX());
WitchRush.get().setConf("teams.jaune.shop.y", player.getLocation().getY());
WitchRush.get().setConf("teams.jaune.shop.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.jaune.shop.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.jaune.shop.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "spawn":
WitchRush.get().getMode().set("teams.jaune.spawn.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.jaune.spawn.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.jaune.spawn.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.jaune.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.jaune.spawn.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.jaune.spawn.x", player.getLocation().getX());
WitchRush.get().setConf("teams.jaune.spawn.y", player.getLocation().getY());
WitchRush.get().setConf("teams.jaune.spawn.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.jaune.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.jaune.spawn.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "upgrade":
WitchRush.get().getMode().set("teams.jaune.upgrade.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.jaune.upgrade.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.jaune.upgrade.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.jaune.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.jaune.upgrade.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.jaune.upgrade.x", player.getLocation().getX());
WitchRush.get().setConf("teams.jaune.upgrade.y", player.getLocation().getY());
WitchRush.get().setConf("teams.jaune.upgrade.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.jaune.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.jaune.upgrade.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "boss":
WitchRush.get().getMode().set("teams.jaune.boss.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.jaune.boss.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.jaune.boss.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.jaune.boss.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.jaune.boss.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.jaune.boss.x", player.getLocation().getX());
WitchRush.get().setConf("teams.jaune.boss.y", player.getLocation().getY());
WitchRush.get().setConf("teams.jaune.boss.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.jaune.boss.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.jaune.boss.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
default:
@@ -140,35 +140,35 @@ public class LocationsCMD implements CommandExecutor {
case "rouge":
switch (args[1].toLowerCase()){
case "shop":
WitchRush.get().getMode().set("teams.rouge.shop.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.rouge.shop.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.rouge.shop.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.rouge.shop.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.rouge.shop.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.rouge.shop.x", player.getLocation().getX());
WitchRush.get().setConf("teams.rouge.shop.y", player.getLocation().getY());
WitchRush.get().setConf("teams.rouge.shop.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.rouge.shop.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.rouge.shop.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "spawn":
WitchRush.get().getMode().set("teams.rouge.spawn.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.rouge.spawn.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.rouge.spawn.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.rouge.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.rouge.spawn.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.rouge.spawn.x", player.getLocation().getX());
WitchRush.get().setConf("teams.rouge.spawn.y", player.getLocation().getY());
WitchRush.get().setConf("teams.rouge.spawn.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.rouge.spawn.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.rouge.spawn.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "upgrade":
WitchRush.get().getMode().set("teams.rouge.upgrade.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.rouge.upgrade.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.rouge.upgrade.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.rouge.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.rouge.upgrade.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.rouge.upgrade.x", player.getLocation().getX());
WitchRush.get().setConf("teams.rouge.upgrade.y", player.getLocation().getY());
WitchRush.get().setConf("teams.rouge.upgrade.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.rouge.upgrade.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.rouge.upgrade.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
case "boss":
WitchRush.get().getMode().set("teams.rouge.boss.x", player.getLocation().getX());
WitchRush.get().getMode().set("teams.rouge.boss.y", player.getLocation().getY());
WitchRush.get().getMode().set("teams.rouge.boss.z", player.getLocation().getZ());
WitchRush.get().getMode().set("teams.rouge.boss.yaw", player.getLocation().getYaw());
WitchRush.get().getMode().set("teams.rouge.boss.pitch", player.getLocation().getPitch());
WitchRush.get().setConf("teams.rouge.boss.x", player.getLocation().getX());
WitchRush.get().setConf("teams.rouge.boss.y", player.getLocation().getY());
WitchRush.get().setConf("teams.rouge.boss.z", player.getLocation().getZ());
WitchRush.get().setConf("teams.rouge.boss.yaw", player.getLocation().getYaw());
WitchRush.get().setConf("teams.rouge.boss.pitch", player.getLocation().getPitch());
player.sendMessage("Location ajoutée !");
break;
default:

View File

@@ -47,7 +47,7 @@ public class GameManager {
}
new HealthRunnable().runTaskTimer(WitchRush.get(), 0L, 20L);
}, 10 * 20);
}, 3 * 20 * 60);
}
}

View File

@@ -4,6 +4,8 @@ import net.berrygames.witchrush.WitchRush;
import net.berrygames.witchrush.game.GameState;
import net.berrygames.witchrush.team.TeamsInfos;
import net.berrygames.witchrush.team.TeamManager;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Witch;
import org.bukkit.event.EventHandler;
@@ -31,7 +33,7 @@ public class DamageEvent implements Listener {
player.sendMessage("§cVous ne pouvez pas tuer votre boss !");
return;
}
/*for(TeamsInfos infos : TeamsInfos.values()){
for(TeamsInfos infos : TeamsInfos.values()){
if(teamManager.getTeamBoss(infos).getWitch().equals(witch)){
Bukkit.getOnlinePlayers().forEach(pls -> {
if(teamManager.getPlayerTeam(pls).equals(infos)){
@@ -40,7 +42,7 @@ public class DamageEvent implements Listener {
}
});
}
}*/
}
break;
case VILLAGER:
if(e.getDamager() instanceof Player) e.setCancelled(true);

View File

@@ -34,19 +34,16 @@ public class EntityDeath implements Listener {
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)){
Bukkit.broadcastMessage(WitchRush.prefix()+" Le boss des"+teamInfos.getChatColor()+teamInfos.getTeamName()+"s §dest mort");
TeamsInfos finalTeamInfos = teamInfos;
Bukkit.broadcastMessage(WitchRush.prefix()+" Le boss des "+teamInfos.getChatColor()+teamInfos.getTeamName().toUpperCase()+"s §dest mort");
final TeamsInfos finalTeamInfos = teamInfos;
Bukkit.getOnlinePlayers().forEach(pls -> {
pls.playSound(pls.getLocation(), Sound.ENTITY_WITHER_DEATH, 1.0f, 1.0f);
if(teamManager.isPlayerInTeam(pls, finalTeamInfos)){
pls.sendMessage("Votre boss est mort !");
pls.sendMessage("Ne mourrez pas");
pls.sendTitle("§cAttention","Votre boss est mort !");
pls.sendMessage("§4Votre boss est mort !");
pls.sendMessage("§4Ne mourrez pas");
pls.sendTitle("§cAttention","§c§oVotre boss est mort !");
teamManager.getBossEntityMap().remove(finalTeamInfos);
}
});
}

View File

@@ -39,7 +39,7 @@ public class PlayerChat implements Listener {
Bukkit.getOnlinePlayers().forEach(playerOnline -> {
final TeamsInfos teamInfos = WitchRush.get().getTeamManager().getPlayerTeam(player);
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()
+player.getDisplayName()+" §7» §f"+message.replace("!","§r"));
}

View File

@@ -52,6 +52,7 @@ public class PlayerJoin implements Listener {
player.sendMessage("§7Seuls les autres spectateurs voient vos messages !");
player.sendMessage(" ");
e.setJoinMessage(null);
witchPlayer.setSpectator(true);
player.setGameMode(GameMode.SPECTATOR);
player.setLevel(0);
player.setHealth(20);

View File

@@ -25,6 +25,7 @@ public class PlayerQuit implements Listener {
e.setQuitMessage(null);
break;
case GAME:
if(witchPlayer.isSpectator()) return;
e.setQuitMessage(
WitchRush.prefix()+"§e"+player.getName()+
" §da quitté la partie §7(§d"+

View File

@@ -55,46 +55,40 @@ public class TeamManager {
}
public boolean isInLife(final TeamsInfos teamInfos) {
if(getBossEntityMap().containsKey(teamInfos)){
return true;
}
return false;
return getBossEntityMap().containsKey(teamInfos);
}
public Location getBossLocation(final TeamsInfos teamInfos) {
return new Location(Bukkit.getWorld("world"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".boss.x"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".boss.y"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".boss.z"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".boss.yaw"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".boss.pitch"));
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".boss.x"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".boss.y"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".boss.z"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".boss.yaw"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".boss.pitch"));
}
public Location getShopLocation(final TeamsInfos teamInfos) {
return new Location(Bukkit.getWorld("world"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".shop.x"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".shop.y"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".shop.z"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".shop.yaw"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".shop.pitch"));
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".shop.x"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".shop.y"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".shop.z"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".shop.yaw"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".shop.pitch"));
}
public Location getUpgradeLocation(final TeamsInfos teamInfos) {
return new Location(Bukkit.getWorld("world"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".upgrade.x"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".upgrade.y"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".upgrade.z"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".upgrade.yaw"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".upgrade.pitch"));
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".upgrade.x"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".upgrade.y"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".upgrade.z"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".upgrade.yaw"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".upgrade.pitch"));
}
public Location getTeamLocation(final TeamsInfos teamInfos) {
return new Location(Bukkit.getWorld("world"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".spawn.x"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".spawn.y"),
WitchRush.get().getMode().getDouble("teams."+teamInfos.getTeamName()+".spawn.z"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".spawn.yaw"),
WitchRush.get().getMode().getLong("teams."+teamInfos.getTeamName()+".spawn.pitch"));
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".spawn.x"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".spawn.y"),
WitchRush.get().getConf().getDouble("teams."+teamInfos.getTeamName()+".spawn.z"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".spawn.yaw"),
WitchRush.get().getConf().getLong("teams."+teamInfos.getTeamName()+".spawn.pitch"));
}
public boolean isPlayerInTeam(final Player player, final TeamsInfos teamInfos) {
@@ -103,9 +97,7 @@ public class TeamManager {
public boolean playerHaveTeam(final Player player) {
for (final TeamsInfos teamInfos : TeamsInfos.values()) {
if (this.playerTeamList.get(teamInfos) != null && this.playerTeamList.get(teamInfos).contains(player)) {
return true;
}
return isPlayerInTeam(player, teamInfos);
}
return false;
}

View File

@@ -5,10 +5,10 @@ import org.bukkit.Color;
public enum TeamsInfos {
VERT(0,"Vert", "vert", "§a", (short)13, Color.GREEN),
BLEU(1,"Bleu", "bleu", "§b", (short)11, Color.BLUE),
JAUNE(2,"Jaune", "jaune", "§e", (short)4, Color.YELLOW),
ROUGE(3,"Rouge", "rouge", "§c", (short)14, Color.RED),
VERT(0,"Vert", "vert", "§a", (short)13, Color.GREEN, 23),
BLEU(1,"Bleu", "bleu", "§b", (short)11, Color.BLUE, 19),
JAUNE(2,"Jaune", "jaune", "§e", (short)4, Color.YELLOW, 21),
ROUGE(3,"Rouge", "rouge", "§c", (short)14, Color.RED, 25),
;
private int id;
@@ -17,14 +17,16 @@ public enum TeamsInfos {
private String chatColor;
private short dataClay;
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.IDName = IDName;
this.teamName = teamName;
this.chatColor = chatColor;
this.dataClay = dataClay;
this.color = color;
this.slotGUI = slotGUI;
}
public String getIDName() {
@@ -51,6 +53,10 @@ public enum TeamsInfos {
return id;
}
public int getSlotGUI() {
return slotGUI;
}
public static TeamsInfos getTeamInfosByIDName(final String ID) {
for (final TeamsInfos teamInfos : values()) {
if (teamInfos.getIDName().equalsIgnoreCase(ID)) {

View File

@@ -15,33 +15,30 @@ public class TeamsMenu {
public TeamsMenu(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++){
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(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(36, 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(27, 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(int slot = 10; slot < 17; slot++){
inventory.setItem(slot, new ItemFactory(Material.WOOL).withName(TeamsInfos.getTeamInfosByID(i).getTeamName()).done());
}
for(int slot = 19; slot < 26; slot++){
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());
for(TeamsInfos infos : TeamsInfos.values()){
inventory.setItem(infos.getSlotGUI(), new ItemFactory(Material.WOOL)
.withName(infos.getChatColor()+infos.getTeamName())
.withColor(infos.getColor())
.done());
}
inventory.setItem(49, new ItemFactory(Material.BARRIER).withName("§cFermer").done());
inventory.setItem(40, new ItemFactory(Material.BARRIER).withName("§cFermer").done());
player.openInventory(inventory);
}
}

View File

@@ -1,5 +1,6 @@
package net.berrygames.witchrush.tools;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
@@ -48,6 +49,11 @@ public class ItemFactory {
return this;
}
public ItemFactory withColor(final Color color) {
this.item.setDurability((short) DyeColor.getByColor(color).getWoolData());
return this;
}
public ItemFactory withOwner(final String owner) {
if (this.item.getType().equals((Object)Material.SKULL_ITEM)) {
this.item.setDurability((short)3);