Merge remote-tracking branch 'upstream/master' into merge

This commit is contained in:
Jesse Boyd 2019-11-19 21:25:36 +00:00
parent 2c9f192baf
commit 5d8adbc10c
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
10 changed files with 54 additions and 61 deletions

View File

@ -26,9 +26,9 @@ configurations.all {
resolutionStrategy {
// Fabric needs this.
force(
"commons-io:commons-io:2.5",
"org.ow2.asm:asm:7.1",
"org.ow2.asm:asm-commons:7.1"
"commons-io:commons-io:2.5",
"org.ow2.asm:asm:7.1",
"org.ow2.asm:asm-commons:7.1"
)
}
}

View File

@ -104,6 +104,7 @@ fun Project.applyShadowConfiguration() {
exclude("GradleStart**")
exclude(".cache")
exclude("LICENSE*")
exclude("META-INF/maven/**")
minimize()
}
}

View File

@ -7,3 +7,7 @@ org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true
loom.version=0.2.5-20190906.190953-30
mixin.version=0.7.11.38

View File

@ -82,11 +82,13 @@ tasks.named<ShadowJar>("shadowJar") {
dependencies {
relocate("org.slf4j", "com.sk89q.worldedit.slf4j")
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge")
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
include(dependency(":worldedit-core"))
include(dependency(":worldedit-libs:core"))
include(dependency(":worldedit-libs:bukkit"))
include(dependency("org.slf4j:slf4j-api"))
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
include(dependency("org.antlr:antlr4-runtime"))
relocate("org.bstats", "com.sk89q.worldedit.bukkit.bstats") {
include(dependency("org.bstats:bstats-bukkit:1.5"))
}

View File

@ -104,16 +104,16 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public BaseItemStack getItemInHand(HandSide handSide) {
ItemStack itemStack = handSide == HandSide.MAIN_HAND
? getPlayer().getInventory().getItemInMainHand()
: getPlayer().getInventory().getItemInOffHand();
? player.getInventory().getItemInMainHand()
: player.getInventory().getItemInOffHand();
return BukkitAdapter.adapt(itemStack);
}
@Override
public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException {
ItemStack itemStack = handSide == HandSide.MAIN_HAND
? getPlayer().getInventory().getItemInMainHand()
: getPlayer().getInventory().getItemInOffHand();
? player.getInventory().getItemInMainHand()
: player.getInventory().getItemInOffHand();
return BukkitAdapter.asBlockState(itemStack).toBaseBlock();
}
@ -124,18 +124,18 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public String getDisplayName() {
return getPlayer().getDisplayName();
return player.getDisplayName();
}
@Override
public void giveItem(BaseItemStack itemStack) {
final PlayerInventory inv = getPlayer().getInventory();
final PlayerInventory inv = player.getInventory();
ItemStack newItem = BukkitAdapter.adapt(itemStack);
if (itemStack.getType().getId().equalsIgnoreCase(WorldEdit.getInstance().getConfiguration().wandItem)) {
inv.remove(newItem);
}
final ItemStack item = getPlayer().getInventory().getItemInMainHand();
getPlayer().getInventory().setItemInMainHand(newItem);
final ItemStack item = player.getInventory().getItemInMainHand();
player.getInventory().setItemInMainHand(newItem);
HashMap<Integer, ItemStack> overflow = inv.addItem(item);
if (!overflow.isEmpty()) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@ -145,7 +145,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
ItemStack stack = entry.getValue();
if (stack.getType() != Material.AIR && stack.getAmount() > 0) {
Item
dropped = getPlayer().getWorld().dropItem(getPlayer().getLocation(), stack);
dropped = player.getWorld().dropItem(player.getLocation(), stack);
PlayerDropItemEvent event = new PlayerDropItemEvent(player, dropped);
if (event.isCancelled()) {
dropped.remove();
@ -155,45 +155,45 @@ public class BukkitPlayer extends AbstractPlayerActor {
}
});
}
getPlayer().updateInventory();
player.updateInventory();
}
@Override
public void printRaw(String msg) {
for (String part : msg.split("\n")) {
getPlayer().sendMessage(part);
player.sendMessage(part);
}
}
@Override
public void print(String msg) {
for (String part : msg.split("\n")) {
getPlayer().sendMessage("\u00A7d" + part);
player.sendMessage("\u00A7d" + part);
}
}
@Override
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
getPlayer().sendMessage("\u00A77" + part);
player.sendMessage("\u00A77" + part);
}
}
@Override
public void printError(String msg) {
for (String part : msg.split("\n")) {
getPlayer().sendMessage("§c" + part);
player.sendMessage("§c" + part);
}
}
@Override
public void print(Component component) {
TextAdapter.sendComponent(getPlayer(), WorldEditText.format(component));
TextAdapter.sendComponent(player, WorldEditText.format(component));
}
@Override
public void setPosition(Vector3 pos, float pitch, float yaw) {
org.bukkit.World world = getPlayer().getWorld();
org.bukkit.World world = player.getWorld();
if (pos instanceof com.sk89q.worldedit.util.Location) {
com.sk89q.worldedit.util.Location loc = (com.sk89q.worldedit.util.Location) pos;
Extent extent = loc.getExtent();
@ -201,17 +201,17 @@ public class BukkitPlayer extends AbstractPlayerActor {
world = Bukkit.getWorld(((World) extent).getName());
}
}
getPlayer().teleport(new Location(world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch));
player.teleport(new Location(world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch));
}
@Override
public String[] getGroups() {
return plugin.getPermissionsResolver().getGroups(getPlayer());
return plugin.getPermissionsResolver().getGroups(player);
}
@Override
public BlockBag getInventoryBlockBag() {
return new BukkitPlayerBlockBag(getPlayer());
return new BukkitPlayerBlockBag(player);
}
@Override
@ -232,10 +232,10 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override public boolean togglePermission(String permission) {
if (this.hasPermission(permission)) {
getPlayer().addAttachment(plugin).setPermission(permission, false);
player.addAttachment(plugin).setPermission(permission, false);
return false;
} else {
getPlayer().addAttachment(plugin).setPermission(permission, true);
player.addAttachment(plugin).setPermission(permission, true);
return true;
}
}
@ -257,19 +257,19 @@ public class BukkitPlayer extends AbstractPlayerActor {
* - The `/wea` command will give/remove the required bypass permission
*/
if (Fawe.<FaweBukkit>imp().getVault() == null || Fawe.<FaweBukkit> imp().getVault().permission == null) {
getPlayer().addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission(permission, value);
player.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission(permission, value);
} else if (value) {
if (!Fawe.<FaweBukkit> imp().getVault().permission.playerAdd(player, permission)) {
getPlayer().addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission(permission, value);
player.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission(permission, value);
}
} else if (!Fawe.<FaweBukkit>imp().getVault().permission.playerRemove(player, permission)) {
getPlayer().addAttachment(Fawe.<FaweBukkit>imp().getPlugin()).setPermission(permission, value);
player.addAttachment(Fawe.<FaweBukkit>imp().getPlugin()).setPermission(permission, value);
}
}
@Override
public World getWorld() {
return BukkitAdapter.adapt(getPlayer().getWorld());
return BukkitAdapter.adapt(player.getWorld());
}
@Override
@ -279,7 +279,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
if (params.length > 0) {
send = send + "|" + StringUtil.joinString(params, "|");
}
getPlayer().sendPluginMessage(plugin, WorldEditPlugin.CUI_PLUGIN_CHANNEL, send.getBytes(CUIChannelListener.UTF_8_CHARSET));
player.sendPluginMessage(plugin, WorldEditPlugin.CUI_PLUGIN_CHANNEL, send.getBytes(CUIChannelListener.UTF_8_CHARSET));
}
public Player getPlayer() {
@ -299,7 +299,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public com.sk89q.worldedit.util.Location getLocation() {
Location nativeLocation = getPlayer().getLocation();
Location nativeLocation = player.getLocation();
Vector3 position = BukkitAdapter.asVector(nativeLocation);
return new com.sk89q.worldedit.util.Location(
getWorld(),
@ -310,7 +310,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public boolean setLocation(com.sk89q.worldedit.util.Location location) {
return getPlayer().teleport(BukkitAdapter.adapt(location));
return player.teleport(BukkitAdapter.adapt(location));
}
@Nullable
@ -364,11 +364,11 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
Location loc = new Location(getPlayer().getWorld(), pos.getX(), pos.getY(), pos.getZ());
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
if (block == null) {
getPlayer().sendBlockChange(loc, getPlayer().getWorld().getBlockAt(loc).getBlockData());
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
} else {
getPlayer().sendBlockChange(loc, BukkitAdapter.adapt(block));
player.sendBlockChange(loc, BukkitAdapter.adapt(block));
if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
@ -383,13 +383,13 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public void sendTitle(String title, String sub) {
getPlayer().sendTitle(ChatColor.GOLD + title, ChatColor.GOLD + sub, 0, 70, 20);
player.sendTitle(ChatColor.GOLD + title, ChatColor.GOLD + sub, 0, 70, 20);
Bukkit.getServer().dispatchCommand(player, "title " + getName() + " subtitle [{\"text\":\"" + sub + "\",\"color\":\"gold\"}]");
Bukkit.getServer().dispatchCommand(player, "title " + getName() + " title [{\"text\":\"" + title + "\",\"color\":\"gold\"}]");
}
@Override
public void unregister() {
getPlayer().removeMetadata("WE", WorldEditPlugin.getInstance());
player.removeMetadata("WE", WorldEditPlugin.getInstance());
}
}

View File

@ -330,12 +330,6 @@ public class BukkitWorld extends AbstractWorld {
@Override
public void checkLoadedChunk(BlockVector3 pt) {
World world = getWorld();
world.getChunkAt(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) {
world.loadChunk(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
}
if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) {
int X = pt.getBlockX() >> 4;
int Z = pt.getBlockZ() >> 4;

View File

@ -347,7 +347,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
// code of WorldEdit expects it
String[] split = new String[args.length + 1];
System.arraycopy(args, 0, split, 1, args.length);
split[0] = "/" + commandLabel;
split[0] = commandLabel;
String arguments = Joiner.on(" ").join(split);
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments);
@ -485,22 +485,6 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
return true;
}
/*
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String commandLabel, String[] args) {
// Add the command to the array because the underlying command handling
// code of WorldEdit expects it
String[] split = new String[args.length + 1];
System.arraycopy(args, 0, split, 1, args.length);
split[0] = "/" + commandLabel;
String arguments = Joiner.on(" ").join(split);
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments);
getWorldEdit().getEventBus().post(event);
return CommandUtil.fixSuggestions(arguments, event.getSuggestions());
}
*/
/**
* Gets the session for the player.
*

View File

@ -1,9 +1,11 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.plugins.ide.idea.model.IdeaModel
plugins {
id("java-library")
id("net.ltgt.apt-eclipse")
id("net.ltgt.apt-idea")
id("antlr")
}
repositories {
@ -28,6 +30,11 @@ dependencies {
"compile"("com.google.code.gson:gson:2.8.0")
"compile"("org.slf4j:slf4j-api:1.7.26")
"compile"("it.unimi.dsi:fastutil:8.2.1")
val antlrVersion = "4.7.2"
"antlr"("org.antlr:antlr4:$antlrVersion")
"implementation"("org.antlr:antlr4-runtime:$antlrVersion")
"compile"("com.googlecode.json-simple:json-simple:1.3.9") { isTransitive = false }
"compileOnly"(project(":worldedit-libs:core:ap"))
"annotationProcessor"(project(":worldedit-libs:core:ap"))

View File

@ -145,7 +145,7 @@ public class ToolCommands {
public void selwand(Player player, LocalSession session) throws WorldEditException {
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(itemType, new SelectionWand());
session.setTool(itemType, SelectionWand.INSTANCE);
player.print("Selection wand bound to " + itemType.getName() + ".");
}

View File

@ -70,6 +70,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockType;