Fix some stupid issues
This commit is contained in:
parent
9cf4fba4c2
commit
cdc75e8ff9
@ -34,7 +34,15 @@ public class MissionClient
|
|||||||
{
|
{
|
||||||
Map<PlayerMission, Integer> unsaved = new HashMap<>(_missions.size());
|
Map<PlayerMission, Integer> unsaved = new HashMap<>(_missions.size());
|
||||||
|
|
||||||
_missions.forEach(mission -> unsaved.put(mission, mission.saveProgress()));
|
_missions.forEach(mission ->
|
||||||
|
{
|
||||||
|
if (mission.isDiscarded() || mission.hasRewarded())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsaved.put(mission, mission.saveProgress());
|
||||||
|
});
|
||||||
|
|
||||||
return unsaved;
|
return unsaved;
|
||||||
}
|
}
|
||||||
|
@ -282,6 +282,12 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
|
|
||||||
mission.reward();
|
mission.reward();
|
||||||
|
|
||||||
|
runAsync(() ->
|
||||||
|
{
|
||||||
|
if (_repository.completeMission(ClientManager.getAccountId(player), mission.getId()))
|
||||||
|
{
|
||||||
|
runSync(() ->
|
||||||
|
{
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
player.sendMessage(" " + mission.getLength().getChatColour() + C.Bold + mission.getLength().getName() + " Mission Complete! " + C.mElem + C.Bold + mission.getName());
|
player.sendMessage(" " + mission.getLength().getChatColour() + C.Bold + mission.getLength().getName() + " Mission Complete! " + C.mElem + C.Bold + mission.getName());
|
||||||
player.sendMessage(" " + C.cGray + mission.getDescription());
|
player.sendMessage(" " + C.cGray + mission.getDescription());
|
||||||
@ -296,8 +302,9 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1, (float) Math.random());
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1, (float) Math.random());
|
||||||
|
|
||||||
_statsManager.incrementStat(player, mission.getLength().getStatName(), 1);
|
});
|
||||||
runAsync(() -> _repository.completeMission(ClientManager.getAccountId(player), mission.getId()));
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> void incrementProgress(Player player, int amount, MissionTrackerType trackerType, GameDisplay game, T data)
|
public <T> void incrementProgress(Player player, int amount, MissionTrackerType trackerType, GameDisplay game, T data)
|
||||||
|
@ -109,7 +109,7 @@ public class MissionRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
complete.Set(resultSet.getBoolean("complete"));
|
complete.Set(resultSet.getByte("complete") == PlayerMission.COMPLETE);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new ColumnInt("accountId", accountId),
|
new ColumnInt("accountId", accountId),
|
||||||
|
@ -1145,9 +1145,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void Login(PlayerLoginEvent event)
|
public void Login(PlayerLoginEvent event)
|
||||||
{
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
CoreClient client = _clientManager.Get(event.getPlayer());
|
||||||
|
|
||||||
if (Bukkit.getServer().hasWhitelist())
|
if (Bukkit.getServer().hasWhitelist())
|
||||||
{
|
{
|
||||||
if (_clientManager.Get(event.getPlayer().getUniqueId()).hasPermission(Perm.BYPASS_WHITELIST))
|
if (client.hasPermission(Perm.BYPASS_WHITELIST))
|
||||||
{
|
{
|
||||||
event.allow();
|
event.allow();
|
||||||
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
||||||
@ -1159,9 +1162,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
|
for (OfflinePlayer other : Bukkit.getWhitelistedPlayers())
|
||||||
{
|
{
|
||||||
if (player.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
if (other.getName().equalsIgnoreCase(player.getName()))
|
||||||
{
|
{
|
||||||
event.allow();
|
event.allow();
|
||||||
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
||||||
@ -1178,29 +1181,29 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
// Reserved Slot Check
|
// Reserved Slot Check
|
||||||
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
|
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
|
||||||
{
|
{
|
||||||
if (_clientManager.Get(event.getPlayer().getUniqueId()).hasPermission(Perm.JOIN_FULL_STAFF))
|
if (client.hasPermission(Perm.JOIN_FULL_STAFF))
|
||||||
{
|
{
|
||||||
event.allow();
|
event.allow();
|
||||||
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (_clientManager.Get(event.getPlayer().getUniqueId()).hasPermission(Perm.JOIN_FULL)
|
else if (client.hasPermission(Perm.JOIN_FULL) || _donationManager.Get(player).ownsUnknownSalesPackage(_serverConfig.ServerType + " ULTRA"))
|
||||||
|| _donationManager.Get(event.getPlayer().getUniqueId()).ownsUnknownSalesPackage(_serverConfig.ServerType + " ULTRA"))
|
|
||||||
{
|
{
|
||||||
|
String reason = C.Bold + "Server has reached max capacity for gameplay purposes.";
|
||||||
|
|
||||||
if (GetGame() != null && GetGame().DontAllowOverfill)
|
if (GetGame() == null || GetGame().DontAllowOverfill)
|
||||||
{
|
{
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (Bukkit.getServer().getOnlinePlayers().size() / Bukkit.getMaxPlayers() > 1.5)
|
else if (Bukkit.getServer().getOnlinePlayers().size() / Bukkit.getMaxPlayers() > 1.5)
|
||||||
{
|
{
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (_gameHostManager.isEventServer() && Bukkit.getServer().getOnlinePlayers().size() >= 128)
|
else if (_gameHostManager.isEventServer() && Bukkit.getServer().getOnlinePlayers().size() >= 128)
|
||||||
{
|
{
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user