3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-07-24 02:58:03 +02:00

Implement getAllProperties to code and adapters

Dieser Commit ist enthalten in:
dordsor21 2021-09-20 16:00:50 +01:00
Ursprung 35e0a47beb
Commit 017a28b3dd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
5 geänderte Dateien mit 32 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -159,5 +159,14 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
}
return blocks;
}
@Override
public Map<String, ? extends Property<?>> getAllProperties() {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
return adapter.getAllProperties();
}
return super.getAllProperties();
}
//FAWE end
}

Datei anzeigen

@ -200,6 +200,7 @@ public class BlockTypesCache {
public static final BlockType[] values;
public static final BlockState[] states;
public static final boolean[] ticking;
public static final Map<String, ? extends Property<?>> allProperties;
protected static final Set<String> $NAMESPACES = new LinkedHashSet<>();
@ -266,6 +267,14 @@ public class BlockTypesCache {
states = stateList.toArray(new BlockState[stateList.size()]);
ticking = Booleans.toArray(tickList);
allProperties = WorldEdit
.getInstance()
.getPlatformManager()
.queryCapability(Capability.GAME_HOOKS)
.getRegistries()
.getBlockRegistry()
.getAllProperties();
} catch (Throwable e) {
e.printStackTrace();
throw new RuntimeException(e);

Datei anzeigen

@ -96,5 +96,12 @@ public interface BlockRegistry {
default Collection<String> values() {
return Collections.emptyList();
}
/**
* Get an unmodifiable map of all block properties
*
* @return a map of states where the key is the property's ID
*/
Map<String, ? extends Property<?>> getAllProperties();
//FAWE end
}

Datei anzeigen

@ -80,4 +80,11 @@ public class BundledBlockRegistry implements BlockRegistry {
return OptionalInt.empty();
}
//FAWE start
@Override
public Map<String, ? extends Property<?>> getAllProperties() {
return Collections.emptyMap(); // Oof
}
//FAWE end
}