Final tweaks to Castle Siege and implementation of leaderboards in arcade

This commit is contained in:
AlexTheCoder 2017-05-08 00:09:04 -04:00
parent 68205a71a1
commit d7341de2f5
11 changed files with 309 additions and 95 deletions

View File

@ -1,10 +1,10 @@
package nautilus.game.arcade;
import static mineplex.core.Managers.require;
import java.io.File;
import java.util.HashMap;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -83,12 +83,10 @@ import mineplex.core.visibility.VisibilityManager;
import mineplex.core.website.WebsiteLinkManager;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameServerConfig;
import static mineplex.core.Managers.require;
import net.minecraft.server.v1_8_R3.MinecraftServer;
public class Arcade extends JavaPlugin
{
@ -167,7 +165,6 @@ public class Arcade extends JavaPlugin
incognito.setPreferencesManager(preferenceManager);
Creature creature = new Creature(this);
LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager);
Teleport teleport = new Teleport(this, _clientManager);
Portal portal = new Portal();
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
@ -199,6 +196,8 @@ public class Arcade extends JavaPlugin
ProjectileManager projectileManager = new ProjectileManager(this);
HologramManager hologramManager = new HologramManager(this, packetHandler);
new LeaderboardManager(this, hologramManager);
//Inventory
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
CastleManager castleManager = new CastleManager(this, _clientManager, hologramManager, false);

View File

@ -346,6 +346,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed
//ELO
public boolean EloRanking = false;
public int EloStart = 1000;
public boolean Leaderboards = false;
public boolean CanAddStats = true;
public boolean CanGiveLoot = true;

View File

@ -18,6 +18,8 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Entity;
import org.bukkit.entity.ItemFrame;
@ -30,7 +32,9 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
@ -55,6 +59,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.Managers;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -67,9 +72,13 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.EnchantedBookBuilder;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.leaderboard.Leaderboard;
import mineplex.core.leaderboard.LeaderboardManager;
import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType;
import mineplex.core.loot.ChestLoot;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -86,7 +95,7 @@ import nautilus.game.arcade.game.GemData;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.castlesiege.data.KillStreakData;
import nautilus.game.arcade.game.games.castlesiege.data.ObjectiveTNTSpawner;
import nautilus.game.arcade.game.games.castlesiege.data.TeamBeacon;
import nautilus.game.arcade.game.games.castlesiege.data.TeamCrystal;
import nautilus.game.arcade.game.games.castlesiege.data.TeamKing;
import nautilus.game.arcade.game.games.castlesiege.shockkits.KitArcher;
import nautilus.game.arcade.game.games.castlesiege.shockkits.KitDemolitionist;
@ -95,6 +104,7 @@ import nautilus.game.arcade.game.games.castlesiege.shockkits.KitPlayer;
import nautilus.game.arcade.game.games.castlesiege.shockkits.KitTank;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
public class ShockCastleSiege extends TeamGame
{
@ -108,7 +118,7 @@ public class ShockCastleSiege extends TeamGame
private ItemBuilder _wearableTnt;
private Map<Player, KillStreakData> _streakData = new WeakHashMap<>();
private Map<GameTeam, List<TeamBeacon>> _beacons = new HashMap<>();
private Map<GameTeam, List<TeamCrystal>> _crystals = new HashMap<>();
private Map<GameTeam, TeamKing> _kings = new HashMap<>();
private List<Player> _tntCarry = new ArrayList<>();
@ -145,12 +155,20 @@ public class ShockCastleSiege extends TeamGame
//new KitNinja(manager),
new KitTank(manager)
},
new String[] {"AlexTheCoder is awesome!"});
new String[]
{
"Destroy enemy sentry crystals with running TNT",
"After the enemy crystals are destroyed you must slay their king",
"First team to kill the enemy king wins",
"Chests refill every 2 minutes",
"TNT Respawns every 1 minute"
}
);
_help = new String[]
{
"Use the TNT spawning platforms to run TNT to the enemy beacons to destroy them!",
"The enemy king is invulnerable until you destroy the two sentry beacons on each sentry tower",
"Use the TNT spawning platforms to run TNT to the enemy crystals to destroy them!",
"The enemy king is invulnerable until you destroy the two sentry crystals on each sentry tower",
"Go on Kill Streaks to earn Kill Streak Rewards to obtain better armor & weapons!",
"Chests refill every 2 minutes with potions, golden applegates, fishing rods, and other useful PvP items!"
};
@ -172,7 +190,9 @@ public class ShockCastleSiege extends TeamGame
this.AllowFlintAndSteel = true;
this.BlockPlaceAllow.add(Material.FIRE.getId());
this.CrownsEnabled = true;
this.Leaderboards = true;
this.FirstKillReward = 20;
this.GemKillDeathRespawn = 1;
new CompassModule()
.setGiveCompass(true)
@ -183,6 +203,34 @@ public class ShockCastleSiege extends TeamGame
_flintAndSteel = new ItemBuilder(Material.FLINT_AND_STEEL).setData((short) (Material.FLINT_AND_STEEL.getMaxDurability() - MAX_FLINT_AND_STEEL_USES));
_wearableTnt = new ItemBuilder(Material.TNT).setTitle(C.cRed + "TNT").addLore(C.cRedB + "Right Click with Weapon to " + F.name("Detonate"));
generateLoot();
if (manager.IsRewardStats())
{
if (manager.GetLobby() instanceof NewGameLobbyManager)
{
Map<String, List<Location>> lobbyCustomLocs = ((NewGameLobbyManager)manager.GetLobby()).getCustomLocs();
if (lobbyCustomLocs.containsKey("TOP_DAILY_WINS"))
{
Location loc = lobbyCustomLocs.get("TOP_DAILY_WINS").get(0);
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_DAILY_WINS", new Leaderboard("Top Daily Wins", new String[] {"Castle Siege New.Wins"}, LeaderboardSQLType.DAILY, loc, 10));
}
if (lobbyCustomLocs.containsKey("TOP_DAILY_KILLS"))
{
Location loc = lobbyCustomLocs.get("TOP_DAILY_KILLS").get(0);
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_DAILY_KILLS", new Leaderboard("Top Daily Kills", new String[] {"Castle Siege New.Kills"}, LeaderboardSQLType.DAILY, loc, 10));
}
if (lobbyCustomLocs.containsKey("TOP_WINS"))
{
Location loc = lobbyCustomLocs.get("TOP_WINS").get(0);
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_WINS", new Leaderboard("Top Wins", new String[] {"Castle Siege New.Wins"}, LeaderboardSQLType.ALL, loc, 10));
}
if (lobbyCustomLocs.containsKey("TOP_KILLS"))
{
Location loc = lobbyCustomLocs.get("TOP_KILLS").get(0);
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_KILLS", new Leaderboard("Top Kills", new String[] {"Castle Siege New.Kills"}, LeaderboardSQLType.ALL, loc, 10));
}
}
}
}
private void generateLoot()
@ -330,13 +378,13 @@ public class ShockCastleSiege extends TeamGame
}
Scoreboard.writeNewLine();
GameTeam red = GetTeam(ChatColor.RED);
long redBeacons = _beacons.get(red).stream().filter(TeamBeacon::isActive).count();
long redCrystals = _crystals.get(red).stream().filter(TeamCrystal::isActive).count();
GameTeam blue = GetTeam(ChatColor.AQUA);
long blueBeacons = _beacons.get(blue).stream().filter(TeamBeacon::isActive).count();
if (redBeacons > 0)
long blueCrystals = _crystals.get(blue).stream().filter(TeamCrystal::isActive).count();
if (redCrystals > 0)
{
Scoreboard.write(_kings.get(red).getName(true));
Scoreboard.write(redBeacons + "/2 Beacons Active");
Scoreboard.write(redCrystals + "/2 Crystals Active");
}
else
{
@ -344,10 +392,10 @@ public class ShockCastleSiege extends TeamGame
Scoreboard.write(_kings.get(red).getHealth() + "");
}
Scoreboard.writeNewLine();
if (blueBeacons > 0)
if (blueCrystals > 0)
{
Scoreboard.write(_kings.get(blue).getName(true));
Scoreboard.write(blueBeacons + "/2 Beacons Active");
Scoreboard.write(blueCrystals + "/2 Crystals Active");
}
else
{
@ -362,9 +410,9 @@ public class ShockCastleSiege extends TeamGame
_writeScoreboard = false;
Scoreboard.reset();
Scoreboard.writeNewLine();
Scoreboard.write(deadKing + "'s " + C.cBlue + "castle has been conquered");
Scoreboard.write(C.cBlue + "by " + winKing + "'s " + C.cBlue + "army with the help of");
Scoreboard.write(warrior + C.cBlue + "!");
Scoreboard.write(deadKing + "'s " + C.cWhite + "castle has been conquered");
Scoreboard.write(C.cWhite + "by " + winKing + "'s " + C.cWhite + "army with the help of");
Scoreboard.write(warrior + C.cWhite + "!");
Scoreboard.writeNewLine();
Scoreboard.draw();
@ -390,11 +438,22 @@ public class ShockCastleSiege extends TeamGame
redKing.setYaw(UtilAlg.GetYaw(redBlue));
blueKing.setPitch(UtilAlg.GetPitch(blueRed));
blueKing.setYaw(UtilAlg.GetYaw(blueRed));
_beacons.put(red, Arrays.asList(new TeamBeacon(red, WorldData.GetDataLocs("PINK").get(0)), new TeamBeacon(red, WorldData.GetDataLocs("PINK").get(1))));
_beacons.put(blue, Arrays.asList(new TeamBeacon(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(0)), new TeamBeacon(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(1))));
_crystals.put(red, Arrays.asList(new TeamCrystal(red, WorldData.GetDataLocs("PINK").get(0)), new TeamCrystal(red, WorldData.GetDataLocs("PINK").get(1))));
_crystals.put(blue, Arrays.asList(new TeamCrystal(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(0)), new TeamCrystal(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(1))));
this.CreatureAllowOverride = true;
_kings.put(red, new TeamKing(red, "King Jon", redKing));
_kings.put(blue, new TeamKing(blue, "King Ryan", blueKing));
int kitIndex = 0;
for (int i = 0; i < WorldData.GetDataLocs("WHITE").size(); i++)
{
if (kitIndex >= GetKits().length)
{
kitIndex = 0;
}
Entity ent = GetKits()[kitIndex].SpawnEntity(WorldData.GetDataLocs("WHITE").get(i));
Manager.GetLobby().addKitLocation(ent, GetKits()[kitIndex], WorldData.GetDataLocs("WHITE").get(i));
kitIndex++;
}
this.CreatureAllowOverride = false;
_tntSpawner = new ObjectiveTNTSpawner(WorldData.GetDataLocs("BLACK"));
}
@ -444,10 +503,29 @@ public class ShockCastleSiege extends TeamGame
AddGems(player, 10, "Participation", false, false);
}
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
if (streak > 0)
{
AddGems(player, streak, streak + " Player Kill Streak", false, false);
int crowns = 0;
for (GemData data : GetGems(player).values())
{
crowns += data.Gems;
}
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
if (streak >= 2 && streak < 4)
{
AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false);
}
else if (streak >= 4 && streak < 6)
{
AddGems(player, crowns, streak + " Player Kill Streak", false, false);
}
else if (streak >= 6 && streak < 8)
{
AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false);
}
else if (streak >= 8)
{
AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false);
}
}
if (GetKit(player) != null)
@ -497,7 +575,7 @@ public class ShockCastleSiege extends TeamGame
GameTeam blue = GetTeam(ChatColor.AQUA);
TeamKing redKing = _kings.get(red);
TeamKing blueKing = _kings.get(blue);
redKing.update(_beacons.get(red).stream().filter(TeamBeacon::isActive).count() > 0);
redKing.update(_crystals.get(red).stream().filter(TeamCrystal::isActive).count() > 0);
if (redKing.isDead())
{
AnnounceEnd(blue);
@ -546,7 +624,7 @@ public class ShockCastleSiege extends TeamGame
SetState(GameState.End);
return;
}
blueKing.update(_beacons.get(blue).stream().filter(TeamBeacon::isActive).count() > 0);
blueKing.update(_crystals.get(blue).stream().filter(TeamCrystal::isActive).count() > 0);
if (blueKing.isDead())
{
AnnounceEnd(red);
@ -686,6 +764,23 @@ public class ShockCastleSiege extends TeamGame
{
event.setCancelled(true);
}
if (event.getToBlock().getType() == Material.ICE)
{
event.setCancelled(true);
}
}
@EventHandler
public void onBlockChange(BlockFormEvent e)
{
if (!IsLive())
{
return;
}
if (e.getNewState().getType() == Material.ICE)
{
e.setCancelled(true);
}
}
@SuppressWarnings("deprecation")
@ -813,7 +908,6 @@ public class ShockCastleSiege extends TeamGame
if (data.addKill(hardLine))
{
AddStat(player, "KillStreak", 1, false, false);
player.sendMessage(C.cRedB + "You have received a Kill Streak Reward!");
((KitPlayer)GetKit(player)).awardKillStreak(player, hardLine ? (data.getKills() + 1) : data.getKills());
}
if (UtilMath.isEven(data.getKills()))
@ -890,26 +984,26 @@ public class ShockCastleSiege extends TeamGame
if (event.getEntity().hasMetadata("OBJECTIVE_TNT"))
{
List<TeamBeacon> beacons = new ArrayList<>();
List<TeamCrystal> crystals = new ArrayList<>();
for (List<TeamBeacon> b : _beacons.values())
for (List<TeamCrystal> c : _crystals.values())
{
beacons.addAll(b);
crystals.addAll(c);
}
for (TeamBeacon beacon : beacons)
for (TeamCrystal crystal : crystals)
{
if (beacon.isActive() && !beacon.getOwner().HasPlayer(player) && UtilMath.offset(event.getEntity().getLocation(), beacon.getLocation()) <= radius)
if (crystal.isActive() && !crystal.getOwner().HasPlayer(player) && UtilMath.offset(event.getEntity().getLocation(), crystal.getLocation()) <= radius)
{
beacon.destroy();
AddGems(player, 40, "Beacon Destruction", false, true);
long remaining = beacons.stream().filter(b -> b.getOwner().GetColor() == beacon.getOwner().GetColor()).filter(TeamBeacon::isActive).count();
crystal.destroy();
AddGems(player, 40, "Crystal Destruction", false, true);
long remaining = crystals.stream().filter(b -> b.getOwner().GetColor() == crystal.getOwner().GetColor()).filter(TeamCrystal::isActive).count();
if (remaining > 0)
{
Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(beacon.getOwner().GetFormattedName() + "'s Beacons") + " has been destroyed!"));
Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " has been destroyed!"));
}
else
{
Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(beacon.getOwner().GetFormattedName() + "'s Beacons") + " has been destroyed and " + F.elem(_kings.get(beacon.getOwner()).getName(false)) + " is now vulnerable!"));
Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " has been destroyed and " + F.elem(_kings.get(crystal.getOwner()).getName(false)) + " is now vulnerable!"));
}
}
}
@ -996,6 +1090,10 @@ public class ShockCastleSiege extends TeamGame
teleport.setYaw(shooter.getLocation().getYaw());
shooter.teleport(teleport);
}
if (event.getEntity() instanceof Arrow)
{
Manager.runSyncLater(event.getEntity()::remove, 1L);
}
}
@EventHandler
@ -1022,6 +1120,11 @@ public class ShockCastleSiege extends TeamGame
{
return;
}
if (event.getEntity() instanceof EnderCrystal)
{
event.setCancelled(true);
return;
}
if (event.getEntity() instanceof Zombie)
{
event.setCancelled(true);
@ -1040,9 +1143,9 @@ public class ShockCastleSiege extends TeamGame
{
return;
}
if (_beacons.get(owner).stream().filter(TeamBeacon::isActive).count() > 0)
if (_crystals.get(owner).stream().filter(TeamCrystal::isActive).count() > 0)
{
UtilPlayer.message(p, F.main("Game", "You cannot attack the enemy king until your team has destroyed his protective beacons!"));
UtilPlayer.message(p, F.main("Game", "You cannot attack the enemy king until your team has destroyed his protective crystals!"));
return;
}
TeamKing king = _kings.get(owner);
@ -1203,6 +1306,7 @@ public class ShockCastleSiege extends TeamGame
event.getPlayer().getInventory().setHelmet(_wearableTnt.build());
UtilPlayer.message(event.getPlayer(), F.main("Game", "You picked up " + F.skill("TNT") + "."));
UtilPlayer.message(event.getPlayer(), F.main("Game", F.elem("Right-Click") + " to detonate yourself."));
UtilPlayer.message(event.getPlayer(), F.main("Game", "Run to the enemy Crystal and Detonate to destroy it."));
}
}
}
@ -1239,8 +1343,15 @@ public class ShockCastleSiege extends TeamGame
@EventHandler
public void TNTExpire(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
if (!IsLive())
{
return;
}
if (event.getType() != UpdateType.FASTER)
{
return;
}
Iterator<Player> tntIterator = _tntCarry.iterator();
@ -1265,7 +1376,34 @@ public class ShockCastleSiege extends TeamGame
tntIterator.remove();
continue;
}
List<TeamCrystal> crystals = new ArrayList<>();
for (List<TeamCrystal> c : _crystals.values())
{
crystals.addAll(c);
}
for (TeamCrystal crystal : crystals)
{
if (crystal.isActive() && !crystal.getOwner().HasPlayer(player) && UtilMath.offset(player.getLocation(), crystal.getLocation()) <= 3)
{
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class);
UtilEnt.SetMetadata(tnt, "THROWER", player.getName());
UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true);
tnt.setFuseTicks(0);
if (!player.isDead())
{
player.getInventory().setHelmet((ItemStack) player.getMetadata("OLD_HELM").get(0).value());
}
player.removeMetadata("OLD_HELM", UtilServer.getPlugin());
player.removeMetadata("TNT_START", UtilServer.getPlugin());
tntIterator.remove();
}
}
UtilTextBottom.display(GetTeam(player).GetColor() + player.getName() + " has the TNT!", UtilServer.getPlayers());
UtilFirework.playFirework(player.getEyeLocation(), Type.BURST, Color.RED, false, false);
}
}
@ -1291,4 +1429,13 @@ public class ShockCastleSiege extends TeamGame
tnt.setFuseTicks(0);
UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + "."));
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
if (_tntSpawner.canPlaceFireAt(event.getBlock()))
{
event.setCancelled(true);
}
}
}

View File

@ -3,9 +3,10 @@ package nautilus.game.arcade.game.games.castlesiege.data;
import java.util.List;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
@ -40,6 +41,16 @@ public class ObjectiveTNTSpawner
return _entity != null;
}
public boolean canPlaceFireAt(Block block)
{
if (!isSpawned())
{
return false;
}
return UtilMath.offsetSquared(_lastSpawnLoc, block.getLocation()) <= 9;
}
public long getNextTNT()
{
return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis();
@ -72,6 +83,10 @@ public class ObjectiveTNTSpawner
else if (isSpawned())
{
_entity.teleport(_lastSpawnLoc);
if (!_entity.isValid() || _entity.isDead())
{
_entity = _lastSpawnLoc.getWorld().dropItem(_lastSpawnLoc, new ItemStack(Material.TNT));
}
}
}

View File

@ -2,16 +2,19 @@ package nautilus.game.arcade.game.games.castlesiege.data;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EnderCrystal;
import nautilus.game.arcade.game.GameTeam;
public class TeamBeacon
public class TeamCrystal
{
private Location _loc;
private GameTeam _owner;
private EnderCrystal _crystal;
private boolean _destroyed;
public TeamBeacon(GameTeam owner, Location loc)
public TeamCrystal(GameTeam owner, Location loc)
{
_owner = owner;
_loc = loc;
@ -37,12 +40,15 @@ public class TeamBeacon
public void spawn()
{
_destroyed = false;
_loc.getBlock().setType(Material.BEACON);
_crystal = _loc.getWorld().spawn(_loc, EnderCrystal.class);
_loc.getBlock().getRelative(0, -2, 0).setType(Material.BEACON);
}
public void destroy()
{
_destroyed = true;
_loc.getBlock().setType(Material.AIR);
_crystal.remove();
_crystal = null;
_loc.getBlock().getRelative(0, -2, 0).setType(Material.SMOOTH_BRICK);
}
}

View File

@ -115,18 +115,22 @@ public class KitArcher extends KitPlayer
{
if (streak == 2)
{
player.sendMessage(C.cRedB + "You have received 8 Arrows as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(8).setTitle(F.item("Fletched Arrow")).build());
}
else if (streak == 4)
{
player.sendMessage(C.cRedB + "You have received a Power I book as a Kill Streak Reward!");
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build());
}
else if (streak == 6)
{
player.sendMessage(C.cRedB + "You have received a Punch I book as a Kill Streak Reward!");
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_KNOCKBACK, 1).build());
}
else if (streak == 8)
{
player.sendMessage(C.cRedB + "You have received a Power I book as a Kill Streak Reward!");
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build());
}
}

View File

@ -130,18 +130,22 @@ public class KitDemolitionist extends KitPlayer
{
if (streak == 2)
{
player.sendMessage(C.cRedB + "You have received 2 Throwing TNT as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(2).build());
}
else if (streak == 4)
{
player.sendMessage(C.cRedB + "You have received 3 Throwing TNT as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(3).build());
}
else if (streak == 6)
{
player.sendMessage(C.cRedB + "You have received 4 Throwing TNT as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(4).build());
}
else if (streak == 8)
{
player.sendMessage(C.cRedB + "You have received 5 Throwing TNT as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(5).build());
}
}

View File

@ -108,18 +108,22 @@ public class KitFighter extends KitPlayer
{
if (streak == 2)
{
player.sendMessage(C.cRedB + "You have received a Golden Applegate as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").build());
}
else if (streak == 4)
{
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.DAMAGE_ALL, 1).build());
player.sendMessage(C.cRedB + "You have received a Splash Healing II Potion as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)16421).build());
}
else if (streak == 6)
{
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.DAMAGE_ALL, 1).build());
player.sendMessage(C.cRedB + "You have received a Speed II Potion as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)8290).build());
}
else if (streak == 8)
{
player.sendMessage(C.cRedB + "You have received a Fire Aspect I book as a Kill Streak Reward!");
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.FIRE_ASPECT, 1).build());
}
}

View File

@ -3,6 +3,10 @@ package nautilus.game.arcade.game.games.castlesiege.shockkits;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.EnchantedBookBuilder;
@ -115,18 +119,27 @@ public class KitTank extends KitPlayer
{
if (streak == 2)
{
player.sendMessage(C.cRedB + "You have received a Golden Applegate as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").build());
}
else if (streak == 4)
{
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build());
player.sendMessage(C.cRedB + "You have received a Regeneration II Potion as a Kill Streak Reward!");
player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)8289).build());
}
else if (streak == 6)
{
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build());
player.sendMessage(C.cRedB + "You have received a Resistance I Potion as a Kill Streak Reward!");
ItemStack item = new ItemBuilder(Material.POTION).setData((short)8205).build();
PotionMeta pm = (PotionMeta) item.getItemMeta();
pm.clearCustomEffects();
pm.addCustomEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20 * 60, 0), true);
item.setItemMeta(pm);
player.getInventory().addItem(item);
}
else if (streak == 8)
{
player.sendMessage(C.cRedB + "You have received a Thorns II book as a Kill Streak Reward!");
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.THORNS, 2).build());
}
}

View File

@ -3,6 +3,16 @@ package nautilus.game.arcade.managers;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.Managers;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath;
@ -14,15 +24,6 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class GameStatManager implements Listener
{
ArcadeManager Manager;
@ -74,10 +75,13 @@ public class GameStatManager implements Listener
Manager.GetStatsManager().incrementStat(player, stat, value);
// Leaderboard hook for logging appropriate stat events
// Note: Rejects stat events that are not of the appropriate types.
int gameId = event.GetGame().GetType().getGameId();
LeaderboardManager.getInstance().attemptStatEvent(player, stat.split("\\.")[1], gameId, value);
if (!event.GetGame().Leaderboards)
continue;
if (stat.startsWith("Global."))
continue;
Managers.get(LeaderboardManager.class).handleStatIncrease(player, stat, value);
}
}
}

View File

@ -1,24 +1,20 @@
package nautilus.game.arcade.managers.lobby.current;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.timing.TimingManager;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.deathtag.DeathTag;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.smash.SuperSmash;
import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.KitSorter;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.managers.LobbyEnt;
import nautilus.game.arcade.managers.lobby.LobbyManager;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -32,16 +28,26 @@ import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import mineplex.core.common.timing.TimingManager;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.deathtag.DeathTag;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.smash.SuperSmash;
import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.KitSorter;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.managers.LobbyEnt;
import nautilus.game.arcade.managers.lobby.LobbyManager;
/**
*
@ -574,5 +580,15 @@ public class NewGameLobbyManager extends LobbyManager
return null;
}
}
public Map<String, List<Location>> getCustomLocs()
{
Map<String, List<Location>> ret = new HashMap<>();
ret.putAll(_multipleLocs);
for (Entry<String, Location> singleEntry : _singleLocs.entrySet())
{
ret.put(singleEntry.getKey(), Arrays.asList(singleEntry.getValue()));
}
return ret;
}
}