diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PowerPlayTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PowerPlayTrack.java index 81fe01721..125116088 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PowerPlayTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PowerPlayTrack.java @@ -10,7 +10,6 @@ import mineplex.core.titles.tracks.TrackTier; public class PowerPlayTrack extends Track { - private final BonusManager _bonusManager = Managers.require(BonusManager.class); public PowerPlayTrack() { @@ -19,7 +18,8 @@ public class PowerPlayTrack extends Track .addTier(new TrackTier( "Power Play Club", null, - player -> _bonusManager.getPowerPlayClubRepository().getCachedData(player).isSubscribed() ? 1L : 0L, + // We have to get BonusManager here to prevent a big problem. Replace with a global variable if it can be created reflectively. + player -> Managers.get(BonusManager.class).getPowerPlayClubRepository().getCachedData(player).isSubscribed() ? 1L : 0L, 1, new TrackFormat(ChatColor.AQUA, ChatColor.AQUA) )); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 4684f9a95..9592effc2 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -107,6 +107,7 @@ import mineplex.hub.news.NewsManager; import mineplex.hub.parkour.ParkourManager; import mineplex.hub.player.CreativeManager; import mineplex.hub.player.HubPlayerManager; +import mineplex.hub.plugin.AnniversaryHubPlugin; import mineplex.hub.plugin.HubPlugin; import mineplex.hub.scoreboard.HubScoreboard; import mineplex.hub.world.HubPortalManager; @@ -250,7 +251,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess _parkourManager = require(ParkourManager.class); _jumpManager = new JumpManager(this); - _hubPlugin = new HubPlugin(); + _hubPlugin = new AnniversaryHubPlugin(); // Disable chunk generation nmsWorld.generator = new VoidGenerator(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/plugin/AnniversaryHubPlugin.java b/Plugins/Mineplex.Hub/src/mineplex/hub/plugin/AnniversaryHubPlugin.java new file mode 100644 index 000000000..d3a01662b --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/plugin/AnniversaryHubPlugin.java @@ -0,0 +1,16 @@ +package mineplex.hub.plugin; + +public class AnniversaryHubPlugin extends HubPlugin +{ + + public AnniversaryHubPlugin() + { + super("Anniversary"); + } + + @Override + protected void setupWorld() + { + _manager.GetSpawn().getWorld().setTime(18000); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index f39597ac7..81cefa700 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -596,6 +596,11 @@ public abstract class Game extends ListenerComponent implements Lifetimed return null; } + public boolean isAllowingGameStats() + { + return true; + } + public GameType GetType() { return _gameType; @@ -1642,12 +1647,22 @@ public abstract class Game extends ListenerComponent implements Lifetimed return; if (!_stats.containsKey(player)) - _stats.put(player, new HashMap()); + _stats.put(player, new HashMap<>()); if (global) + { stat = "Global." + stat; + } else + { + // In certain game modes (for example OP Bridges) we don't want to award game stats but global ones like EXP are fine. + if (!isAllowingGameStats()) + { + return; + } + stat = GetName() + "." + stat; + } if (Manager.IsTournamentServer()) stat += ".Tournament"; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java index 9a233d32c..f3586e7e3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java @@ -58,4 +58,9 @@ public class OverpoweredBridge extends Bridge return "OP Bridges"; } + @Override + public boolean isAllowingGameStats() + { + return false; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooters/kit/KitRetroSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooters/kit/KitRetroSquid.java index 1cb91354b..888611e49 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooters/kit/KitRetroSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooters/kit/KitRetroSquid.java @@ -8,6 +8,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; @@ -53,24 +54,37 @@ public class KitRetroSquid extends Kit } @EventHandler(priority = EventPriority.HIGH) + public void playerInteractEntity(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof Player) + { + attemptLaser(event.getPlayer(), null); + } + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void playerInteract(PlayerInteractEvent event) { - if (event.isCancelled() || !UtilEvent.isAction(event, ActionType.R)) + if (!UtilEvent.isAction(event, ActionType.R)) { return; } - Player player = event.getPlayer(); + if (attemptLaser(event.getPlayer(), event.getClickedBlock())) + { + event.setCancelled(true); + } + } + + private boolean attemptLaser(Player player, Block block) + { ItemStack itemStack = player.getItemInHand(); - Block block = event.getClickedBlock(); if (!HasKit(player) || !UtilItem.isAxe(itemStack) || UtilBlock.usable(block) || !Recharge.Instance.use(player, NAME, 1200, false, true)) { - return; + return false; } - event.setCancelled(true); - Location location = player.getEyeLocation(); location.add(location.getDirection()); location.getWorld().playSound(location, Sound.FIREWORK_LAUNCH, 1, 1); @@ -103,5 +117,7 @@ public class KitRetroSquid extends Kit break; } + + return true; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/TugOfWool.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/TugOfWool.java index aa887016d..086d5fe99 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/TugOfWool.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/TugOfWool.java @@ -69,6 +69,7 @@ public class TugOfWool extends TeamGame { "Your animals are " + C.cRed + "Hungry" + C.Reset + ".", "Guide them to " + C.cYellow + "Enemy Crops" + C.Reset + ".", + "Kill animals and players to get " + C.cGold + "Gold" + C.Reset + ".", "Eat " + C.cAqua + "All" + C.Reset + " enemy crops to win!" }; private static final int MAX_ANIMALS = 30; @@ -619,7 +620,11 @@ public class TugOfWool extends TeamGame public void incrementGold(Player player, double amount) { setGold(player, _gold.getOrDefault(player, 0D) + amount); - AddGems(player, amount / 100D, "Gold Collected", false, true); + + if (amount > 0) + { + AddGems(player, amount / 10D, "Gold Collected", true, true); + } } public void setGold(Player player, double amount) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index c4440e3ec..67c63e135 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -437,9 +437,25 @@ public class GameCreationManager implements Listener private GameMode randomGameMode(List modes, GameType type) { - return UtilAlg.Random(Arrays.stream(type.getGameModes()) - .filter(gameMode -> modes.contains(gameMode.getName()) && (_lastMode == null || _lastMode.equals(gameMode.getName()))) - .collect(Collectors.toList())); + List possible = new ArrayList<>(Arrays.asList(type.getGameModes())); + possible.removeIf(gameMode -> !modes.contains(gameMode.getName())); + + // If there's none or one mode for this gametype just use that one. + if (possible.isEmpty()) + { + return null; + } + else if (possible.size() == 1) + { + return possible.get(0); + } + + if (_lastMode != null) + { + possible.removeIf(gameMode -> _lastMode.equals(gameMode.getName())); + } + + return UtilAlg.Random(possible); } private GameMode getModeByName(GameMode[] gameModes, String gameModeName)