Get the plugin to actually start
This commit is contained in:
parent
c52908ec48
commit
28e77f78a3
@ -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)
|
||||
));
|
||||
|
@ -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<HubClient> implements IChatMess
|
||||
_parkourManager = require(ParkourManager.class);
|
||||
_jumpManager = new JumpManager(this);
|
||||
|
||||
_hubPlugin = new HubPlugin();
|
||||
_hubPlugin = new AnniversaryHubPlugin();
|
||||
|
||||
// Disable chunk generation
|
||||
nmsWorld.generator = new VoidGenerator();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<String, Integer>());
|
||||
_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";
|
||||
|
@ -58,4 +58,9 @@ public class OverpoweredBridge extends Bridge
|
||||
return "OP Bridges";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowingGameStats()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -437,9 +437,25 @@ public class GameCreationManager implements Listener
|
||||
|
||||
private GameMode randomGameMode(List<String> 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<GameMode> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user