Possible final push

This commit is contained in:
Sam 2018-07-13 02:59:07 +01:00 committed by Alexander Meech
parent d86d5172c0
commit c52908ec48
13 changed files with 161 additions and 30 deletions

View File

@ -0,0 +1,33 @@
package mineplex.core.achievement.leveling.rewards;
import org.bukkit.entity.Player;
import mineplex.core.Managers;
import mineplex.core.common.util.C;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackManager;
public class LevelTitleReward implements LevelReward
{
private static final TrackManager TRACK_MANAGER = Managers.require(TrackManager.class);
private final Track _track;
public LevelTitleReward(Track track)
{
_track = track;
}
@Override
public void claim(Player player)
{
TRACK_MANAGER.unlockTrack(player, _track);
}
@Override
public String getDescription()
{
return C.cAqua + _track.getLongName() + C.Reset + " (" + C.cAqua + "Title" + C.Reset + ")";
}
}

View File

@ -468,12 +468,14 @@ public class GadgetManager extends MiniPlugin
_userGadgetPersistence = new UserGadgetPersistence(this); _userGadgetPersistence = new UserGadgetPersistence(this);
_incognitoManager = require(IncognitoManager.class); _incognitoManager = require(IncognitoManager.class);
_gameCosmeticManager = require(GameCosmeticManager.class); _gameCosmeticManager = require(GameCosmeticManager.class);
_missionManager = require(MissionManager.class);
_soulManager = new SoulManager(); _soulManager = new SoulManager();
_castleManager = require(CastleManager.class); _castleManager = require(CastleManager.class);
createGadgets(); createGadgets();
createSets(); createSets();
_missionManager = require(MissionManager.class);
registerTrackers(); registerTrackers();
generatePermissions(); generatePermissions();
} }

View File

@ -58,7 +58,7 @@ public enum GameDisplay
SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EVENT, 39, false), SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EVENT, 39, false),
Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.NONE, 40, true), Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.NONE, 40, true),
SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.NONE, 41, false), SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.NONE, 41, false),
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.NONE, 43, false), SquidShooter("Squid Shooter", Material.INK_SACK, (byte)0, GameCategory.NONE, 43, false),
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.NONE, 42, false), Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.NONE, 42, false),
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.INTERMEDIATE, 22, true), SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.INTERMEDIATE, 22, true),
SurvivalGamesTeams("Survival Games Teams", "Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.INTERMEDIATE, 23, false), SurvivalGamesTeams("Survival Games Teams", "Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.INTERMEDIATE, 23, false),

View File

@ -4,10 +4,17 @@ import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.Managers;
import mineplex.core.achievement.leveling.rewards.LevelCurrencyReward; import mineplex.core.achievement.leveling.rewards.LevelCurrencyReward;
import mineplex.core.achievement.leveling.rewards.LevelExperienceReward; import mineplex.core.achievement.leveling.rewards.LevelExperienceReward;
import mineplex.core.achievement.leveling.rewards.LevelGadgetReward;
import mineplex.core.achievement.leveling.rewards.LevelTitleReward;
import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.particle.ParticleFiveYear;
import mineplex.core.game.GameDisplay; import mineplex.core.game.GameDisplay;
import mineplex.core.titles.tracks.TrackManager;
import mineplex.core.titles.tracks.award.FiveYearTrack;
import static mineplex.core.game.GameDisplay.*; import static mineplex.core.game.GameDisplay.*;
import static mineplex.core.mission.MissionTrackerType.*; import static mineplex.core.mission.MissionTrackerType.*;
@ -24,17 +31,28 @@ public class MissionPopulator
// Special Event Missions 10000+ // Special Event Missions 10000+
MissionContext.newBuilder(manager, 10000) // MissionContext.newBuilder(manager, 10000)
.name("Welcome Polly!") // .name("Welcome Polly!")
.description("Play %s Games of Cake Wars") // .description("Play %s Games of Cake Wars")
// .event()
// .games(CakeWars4, CakeWarsDuos)
// .xRange(25, 25)
// .tracker(GAME_PLAY)
// .rewards(
// new LevelExperienceReward(100),
// new LevelCurrencyReward(GlobalCurrency.GEM, 50),
// new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 50)
// )
// .build();
MissionContext.newBuilder(manager, 10001)
.name("Happy Birthday!")
.description("Join Mineplex. You've already done it!")
.event() .event()
.games(CakeWars4, CakeWarsDuos) .tracker(LOBBY_JOIN)
.xRange(25, 25)
.tracker(GAME_PLAY)
.rewards( .rewards(
new LevelExperienceReward(100), new LevelGadgetReward(Managers.require(GadgetManager.class).getGadget(ParticleFiveYear.class)),
new LevelCurrencyReward(GlobalCurrency.GEM, 50), new LevelTitleReward(Managers.require(TrackManager.class).getTrack(FiveYearTrack.class))
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 50)
) )
.build(); .build();

View File

@ -3,6 +3,7 @@ package mineplex.core.mission;
public enum MissionTrackerType public enum MissionTrackerType
{ {
LOBBY_JOIN,
LOBBY_PARKOUR, LOBBY_PARKOUR,
LOBBY_GADGET_USE, LOBBY_GADGET_USE,
LOBBY_FLESH_HOOK, LOBBY_FLESH_HOOK,

View File

@ -69,6 +69,7 @@ import mineplex.core.inventory.InventoryManager;
import mineplex.core.menu.MenuManager; import mineplex.core.menu.MenuManager;
import mineplex.core.message.PrivateMessageEvent; import mineplex.core.message.PrivateMessageEvent;
import mineplex.core.mission.MissionManager; import mineplex.core.mission.MissionManager;
import mineplex.core.mission.MissionTrackerType;
import mineplex.core.noteblock.MusicManager; import mineplex.core.noteblock.MusicManager;
import mineplex.core.notifier.NotificationManager; import mineplex.core.notifier.NotificationManager;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
@ -367,11 +368,12 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
} }
@EventHandler @EventHandler
public void autoOP(PlayerJoinEvent event) public void playerJoin(PlayerJoinEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
player.setOp(_clientManager.Get(event.getPlayer()).hasPermission(Perm.AUTO_OP)); player.setOp(_clientManager.Get(event.getPlayer()).hasPermission(Perm.AUTO_OP));
_missionManager.incrementProgress(player, 1, MissionTrackerType.LOBBY_JOIN, null, null);
} }
@EventHandler @EventHandler

View File

@ -143,8 +143,24 @@ public class DragonsTeams extends Dragons
return; return;
} }
GetPlayers(true).forEach(this::giveSurvivedGems); GameTeam winner = placements.get(0);
AnnounceEnd(placements.get(0));
GetPlayers(false).forEach(player ->
{
if (!player.isOnline())
{
return;
}
AddGems(player, 10, "Participation", false, false);
if (winner.HasPlayer(player))
{
AddGems(player, 20, "Winning Team", false, false);
}
});
AnnounceEnd(winner);
SetState(GameState.End); SetState(GameState.End);
} }

View File

@ -1,5 +1,8 @@
package nautilus.game.arcade.game.games.milkcow; package nautilus.game.arcade.game.games.milkcow;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -300,7 +303,6 @@ public class MilkCow extends SoloGame
event.setCancelled(true); event.setCancelled(true);
player.setItemInHand(new ItemStack(Material.MILK_BUCKET)); player.setItemInHand(new ItemStack(Material.MILK_BUCKET));
Bukkit.broadcastMessage(event.getEventName());
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
@ -448,6 +450,34 @@ public class MilkCow extends SoloGame
} }
} }
@Override
public List<Player> getWinners()
{
if (GetState().ordinal() >= GameState.End.ordinal())
{
Player winner = getPlacements().get(0);
if (winner == null)
{
return Collections.emptyList();
}
else
{
return Collections.singletonList(winner);
}
}
return null;
}
@Override
public List<Player> getLosers()
{
List<Player> losers = new ArrayList<>(GetPlayers(false));
losers.removeAll(getWinners());
return losers;
}
@Override @Override
@EventHandler @EventHandler
public void ScoreboardUpdate(UpdateEvent event) public void ScoreboardUpdate(UpdateEvent event)

View File

@ -325,6 +325,8 @@ public class SquidShooters extends SoloGame
.sorted(Comparator.comparing(player -> _kills.getOrDefault(player, 0)).reversed()) .sorted(Comparator.comparing(player -> _kills.getOrDefault(player, 0)).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
places.forEach(player -> AddGems(player, 10, "Participation", false, false));
if (!places.isEmpty()) if (!places.isEmpty())
{ {
AddGems(places.get(0), 20, "1st Place", false, false); AddGems(places.get(0), 20, "1st Place", false, false);

View File

@ -30,6 +30,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.Glide;
import com.mineplex.anticheat.checks.move.HeadRoll;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
@ -75,6 +76,8 @@ public class TugOfWool extends TeamGame
private static final long GAME_TIMEOUT = TimeUnit.MINUTES.toMillis(8); private static final long GAME_TIMEOUT = TimeUnit.MINUTES.toMillis(8);
private static final long PURCHASE_COOLDOWN = TimeUnit.SECONDS.toMillis(5); private static final long PURCHASE_COOLDOWN = TimeUnit.SECONDS.toMillis(5);
private static final int GOLD_SLOT = 8; private static final int GOLD_SLOT = 8;
private static final int MAX_GOLD = 50;
private static final double GOLD_PER_ANIMAL = 0.2, GOLD_PER_PLAYER = 0.3, GOLD_PER_SEC = 0.05, GOLD_PER_CROP_LOST = 3, GOLD_LOST_DEATH = 0.5;
private final Set<TugTeam> _teams; private final Set<TugTeam> _teams;
private final List<TugItem> _items; private final List<TugItem> _items;
@ -103,7 +106,7 @@ public class TugOfWool extends TeamGame
AntiHack antiHack = Managers.get(AntiHack.class); AntiHack antiHack = Managers.get(AntiHack.class);
antiHack.addIgnoredCheck(Glide.class); antiHack.addIgnoredCheck(Glide.class);
antiHack.addIgnoredCheck(HeadRoll.class);
registerChatStats( registerChatStats(
Kills, Kills,
Deaths, Deaths,
@ -308,7 +311,7 @@ public class TugOfWool extends TeamGame
{ {
for (Player player : team.getEnemy().getGameTeam().GetPlayers(true)) for (Player player : team.getEnemy().getGameTeam().GetPlayers(true))
{ {
incrementGold(player, 3); incrementGold(player, GOLD_PER_CROP_LOST);
} }
targetCrops.remove(targetLocation); targetCrops.remove(targetLocation);
@ -361,12 +364,12 @@ public class TugOfWool extends TeamGame
{ {
if (damagee instanceof Player) if (damagee instanceof Player)
{ {
incrementGold(damager, 0.3); incrementGold(damager, GOLD_PER_PLAYER);
} }
else else
{ {
event.SetKnockback(false); event.SetKnockback(false);
incrementGold(damager, 0.2); incrementGold(damager, GOLD_PER_ANIMAL);
} }
} }
} }
@ -439,7 +442,7 @@ public class TugOfWool extends TeamGame
player.getInventory().setItem(slot++, item.getItemStack()); player.getInventory().setItem(slot++, item.getItemStack());
} }
setGold(player, _gold.getOrDefault(player, 0D) / 2D); setGold(player, _gold.getOrDefault(player, 0D) / GOLD_LOST_DEATH);
} }
@EventHandler @EventHandler
@ -504,7 +507,7 @@ public class TugOfWool extends TeamGame
continue; continue;
} }
incrementGold(player, 0.05); incrementGold(player, GOLD_PER_SEC);
} }
} }
@ -575,6 +578,21 @@ public class TugOfWool extends TeamGame
if (winner != null) if (winner != null)
{ {
for (Player player : GetPlayers(false))
{
if (!player.isOnline())
{
continue;
}
AddGems(player, 10, "Participation", false, false);
if (winner.HasPlayer(player))
{
AddGems(player, 20, "Winning Team", false, false);
}
}
AnnounceEnd(winner); AnnounceEnd(winner);
SetState(GameState.End); SetState(GameState.End);
} }
@ -601,13 +619,14 @@ public class TugOfWool extends TeamGame
public void incrementGold(Player player, double amount) public void incrementGold(Player player, double amount)
{ {
setGold(player, _gold.getOrDefault(player, 0D) + amount); setGold(player, _gold.getOrDefault(player, 0D) + amount);
AddGems(player, amount / 100D, "Gold Collected", false, true);
} }
public void setGold(Player player, double amount) public void setGold(Player player, double amount)
{ {
if (amount >= 50) if (amount >= MAX_GOLD)
{ {
amount = 50; amount = MAX_GOLD;
} }
int amountFloor = (int) Math.floor(amount); int amountFloor = (int) Math.floor(amount);

View File

@ -35,7 +35,7 @@ public class TugCow extends TugEntity<Cow>
@Override @Override
public void attack(LivingEntity other) public void attack(LivingEntity other)
{ {
other.damage(20, _entity); other.damage(12, _entity);
other.getWorld().playSound(other.getLocation(), Sound.COW_IDLE, 1, (float) Math.random()); other.getWorld().playSound(other.getLocation(), Sound.COW_IDLE, 1, (float) Math.random());
} }

View File

@ -122,7 +122,17 @@ public class GameSummaryModule extends Module
player.sendMessage(C.Bold + "Game Rewards"); player.sendMessage(C.Bold + "Game Rewards");
player.sendMessage(""); player.sendMessage("");
_components.forEach(component -> component.sendMessage(player)); _components.forEach(component ->
{
try
{
component.sendMessage(player);
}
catch (Exception e)
{
e.printStackTrace();
}
});
new JsonMessage(C.cGray + "Hover over for details.") new JsonMessage(C.cGray + "Hover over for details.")
.hover(HoverEvent.SHOW_TEXT, C.cGray + "Don't hover over me, silly!") .hover(HoverEvent.SHOW_TEXT, C.cGray + "Don't hover over me, silly!")

View File

@ -230,7 +230,7 @@ public class GameCreationManager implements Listener
for (int i = 0; i < MAX_ATTEMPTS; i++) for (int i = 0; i < MAX_ATTEMPTS; i++)
{ {
gameType = UtilAlg.Random(Manager.GetGameList()); gameType = UtilAlg.Random(Manager.GetGameList());
ModePref = randomGameMode(gameType); ModePref = randomGameMode(Manager.GetServerConfig().GameModeList, gameType);
if (!_lastGames.contains(gameType)) if (!_lastGames.contains(gameType))
{ {
@ -285,7 +285,7 @@ public class GameCreationManager implements Listener
} }
else if (!gameModes.isEmpty()) else if (!gameModes.isEmpty())
{ {
mode = randomGameMode(gameType); mode = randomGameMode(gameModes, gameType);
} }
if (mode != null) if (mode != null)
@ -435,10 +435,8 @@ public class GameCreationManager implements Listener
return Pair.create(gameType, UtilAlg.Random(_maps.get(gameType))); return Pair.create(gameType, UtilAlg.Random(_maps.get(gameType)));
} }
private GameMode randomGameMode(GameType type) private GameMode randomGameMode(List<String> modes, GameType type)
{ {
List<String> modes = Manager.GetServerConfig().GameModeList;
return UtilAlg.Random(Arrays.stream(type.getGameModes()) return UtilAlg.Random(Arrays.stream(type.getGameModes())
.filter(gameMode -> modes.contains(gameMode.getName()) && (_lastMode == null || _lastMode.equals(gameMode.getName()))) .filter(gameMode -> modes.contains(gameMode.getName()) && (_lastMode == null || _lastMode.equals(gameMode.getName())))
.collect(Collectors.toList())); .collect(Collectors.toList()));