Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-07 08:32:51 +02:00
Apply list of properties everywhere
Dieser Commit ist enthalten in:
Ursprung
cf585c48ae
Commit
268d8cff49
@ -33,6 +33,7 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
@ -161,7 +162,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends Property<?>> getAllProperties() {
|
public Map<String, ? extends List<Property<?>>> getAllProperties() {
|
||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
return adapter.getAllProperties();
|
return adapter.getAllProperties();
|
||||||
|
Binäre Datei nicht angezeigt.
@ -200,7 +200,7 @@ public class BlockTypesCache {
|
|||||||
public static final BlockType[] values;
|
public static final BlockType[] values;
|
||||||
public static final BlockState[] states;
|
public static final BlockState[] states;
|
||||||
public static final boolean[] ticking;
|
public static final boolean[] ticking;
|
||||||
public static final Map<String, ? extends Property<?>> allProperties;
|
private static final Map<String, List<Property<?>>> allProperties = new HashMap<>();
|
||||||
|
|
||||||
protected static final Set<String> $NAMESPACES = new LinkedHashSet<>();
|
protected static final Set<String> $NAMESPACES = new LinkedHashSet<>();
|
||||||
|
|
||||||
@ -267,14 +267,6 @@ public class BlockTypesCache {
|
|||||||
states = stateList.toArray(new BlockState[stateList.size()]);
|
states = stateList.toArray(new BlockState[stateList.size()]);
|
||||||
ticking = Booleans.toArray(tickList);
|
ticking = Booleans.toArray(tickList);
|
||||||
|
|
||||||
allProperties = WorldEdit
|
|
||||||
.getInstance()
|
|
||||||
.getPlatformManager()
|
|
||||||
.queryCapability(Capability.GAME_HOOKS)
|
|
||||||
.getRegistries()
|
|
||||||
.getBlockRegistry()
|
|
||||||
.getAllProperties();
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@ -296,4 +288,24 @@ public class BlockTypesCache {
|
|||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all block properties available.
|
||||||
|
*
|
||||||
|
* @return map of string key against property of all block properties available
|
||||||
|
*/
|
||||||
|
public static Map<String, List<Property<?>>> getAllProperties() {
|
||||||
|
synchronized (allProperties) {
|
||||||
|
if (allProperties.size() == 0) {
|
||||||
|
allProperties.putAll(WorldEdit
|
||||||
|
.getInstance()
|
||||||
|
.getPlatformManager()
|
||||||
|
.queryCapability(Capability.GAME_HOOKS)
|
||||||
|
.getRegistries()
|
||||||
|
.getBlockRegistry()
|
||||||
|
.getAllProperties());
|
||||||
|
}
|
||||||
|
return allProperties;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.world.block.BlockType;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
@ -102,6 +103,6 @@ public interface BlockRegistry {
|
|||||||
*
|
*
|
||||||
* @return a map of states where the key is the property's ID
|
* @return a map of states where the key is the property's ID
|
||||||
*/
|
*/
|
||||||
Map<String, ? extends Property<?>> getAllProperties();
|
Map<String, ? extends List<Property<?>>> getAllProperties();
|
||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.world.block.BlockType;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ public class BundledBlockRegistry implements BlockRegistry {
|
|||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends Property<?>> getAllProperties() {
|
public Map<String, ? extends List<Property<?>>> getAllProperties() {
|
||||||
return Collections.emptyMap(); // Oof
|
return Collections.emptyMap(); // Oof
|
||||||
}
|
}
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren