mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
Selective upstream merge
This commit is contained in:
parent
7ad364917f
commit
47e66913e3
@ -35,11 +35,7 @@ import java.util.Set;
|
|||||||
public class CommandRegistration {
|
public class CommandRegistration {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class, new DynamicPluginCommandHelpTopic.Factory());
|
||||||
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class, new DynamicPluginCommandHelpTopic.Factory());
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Plugin plugin;
|
protected final Plugin plugin;
|
||||||
|
@ -35,6 +35,9 @@ public class VaultResolver implements PermissionsResolver {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
RegisteredServiceProvider<Permission> rsp = server.getServicesManager().getRegistration(Permission.class);
|
RegisteredServiceProvider<Permission> rsp = server.getServicesManager().getRegistration(Permission.class);
|
||||||
|
if (rsp == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
perms = rsp.getProvider();
|
perms = rsp.getProvider();
|
||||||
if (perms == null) {
|
if (perms == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -49,4 +49,4 @@ public class BukkitBlockCategoryRegistry implements BlockCategoryRegistry {
|
|||||||
public Set<BlockType> getAll(Category<BlockType> category) {
|
public Set<BlockType> getAll(Category<BlockType> category) {
|
||||||
return getCategorisedByName(category.getId());
|
return getCategorisedByName(category.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
|
public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) {
|
||||||
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
|
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
|
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.blocks;
|
package com.sk89q.worldedit.blocks;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
@ -26,6 +28,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,4 +193,28 @@ public final class Blocks {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a string->string map to find the matching Property and values for the given BlockType.
|
||||||
|
*
|
||||||
|
* @param states the desired states and values
|
||||||
|
* @param type the block type to get properties and values for
|
||||||
|
* @return a property->value map
|
||||||
|
*/
|
||||||
|
public static Map<Property<Object>, Object> resolveProperties(Map<String, String> states, BlockType type) {
|
||||||
|
Map<String, ? extends Property<?>> existing = type.getPropertyMap();
|
||||||
|
Map<Property<Object>, Object> newMap = Maps.newHashMap();
|
||||||
|
states.forEach((key, value) -> {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Property<Object> prop = (Property<Object>) existing.get(key);
|
||||||
|
if (prop == null) return;
|
||||||
|
Object val = null;
|
||||||
|
try {
|
||||||
|
val = prop.getValueFor(value);
|
||||||
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
}
|
||||||
|
if (val == null) return;
|
||||||
|
newMap.put(prop, val);
|
||||||
|
});
|
||||||
|
return newMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/line"},
|
aliases = {"/line"},
|
||||||
usage = "<pattern> [thickness]",
|
usage = "<block> [thickness]",
|
||||||
desc = "Draws a line segment between cuboid selection corners",
|
desc = "Draws a line segment between cuboid selection corners",
|
||||||
help =
|
help =
|
||||||
"Draws a line segment between cuboid selection corners.\n" +
|
"Draws a line segment between cuboid selection corners.\n" +
|
||||||
@ -261,7 +261,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/curve", "/spline"},
|
aliases = {"/curve", "/spline"},
|
||||||
usage = "<pattern> [thickness]",
|
usage = "<block> [thickness]",
|
||||||
desc = "Draws a spline through selected points",
|
desc = "Draws a spline through selected points",
|
||||||
help =
|
help =
|
||||||
"Draws a spline through selected points.\n" +
|
"Draws a spline through selected points.\n" +
|
||||||
@ -297,8 +297,8 @@ public class RegionCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/replace", "/re", "/rep", "/r"},
|
aliases = { "/replace", "/re", "/rep" },
|
||||||
usage = "[from-mask] <to-pattern>",
|
usage = "[from-block] <to-block>",
|
||||||
desc = "Replace all blocks in the selection with another",
|
desc = "Replace all blocks in the selection with another",
|
||||||
flags = "f",
|
flags = "f",
|
||||||
min = 1,
|
min = 1,
|
||||||
@ -343,7 +343,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/overlay"},
|
aliases = {"/overlay"},
|
||||||
usage = "<pattern>",
|
usage = "<block>",
|
||||||
desc = "Set a block on top of blocks in the region",
|
desc = "Set a block on top of blocks in the region",
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1
|
max = 1
|
||||||
@ -393,7 +393,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/center", "/middle"},
|
aliases = {"/center", "/middle"},
|
||||||
usage = "<pattern>",
|
usage = "<block>",
|
||||||
desc = "Set the center block(s)",
|
desc = "Set the center block(s)",
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1
|
max = 1
|
||||||
@ -423,7 +423,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/walls"},
|
aliases = {"/walls"},
|
||||||
usage = "<pattern>",
|
usage = "<block>",
|
||||||
desc = "Build the four sides of the selection",
|
desc = "Build the four sides of the selection",
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1
|
max = 1
|
||||||
@ -439,7 +439,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/faces", "/outline"},
|
aliases = {"/faces", "/outline"},
|
||||||
usage = "<pattern>",
|
usage = "<block>",
|
||||||
desc = "Build the walls, ceiling, and floor of a selection",
|
desc = "Build the walls, ceiling, and floor of a selection",
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1
|
max = 1
|
||||||
@ -527,7 +527,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
desc = "Move the contents of the selection",
|
desc = "Move the contents of the selection",
|
||||||
help =
|
help =
|
||||||
"Moves the contents of the selection.\n" +
|
"Moves the contents of the selection.\n" +
|
||||||
" -s flag shifts the selection to the target location.\n" +
|
"The -s flag shifts the selection to the target location.\n" +
|
||||||
" -b also copies biomes\n" +
|
" -b also copies biomes\n" +
|
||||||
" -e ignores entities\n" +
|
" -e ignores entities\n" +
|
||||||
" -a ignores air\n" +
|
" -a ignores air\n" +
|
||||||
@ -621,7 +621,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
if (moveSelection) {
|
if (moveSelection) {
|
||||||
try {
|
try {
|
||||||
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||||
BlockVector3 shiftVector = BlockVector3.at(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
|
final BlockVector3 shiftVector = BlockVector3.at(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
|
||||||
region.shift(shiftVector);
|
region.shift(shiftVector);
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||||
@ -735,7 +735,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/hollow"},
|
aliases = {"/hollow"},
|
||||||
usage = "[<thickness>[ <pattern>]]",
|
usage = "[<thickness>[ <block>]]",
|
||||||
desc = "Hollows out the object contained in this selection",
|
desc = "Hollows out the object contained in this selection",
|
||||||
help =
|
help =
|
||||||
"Hollows out the object contained in this selection.\n" +
|
"Hollows out the object contained in this selection.\n" +
|
||||||
@ -803,4 +803,4 @@ public class RegionCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ public final class BlockCategories {
|
|||||||
public static final BlockCategory BIRCH_LOGS = register("minecraft:birch_logs");
|
public static final BlockCategory BIRCH_LOGS = register("minecraft:birch_logs");
|
||||||
public static final BlockCategory BUTTONS = register("minecraft:buttons");
|
public static final BlockCategory BUTTONS = register("minecraft:buttons");
|
||||||
public static final BlockCategory CARPETS = register("minecraft:carpets");
|
public static final BlockCategory CARPETS = register("minecraft:carpets");
|
||||||
public static final BlockCategory CORAL = register("minecraft:coral");
|
public static final BlockCategory CORALS = register("minecraft:corals");
|
||||||
public static final BlockCategory CORAL_PLANTS = register("minecraft:coral_plants");
|
public static final BlockCategory CORAL_BLOCKS = register("minecraft:coral_blocks");
|
||||||
public static final BlockCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs");
|
public static final BlockCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs");
|
||||||
public static final BlockCategory DOORS = register("minecraft:doors");
|
public static final BlockCategory DOORS = register("minecraft:doors");
|
||||||
public static final BlockCategory ENDERMAN_HOLDABLE = register("minecraft:enderman_holdable");
|
public static final BlockCategory ENDERMAN_HOLDABLE = register("minecraft:enderman_holdable");
|
||||||
|
Loading…
Reference in New Issue
Block a user