fixed some scoreboard stuff
This commit is contained in:
parent
b7ad0035bc
commit
6ed3f93df7
@ -1,6 +1,7 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -39,12 +40,14 @@ public class UtilAction
|
|||||||
|
|
||||||
//Velocity
|
//Velocity
|
||||||
ent.setFallDistance(0);
|
ent.setFallDistance(0);
|
||||||
ent.setVelocity(vec);
|
|
||||||
|
|
||||||
//Debug
|
//Debug
|
||||||
if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR))
|
if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(ent, F.main("Debug", "Velocity Sent: " + vec.length()));
|
Bukkit.broadcastMessage(F.main("Debug", "Velocity Sent: " + vec.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ent.setVelocity(vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -251,34 +252,34 @@ public class DamageManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (stack == null)
|
if (stack == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Map<Enchantment, Integer> enchants = stack.getEnchantments();
|
Map<Enchantment, Integer> enchants = stack.getEnchantments();
|
||||||
for (Enchantment e : enchants.keySet())
|
for (Enchantment e : enchants.keySet())
|
||||||
{
|
{
|
||||||
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
|
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
|
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
|
||||||
event.GetCause() == DamageCause.FIRE &&
|
event.GetCause() == DamageCause.FIRE &&
|
||||||
event.GetCause() == DamageCause.FIRE_TICK &&
|
event.GetCause() == DamageCause.FIRE_TICK &&
|
||||||
event.GetCause() == DamageCause.LAVA)
|
event.GetCause() == DamageCause.LAVA)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_FALL) &&
|
else if (e.equals(Enchantment.PROTECTION_FALL) &&
|
||||||
event.GetCause() == DamageCause.FALL)
|
event.GetCause() == DamageCause.FALL)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
|
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
|
||||||
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
|
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
|
||||||
event.GetCause() == DamageCause.PROJECTILE)
|
event.GetCause() == DamageCause.PROJECTILE)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Offensive
|
//Offensive
|
||||||
Player damager = event.GetDamagerPlayer(true);
|
Player damager = event.GetDamagerPlayer(true);
|
||||||
if (damager != null)
|
if (damager != null)
|
||||||
@ -390,9 +391,19 @@ public class DamageManager extends MiniPlugin
|
|||||||
trajectory.multiply(0.6 * knockback);
|
trajectory.multiply(0.6 * knockback);
|
||||||
trajectory.setY(Math.abs(trajectory.getY()));
|
trajectory.setY(Math.abs(trajectory.getY()));
|
||||||
|
|
||||||
|
//Debug
|
||||||
|
if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR))
|
||||||
|
{
|
||||||
|
Bukkit.broadcastMessage("--------- " +
|
||||||
|
UtilEnt.getName(event.GetDamageeEntity()) + " hurt by " + UtilEnt.getName(event.GetDamagerEntity(true)) + "-----------" );
|
||||||
|
|
||||||
|
Bukkit.broadcastMessage(F.main("Debug", "Damage: " + event.GetDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Apply
|
//Apply
|
||||||
double vel = 0.2 + trajectory.length() * 0.8;
|
double vel = 0.2 + trajectory.length() * 0.8;
|
||||||
|
|
||||||
UtilAction.velocity(event.GetDamageeEntity(), trajectory, vel,
|
UtilAction.velocity(event.GetDamageeEntity(), trajectory, vel,
|
||||||
false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
|
false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
|
||||||
}
|
}
|
||||||
@ -411,6 +422,15 @@ public class DamageManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void debugVel2(PlayerVelocityEvent event)
|
||||||
|
{
|
||||||
|
if (UtilGear.isMat(((Player)event.getPlayer()).getItemInHand(), Material.SUGAR))
|
||||||
|
{
|
||||||
|
Bukkit.broadcastMessage(F.main("Debug", "Event: " + event.getVelocity().length()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DisplayDamage(CustomDamageEvent event)
|
private void DisplayDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
@ -209,7 +209,7 @@ public abstract class Game implements Listener
|
|||||||
|
|
||||||
public int TickPerTeleport = 1;
|
public int TickPerTeleport = 1;
|
||||||
|
|
||||||
public int EnforceTeamSize = -1;
|
public int FillTeamsInOrderToCount = -1;
|
||||||
|
|
||||||
public boolean SpawnNearAllies = false;
|
public boolean SpawnNearAllies = false;
|
||||||
public boolean SpawnNearEnemies = false;
|
public boolean SpawnNearEnemies = false;
|
||||||
@ -618,11 +618,11 @@ public abstract class Game implements Listener
|
|||||||
|
|
||||||
public GameTeam ChooseTeam(Player player)
|
public GameTeam ChooseTeam(Player player)
|
||||||
{
|
{
|
||||||
if (EnforceTeamSize != -1)
|
if (FillTeamsInOrderToCount != -1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _teamList.size(); i++)
|
for (int i = 0; i < _teamList.size(); i++)
|
||||||
{
|
{
|
||||||
if (_teamList.get(i).GetSize() < EnforceTeamSize)
|
if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount)
|
||||||
{
|
{
|
||||||
return _teamList.get(i);
|
return _teamList.get(i);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ public class TeamSkywars extends Skywars
|
|||||||
"Last team alive wins!"
|
"Last team alive wins!"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.FillTeamsInOrderToCount = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -169,16 +170,34 @@ public class TeamSkywars extends Skywars
|
|||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
Scoreboard.Write(C.cYellow + C.Bold + "Teams");
|
Scoreboard.Write(C.cYellow + C.Bold + "Teams");
|
||||||
if (GetTeamList().size() <= 4)
|
|
||||||
|
ArrayList<GameTeam> alive = new ArrayList<GameTeam>();
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
{
|
{
|
||||||
for(GameTeam team : GetTeamList())
|
if (team.IsTeamAlive())
|
||||||
|
alive.add(team);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetPlayers(true).size() <= 4)
|
||||||
|
{
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
{
|
{
|
||||||
Scoreboard.Write(team.GetColor() + team.GetName() + " " + team.GetSize());
|
for (Player player : team.GetPlayers(true))
|
||||||
|
{
|
||||||
|
Scoreboard.Write(team.GetColor() + player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (alive.size() <= 4)
|
||||||
|
{
|
||||||
|
for (GameTeam team : alive)
|
||||||
|
{
|
||||||
|
Scoreboard.Write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Scoreboard.Write(C.cYellow + "Players " + GetPlayers(true).size());
|
Scoreboard.Write(C.cWhite + alive.size() + " Alive");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsLive())
|
if (IsLive())
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
@ -45,7 +46,7 @@ public class TeamSuperSmash extends SuperSmash
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.PlayersPerTeam = 2;
|
this.PlayersPerTeam = 2;
|
||||||
this.EnforceTeamSize = 2;
|
this.FillTeamsInOrderToCount = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,37 +56,48 @@ public class TeamSuperSmash extends SuperSmash
|
|||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ArrayList<GameTeam> alive = new ArrayList<GameTeam>();
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
|
{
|
||||||
|
if (team.IsTeamAlive())
|
||||||
|
alive.add(team);
|
||||||
|
}
|
||||||
|
|
||||||
//Wipe Last
|
//Wipe Last
|
||||||
Scoreboard.Reset();
|
Scoreboard.Reset();
|
||||||
|
Scoreboard.WriteBlank();
|
||||||
if (GetPlayers(true).size() > 14)
|
|
||||||
|
if (GetPlayers(true).size() < 16)
|
||||||
{
|
{
|
||||||
for (GameTeam team : this.GetTeamList())
|
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
{
|
{
|
||||||
Scoreboard.WriteBlank();
|
|
||||||
Scoreboard.Write(team.GetFormattedName());
|
|
||||||
|
|
||||||
int lives = 0;
|
|
||||||
for (Player player : team.GetPlayers(true))
|
for (Player player : team.GetPlayers(true))
|
||||||
|
{
|
||||||
|
int lives = GetLives(player);
|
||||||
|
|
||||||
|
Scoreboard.Write(C.cWhite + lives + " " + team.GetColor() + player.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (alive.size() < 16)
|
||||||
|
{
|
||||||
|
for (GameTeam team : alive)
|
||||||
|
{
|
||||||
|
int lives = 0;
|
||||||
|
|
||||||
|
for (Player player : team.GetPlayers(true))
|
||||||
|
{
|
||||||
lives += GetLives(player);
|
lives += GetLives(player);
|
||||||
|
}
|
||||||
|
|
||||||
Scoreboard.Write(team.GetColor() + "" + lives + " Lives");
|
Scoreboard.Write(C.cWhite + lives + " " + team.GetColor() + team.GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.Write(C.cYellow + C.Bold + "Teams Alive");
|
||||||
|
Scoreboard.Write(C.cWhite + alive.size());
|
||||||
//Write New
|
|
||||||
for (Player player : GetPlayers(true))
|
|
||||||
{
|
|
||||||
int lives = GetLives(player);
|
|
||||||
|
|
||||||
if (lives <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Scoreboard.WriteOrdered("Lives", GetTeam(player).GetColor() + player.getName(), lives, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scoreboard.Draw();
|
Scoreboard.Draw();
|
||||||
|
@ -27,6 +27,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
public class TeamSurvivalGames extends SurvivalGames
|
public class TeamSurvivalGames extends SurvivalGames
|
||||||
{
|
{
|
||||||
@ -49,7 +50,7 @@ public class TeamSurvivalGames extends SurvivalGames
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.PlayersPerTeam = 2;
|
this.PlayersPerTeam = 2;
|
||||||
this.EnforceTeamSize = 2;
|
this.FillTeamsInOrderToCount = 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,19 +147,36 @@ public class TeamSurvivalGames extends SurvivalGames
|
|||||||
Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
|
Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
Scoreboard.Write(C.cYellow + C.Bold + "Teams");
|
Scoreboard.Write(C.cYellow + C.Bold + "Teams");
|
||||||
if (GetTeamList().size() > 7)
|
|
||||||
|
ArrayList<GameTeam> alive = new ArrayList<GameTeam>();
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
{
|
{
|
||||||
Scoreboard.Write("" + GetTeamList().size());
|
if (team.IsTeamAlive())
|
||||||
|
alive.add(team);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (GetPlayers(true).size() <= 7)
|
||||||
{
|
{
|
||||||
for (GameTeam team : GetTeamList())
|
for (GameTeam team : GetTeamList())
|
||||||
{
|
{
|
||||||
Scoreboard.Write(C.cWhite + team.GetColor() + team.GetName());
|
for (Player player : team.GetPlayers(true))
|
||||||
|
{
|
||||||
|
Scoreboard.Write(team.GetColor() + player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (alive.size() <= 7)
|
||||||
|
{
|
||||||
|
for (GameTeam team : alive)
|
||||||
|
{
|
||||||
|
Scoreboard.Write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Scoreboard.Write(C.cWhite + alive.size() + " Alive");
|
||||||
|
}
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Standard
|
//Standard
|
||||||
if (game.GetKits().length > 1 || game.GetTeamList().size() < 6)
|
if ((game.GetKits().length > 1 || game.GetTeamList().size() < 6) && game.GetType() != GameType.SurvivalGamesTeams)
|
||||||
{
|
{
|
||||||
//Display
|
//Display
|
||||||
ArrayList<GameTeam> teams = new ArrayList<GameTeam>();
|
ArrayList<GameTeam> teams = new ArrayList<GameTeam>();
|
||||||
|
Loading…
Reference in New Issue
Block a user