mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 01:49:49 -05:00
Fix default config & NPE
Former-commit-id: 6945dfd6c6a3bb1cc83aa2c7424ab9a0b8857689
This commit is contained in:
1 parent
9d0775cdcf
commit
0b7e740bf2
2 files changed
+35
-6
No files matched your search
@@ -19,6 +19,7 @@
|
||||
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import com.bekvon.bukkit.residence.commands.contract;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
@@ -208,22 +209,40 @@ public interface DisplayItem {
|
||||
*/
|
||||
// type id such as 0, 1, 2, 3.
|
||||
List<?> typeSections =
|
||||
QuickShop.instance.getConfig().getList("shop.display-type-specifics");
|
||||
QuickShop.instance.getConfig().getList("shop.display-type-specifics", Lists.newArrayList());
|
||||
if (typeSections.isEmpty()) {
|
||||
return DisplayType.fromID(QuickShop.instance.getConfig().getInt("shop.display-type"));
|
||||
}
|
||||
for (Object typeSection : typeSections) {
|
||||
if (typeSection == null) {
|
||||
continue;
|
||||
}
|
||||
// id as key
|
||||
Util.debugLog(typeSection.toString() + " @ LEVEL 1, " + typeSection.getClass().getName());
|
||||
if (typeSection instanceof Map) {
|
||||
Map<?, ?> itemSections = Map.class.cast(typeSection);
|
||||
for (Entry<?, ?> itemSection : itemSections.entrySet()) {
|
||||
if (itemSection == null) {
|
||||
continue;
|
||||
}
|
||||
// list
|
||||
Util.debugLog(itemSection.toString() + " @ LEVEL 2, " + itemSection.getClass().getName());
|
||||
if (itemSection.getValue() instanceof List) {
|
||||
List<?> infoSections = List.class.cast(itemSection.getValue());
|
||||
if (infoSections == null) {
|
||||
continue;
|
||||
}
|
||||
for (Object $infoSection : infoSections) {
|
||||
if ($infoSection == null) {
|
||||
continue;
|
||||
}
|
||||
// custom name as key
|
||||
Util.debugLog($infoSection.toString() + " @ LEVEL 3, " + $infoSection.getClass().getName());
|
||||
if ($infoSection instanceof Map) {
|
||||
for (Object infoSectiont : Map.class.cast($infoSection).values()) {
|
||||
if (infoSectiont == null) {
|
||||
continue;
|
||||
}
|
||||
Map<?, Object> infoSection = Map.class.cast(infoSectiont);
|
||||
Util.debugLog(infoSection.toString() + " @ LEVEL 4, " + infoSection.getClass().getName());
|
||||
List<Material> type = Lists.newArrayList();
|
||||
|
||||
@@ -176,14 +176,24 @@ shop:
|
||||
#The display type you want use.
|
||||
#0=Normal Dropped Item, 1=ArmorStand
|
||||
display-type: 0
|
||||
|
||||
|
||||
# Custom display type depending on item meta
|
||||
display-type-specifics:
|
||||
- 0:
|
||||
- 'test':
|
||||
type: GLASS
|
||||
- customType0:
|
||||
type: AIR
|
||||
lore: []
|
||||
strict: true
|
||||
- customType1:
|
||||
type:
|
||||
- AIR_VOID
|
||||
- AIR_CAVE
|
||||
- 1:
|
||||
- 'test2':
|
||||
type: GRASS
|
||||
- demo:
|
||||
type: AIR_VOID
|
||||
lore:
|
||||
- A demo item lore
|
||||
- Another demo lore
|
||||
|
||||
#Allow quickshop auto despawn-spawn the display when no-player or player close the shop.
|
||||
display-auto-despawn: false
|
||||
|
||||
Reference in new issue
Block a user