mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 19:22:50 +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
|
||||
+ @Override
|
||||
+ 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
|
||||
+
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ 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
|
||||
+
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package org.bukkit.craftbukkit.command;
|
||||
|
||||
import net.minecraft.server.CommandBlockListenerAbstract;
|
||||
import net.minecraft.server.CommandListenerWrapper;
|
||||
import net.minecraft.server.ICommandListener;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.Vec3D;
|
||||
import net.minecraft.server.TileEntity;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
|
||||
/**
|
||||
|
@ -15,15 +14,16 @@ import org.bukkit.craftbukkit.util.CraftChatMessage;
|
|||
*/
|
||||
public class CraftBlockCommandSender extends ServerCommandSender implements BlockCommandSender {
|
||||
private final CommandListenerWrapper block;
|
||||
private final TileEntity tile;
|
||||
|
||||
public CraftBlockCommandSender(CommandListenerWrapper commandBlockListenerAbstract) {
|
||||
public CraftBlockCommandSender(CommandListenerWrapper commandBlockListenerAbstract, TileEntity tile) {
|
||||
super();
|
||||
this.block = commandBlockListenerAbstract;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
Vec3D pos = block.getPosition();
|
||||
return block.getWorld().getWorld().getBlockAt((int) pos.x, (int) pos.y, (int) pos.z);
|
||||
return CraftBlock.at(tile.getWorld(), tile.getPosition());
|
||||
}
|
||||
|
||||
public void sendMessage(String message) {
|
||||
|
|
Loading…
Reference in a new issue