After QA testing
This commit is contained in:
parent
ff83d63f13
commit
1e1fa6ce19
@ -357,7 +357,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
||||
|
||||
private boolean canInform(int currentProgress, int amount, int requiredProgress, double requirement)
|
||||
{
|
||||
int progressToGet = (int) (requiredProgress * requirement);
|
||||
int progressToGet = (int) Math.ceil(requiredProgress * requirement);
|
||||
|
||||
return currentProgress + amount >= progressToGet && currentProgress < progressToGet;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class ViewMissionsCommand extends CommandBase<MissionManager>
|
||||
|
||||
public ViewMissionsCommand(MissionManager plugin)
|
||||
{
|
||||
super(plugin, Perm.VIEW_MISSION_COMMAND, "missions");
|
||||
super(plugin, Perm.VIEW_MISSION_COMMAND, "missions", "mission");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +150,7 @@ public class PersonalServerManager extends MiniPlugin
|
||||
}
|
||||
|
||||
final ServerGroup serverGroup = new ServerGroup("COM-" + community.getId(), "COM-" + community.getName(), "COM-" + community.getId(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, "", true, "Lobby_MCS.zip", "Arcade.jar", "plugins/Arcade/", 15, 20,
|
||||
true, false, false, community.getFavoriteGame().name(), "", "", "Community", true, false, false, true, false, false, true, false, false, false, false, false, false, true, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
true, false, false, community.getFavoriteGame().name(), "", "", "Community", true, false, false, true, false, false, true, false, false, false, false, false, false, true, true, true, false, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
|
||||
_repository.updateServerGroup(serverGroup);
|
||||
runSync(() ->
|
||||
@ -183,7 +183,7 @@ public class PersonalServerManager extends MiniPlugin
|
||||
}
|
||||
|
||||
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, "", true, "Lobby_MPS.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
|
||||
true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, false, false, true, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, false, false, true, true, true, false, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
|
||||
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), () ->
|
||||
{
|
||||
|
@ -169,6 +169,7 @@ import nautilus.game.arcade.managers.chat.GameChatManager;
|
||||
import nautilus.game.arcade.managers.lobby.LobbyManager;
|
||||
import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
|
||||
import nautilus.game.arcade.managers.lobby.legacy.LegacyGameLobbyManager;
|
||||
import nautilus.game.arcade.managers.voting.event.VoteStartEvent;
|
||||
|
||||
public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
@ -557,7 +558,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
scoreboard.get(ArcadeScoreboardLine.GEM_VALUE).write(donationManager.Get(scoreboard.getOwner()).getBalance(GlobalCurrency.GEM));
|
||||
}
|
||||
|
||||
ChatColor teamColor = ChatColor.GRAY;
|
||||
ChatColor teamColor = ChatColor.GOLD;
|
||||
String kitName = "None";
|
||||
|
||||
if (GetGame() != null)
|
||||
@ -1654,6 +1655,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVote(VoteStartEvent event)
|
||||
{
|
||||
getTitles().forceEnable();
|
||||
getCosmeticManager().setActive(true);
|
||||
getCosmeticManager().setHideParticles(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableGadget(PlayerJoinEvent event)
|
||||
{
|
||||
|
@ -4,31 +4,34 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class PlayerStateChangeEvent extends Event
|
||||
public class PlayerStateChangeEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Game _game;
|
||||
private Player _player;
|
||||
private PlayerState _state;
|
||||
|
||||
public PlayerStateChangeEvent(Game game, Player player, PlayerState state)
|
||||
{
|
||||
_game = game;
|
||||
_player = player;
|
||||
_state = state;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
private final Game _game;
|
||||
private final PlayerState _state;
|
||||
|
||||
public PlayerStateChangeEvent(Game game, Player player, PlayerState state)
|
||||
{
|
||||
super(player);
|
||||
|
||||
_game = game;
|
||||
_state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public Game GetGame()
|
||||
@ -36,9 +39,10 @@ public class PlayerStateChangeEvent extends Event
|
||||
return _game;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Player GetPlayer()
|
||||
{
|
||||
return _player;
|
||||
return getPlayer();
|
||||
}
|
||||
|
||||
public PlayerState GetState()
|
||||
|
@ -1161,13 +1161,14 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
GameTeam team = GetTeam(player);
|
||||
|
||||
if (team == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
team.SetPlayerState(player, state);
|
||||
|
||||
// Event
|
||||
PlayerStateChangeEvent playerStateEvent = new PlayerStateChangeEvent(this, player, PlayerState.OUT);
|
||||
UtilServer.getServer().getPluginManager().callEvent(playerStateEvent);
|
||||
UtilServer.CallEvent(new PlayerStateChangeEvent(this, player, state));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.newnpc.NPC;
|
||||
import mineplex.core.newnpc.NewNPCManager;
|
||||
import mineplex.core.newnpc.SimpleNPC;
|
||||
import mineplex.core.newnpc.event.NPCInteractEvent;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -233,6 +234,7 @@ public class CakeShopModule extends CakeModule
|
||||
}
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (block == null || block.getType() != Material.BARRIER)
|
||||
{
|
||||
@ -240,20 +242,30 @@ public class CakeShopModule extends CakeModule
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
openShop(player, event.getAction(), block.getLocation());
|
||||
}
|
||||
|
||||
Location location = block.getLocation();
|
||||
// Why do we need this? 1.8 clients sometimes ignore the block, and instead say they hit the entity.
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void entityInteract(NPCInteractEvent event)
|
||||
{
|
||||
openShop(event.getPlayer(), event.isLeftClick() ? Action.LEFT_CLICK_BLOCK : Action.RIGHT_CLICK_BLOCK, event.getNpc().getEntity().getLocation());
|
||||
}
|
||||
|
||||
private void openShop(Player player, Action action, Location location)
|
||||
{
|
||||
for (Entry<NPC, CakeResource> entry : _npcs.entrySet())
|
||||
{
|
||||
if (UtilMath.offset2dSquared(entry.getKey().getEntity().getLocation(), location) > 1)
|
||||
Location npcLocation = entry.getKey().getEntity().getLocation();
|
||||
|
||||
if (location.getBlockX() != npcLocation.getBlockX() || location.getBlockZ() != npcLocation.getBlockZ())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
CakeResource resource = entry.getValue();
|
||||
|
||||
if (UtilPlayer.isSpectator(player) || event.getAction() == Action.LEFT_CLICK_BLOCK && UtilItem.isSword(player.getItemInHand()) || !Recharge.Instance.use(player, "Interact Shop", 500, false, false))
|
||||
if (UtilPlayer.isSpectator(player) || (action == Action.LEFT_CLICK_BLOCK && UtilItem.isSword(player.getItemInHand())) || !Recharge.Instance.use(player, "Interact Shop", 500, false, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public enum CakeTeamItem implements CakeItem
|
||||
new ItemStack(Material.DIAMOND_SWORD),
|
||||
"Gives your entire team %s.",
|
||||
Pair.create("Sharpness I", 8),
|
||||
Pair.create("Haste II", 12)
|
||||
Pair.create("Sharpness II", 12)
|
||||
)
|
||||
{
|
||||
@Override
|
||||
|
@ -493,7 +493,7 @@ public class CakeTeamModule extends CakeModule
|
||||
|
||||
CakeTeam cakeTeam = _teams.get(team);
|
||||
|
||||
if (!cakeTeam.canRespawn())
|
||||
if (cakeTeam == null || !cakeTeam.canRespawn())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class CakeResourcePage extends ShopPageBase<ArcadeManager, CakeResourceSh
|
||||
{
|
||||
return CakeShopResult.ONLY_ONE;
|
||||
}
|
||||
else if (!UtilInv.contains(_player, itemStack.getType(), itemStack.getData().getData(), item.getCost()))
|
||||
else if (!UtilInv.contains(_player, null, itemStack.getType(), itemStack.getData().getData(), item.getCost(), false, false, false))
|
||||
{
|
||||
return CakeShopResult.NOT_ENOUGH_RESOURCES;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class CakeResourceStarPage extends CakeResourcePage
|
||||
{
|
||||
return CakeShopResult.MAX_TIER;
|
||||
}
|
||||
else if (!UtilInv.contains(_player, itemStack.getType(), itemStack.getData().getData(), teamItem.getLevels()[level].getRight()))
|
||||
else if (!UtilInv.contains(_player, null, itemStack.getType(), itemStack.getData().getData(), teamItem.getLevels()[level].getRight(), false, false, false))
|
||||
{
|
||||
return CakeShopResult.NOT_ENOUGH_RESOURCES;
|
||||
}
|
||||
|
@ -212,8 +212,8 @@ public class GameTeamModule extends Module
|
||||
{
|
||||
ArcadeManager manager = getGame().getArcadeManager();
|
||||
|
||||
// Is MPS and No team balancing
|
||||
if (manager.GetGameHostManager().isPrivateServer() && !manager.IsTeamBalance())
|
||||
// No team balancing, we don't care. Just put them on the team.
|
||||
if (!manager.IsTeamBalance())
|
||||
{
|
||||
getGame().SetPlayerTeam(player, team, true);
|
||||
return;
|
||||
|
@ -521,9 +521,18 @@ public class GameManager implements Listener
|
||||
continue;
|
||||
}
|
||||
|
||||
int amount = game.getTeamModule().getPlayersQueued(team);
|
||||
String amount;
|
||||
|
||||
team.GetTeamEntity().setCustomName(team.GetFormattedName() + " Team" + C.Reset + " " + amount + " Queued");
|
||||
if (Manager.IsTeamBalance())
|
||||
{
|
||||
amount = game.getTeamModule().getPlayersQueued(team) + " Queued";
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = team.GetSize() + " Players";
|
||||
}
|
||||
|
||||
team.GetTeamEntity().setCustomName(team.GetFormattedName() + " Team" + C.Reset + " " + amount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.managers.voting.event.VoteStartEvent;
|
||||
|
||||
public class HubClockManager implements Listener
|
||||
{
|
||||
@ -71,28 +72,29 @@ public class HubClockManager implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void giveOnDeath(PlayerStateChangeEvent event)
|
||||
public void giveOnVote(VoteStartEvent event)
|
||||
{
|
||||
// Only handle when the player is now out
|
||||
if (event.GetState() != PlayerState.OUT || !canGiveClock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_manager.runSyncLater(() -> giveClock(event.GetPlayer()), GameSpectatorManager.ITEM_GIVE_DELAY);
|
||||
UtilServer.getPlayersCollection().forEach(this::giveClock);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void removeOnRespawn(PlayerStateChangeEvent event)
|
||||
public void giveOnDeath(PlayerStateChangeEvent event)
|
||||
{
|
||||
// Only handle when the player is now in.
|
||||
// This should make MS not have a persistent clock after round end
|
||||
if (event.GetState() != PlayerState.IN || !canGiveClock())
|
||||
if (!canGiveClock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
removeClock(event.GetPlayer());
|
||||
// Only handle when the player is now out
|
||||
if (event.GetState() == PlayerState.OUT)
|
||||
{
|
||||
_manager.runSyncLater(() -> giveClock(event.getPlayer()), GameSpectatorManager.ITEM_GIVE_DELAY);
|
||||
}
|
||||
// Fix for MineStrike
|
||||
else
|
||||
{
|
||||
removeClock(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -117,7 +119,7 @@ public class HubClockManager implements Listener
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Only allow this exact clock to be used.
|
||||
if (HUB_CLOCK_ITEM.equals(player.getItemInHand()))
|
||||
if (!HUB_CLOCK_ITEM.equals(player.getItemInHand()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -406,8 +406,10 @@ public class NextBestGameManager implements Listener
|
||||
|
||||
private void handle(Player player)
|
||||
{
|
||||
if (getGame().IsAlive(player))
|
||||
if (getGame() != null && getGame().IsAlive(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Party party = _partyManager.getPartyByPlayer(player);
|
||||
|
||||
|
@ -28,6 +28,8 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.managers.voting.command.MapRatingsCommand;
|
||||
import nautilus.game.arcade.managers.voting.event.VoteStartEvent;
|
||||
import nautilus.game.arcade.managers.voting.types.MapVote;
|
||||
import nautilus.game.arcade.managers.voting.ui.VotingPage;
|
||||
import nautilus.game.arcade.managers.voting.ui.VotingShop;
|
||||
|
||||
@ -94,6 +96,8 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
||||
|
||||
activate();
|
||||
_lifetime.start();
|
||||
|
||||
UtilServer.CallEvent(new VoteStartEvent(vote));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,11 +120,7 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
||||
UtilPlayer.closeInventoryIfOpen(player);
|
||||
}
|
||||
|
||||
// false when /game set has been used during a vote
|
||||
if (_manager.GetGameCreationManager().getNextGameType() == null)
|
||||
{
|
||||
_currentVote.onEnd();
|
||||
}
|
||||
|
||||
_currentVote = null;
|
||||
_finishedVote = null;
|
||||
|
@ -0,0 +1,35 @@
|
||||
package nautilus.game.arcade.managers.voting.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import nautilus.game.arcade.managers.voting.Vote;
|
||||
|
||||
public class VoteStartEvent extends Event
|
||||
{
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
private final Vote<?> _vote;
|
||||
|
||||
public VoteStartEvent(Vote<?> vote)
|
||||
{
|
||||
_vote = vote;
|
||||
}
|
||||
|
||||
public Vote<?> getVote()
|
||||
{
|
||||
return _vote;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
@ -86,6 +86,12 @@ public class GameVote extends Vote<GameType>
|
||||
@Override
|
||||
public void onEnd()
|
||||
{
|
||||
// true when /game set has been used during a vote
|
||||
if (getManager().GetGameCreationManager().getNextGameType() != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String message = C.cGreenB + getWinner().getName() + C.cWhiteB;
|
||||
|
||||
if (_winningMapVote != null)
|
||||
|
Loading…
Reference in New Issue
Block a user