9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-21 16:09:26 +00:00

添加新的条件类型和函数类型

This commit is contained in:
XiaoMoMi
2025-05-21 21:09:02 +08:00
parent c788689277
commit 7bcfbf9cfe
58 changed files with 393 additions and 76 deletions

View File

@@ -6,7 +6,6 @@ import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import net.momirealms.craftengine.bukkit.api.CraftEngineFurniture;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurniture;
import net.momirealms.craftengine.core.entity.furniture.Furniture;
import org.bukkit.entity.Entity;
import org.bukkit.event.Event;

View File

@@ -94,6 +94,7 @@ warning.config.condition.permission.missing_permission: "<yellow>Issue found in
warning.config.condition.equals.missing_value1: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'value1' argument for 'equals' condition.</yellow>"
warning.config.condition.equals.missing_value2: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'value2' argument for 'equals' condition.</yellow>"
warning.config.condition.expression.missing_expression: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'expression' argument for 'expression' condition.</yellow>"
warning.config.condition.is_null.missing_argument: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'argument' argument for 'is_null' condition.</yellow>"
warning.config.structure.not_section: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is expected to be a config section while it's actually a(n) '<arg:2>'.</yellow>"
warning.config.image.duplicate: "<yellow>Issue found in file <arg:0> - Duplicated image '<arg:1>'. Please check if there is the same configuration in other files.</yellow>"
warning.config.image.missing_height: "<yellow>Issue found in file <arg:0> - The image '<arg:1>' is missing the required 'height' argument.</yellow>"
@@ -317,6 +318,7 @@ warning.config.function.message.missing_message: "<yellow>Issue found in file <a
warning.config.function.open_window.missing_gui_type: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'gui-type' argument for 'open_window' function.</yellow>"
warning.config.function.open_window.invalid_gui_type: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is using an invalid gui type <arg:2> for 'open_window' function. Allowed types: [<arg:3>].</yellow>"
warning.config.function.run.missing_functions: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'functions' argument for 'run' function.</yellow>"
warning.config.function.place_block.missing_block_state: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'block-state' argument for 'place_block' function.</yellow>"
warning.config.selector.missing_type: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'type' argument for selector.</yellow>"
warning.config.selector.invalid_type: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is using an invalid selector type '<arg:2>'.</yellow>"
warning.config.selector.invalid_target: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is using an invalid selector target '<arg:2>'.</yellow>"

View File

@@ -94,6 +94,7 @@ warning.config.condition.permission.missing_permission: "<yellow>在文件 <arg:
warning.config.condition.equals.missing_value1: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 缺少 'equals' 条件必需的 'value1' 参数</yellow>"
warning.config.condition.equals.missing_value2: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 缺少 'equals' 条件必需的 'value2' 参数</yellow>"
warning.config.condition.expression.missing_expression: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 缺少 'expression' 条件必需的 'expression' 参数</yellow>"
warning.config.condition.is_null.missing_argument: "<yellow>在文件 <arg:0> 发现问题 - 配置项 '<arg:1>' 缺少 'is_null' 条件的必需的 'argument' 参数.</yellow>"
warning.config.structure.not_section: "<yellow>在文件 <arg:0> 发现问题 - 配置项 '<arg:1>' 应为配置段落 但实际类型为 '<arg:2>'</yellow>"
warning.config.image.duplicate: "<yellow>在文件 <arg:0> 发现问题 - 重复的图片配置 '<arg:1>' 请检查其他文件中是否存在相同配置</yellow>"
warning.config.image.missing_height: "<yellow>在文件 <arg:0> 发现问题 - 图片 '<arg:1>' 缺少必需的 'height' 参数</yellow>"
@@ -317,6 +318,7 @@ warning.config.function.message.missing_message: "<yellow>在文件 <arg:0> 中
warning.config.function.open_window.missing_gui_type: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 缺少 'open_window' 函数必需的 'gui-type' 参数</yellow>"
warning.config.function.open_window.invalid_gui_type: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 为 'open_window' 函数使用了无效的 GUI 类型 <arg:2>. 允许的类型: [<arg:3>]。</yellow>"
warning.config.function.run.missing_functions: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 缺少 'run' 函数必需的 'functions' 参数</yellow>"
warning.config.function.place_block.missing_block_state: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 缺少 'place_block' 函数必需的 'block-state' 参数.</yellow>"
warning.config.selector.missing_type: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 缺少选择器必需的 'type' 参数</yellow>"
warning.config.selector.invalid_type: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 使用了无效的选择器类型 '<arg:2>'</yellow>"
warning.config.selector.invalid_target: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 使用了无效的选择器目标 '<arg:2>'</yellow>"

View File

@@ -1,7 +1,7 @@
package net.momirealms.craftengine.bukkit.api;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurnitureManager;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurniture;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurnitureManager;
import net.momirealms.craftengine.bukkit.nms.CollisionEntity;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.plugin.BukkitCraftEngine;

View File

@@ -40,8 +40,8 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.io.File;
import java.lang.reflect.Field;
import java.nio.file.Path;
@@ -164,6 +164,21 @@ public class BukkitBlockManager extends AbstractBlockManager {
}
}
@Nullable
@Override
public BlockStateWrapper createPackedBlockState(String blockState) {
ImmutableBlockState state = BlockStateParser.deserialize(blockState);
if (state != null) {
return state.customBlockState();
}
try {
BlockData blockData = Bukkit.createBlockData(blockState);
return BlockStateUtils.toPackedBlockState(blockData);
} catch (IllegalArgumentException e) {
return null;
}
}
@Nullable
public Object getMinecraftBlockHolder(int stateId) {
return stateId2BlockHolder.get(stateId);
@@ -205,7 +220,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
}
@Override
public Key getBlockOwnerId(PackedBlockState state) {
public Key getBlockOwnerId(BlockStateWrapper state) {
return BlockStateUtils.getBlockOwnerIdFromState(state.handle());
}
@@ -226,11 +241,11 @@ public class BukkitBlockManager extends AbstractBlockManager {
private void initMirrorRegistry() {
int size = RegistryUtils.currentBlockRegistrySize();
PackedBlockState[] states = new PackedBlockState[size];
BlockStateWrapper[] states = new BlockStateWrapper[size];
for (int i = 0; i < size; i++) {
states[i] = new PackedBlockState(BlockStateUtils.idToBlockState(i), i);
states[i] = BlockStateWrapper.create(BlockStateUtils.idToBlockState(i), i, BlockStateUtils.isVanillaBlock(i));
}
BlockRegistryMirror.init(states, new PackedBlockState(Reflections.instance$Blocks$STONE$defaultState, BlockStateUtils.blockStateToId(Reflections.instance$Blocks$STONE$defaultState)));
BlockRegistryMirror.init(states, BlockStateWrapper.vanilla(Reflections.instance$Blocks$STONE$defaultState, BlockStateUtils.blockStateToId(Reflections.instance$Blocks$STONE$defaultState)));
}
private void registerEmptyBlock() {
@@ -363,7 +378,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
if (singleState) {
properties = Map.of();
int internalId = ResourceConfigUtils.getAsInt(ResourceConfigUtils.requireNonNullOrThrow(stateSection.get("id"), "warning.config.block.state.missing_real_id"), "id");
VanillaBlock vanillaBlock = getVanillaBlock(id, stateSection);
VanillaBlockState vanillaBlock = getVanillaBlock(id, stateSection);
appearances = Map.of("", vanillaBlock.registryId());
Key internalBlockId = Key.of(Key.DEFAULT_NAMESPACE, vanillaBlock.type().value() + "_" + internalId);
int internalBlockRegistryId = Optional.ofNullable(internalId2StateId.get(internalBlockId)).orElse(-1);
@@ -379,7 +394,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
Map<String, Key> appearance2BlockType = new HashMap<>();
for (Map.Entry<String, Object> appearanceEntry : MiscUtils.castToMap(ResourceConfigUtils.requireNonNullOrThrow(stateSection.get("appearances"), "warning.config.block.state.missing_appearances"), false).entrySet()) {
if (appearanceEntry.getValue() instanceof Map<?, ?>) {
VanillaBlock vanillaBlock = getVanillaBlock(id, MiscUtils.castToMap(appearanceEntry.getValue(), false));
VanillaBlockState vanillaBlock = getVanillaBlock(id, MiscUtils.castToMap(appearanceEntry.getValue(), false));
appearances.put(appearanceEntry.getKey(), vanillaBlock.registryId());
appearance2BlockType.put(appearanceEntry.getKey(), vanillaBlock.type());
}
@@ -449,7 +464,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
}
@NotNull
private VanillaBlock getVanillaBlock(Key id, Map<String, Object> section) {
private VanillaBlockState getVanillaBlock(Key id, Map<String, Object> section) {
// require state non null
String vanillaBlockStateTag = ResourceConfigUtils.requireNonEmptyStringOrThrow(section.get("state"), "warning.config.block.state.missing_state");
// get its registry id
@@ -476,7 +491,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
JsonElement combinedVariant = GsonHelper.combine(variants);
this.blockStateOverrides.computeIfAbsent(blockId, k -> new HashMap<>()).put(propertyNBT, combinedVariant);
this.tempVanillaBlockStateModels.put(vanillaBlockStateRegistryId, combinedVariant);
return new VanillaBlock(blockId, propertyNBT, vanillaBlockStateRegistryId);
return new VanillaBlockState(blockId, propertyNBT, vanillaBlockStateRegistryId);
}
private JsonObject getVariantModel(Map<String, Object> singleModelMap) {

View File

@@ -1,7 +1,6 @@
package net.momirealms.craftengine.bukkit.entity.furniture;
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import net.momirealms.craftengine.bukkit.entity.BukkitEntity;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
@@ -9,15 +8,12 @@ import net.momirealms.craftengine.bukkit.util.EntityUtils;
import net.momirealms.craftengine.bukkit.util.LegacyAttributeUtils;
import net.momirealms.craftengine.bukkit.util.LocationUtils;
import net.momirealms.craftengine.bukkit.util.Reflections;
import net.momirealms.craftengine.bukkit.world.BukkitWorld;
import net.momirealms.craftengine.core.entity.furniture.*;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.util.ArrayUtils;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.QuaternionUtils;
import net.momirealms.craftengine.core.util.VersionHelper;
import net.momirealms.craftengine.core.world.Vec3d;
import net.momirealms.craftengine.core.world.World;
import net.momirealms.craftengine.core.world.WorldPosition;
import net.momirealms.craftengine.core.world.collision.AABB;
import org.bukkit.Location;

View File

@@ -22,9 +22,9 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.joml.Vector3f;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Collection;
import java.util.List;

View File

@@ -25,8 +25,8 @@ import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.world.EntitiesLoadEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

View File

@@ -2,8 +2,8 @@ package net.momirealms.craftengine.bukkit.item.behavior;
import net.momirealms.craftengine.bukkit.api.event.FurnitureAttemptPlaceEvent;
import net.momirealms.craftengine.bukkit.api.event.FurniturePlaceEvent;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurnitureManager;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurniture;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurnitureManager;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.plugin.BukkitCraftEngine;
import net.momirealms.craftengine.bukkit.util.DirectionUtils;

View File

@@ -25,8 +25,8 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

View File

@@ -10,8 +10,8 @@ import net.momirealms.craftengine.bukkit.api.CraftEngineFurniture;
import net.momirealms.craftengine.bukkit.api.event.FurnitureBreakEvent;
import net.momirealms.craftengine.bukkit.api.event.FurnitureInteractEvent;
import net.momirealms.craftengine.bukkit.block.BukkitBlockManager;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurnitureManager;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurniture;
import net.momirealms.craftengine.bukkit.entity.furniture.BukkitFurnitureManager;
import net.momirealms.craftengine.bukkit.entity.projectile.BukkitProjectileManager;
import net.momirealms.craftengine.bukkit.item.behavior.FurnitureItemBehavior;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
@@ -39,7 +39,10 @@ import net.momirealms.craftengine.core.plugin.context.event.EventTrigger;
import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters;
import net.momirealms.craftengine.core.plugin.network.*;
import net.momirealms.craftengine.core.util.*;
import net.momirealms.craftengine.core.world.*;
import net.momirealms.craftengine.core.world.BlockHitResult;
import net.momirealms.craftengine.core.world.BlockPos;
import net.momirealms.craftengine.core.world.EntityHitResult;
import net.momirealms.craftengine.core.world.WorldEvents;
import net.momirealms.craftengine.core.world.chunk.Palette;
import net.momirealms.craftengine.core.world.chunk.PalettedContainer;
import net.momirealms.craftengine.core.world.chunk.packet.BlockEntityData;
@@ -47,7 +50,6 @@ import net.momirealms.craftengine.core.world.chunk.packet.MCSection;
import net.momirealms.craftengine.core.world.collision.AABB;
import net.momirealms.sparrow.nbt.Tag;
import org.bukkit.*;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;

View File

@@ -11,8 +11,8 @@ import net.momirealms.craftengine.bukkit.plugin.gui.CraftEngineInventoryHolder;
import net.momirealms.craftengine.bukkit.util.*;
import net.momirealms.craftengine.bukkit.world.BukkitWorld;
import net.momirealms.craftengine.core.block.BlockSettings;
import net.momirealms.craftengine.core.block.BlockStateWrapper;
import net.momirealms.craftengine.core.block.ImmutableBlockState;
import net.momirealms.craftengine.core.block.PackedBlockState;
import net.momirealms.craftengine.core.entity.player.GameMode;
import net.momirealms.craftengine.core.entity.player.InteractionHand;
import net.momirealms.craftengine.core.entity.player.Player;
@@ -405,7 +405,7 @@ public class BukkitServerPlayer extends Player {
// instant break
boolean custom = immutableBlockState != null;
if (custom && getDestroyProgress(state, pos) >= 1f) {
PackedBlockState vanillaBlockState = immutableBlockState.vanillaBlockState();
BlockStateWrapper vanillaBlockState = immutableBlockState.vanillaBlockState();
// if it's not an instant break on client side, we should resend level event
if (vanillaBlockState != null && getDestroyProgress(vanillaBlockState.handle(), pos) < 1f) {
Object levelEventPacket = FastNMS.INSTANCE.constructor$ClientboundLevelEventPacket(
@@ -613,6 +613,11 @@ public class BukkitServerPlayer extends Player {
}
}
@Override
public void breakBlock(int x, int y, int z) {
platformPlayer().breakBlock(new Location(platformPlayer().getWorld(), x, y, z).getBlock());
}
private void broadcastDestroyProgress(org.bukkit.entity.Player player, BlockPos hitPos, Object blockPos, int stage) {
Object packet = FastNMS.INSTANCE.constructor$ClientboundBlockDestructionPacket(Integer.MAX_VALUE - entityID(), blockPos, stage);
for (org.bukkit.entity.Player other : player.getWorld().getPlayers()) {

View File

@@ -33,6 +33,12 @@ public class BlockStateUtils {
hasInit = true;
}
public static BlockStateWrapper toPackedBlockState(BlockData blockData) {
Object state = blockDataToBlockState(blockData);
int id = blockStateToId(state);
return BlockStateWrapper.create(state, id, isVanillaBlock(id));
}
public static boolean isCorrectTool(@NotNull ImmutableBlockState state, @Nullable Item<ItemStack> itemInHand) {
BlockSettings settings = state.settings();
if (settings.requireCorrectTool()) {

View File

@@ -4,8 +4,8 @@ import net.momirealms.craftengine.core.util.Key;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;

View File

@@ -3,6 +3,7 @@ package net.momirealms.craftengine.bukkit.world;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.util.EntityUtils;
import net.momirealms.craftengine.bukkit.util.ItemUtils;
import net.momirealms.craftengine.core.block.BlockStateWrapper;
import net.momirealms.craftengine.core.item.Item;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.VersionHelper;
@@ -95,4 +96,11 @@ public class BukkitWorld implements World {
public long time() {
return platformWorld().getTime();
}
@Override
public void setBlockAt(int x, int y, int z, BlockStateWrapper blockState, int flags) {
Object worldServer = serverWorld();
Object blockPos = FastNMS.INSTANCE.constructor$BlockPos(x, y, z);
FastNMS.INSTANCE.method$LevelWriter$setBlock(worldServer, blockPos, blockState.handle(), flags);
}
}

View File

@@ -8,8 +8,8 @@ import net.momirealms.craftengine.core.plugin.config.ConfigParser;
import net.momirealms.craftengine.core.util.Key;
import org.incendo.cloud.suggestion.Suggestion;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
@@ -36,11 +36,14 @@ public interface BlockManager extends Manageable, ModelGenerator {
int availableAppearances(Key blockType);
Key getBlockOwnerId(PackedBlockState state);
Key getBlockOwnerId(BlockStateWrapper state);
@NotNull
ImmutableBlockState getImmutableBlockStateUnsafe(int stateId);
@Nullable
ImmutableBlockState getImmutableBlockState(int stateId);
@Nullable
BlockStateWrapper createPackedBlockState(String blockState);
}

View File

@@ -1,15 +1,15 @@
package net.momirealms.craftengine.core.block;
public class BlockRegistryMirror {
private static PackedBlockState[] customBlockStates;
private static PackedBlockState stoneState;
private static BlockStateWrapper[] customBlockStates;
private static BlockStateWrapper stoneState;
public static void init(PackedBlockState[] states, PackedBlockState state) {
public static void init(BlockStateWrapper[] states, BlockStateWrapper state) {
customBlockStates = states;
stoneState = state;
}
public static PackedBlockState stateByRegistryId(int vanillaId) {
public static BlockStateWrapper stateByRegistryId(int vanillaId) {
if (vanillaId < 0) return stoneState;
return customBlockStates[vanillaId];
}

View File

@@ -0,0 +1,67 @@
package net.momirealms.craftengine.core.block;
public interface BlockStateWrapper {
Object handle();
int registryId();
boolean isVanillaBlock();
static BlockStateWrapper vanilla(Object handle, int registryId) {
return new VanillaBlockState(handle, registryId);
}
static BlockStateWrapper custom(Object handle, int registryId) {
return new CustomBlockState(handle, registryId);
}
static BlockStateWrapper create(Object handle, int registryId, boolean isVanillaBlock) {
if (isVanillaBlock) return new VanillaBlockState(handle, registryId);
else return new CustomBlockState(handle, registryId);
}
abstract class AbstractBlockState implements BlockStateWrapper {
protected final Object handle;
protected final int registryId;
public AbstractBlockState(Object handle, int registryId) {
this.handle = handle;
this.registryId = registryId;
}
@Override
public Object handle() {
return this.handle;
}
@Override
public int registryId() {
return this.registryId;
}
}
class VanillaBlockState extends AbstractBlockState {
public VanillaBlockState(Object handle, int registryId) {
super(handle, registryId);
}
@Override
public boolean isVanillaBlock() {
return true;
}
}
class CustomBlockState extends AbstractBlockState {
public CustomBlockState(Object handle, int registryId) {
super(handle, registryId);
}
@Override
public boolean isVanillaBlock() {
return false;
}
}
}

View File

@@ -14,14 +14,14 @@ import net.momirealms.sparrow.nbt.CompoundTag;
import net.momirealms.sparrow.nbt.NBT;
import net.momirealms.sparrow.nbt.Tag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.List;
public class ImmutableBlockState extends BlockStateHolder {
private CompoundTag tag;
private PackedBlockState customBlockState;
private PackedBlockState vanillaBlockState;
private BlockStateWrapper customBlockState;
private BlockStateWrapper vanillaBlockState;
private BlockBehavior behavior;
private Integer hashCode;
@@ -81,19 +81,19 @@ public class ImmutableBlockState extends BlockStateHolder {
return settings.pushReaction;
}
public PackedBlockState customBlockState() {
public BlockStateWrapper customBlockState() {
return this.customBlockState;
}
public PackedBlockState vanillaBlockState() {
public BlockStateWrapper vanillaBlockState() {
return this.vanillaBlockState;
}
public void setCustomBlockState(@NotNull PackedBlockState customBlockState) {
public void setCustomBlockState(@NotNull BlockStateWrapper customBlockState) {
this.customBlockState = customBlockState;
}
public void setVanillaBlockState(@NotNull PackedBlockState vanillaBlockState) {
public void setVanillaBlockState(@NotNull BlockStateWrapper vanillaBlockState) {
this.vanillaBlockState = vanillaBlockState;
}

View File

@@ -1,4 +0,0 @@
package net.momirealms.craftengine.core.block;
public record PackedBlockState(Object handle, int registryId) {
}

View File

@@ -2,5 +2,5 @@ package net.momirealms.craftengine.core.block;
import net.momirealms.craftengine.core.util.Key;
public record VanillaBlock(Key type, String properties, int registryId) {
public record VanillaBlockState(Key type, String properties, int registryId) {
}

View File

@@ -5,8 +5,8 @@ import net.momirealms.craftengine.core.item.context.BlockPlaceContext;
import net.momirealms.craftengine.core.util.Direction;
import net.momirealms.craftengine.core.util.HorizontalDirection;
import net.momirealms.sparrow.nbt.Tag;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@@ -2,8 +2,6 @@ package net.momirealms.craftengine.core.entity.furniture;
import net.momirealms.craftengine.core.entity.player.Player;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.world.Vec3d;
import net.momirealms.craftengine.core.world.World;
import net.momirealms.craftengine.core.world.WorldPosition;
import org.jetbrains.annotations.NotNull;
import org.joml.Vector3f;

View File

@@ -6,8 +6,8 @@ import net.momirealms.craftengine.core.plugin.config.ConfigParser;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.world.WorldPosition;
import org.incendo.cloud.suggestion.Suggestion;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Optional;

View File

@@ -36,6 +36,8 @@ public abstract class Player extends AbstractEntity implements NetWorkUser {
public abstract void abortMiningBlock();
public abstract void breakBlock(int x, int y, int z);
public abstract double getCachedInteractionRange();
public abstract void onSwingHand();

View File

@@ -1,6 +1,7 @@
package net.momirealms.craftengine.core.font;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class Emoji {

View File

@@ -11,8 +11,8 @@ import net.momirealms.craftengine.core.plugin.config.ConfigParser;
import net.momirealms.craftengine.core.registry.Holder;
import net.momirealms.craftengine.core.util.Key;
import org.incendo.cloud.suggestion.Suggestion;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.*;
public interface ItemManager<T> extends Manageable, ModelGenerator {

View File

@@ -4,8 +4,8 @@ import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.objects.Reference2IntMap;
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;

View File

@@ -33,6 +33,7 @@ public class LootConditions {
register(CommonConditions.PERMISSION, new PermissionCondition.FactoryImpl<>());
register(CommonConditions.EQUALS, new EqualsCondition.FactoryImpl<>());
register(CommonConditions.EXPRESSION, new ExpressionCondition.FactoryImpl<>());
register(CommonConditions.IS_NULL, new IsNullCondition.FactoryImpl<>());
}
public static void register(Key key, ConditionFactory<LootContext> factory) {

View File

@@ -5,8 +5,7 @@ import net.momirealms.craftengine.core.plugin.context.ContextHolder;
import net.momirealms.craftengine.core.plugin.context.PlayerOptionalContext;
import net.momirealms.craftengine.core.world.World;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public class LootContext extends PlayerOptionalContext {
private final World world;

View File

@@ -10,8 +10,8 @@ import net.momirealms.craftengine.core.pack.host.ResourcePackHosts;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.locale.LocalizedException;
import net.momirealms.craftengine.core.util.*;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

View File

@@ -1,8 +1,8 @@
package net.momirealms.craftengine.core.plugin.context;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

View File

@@ -20,4 +20,5 @@ public final class CommonConditions {
public static final Key PERMISSION = Key.from("craftengine:permission");
public static final Key EQUALS = Key.from("craftengine:equals");
public static final Key EXPRESSION = Key.from("craftengine:expression");
public static final Key IS_NULL = Key.from("craftengine:is_null");
}

View File

@@ -0,0 +1,38 @@
package net.momirealms.craftengine.core.plugin.context.condition;
import net.momirealms.craftengine.core.plugin.context.Condition;
import net.momirealms.craftengine.core.plugin.context.Context;
import net.momirealms.craftengine.core.plugin.context.ContextKey;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
import java.util.Map;
import java.util.Optional;
public class IsNullCondition<CTX extends Context> implements Condition<CTX> {
private final ContextKey<?> key;
public IsNullCondition(ContextKey<?> key) {
this.key = key;
}
@Override
public Key type() {
return CommonConditions.IS_NULL;
}
@Override
public boolean test(CTX ctx) {
Optional<?> optional = ctx.getOptionalParameter(this.key);
return optional.isPresent();
}
public static class FactoryImpl<CTX extends Context> implements ConditionFactory<CTX> {
@Override
public Condition<CTX> create(Map<String, Object> arguments) {
String argument = ResourceConfigUtils.requireNonEmptyStringOrThrow(arguments.get("argument"), "warning.config.condition.is_null.missing_argument");
return new IsNullCondition<>(ContextKey.chain(argument));
}
}
}

View File

@@ -31,6 +31,7 @@ public class EventConditions {
register(CommonConditions.PERMISSION, new PermissionCondition.FactoryImpl<>());
register(CommonConditions.EQUALS, new EqualsCondition.FactoryImpl<>());
register(CommonConditions.EXPRESSION, new ExpressionCondition.FactoryImpl<>());
register(CommonConditions.IS_NULL, new IsNullCondition.FactoryImpl<>());
}
public static void register(Key key, ConditionFactory<PlayerOptionalContext> factory) {

View File

@@ -24,6 +24,8 @@ public class EventFunctions {
register(CommonFunctions.OPEN_WINDOW, new OpenWindowFunction.FactoryImpl<>(EventConditions::fromMap));
register(CommonFunctions.CANCEL_EVENT, new CancelEventFunction.FactoryImpl<>(EventConditions::fromMap));
register(CommonFunctions.RUN, new RunFunction.FactoryImpl<>(EventFunctions::fromMap, EventConditions::fromMap));
register(CommonFunctions.PLACE_BLOCK, new PlaceBlockFunction.FactoryImpl<>(EventConditions::fromMap));
register(CommonFunctions.BREAK_BLOCK, new BreakBlockFunction.FactoryImpl<>(EventConditions::fromMap));
}
public static void register(Key key, FunctionFactory<PlayerOptionalContext> factory) {

View File

@@ -10,8 +10,8 @@ import net.momirealms.craftengine.core.plugin.context.text.TextProviders;
import net.momirealms.craftengine.core.util.AdventureHelper;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.Optional;

View File

@@ -0,0 +1,53 @@
package net.momirealms.craftengine.core.plugin.context.function;
import net.momirealms.craftengine.core.entity.player.Player;
import net.momirealms.craftengine.core.plugin.context.Condition;
import net.momirealms.craftengine.core.plugin.context.Context;
import net.momirealms.craftengine.core.plugin.context.number.NumberProvider;
import net.momirealms.craftengine.core.plugin.context.number.NumberProviders;
import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.MCUtils;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class BreakBlockFunction<CTX extends Context> extends AbstractConditionalFunction<CTX> {
private final NumberProvider x;
private final NumberProvider y;
private final NumberProvider z;
public BreakBlockFunction(NumberProvider x, NumberProvider y, NumberProvider z, List<Condition<CTX>> predicates) {
super(predicates);
this.x = x;
this.y = y;
this.z = z;
}
@Override
public void runInternal(CTX ctx) {
Optional<Player> optionalPlayer = ctx.getOptionalParameter(DirectContextParameters.PLAYER);
optionalPlayer.ifPresent(player -> player.breakBlock(MCUtils.fastFloor(x.getDouble(ctx)), MCUtils.fastFloor(y.getDouble(ctx)), MCUtils.fastFloor(z.getDouble(ctx))));
}
@Override
public Key type() {
return CommonFunctions.BREAK_BLOCK;
}
public static class FactoryImpl<CTX extends Context> extends AbstractFactory<CTX> {
public FactoryImpl(java.util.function.Function<Map<String, Object>, Condition<CTX>> factory) {
super(factory);
}
@Override
public Function<CTX> create(Map<String, Object> arguments) {
NumberProvider x = NumberProviders.fromObject(arguments.getOrDefault("x", "<arg:block.block_x>"));
NumberProvider y = NumberProviders.fromObject(arguments.getOrDefault("y", "<arg:block.block_y>"));
NumberProvider z = NumberProviders.fromObject(arguments.getOrDefault("z", "<arg:block.block_z>"));
return new BreakBlockFunction<>(x, y, z, getPredicates(arguments));
}
}
}

View File

@@ -12,8 +12,8 @@ import net.momirealms.craftengine.core.plugin.context.text.TextProviders;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.MiscUtils;
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.Optional;

View File

@@ -16,9 +16,11 @@ public final class CommonFunctions {
public static final Key POTION_EFFECT = Key.of("craftengine:potion_effect");
public static final Key BREAK_BLOCK = Key.of("craftengine:break_block");
public static final Key CANCEL_EVENT = Key.of("craftengine:cancel_event");
public static final Key PLACE_BLOCK = Key.of("craftengine:place_block");
public static final Key FOOD = Key.of("craftengine:food");
public static final Key SATURATION = Key.of("craftengine:saturation");
public static final Key MONEY = Key.of("craftengine:money");
public static final Key OXYGEN = Key.of("craftengine:oxygen");
public static final Key MINE_RADIUS = Key.of("craftengine:mine_radius");
public static final Key DROP_LOOT = Key.of("craftengine:drop_loot");
}

View File

@@ -11,8 +11,8 @@ import net.momirealms.craftengine.core.util.AdventureHelper;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.MiscUtils;
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.Optional;

View File

@@ -14,8 +14,8 @@ import net.momirealms.craftengine.core.util.AdventureHelper;
import net.momirealms.craftengine.core.util.EnumUtils;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Locale;
import java.util.Map;

View File

@@ -0,0 +1,87 @@
package net.momirealms.craftengine.core.plugin.context.function;
import net.momirealms.craftengine.core.block.BlockStateWrapper;
import net.momirealms.craftengine.core.block.UpdateOption;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.context.Condition;
import net.momirealms.craftengine.core.plugin.context.Context;
import net.momirealms.craftengine.core.plugin.context.number.NumberProvider;
import net.momirealms.craftengine.core.plugin.context.number.NumberProviders;
import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.MCUtils;
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
import net.momirealms.craftengine.core.world.World;
import net.momirealms.craftengine.core.world.WorldPosition;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class PlaceBlockFunction<CTX extends Context> extends AbstractConditionalFunction<CTX> {
private final DelayedInitBlockState delayedInitBlockState;
private final NumberProvider x;
private final NumberProvider y;
private final NumberProvider z;
private final NumberProvider updateFlags;
public PlaceBlockFunction(DelayedInitBlockState delayedInitBlockState, NumberProvider x, NumberProvider y, NumberProvider z, NumberProvider updateFlags, List<Condition<CTX>> predicates) {
super(predicates);
this.delayedInitBlockState = delayedInitBlockState;
this.x = x;
this.y = y;
this.z = z;
this.updateFlags = updateFlags;
}
@Override
public void runInternal(CTX ctx) {
Optional<WorldPosition> optionalWorldPosition = ctx.getOptionalParameter(DirectContextParameters.POSITION);
if (optionalWorldPosition.isPresent()) {
World world = optionalWorldPosition.get().world();
world.setBlockAt(MCUtils.fastFloor(this.x.getDouble(ctx)), MCUtils.fastFloor(this.y.getDouble(ctx)), MCUtils.fastFloor(this.z.getDouble(ctx)), this.delayedInitBlockState.getState(), this.updateFlags.getInt(ctx));
}
}
@Override
public Key type() {
return CommonFunctions.PLACE_BLOCK;
}
public static class DelayedInitBlockState {
private final String state;
private BlockStateWrapper packedBlockState;
public DelayedInitBlockState(String state) {
this.state = state;
}
public BlockStateWrapper getState() {
if (this.packedBlockState == null) {
this.packedBlockState = CraftEngine.instance().blockManager().createPackedBlockState(state);
if (this.packedBlockState == null) {
CraftEngine.instance().logger().warn("Could not create block state: " + this.state);
}
}
return this.packedBlockState;
}
}
public static class FactoryImpl<CTX extends Context> extends AbstractFactory<CTX> {
public FactoryImpl(java.util.function.Function<Map<String, Object>, Condition<CTX>> factory) {
super(factory);
}
@Override
public Function<CTX> create(Map<String, Object> arguments) {
String state = ResourceConfigUtils.requireNonEmptyStringOrThrow(arguments.get("block-state"), "warning.config.function.place_block.missing_block_state");
DelayedInitBlockState delayedInitBlockState = new DelayedInitBlockState(state);
NumberProvider x = NumberProviders.fromObject(arguments.getOrDefault("x", "<arg:block.block_x>"));
NumberProvider y = NumberProviders.fromObject(arguments.getOrDefault("y", "<arg:block.block_y>"));
NumberProvider z = NumberProviders.fromObject(arguments.getOrDefault("z", "<arg:block.block_z>"));
NumberProvider flags = Optional.ofNullable(arguments.get("update-flags")).map(NumberProviders::fromObject).orElse(NumberProviders.direct(UpdateOption.UPDATE_ALL.flags()));
return new PlaceBlockFunction<>(delayedInitBlockState, x, y, z, flags, getPredicates(arguments));
}
}
}

View File

@@ -11,8 +11,8 @@ import net.momirealms.craftengine.core.plugin.context.text.TextProvider;
import net.momirealms.craftengine.core.plugin.context.text.TextProviders;
import net.momirealms.craftengine.core.util.AdventureHelper;
import net.momirealms.craftengine.core.util.Key;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.Optional;

View File

@@ -31,6 +31,18 @@ public class ExpressionNumberProvider implements NumberProvider {
}
}
@Override
public double getDouble(Context context) {
Component resultComponent = AdventureHelper.customMiniMessage().deserialize(this.expr, context.tagResolvers());
String resultString = AdventureHelper.plainTextContent(resultComponent);
Expression expression = new Expression(resultString);
try {
return expression.evaluate().getNumberValue().doubleValue();
} catch (EvaluationException | ParseException e) {
throw new RuntimeException("Invalid expression: " + this.expr + " -> " + resultString + " -> Cannot parse", e);
}
}
@Override
public Key type() {
return NumberProviders.EXPRESSION;

View File

@@ -10,14 +10,19 @@ import java.util.Map;
public class FixedNumberProvider implements NumberProvider {
public static final FactoryImpl FACTORY = new FactoryImpl();
private final float value;
private final double value;
public FixedNumberProvider(float value) {
public FixedNumberProvider(double value) {
this.value = value;
}
@Override
public float getFloat(Context context) {
return (float) this.value;
}
@Override
public double getDouble(Context context) {
return this.value;
}
@@ -32,12 +37,12 @@ public class FixedNumberProvider implements NumberProvider {
public NumberProvider create(Map<String, Object> arguments) {
String plainOrExpression = ResourceConfigUtils.requireNonEmptyStringOrThrow(arguments.get("value"), "warning.config.number.fixed.missing_value");
try {
float value = Float.parseFloat(plainOrExpression);
double value = Double.parseDouble(plainOrExpression);
return new FixedNumberProvider(value);
} catch (NumberFormatException e) {
Expression expression = new Expression(plainOrExpression);
try {
return new FixedNumberProvider(expression.evaluate().getNumberValue().floatValue());
return new FixedNumberProvider(expression.evaluate().getNumberValue().doubleValue());
} catch (Exception e1) {
throw new LocalizedResourceConfigException("warning.config.number.fixed.invalid_value", e1, plainOrExpression);
}

View File

@@ -7,6 +7,8 @@ public interface NumberProvider {
float getFloat(Context context);
double getDouble(Context context);
default int getInt(Context context) {
return Math.round(this.getFloat(context));
}

View File

@@ -41,6 +41,10 @@ public class NumberProviders {
return functions;
}
public static NumberProvider direct(double value) {
return new FixedNumberProvider(value);
}
public static NumberProvider fromMap(Map<String, Object> map) {
String type = ResourceConfigUtils.requireNonEmptyStringOrThrow(map.get("type"), "warning.config.number.missing_type");
Key key = Key.withDefaultNamespace(type, Key.DEFAULT_NAMESPACE);

View File

@@ -30,6 +30,11 @@ public class UniformNumberProvider implements NumberProvider {
return RandomUtils.generateRandomInt(this.min.getInt(context), this.max.getInt(context) + 1);
}
@Override
public double getDouble(Context context) {
return RandomUtils.generateRandomDouble(this.min.getDouble(context), this.max.getDouble(context));
}
@Override
public float getFloat(Context context) {
return RandomUtils.generateRandomFloat(this.min.getFloat(context), this.max.getFloat(context));

View File

@@ -3,8 +3,8 @@ package net.momirealms.craftengine.core.registry;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.ResourceKey;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;

View File

@@ -3,8 +3,8 @@ package net.momirealms.craftengine.core.registry;
import com.google.common.collect.Maps;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.ResourceKey;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.*;
public class MappedRegistry<T> implements WritableRegistry<T> {

View File

@@ -2,8 +2,8 @@ package net.momirealms.craftengine.core.registry;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.util.ResourceKey;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

View File

@@ -1,8 +1,8 @@
package net.momirealms.craftengine.core.util;
import com.google.common.collect.Iterators;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;

View File

@@ -1,5 +1,6 @@
package net.momirealms.craftengine.core.world;
import net.momirealms.craftengine.core.block.BlockStateWrapper;
import net.momirealms.craftengine.core.item.Item;
import net.momirealms.craftengine.core.sound.SoundData;
import net.momirealms.craftengine.core.util.Key;
@@ -21,6 +22,8 @@ public interface World {
return getBlockAt(pos.x(), pos.y(), pos.z());
}
void setBlockAt(int x, int y, int z, BlockStateWrapper blockState, int flags);
String name();
Path directory();

View File

@@ -5,8 +5,8 @@ import net.jpountz.lz4.LZ4BlockInputStream;
import net.jpountz.lz4.LZ4BlockOutputStream;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.dependency.Dependencies;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;

View File

@@ -5,8 +5,8 @@ import net.momirealms.craftengine.core.plugin.logger.PluginLogger;
import net.momirealms.craftengine.core.world.ChunkPos;
import net.momirealms.sparrow.nbt.CompoundTag;
import net.momirealms.sparrow.nbt.NBT;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.io.*;
import java.nio.Buffer;
import java.nio.ByteBuffer;

View File

@@ -3,8 +3,8 @@ package net.momirealms.craftengine.core.world.collision;
import net.momirealms.craftengine.core.util.Direction;
import net.momirealms.craftengine.core.world.EntityHitResult;
import net.momirealms.craftengine.core.world.Vec3d;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Optional;
public class AABB {

View File

@@ -71,9 +71,9 @@ modmenu_version=13.0.3
cloth_version=17.0.144
# Proxy settings
systemProp.socks.proxyHost=127.0.0.1
systemProp.socks.proxyPort=7890
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=7890
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7890
#systemProp.socks.proxyHost=127.0.0.1
#systemProp.socks.proxyPort=7890
#systemProp.http.proxyHost=127.0.0.1
#systemProp.http.proxyPort=7890
#systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=7890