package com.yuyu.srdisassemble.disassemeble;

import com.germ.germplugin.api.dynamic.gui.GermGuiScreen;

import java.util.HashMap;

/**
 * @author 峰。
 * @version 1.0
 * @project SrDisassemble
 * @date 2024/6/21 18:50:18
 * @description 用于存放暂存箱
 */
public class TemporarilyBox {
    public static HashMap<String, HashMap<String,GermGuiScreen>> temporarilyBoxHashMap = new HashMap<>();

    public static GermGuiScreen getGermGuiScreen(String playname,String guiName) {
        if(temporarilyBoxHashMap.containsKey(playname)) {
            HashMap<String, GermGuiScreen> stringGermGuiScreenHashMap = temporarilyBoxHashMap.get(playname);
            if(stringGermGuiScreenHashMap.containsKey(guiName)) {
                return stringGermGuiScreenHashMap.get(guiName);
            }else {
                return null;
            }
        }else {
            return null;
        }
    }

    public static void deleteGuiScreen(String playname,String guiName) {
        if(temporarilyBoxHashMap.containsKey(playname)) {
            temporarilyBoxHashMap.get(playname).remove(guiName);
        }
    }

    public static void addGuiScreen(String playname,String guiName,GermGuiScreen guiScreen) {
        if(temporarilyBoxHashMap.containsKey(playname)) {
            temporarilyBoxHashMap.get(playname).put(guiName, guiScreen);
        }else {
            HashMap<String,GermGuiScreen> stringGermGuiScreenHashMap = new HashMap<>();
            stringGermGuiScreenHashMap.put(guiName, guiScreen);
            temporarilyBoxHashMap.put(playname, stringGermGuiScreenHashMap);
        }
    }
}
