You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.4 KiB

package cx.sfy.TheBridge.managers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.configuration.ConfigurationSection;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.cosmetics.Arrow;
import lombok.Getter;
public class ArrowManager {
Main plugin;
@Getter
private HashMap<String, Arrow> arrows = new HashMap<String, Arrow>();
@Getter
private List<String> unlocked = null;
@Getter
private List<String> locked = null;
@Getter
private List<String> noPerm = null;
public ArrowManager(Main plugin) {
this.plugin = plugin;
loadArrows();
}
public void loadArrows() {
List<String> un = new ArrayList<String>();
for (String u : plugin.getArrow().getList("unlocked")) {
un.add(u);
}
unlocked = un;
List<String> lo = new ArrayList<String>();
for (String l : plugin.getArrow().getList("locked")) {
lo.add(l);
}
locked = lo;
List<String> pe = new ArrayList<String>();
for (String p : plugin.getArrow().getList("noPerm")) {
pe.add(p);
}
noPerm = pe;
ConfigurationSection conf = plugin.getArrow().getConfig().getConfigurationSection("arrows");
for (String arrow : conf.getKeys(false)) {
arrows.put(arrow, new Arrow(plugin, "arrows." + arrow, arrow));
}
}
public Arrow getArrowByName(String name) {
if (arrows.containsKey(name)) {
return arrows.get(name);
}
return null;
}
}