Add mid-game kit changing NPCs
This commit is contained in:
parent
69fd78bbf2
commit
2915a5e3b9
@ -12,6 +12,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
@ -20,6 +21,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
@ -63,6 +65,7 @@ import nautilus.game.arcade.game.games.quiver.kits.KitPyromancer;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.Ultimate;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class QuiverPayload extends TeamGame
|
||||
@ -113,7 +116,8 @@ public class QuiverPayload extends TeamGame
|
||||
|
||||
private List<PowerupGenerator> _powerupGenerators = new ArrayList<>();
|
||||
|
||||
private Map<UUID, Double> _ultimatePercentage = new HashMap<UUID, Double>();
|
||||
private Map<UUID, Double> _ultimatePercentage = new HashMap<>();
|
||||
private Map<Entity, ProgressingKit> _kitNPCs = new HashMap<>();
|
||||
|
||||
private boolean _coloredMessage;
|
||||
|
||||
@ -138,7 +142,7 @@ public class QuiverPayload extends TeamGame
|
||||
this.TeamArmor = true;
|
||||
this.TeamArmorHotbar = true;
|
||||
this.HungerSet = 20;
|
||||
|
||||
|
||||
new Quiver1_9(this);
|
||||
}
|
||||
|
||||
@ -202,6 +206,39 @@ public class QuiverPayload extends TeamGame
|
||||
{
|
||||
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
|
||||
}
|
||||
|
||||
CreatureAllowOverride = true;
|
||||
|
||||
int i = 0;
|
||||
for (Location location : WorldData.GetDataLocs("ORANGE"))
|
||||
{
|
||||
if (!(GetKits()[i] instanceof ProgressingKit))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Entity entity = GetKits()[i].SpawnEntity(location);
|
||||
ProgressingKit progressingKit = (ProgressingKit) GetKits()[i++];
|
||||
|
||||
_kitNPCs.put(entity, progressingKit);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
||||
for (Location location : WorldData.GetDataLocs("LIGHT_BLUE"))
|
||||
{
|
||||
if (!(GetKits()[i] instanceof ProgressingKit))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Entity entity = GetKits()[i].SpawnEntity(location);
|
||||
ProgressingKit progressingKit = (ProgressingKit) GetKits()[i++];
|
||||
|
||||
_kitNPCs.put(entity, progressingKit);
|
||||
}
|
||||
|
||||
CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
if (event.GetState() == GameState.Live)
|
||||
@ -223,10 +260,9 @@ public class QuiverPayload extends TeamGame
|
||||
_minecart.setDisplayBlock(new MaterialData(Material.TNT));
|
||||
_hologram.setFollowEntity(_minecart);
|
||||
_hologram.start();
|
||||
|
||||
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
{
|
||||
// Give all players a Super Arrow item.
|
||||
player.getInventory().addItem(Quiver.SUPER_ARROW);
|
||||
}
|
||||
@ -483,7 +519,7 @@ public class QuiverPayload extends TeamGame
|
||||
_recentlyChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_teamDirection = GetTeamList().get(1);
|
||||
}
|
||||
else
|
||||
@ -598,7 +634,7 @@ public class QuiverPayload extends TeamGame
|
||||
{
|
||||
return isMinecartNearMarker(marker, PAYLOAD_MARKER_MAX_DISTANCE);
|
||||
}
|
||||
|
||||
|
||||
private boolean isMinecartNearMarker(Location marker, double distance)
|
||||
{
|
||||
return UtilMath.offset(_minecart.getLocation(), marker) < distance;
|
||||
@ -844,27 +880,40 @@ public class QuiverPayload extends TeamGame
|
||||
@EventHandler
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
if (event.GetDamageeEntity() instanceof Player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
if (event.GetProjectile() != null)
|
||||
{
|
||||
if (event.GetProjectile() instanceof Arrow)
|
||||
if (event.GetProjectile() != null)
|
||||
{
|
||||
event.AddMod("Projectile", SUPER_ARROW_DAMAGE_REASON, SUPER_ARROW_DAMAGE_MOD, false);
|
||||
if (event.GetProjectile() instanceof Arrow)
|
||||
{
|
||||
event.AddMod("Projectile", SUPER_ARROW_DAMAGE_REASON, SUPER_ARROW_DAMAGE_MOD, false);
|
||||
|
||||
event.SetDamageToLevel(false);
|
||||
event.SetKnockback(false);
|
||||
event.SetDamageToLevel(false);
|
||||
event.SetKnockback(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilItem.isLeatherProduct(player.getInventory().getBoots()))
|
||||
{
|
||||
event.SetIgnoreArmor(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilItem.isLeatherProduct(player.getInventory().getBoots()))
|
||||
else if (_kitNPCs.containsKey(event.GetDamageeEntity()))
|
||||
{
|
||||
event.SetIgnoreArmor(true);
|
||||
event.SetCancelled("Kit NPC Damage");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (_kitNPCs.containsKey(event.getRightClicked()))
|
||||
{
|
||||
ProgressingKit progressingKit = _kitNPCs.get(event.getRightClicked());
|
||||
|
||||
Manager.getProgressionKitManager().entityClick(event.getPlayer(), progressingKit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -893,21 +942,21 @@ public class QuiverPayload extends TeamGame
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setMinecartTeam(GameTeam gameTeam)
|
||||
{
|
||||
String minecartID = _minecart.getUniqueId().toString();
|
||||
|
||||
GetScoreboard().GetScoreboard().getTeam("RED").removeEntry(minecartID);
|
||||
GetScoreboard().GetScoreboard().getTeam("BLUE").removeEntry(minecartID);
|
||||
|
||||
if (gameTeam == null)
|
||||
|
||||
GetScoreboard().GetScoreboard().getTeam("RED").removeEntry(minecartID);
|
||||
GetScoreboard().GetScoreboard().getTeam("BLUE").removeEntry(minecartID);
|
||||
|
||||
if (gameTeam == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String added = GetTeamList().get(0).equals(gameTeam) ? "RED" : "BLUE";
|
||||
|
||||
|
||||
GetScoreboard().GetScoreboard().getTeam(added).addEntry(minecartID);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user