Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.alttd.objects;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LoadedVillagers {
|
||||
private final static Map<UUID, VillagerType> loadedVillagers = new HashMap<>();
|
||||
|
||||
public static VillagerType getLoadedVillager(UUID uuid) {
|
||||
return loadedVillagers.get(uuid);
|
||||
}
|
||||
|
||||
public static void addLoadedVillager(UUID uuid, VillagerType villagerType) {
|
||||
loadedVillagers.put(uuid, villagerType);
|
||||
}
|
||||
|
||||
public static void removeLoadedVillager(UUID uuid) {
|
||||
loadedVillagers.remove(uuid);
|
||||
}
|
||||
|
||||
public static void clearLoadedVillagers() {
|
||||
loadedVillagers.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.alttd.objects;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class VillagerType {
|
||||
private static final Set<VillagerType> villagerTypes = new HashSet<>();
|
||||
|
||||
public static Set<VillagerType> getVillagerTypes() {
|
||||
return villagerTypes;
|
||||
}
|
||||
|
||||
public static VillagerType getVillagerType(String name) {
|
||||
return villagerTypes.stream().filter(villagerType -> villagerType.getName().equals(name)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static void addVillagerType(VillagerType villagerType) {
|
||||
villagerTypes.add(villagerType);
|
||||
}
|
||||
|
||||
public static void clearVillagerTypes() {
|
||||
villagerTypes.clear();
|
||||
}
|
||||
private final String name;
|
||||
private final String displayName;
|
||||
private final Set<ItemStack> buying;
|
||||
private final Set<ItemStack> selling;
|
||||
private final double priceModifier;
|
||||
|
||||
public VillagerType(String name, String displayName, Set<ItemStack> buying, Set<ItemStack> selling, double priceModifier) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.buying = buying;
|
||||
this.selling = selling;
|
||||
this.priceModifier = priceModifier;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public Set<ItemStack> getBuying() {
|
||||
return buying;
|
||||
}
|
||||
|
||||
public Set<ItemStack> getSelling() {
|
||||
return selling;
|
||||
}
|
||||
|
||||
public double getPriceModifier() {
|
||||
return priceModifier;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user