Bundle kits
This commit is contained in:
1 parent
a3d290eef0
commit
e119736740
3 files changed
+26
-17
No files matched your search
@@ -74,23 +74,36 @@ public class KitManagerImpl implements Loadable, KitManager {
|
||||
gui.setEmptyIndicator(ItemBuilder.of(Material.PAPER).name(lang.getMessage("GUI.kit-selector.buttons.empty.name")).build());
|
||||
plugin.getGuiListener().addGui(gui);
|
||||
|
||||
if (FileUtil.checkNonEmpty(plugin, file, FILE_NAME)) {
|
||||
try (final Reader reader = new InputStreamReader(new FileInputStream(file), Charsets.UTF_8)) {
|
||||
final Map<String, KitData> data = JsonUtil.getObjectMapper().readValue(reader, new TypeReference<LinkedHashMap<String, KitData>>() {});
|
||||
final Map<String, KitData> combinedData = new LinkedHashMap<>();
|
||||
|
||||
if (data != null) {
|
||||
for (final Map.Entry<String, KitData> entry : data.entrySet()) {
|
||||
if (!StringUtil.isAlphanumeric(entry.getKey())) {
|
||||
Log.warn(this, String.format(ERROR_NOT_ALPHANUMERIC, entry.getKey()));
|
||||
continue;
|
||||
}
|
||||
|
||||
kits.put(entry.getKey(), entry.getValue().toKit(plugin));
|
||||
}
|
||||
try (final java.io.InputStream in = plugin.getResource(FILE_NAME)) {
|
||||
if (in != null) {
|
||||
final Map<String, KitData> jarData = JsonUtil.getObjectMapper().readValue(in, new TypeReference<LinkedHashMap<String, KitData>>() {});
|
||||
if (jarData != null) {
|
||||
combinedData.putAll(jarData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FileUtil.checkNonEmpty(plugin, file, FILE_NAME)) {
|
||||
try (final Reader reader = new InputStreamReader(new FileInputStream(file), Charsets.UTF_8)) {
|
||||
final Map<String, KitData> fileData = JsonUtil.getObjectMapper().readValue(reader, new TypeReference<LinkedHashMap<String, KitData>>() {});
|
||||
|
||||
if (fileData != null) {
|
||||
combinedData.putAll(fileData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (final Map.Entry<String, KitData> entry : combinedData.entrySet()) {
|
||||
if (!StringUtil.isAlphanumeric(entry.getKey())) {
|
||||
Log.warn(this, String.format(ERROR_NOT_ALPHANUMERIC, entry.getKey()));
|
||||
continue;
|
||||
}
|
||||
|
||||
kits.put(entry.getKey(), entry.getValue().toKit(plugin));
|
||||
}
|
||||
|
||||
Log.info(this, String.format(KITS_LOADED, kits.size()));
|
||||
gui.calculatePages();
|
||||
}
|
||||
|
||||
@@ -108,10 +108,6 @@ public class Settings {
|
||||
|
||||
public void setOwnInventory(final boolean ownInventory) {
|
||||
this.ownInventory = ownInventory;
|
||||
|
||||
if (ownInventory) {
|
||||
this.kit = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't copy the gui since it won't be required to start a match
|
||||
|
||||
@@ -464,7 +464,7 @@ countdown:
|
||||
- '&7[&a&lTrue&c&lOG &e&lNetwork&7] &cDuel &3with %opponent% starting in &55 &3seconds...'
|
||||
- '&7[&a&lTrue&c&lOG &e&lNetwork&7] &cDuel &3with %opponent% starting in &d4 &3seconds...'
|
||||
- '&7[&a&lTrue&c&lOG &e&lNetwork&7] &cDuel &3with %opponent% starting in &c3 &3seconds...'
|
||||
- '&7[&a&lTrue&c&lOG &e&lNetwork&7]&cDuel &3with %opponent% starting in &e2 &3seconds...'
|
||||
- '&7[&a&lTrue&c&lOG &e&lNetwork&7] &cDuel &3with %opponent% starting in &e2 &3seconds...'
|
||||
- '&7[&a&lTrue&c&lOG &e&lNetwork&7] &cDuel &3with %opponent% starting in &a1 &3second...'
|
||||
- '&aNow in a match against &4%opponent% &7(&e%opponent_rating% ELO&7) &awith kit &d%kit% &ain arena &e%arena%&a!'
|
||||
|
||||
|
||||
Reference in new issue
Block a user