mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2024-12-05 00:43:15 +01:00
Makes sure arena data is deleted with the arena
This commit is contained in:
parent
6a41664fef
commit
3bbf41206c
@ -158,10 +158,15 @@ public class DropperArenaHandler {
|
||||
* @param arena <p>The arena to remove</p>
|
||||
*/
|
||||
public void removeArena(@NotNull DropperArena arena) {
|
||||
UUID arenaId = arena.getArenaId();
|
||||
Dropper.getInstance().getPlayerRegistry().removeForArena(arena);
|
||||
this.arenas.remove(arena.getArenaId());
|
||||
this.arenas.remove(arenaId);
|
||||
this.arenaNameLookup.remove(arena.getArenaNameSanitized());
|
||||
this.arenaGroups.remove(arena.getArenaId());
|
||||
this.arenaGroups.remove(arenaId);
|
||||
if (!ArenaStorageHelper.removeArenaData(arenaId)) {
|
||||
Dropper.getInstance().getLogger().log(Level.WARNING, "Unable to remove dropper arena data file " +
|
||||
arenaId + ".yml. You must remove it manually!");
|
||||
}
|
||||
this.saveArenas();
|
||||
}
|
||||
|
||||
|
@ -203,6 +203,16 @@ public final class ArenaStorageHelper {
|
||||
return (DropperArenaData) configuration.get(ArenaStorageKey.DATA.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes data for the arena with the given id
|
||||
*
|
||||
* @param arenaId <p>The id of the arena to remove data for</p>
|
||||
* @return <p>True if the data was successfully removed</p>
|
||||
*/
|
||||
public static boolean removeArenaData(@NotNull UUID arenaId) {
|
||||
return getArenaDataFile(arenaId).delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file used to store the given arena id's data
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user