Fix issues from testing
This commit is contained in:
parent
d85b6ee332
commit
f93d873ad5
@ -75,6 +75,7 @@ public class ServerManager extends MiniPlugin
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
JOIN_FULL,
|
||||
JOIN_ALWAYS,
|
||||
FEATURE_SERVER,
|
||||
}
|
||||
|
||||
@ -189,6 +190,7 @@ public class ServerManager extends MiniPlugin
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionGroup.ULTRA.setPermission(Perm.JOIN_FULL, true, true);
|
||||
PermissionGroup.TRAINEE.setPermission(Perm.JOIN_ALWAYS, true, true);
|
||||
PermissionGroup.CONTENT.setPermission(Perm.FEATURE_SERVER, true, true);
|
||||
PermissionGroup.BUILDER.setPermission(Perm.FEATURE_SERVER, true, true);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mineplex.hub.server.ui.lobby;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -34,8 +33,6 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop>
|
||||
boolean ownsUltra = getClientManager().Get(getPlayer()).hasPermission(Perm.JOIN_FULL);
|
||||
String serverName = UtilServer.getServerName();
|
||||
|
||||
servers.sort(Comparator.comparingInt(GameServer::getNumber));
|
||||
|
||||
servers.forEach(server ->
|
||||
{
|
||||
if (server.getNumber() >= getSize())
|
||||
|
@ -308,16 +308,20 @@ public class ServerSelectionPage extends ShopPageBase<ServerManager, ServerSelec
|
||||
builder.addLore(C.cYellow + votingOn + ": " + C.cWhite + value);
|
||||
}
|
||||
}
|
||||
|
||||
builder.addLore("");
|
||||
}
|
||||
|
||||
// Map
|
||||
if (info.getMap() != null)
|
||||
{
|
||||
builder.addLore(C.cYellow + "Map: " + C.cWhite + info.getMap());
|
||||
builder.addLore(
|
||||
C.cYellow + "Map: " + C.cWhite + info.getMap(),
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
builder.addLore(
|
||||
"",
|
||||
C.cGreen + motd,
|
||||
""
|
||||
);
|
||||
@ -346,7 +350,8 @@ public class ServerSelectionPage extends ShopPageBase<ServerManager, ServerSelec
|
||||
default:
|
||||
builder.setType(Material.REDSTONE_BLOCK);
|
||||
footer = "Game is full!";
|
||||
canJoin = false;
|
||||
// Always let staff join
|
||||
canJoin = _clientManager.Get(getPlayer()).hasPermission(Perm.JOIN_ALWAYS);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ public class CombatManager extends MiniClientPlugin<ClientCombat>
|
||||
fakeDeath(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void vanishStatus(IncognitoStatusChangeEvent event)
|
||||
{
|
||||
if (!event.getNewState())
|
||||
|
@ -273,8 +273,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
.register(this);
|
||||
|
||||
_rejoinModule = new RejoinModule(manager)
|
||||
.setSaveInventory(true)
|
||||
.setSaveLocation(true);
|
||||
.setSaveInventory(true);
|
||||
_rejoinModule.register(this);
|
||||
|
||||
// So that we can be 110% sure
|
||||
|
@ -59,7 +59,6 @@ import nautilus.game.arcade.game.games.draw.tools.ToolCircle;
|
||||
import nautilus.game.arcade.game.games.draw.tools.ToolLine;
|
||||
import nautilus.game.arcade.game.games.draw.tools.ToolSquare;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.DrawGuessStatTracker;
|
||||
@ -263,9 +262,6 @@ public class Draw extends SoloGame
|
||||
new ChatStatData("PureLuck", "Lucky Guesses", true)
|
||||
);
|
||||
|
||||
new RejoinModule(manager)
|
||||
.register(this);
|
||||
|
||||
new CompassModule()
|
||||
.setGiveCompass(true)
|
||||
.setGiveCompassToSpecs(true)
|
||||
|
@ -1,13 +1,16 @@
|
||||
package nautilus.game.arcade.game.modules.rejoin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -26,13 +29,15 @@ public class RejoinModule extends Module
|
||||
|
||||
private final GameRejoinManager _manager;
|
||||
private final Map<UUID, PlayerGameInfo> _rejoinData;
|
||||
private final Set<Player> _disallow;
|
||||
|
||||
private boolean _saveInventory, _saveLocation;
|
||||
private boolean _saveInventory;
|
||||
|
||||
public RejoinModule(ArcadeManager manager)
|
||||
{
|
||||
_manager = new GameRejoinManager(manager);
|
||||
_rejoinData = new HashMap<>();
|
||||
_disallow = new HashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,6 +50,7 @@ public class RejoinModule extends Module
|
||||
public void cleanup()
|
||||
{
|
||||
_rejoinData.clear();
|
||||
_disallow.clear();
|
||||
UtilServer.Unregister(_manager);
|
||||
}
|
||||
|
||||
@ -54,18 +60,23 @@ public class RejoinModule extends Module
|
||||
return this;
|
||||
}
|
||||
|
||||
public RejoinModule setSaveLocation(boolean saveLocation)
|
||||
{
|
||||
_saveLocation = saveLocation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void disableRejoining()
|
||||
{
|
||||
getGame().QuitOut = true;
|
||||
_rejoinData.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerKick(PlayerKickEvent event)
|
||||
{
|
||||
if (!isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_disallow.add(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
@ -77,7 +88,7 @@ public class RejoinModule extends Module
|
||||
Player player = event.getPlayer();
|
||||
GameTeam team = getGame().GetTeam(player);
|
||||
|
||||
if (team == null || !team.IsAlive(player) || getGame().QuitOut || player.isDead() || !player.getWorld().equals(getGame().WorldData.World))
|
||||
if (team == null || !team.IsAlive(player) || getGame().QuitOut || player.isDead() || _disallow.remove(player) || !player.getWorld().equals(getGame().WorldData.World))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -95,16 +106,17 @@ public class RejoinModule extends Module
|
||||
|
||||
_rejoinData.put(player.getUniqueId(), data);
|
||||
|
||||
if (_saveLocation)
|
||||
{
|
||||
getGame().GetLocationStore().putIfAbsent(player.getName(), player.getLocation());
|
||||
}
|
||||
|
||||
team.RemovePlayer(player);
|
||||
|
||||
_manager.saveRejoinData(player, getGame().GetType().getGameId());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void playerQuitMonitor(PlayerQuitEvent event)
|
||||
{
|
||||
_disallow.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void playerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
@ -169,7 +181,7 @@ public class RejoinModule extends Module
|
||||
|
||||
private boolean isEnabled()
|
||||
{
|
||||
return !getGame().getArcadeManager().GetGameHostManager().isPrivateServer() && getGame().IsLive();
|
||||
return !getGame().getArcadeManager().GetGameHostManager().isPrivateServer() && getGame().InProgress();
|
||||
}
|
||||
|
||||
public class PlayerGameInfo
|
||||
|
Loading…
Reference in New Issue
Block a user