Improving Team names in SG, SSM and Skywars and disabled friendly fire.
This commit is contained in:
parent
5e05530b1d
commit
8b26ffaecd
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
@ -14,11 +15,15 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
public class SoloSkywars extends Skywars
|
||||
{
|
||||
|
||||
private GameTeam _players;
|
||||
|
||||
public SoloSkywars(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Skywars,
|
||||
@ -33,6 +38,18 @@ public class SoloSkywars extends Skywars
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
_players = GetTeamList().get(0);
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
_players.setDisplayName(C.cYellow + C.Bold + "Players");
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
|
@ -49,6 +49,8 @@ public class TeamSkywars extends Skywars
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
|
||||
this.DamageTeamSelf = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -120,24 +122,26 @@ public class TeamSkywars extends Skywars
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW),
|
||||
GREEN(ChatColor.GREEN),
|
||||
AQUA(ChatColor.AQUA),
|
||||
DARK_RED(ChatColor.DARK_RED),
|
||||
GOLD(ChatColor.GOLD),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE),
|
||||
WHITE(ChatColor.WHITE),
|
||||
BLUE(ChatColor.BLUE),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA);
|
||||
YELLOW(ChatColor.YELLOW, "Yellow"),
|
||||
GREEN(ChatColor.GREEN, "Green"),
|
||||
AQUA(ChatColor.AQUA, "Aqua"),
|
||||
DARK_RED(ChatColor.DARK_RED, "Dark Red"),
|
||||
GOLD(ChatColor.GOLD, "Gold"),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, "Light Purple"),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, "Dark Blue"),
|
||||
WHITE(ChatColor.WHITE, "White"),
|
||||
BLUE(ChatColor.BLUE, "Blue"),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, "Dark Green"),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, "Dark Purple"),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, "Cyan");
|
||||
|
||||
private ChatColor color;
|
||||
private String name;
|
||||
|
||||
private TeamColors(ChatColor color)
|
||||
private TeamColors(ChatColor color, String name)
|
||||
{
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
@ -145,6 +149,23 @@ public class TeamSkywars extends Skywars
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.toString();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
@ -314,19 +335,18 @@ public class TeamSkywars extends Skywars
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = "";
|
||||
|
||||
for (int i = 0; i < team.GetPlayers(false).size(); i++)
|
||||
String name = team.GetColor() + getColorName(team.GetColor());
|
||||
|
||||
int i = 1;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
Player player = team.GetPlayers(false).get(i);
|
||||
|
||||
name += player.getName();
|
||||
|
||||
if (i < team.GetPlayers(false).size() - 1)
|
||||
name += " & ";
|
||||
if(teams.GetName().startsWith(name))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
team.SetName(name);
|
||||
|
||||
team.setDisplayName(i + " " + name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,7 +427,18 @@ public class TeamSkywars extends Skywars
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
team.setDisplayName(player.getName() + " & " + ally.getName());
|
||||
String name = team.GetColor() + getColorName(team.GetColor());
|
||||
|
||||
int i = 1;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetName().startsWith(name))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
team.setDisplayName(i + " " + name);
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
@ -12,11 +13,15 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
public class SoloSuperSmash extends SuperSmash
|
||||
{
|
||||
|
||||
private GameTeam _players;
|
||||
|
||||
public SoloSuperSmash(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Smash, new String[]
|
||||
@ -28,6 +33,18 @@ public class SoloSuperSmash extends SuperSmash
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
_players = GetTeamList().get(0);
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
_players.setDisplayName(C.cYellow + C.Bold + "Players");
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
|
@ -15,7 +15,6 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -49,6 +48,7 @@ public class TeamSuperSmash extends SuperSmash
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
this.DamageTeamSelf = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -141,24 +141,26 @@ public class TeamSuperSmash extends SuperSmash
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW),
|
||||
GREEN(ChatColor.GREEN),
|
||||
AQUA(ChatColor.AQUA),
|
||||
DARK_RED(ChatColor.DARK_RED),
|
||||
GOLD(ChatColor.GOLD),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE),
|
||||
WHITE(ChatColor.WHITE),
|
||||
BLUE(ChatColor.BLUE),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA);
|
||||
YELLOW(ChatColor.YELLOW, "Yellow"),
|
||||
GREEN(ChatColor.GREEN, "Green"),
|
||||
AQUA(ChatColor.AQUA, "Aqua"),
|
||||
DARK_RED(ChatColor.DARK_RED, "Dark Red"),
|
||||
GOLD(ChatColor.GOLD, "Gold"),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, "Light Purple"),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, "Dark Blue"),
|
||||
WHITE(ChatColor.WHITE, "White"),
|
||||
BLUE(ChatColor.BLUE, "Blue"),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, "Dark Green"),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, "Dark Purple"),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, "Cyan");
|
||||
|
||||
private ChatColor color;
|
||||
private String name;
|
||||
|
||||
private TeamColors(ChatColor color)
|
||||
private TeamColors(ChatColor color, String name)
|
||||
{
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
@ -166,6 +168,23 @@ public class TeamSuperSmash extends SuperSmash
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.toString();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
@ -262,19 +281,18 @@ public class TeamSuperSmash extends SuperSmash
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = "";
|
||||
|
||||
for (int i = 0; i < team.GetPlayers(false).size(); i++)
|
||||
String name = team.GetColor() + getColorName(team.GetColor());
|
||||
|
||||
int i = 1;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
Player player = team.GetPlayers(false).get(i);
|
||||
|
||||
name += player.getName();
|
||||
|
||||
if (i < team.GetPlayers(false).size() - 1)
|
||||
name += " & ";
|
||||
if(teams.GetName().startsWith(name))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
team.SetName(name);
|
||||
|
||||
team.setDisplayName(i + " " + name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,7 +373,18 @@ public class TeamSuperSmash extends SuperSmash
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
team.setDisplayName(player.getName() + " & " + ally.getName());
|
||||
String name = team.GetColor() + getColorName(team.GetColor());
|
||||
|
||||
int i = 1;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetName().startsWith(name))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
team.setDisplayName(i + " " + name);
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
|
@ -11,13 +11,18 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class SoloSurvivalGames extends SurvivalGames
|
||||
{
|
||||
|
||||
private GameTeam _players;
|
||||
|
||||
public SoloSurvivalGames(ArcadeManager manager)
|
||||
{
|
||||
@ -36,6 +41,18 @@ public class SoloSurvivalGames extends SurvivalGames
|
||||
this.DamageTeamSelf = true;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
_players = GetTeamList().get(0);
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
_players.setDisplayName(C.cYellow + C.Bold + "Players");
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
|
@ -17,7 +17,6 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -27,7 +26,6 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class TeamSurvivalGames extends SurvivalGames
|
||||
{
|
||||
@ -55,6 +53,8 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
this.SpawnNearAllies = true;
|
||||
this.SpawnNearEnemies = true;
|
||||
|
||||
this.DamageTeamSelf = false;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -94,24 +94,26 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW),
|
||||
GREEN(ChatColor.GREEN),
|
||||
AQUA(ChatColor.AQUA),
|
||||
DARK_RED(ChatColor.DARK_RED),
|
||||
GOLD(ChatColor.GOLD),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE),
|
||||
WHITE(ChatColor.WHITE),
|
||||
BLUE(ChatColor.BLUE),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA);
|
||||
YELLOW(ChatColor.YELLOW, "Yellow"),
|
||||
GREEN(ChatColor.GREEN, "Green"),
|
||||
AQUA(ChatColor.AQUA, "Aqua"),
|
||||
DARK_RED(ChatColor.DARK_RED, "Dark Red"),
|
||||
GOLD(ChatColor.GOLD, "Gold"),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, "Light Purple"),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, "Dark Blue"),
|
||||
WHITE(ChatColor.WHITE, "White"),
|
||||
BLUE(ChatColor.BLUE, "Blue"),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, "Dark Green"),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, "Dark Purple"),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, "Cyan");
|
||||
|
||||
private ChatColor color;
|
||||
private String name;
|
||||
|
||||
private TeamColors(ChatColor color)
|
||||
private TeamColors(ChatColor color, String name)
|
||||
{
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
@ -119,6 +121,23 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.toString();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
@ -286,19 +305,18 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = "";
|
||||
|
||||
for (int i = 0; i < team.GetPlayers(false).size(); i++)
|
||||
String name = team.GetColor() + getColorName(team.GetColor());
|
||||
|
||||
int i = 1;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
Player player = team.GetPlayers(false).get(i);
|
||||
|
||||
name += player.getName();
|
||||
|
||||
if (i < team.GetPlayers(false).size() - 1)
|
||||
name += " & ";
|
||||
if(teams.GetName().startsWith(name))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
team.SetName(name);
|
||||
|
||||
team.setDisplayName(i + " " + name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -378,8 +396,19 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
GameTeam team = getEmptyTeam();
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
team.setDisplayName(player.getName() + " & " + ally.getName());
|
||||
|
||||
String name = team.GetColor() + getColorName(team.GetColor());
|
||||
|
||||
int i = 1;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetName().startsWith(name))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
team.setDisplayName(i + " " + name);
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
|
Loading…
Reference in New Issue
Block a user