PlayerSelectionWrapper now can hold all users kit choices.

This commit is contained in:
officereso 2020-06-10 02:50:42 -05:00
parent adf0486f83
commit 89042af922
2 changed files with 44 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package io.github.officereso;
import org.bukkit.entity.Player;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -10,6 +11,11 @@ public class PlayerSelectionWrapper {
public final Player player;
public Kit selectedKit;
public Kit selectedHelmet;
public Kit selectedChestplate;
public Kit selectedLeggings;
public Kit selectedBoots;
public HashMap<Kit, Integer> selectedPotions;
public HashMap<Kit, Integer> selectedAdditions;
public PlayerSelectionWrapper(Player player, Kit kit) {
this.player = player;
@ -32,6 +38,14 @@ public class PlayerSelectionWrapper {
return selectedHelmet;
}
public HashMap<Kit, Integer> getSelectedAdditions() {
return selectedAdditions;
}
public HashMap<Kit, Integer> getSelectedPotions() {
return selectedPotions;
}
public HashMap<Integer, Integer> getGreenSlots() {
HashMap<Integer, Integer> slots = new HashMap<>();
if (selectedKit != null) {
@ -44,6 +58,34 @@ public class PlayerSelectionWrapper {
return slots;
}
public void setSelectedAdditions(HashMap<Kit, Integer> selectedAdditions) {
this.selectedAdditions = selectedAdditions;
}
public void addAdditions(Kit kit, int amount) {
selectedAdditions.put(kit, selectedAdditions.get(kit) + amount);
}
public void setSelectedBoots(Kit selectedBoots) {
this.selectedBoots = selectedBoots;
}
public void setSelectedChestplate(Kit selectedChestplate) {
this.selectedChestplate = selectedChestplate;
}
public void setSelectedLeggings(Kit selectedLeggings) {
this.selectedLeggings = selectedLeggings;
}
public void setSelectedPotions(HashMap<Kit, Integer> selectedPotions) {
this.selectedPotions = selectedPotions;
}
public void addPotions(Kit kit, int amount) {
selectedPotions.put(kit, selectedPotions.get(kit) + amount);
}
public void setSelectedHelmet(Kit selectedHelmet) {
this.selectedHelmet = selectedHelmet;
}

View File

@ -95,7 +95,8 @@ public class pvp extends JavaPlugin implements Listener {
}
}
}
System.out.println("ldkfsjld");
if (kit.getType() == Kit.Type.HELMET)
System.out.println("ldkfsjld");
});
}