Skip to content

Instantly share code, notes, and snippets.

@alufers
Created March 6, 2015 18:49
Show Gist options
  • Save alufers/63b9f04b55da3f515878 to your computer and use it in GitHub Desktop.
Save alufers/63b9f04b55da3f515878 to your computer and use it in GitHub Desktop.
HashMap<Player, Inventory> ekwipunekGraczy = new HashMap<Player, Inventory>(); // tworzymy sobię hashmapę, pewnie będzie to pole twojej klasy plugin
//dodajemy do niej nowy ekwipunek i przypisujemy go do gracza (daj to do omendy /create albo coś, zmienna gracz to garcz, który wywołał tą komendę)
ekwipunekGraczy.put(gracz, Bukkit.createInventory(gracz, TUTAJ_WPISZ_ILOŚĆ_SLOTÓW, "NAZWA"));
//jeżeli gdzies musisz odczytać ekwipunek gracza używasz .get:
Inventory ekwipunekJakiegosGracza = ekwipunekGraczy.get(gracz);
//mozesz robic teraz z tym ekwipunkiem co chesz
//mozesz sprawdzic, czy gracz posiada jakis ekwipunek
if(ekwipunekGraczy.has(gracz)){
//rob co chesz
} else {
// - || -
}
// i usuwac ekwipunki gracza
ekwipunekGraczy.remove(gracz);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment