mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
SPIGOT-4298: Block command sender returns wrong block
This commit is contained in:
parent
ec86574b9b
commit
3418f8d7a1
3 changed files with 8 additions and 8 deletions
|
@ -7,7 +7,7 @@
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
|
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
|
||||||
+ return new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper);
|
+ return new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, TileEntityCommand.this);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
|
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
|
||||||
+ return wrapper.f() != null ? wrapper.f().getBukkitSender(wrapper) : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper);
|
+ return wrapper.f() != null ? wrapper.f().getBukkitSender(wrapper) : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, this);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package org.bukkit.craftbukkit.command;
|
package org.bukkit.craftbukkit.command;
|
||||||
|
|
||||||
import net.minecraft.server.CommandBlockListenerAbstract;
|
|
||||||
import net.minecraft.server.CommandListenerWrapper;
|
import net.minecraft.server.CommandListenerWrapper;
|
||||||
import net.minecraft.server.ICommandListener;
|
|
||||||
import net.minecraft.server.IChatBaseComponent;
|
import net.minecraft.server.IChatBaseComponent;
|
||||||
import net.minecraft.server.Vec3D;
|
import net.minecraft.server.TileEntity;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.BlockCommandSender;
|
import org.bukkit.command.BlockCommandSender;
|
||||||
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,15 +14,16 @@ import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
*/
|
*/
|
||||||
public class CraftBlockCommandSender extends ServerCommandSender implements BlockCommandSender {
|
public class CraftBlockCommandSender extends ServerCommandSender implements BlockCommandSender {
|
||||||
private final CommandListenerWrapper block;
|
private final CommandListenerWrapper block;
|
||||||
|
private final TileEntity tile;
|
||||||
|
|
||||||
public CraftBlockCommandSender(CommandListenerWrapper commandBlockListenerAbstract) {
|
public CraftBlockCommandSender(CommandListenerWrapper commandBlockListenerAbstract, TileEntity tile) {
|
||||||
super();
|
super();
|
||||||
this.block = commandBlockListenerAbstract;
|
this.block = commandBlockListenerAbstract;
|
||||||
|
this.tile = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlock() {
|
public Block getBlock() {
|
||||||
Vec3D pos = block.getPosition();
|
return CraftBlock.at(tile.getWorld(), tile.getPosition());
|
||||||
return block.getWorld().getWorld().getBlockAt((int) pos.x, (int) pos.y, (int) pos.z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
|
|
Loading…
Reference in a new issue