@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandEffect.java
|
||||
+++ b/net/minecraft/server/commands/CommandEffect.java
|
||||
@@ -76,7 +76,7 @@
|
||||
@@ -84,7 +84,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@
|
||||
@@ -110,7 +110,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@
|
||||
@@ -136,7 +136,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandLoot.java
|
||||
+++ b/net/minecraft/server/commands/CommandLoot.java
|
||||
@@ -91,7 +91,7 @@
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
private static <T extends ArgumentBuilder<CommandListenerWrapper, T>> T addTargets(T t0, CommandLoot.c commandloot_c) {
|
||||
@@ -9,7 +9,7 @@
|
||||
return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), list.size(), list, commandloot_a);
|
||||
}).then(commandloot_c.construct(net.minecraft.commands.CommandDispatcher.argument("count", IntegerArgumentType.integer(0)), (commandcontext, list, commandloot_a) -> {
|
||||
return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), IntegerArgumentType.getInteger(commandcontext, "count"), list, commandloot_a);
|
||||
@@ -248,6 +248,7 @@
|
||||
@@ -247,6 +247,7 @@
|
||||
private static int dropInWorld(CommandListenerWrapper commandlistenerwrapper, Vec3D vec3d, List<ItemStack> list, CommandLoot.a commandloot_a) throws CommandSyntaxException {
|
||||
WorldServer worldserver = commandlistenerwrapper.getLevel();
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
@@ -312,7 +312,7 @@
|
||||
|
||||
public boolean isSafe(IBlockAccess iblockaccess, int i) {
|
||||
BlockPosition blockposition = new BlockPosition(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
|
||||
BlockPosition blockposition = BlockPosition.containing(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
|
||||
- IBlockData iblockdata = iblockaccess.getBlockState(blockposition);
|
||||
+ IBlockData iblockdata = getBlockState(iblockaccess, blockposition); // CraftBukkit
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND"
|
||||
throw CommandSummon.ERROR_DUPLICATE_UUID.create();
|
||||
} else {
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.summon.success", entity.getDisplayName()), true);
|
||||
return entity;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandTeleport.java
|
||||
+++ b/net/minecraft/server/commands/CommandTeleport.java
|
||||
@@ -35,6 +35,12 @@
|
||||
@@ -33,6 +33,13 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -8,27 +8,23 @@
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class CommandTeleport {
|
||||
|
||||
private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(IChatBaseComponent.translatable("commands.teleport.invalidPosition"));
|
||||
@@ -159,14 +165,29 @@
|
||||
}
|
||||
@@ -147,7 +154,30 @@
|
||||
float f2 = MathHelper.wrapDegrees(f);
|
||||
float f3 = MathHelper.wrapDegrees(f1);
|
||||
|
||||
if (worldserver == entity.level) {
|
||||
- ((EntityPlayer) entity).connection.teleport(d0, d1, d2, f2, f3, set);
|
||||
+ ((EntityPlayer) entity).connection.teleport(d0, d1, d2, f2, f3, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
} else {
|
||||
- ((EntityPlayer) entity).teleportTo(worldserver, d0, d1, d2, f2, f3);
|
||||
+ ((EntityPlayer) entity).teleportTo(worldserver, d0, d1, d2, f2, f3, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
}
|
||||
|
||||
entity.setYHeadRot(f2);
|
||||
} else {
|
||||
float f4 = MathHelper.clamp(f3, -90.0F, 90.0F);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f4);
|
||||
- if (entity.teleportTo(worldserver, d0, d1, d2, set, f2, f3)) {
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ boolean result;
|
||||
+ if (entity instanceof EntityPlayer player) {
|
||||
+ result = player.teleportTo(worldserver, d0, d1, d2, set, f2, f3, PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
+ } else {
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
@@ -39,9 +35,14 @@
|
||||
+ d1 = to.getY();
|
||||
+ d2 = to.getZ();
|
||||
+ f2 = to.getYaw();
|
||||
+ f4 = to.getPitch();
|
||||
+ f3 = to.getPitch();
|
||||
+ worldserver = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+
|
||||
+ result = entity.teleportTo(worldserver, d0, d1, d2, set, f2, f3);
|
||||
+ }
|
||||
+
|
||||
+ if (result) {
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (worldserver == entity.level) {
|
||||
entity.moveTo(d0, d1, d2, f2, f4);
|
||||
if (commandteleport_a != null) {
|
||||
commandteleport_a.perform(commandlistenerwrapper, entity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user