Created
March 6, 2015 18:49
-
-
Save alufers/63b9f04b55da3f515878 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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