@@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/server/CommandEffect.java
|
||||
+++ b/net/minecraft/server/CommandEffect.java
|
||||
@@ -62,7 +62,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
|
||||
|
||||
- if (((EntityLiving) entity).addEffect(mobeffect)) {
|
||||
+ if (((EntityLiving) entity).addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (entity instanceof EntityLiving && ((EntityLiving) entity).removeAllEffects()) {
|
||||
+ if (entity instanceof EntityLiving && ((EntityLiving) entity).removeAllEffects(org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (entity instanceof EntityLiving && ((EntityLiving) entity).removeEffect(mobeffectlist)) {
|
||||
+ if (entity instanceof EntityLiving && ((EntityLiving) entity).removeEffect(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/server/CommandGamemode.java
|
||||
+++ b/net/minecraft/server/CommandGamemode.java
|
||||
@@ -55,6 +55,12 @@
|
||||
|
||||
if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
||||
entityplayer.a(enumgamemode);
|
||||
+ // CraftBukkit start - handle event cancelling the change
|
||||
+ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
||||
+ commandcontext.getSource().sendFailureMessage(new ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
a((CommandListenerWrapper) commandcontext.getSource(), entityplayer, enumgamemode);
|
||||
++i;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/CommandGamerule.java
|
||||
+++ b/net/minecraft/server/CommandGamerule.java
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource();
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
t0.b(commandcontext, "value");
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true);
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.query", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), false);
|
||||
return t0.getIntValue();
|
||||
@@ -0,0 +1,19 @@
|
||||
--- a/net/minecraft/server/CommandReload.java
|
||||
+++ b/net/minecraft/server/CommandReload.java
|
||||
@@ -36,6 +36,16 @@
|
||||
return collection1;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public static void reload(MinecraftServer minecraftserver) {
|
||||
+ ResourcePackRepository resourcepackrepository = minecraftserver.getResourcePackRepository();
|
||||
+ SaveData savedata = minecraftserver.getSaveData();
|
||||
+ Collection<String> collection = resourcepackrepository.d();
|
||||
+ Collection<String> collection1 = a(resourcepackrepository, savedata, collection);
|
||||
+ minecraftserver.a(collection1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
|
||||
com_mojang_brigadier_commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) CommandDispatcher.a("reload").requires((commandlistenerwrapper) -> {
|
||||
return commandlistenerwrapper.hasPermission(2);
|
||||
@@ -0,0 +1,42 @@
|
||||
--- a/net/minecraft/server/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/CommandSpreadPlayers.java
|
||||
@@ -61,7 +61,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
set.add(entity.getScoreboardTeam());
|
||||
} else {
|
||||
- set.add((Object) null);
|
||||
+ set.add((ScoreboardTeamBase) null); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
|
||||
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > 0; flag2 = flag1) {
|
||||
blockposition_mutableblockposition.c(EnumDirection.DOWN);
|
||||
- flag1 = iblockaccess.getType(blockposition_mutableblockposition).isAir();
|
||||
+ flag1 = getType(iblockaccess, blockposition_mutableblockposition).isAir(); // CraftBukkit
|
||||
if (!flag1 && flag2 && flag) {
|
||||
return blockposition_mutableblockposition.getY() + 1;
|
||||
}
|
||||
@@ -283,7 +283,7 @@
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i) {
|
||||
BlockPosition blockposition = new BlockPosition(this.a, (double) (this.a(iblockaccess, i) - 1), this.b);
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = getType(iblockaccess, blockposition); // CraftBukkit
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -293,5 +293,12 @@
|
||||
this.a = MathHelper.a(random, d0, d2);
|
||||
this.b = MathHelper.a(random, d1, d3);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - add a version of getType which force loads chunks
|
||||
+ private static IBlockData getType(IBlockAccess iblockaccess, BlockPosition position) {
|
||||
+ ((WorldServer) iblockaccess).getChunkProvider().getChunkAt(position.getX() >> 4, position.getZ() >> 4, true);
|
||||
+ return iblockaccess.getType(position);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
--- a/net/minecraft/server/CommandTeleport.java
|
||||
+++ b/net/minecraft/server/CommandTeleport.java
|
||||
@@ -13,6 +13,12 @@
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class CommandTeleport {
|
||||
|
||||
private static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
|
||||
@@ -128,9 +134,9 @@
|
||||
}
|
||||
|
||||
if (worldserver == entity.world) {
|
||||
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
|
||||
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
} else {
|
||||
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1);
|
||||
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
}
|
||||
|
||||
entity.setHeadRotation(f);
|
||||
@@ -139,6 +145,21 @@
|
||||
float f3 = MathHelper.g(f1);
|
||||
|
||||
f3 = MathHelper.a(f3, -90.0F, 90.0F);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
|
||||
+ worldserver.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ d0 = to.getX();
|
||||
+ d1 = to.getY();
|
||||
+ d2 = to.getZ();
|
||||
+ f2 = to.getYaw();
|
||||
+ f3 = to.getPitch();
|
||||
+ worldserver = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
if (worldserver == entity.world) {
|
||||
entity.setPositionRotation(d0, d1, d2, f2, f3);
|
||||
entity.setHeadRotation(f2);
|
||||
@@ -0,0 +1,44 @@
|
||||
--- a/net/minecraft/server/CommandTime.java
|
||||
+++ b/net/minecraft/server/CommandTime.java
|
||||
@@ -5,6 +5,11 @@
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import java.util.Iterator;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.world.TimeSkipEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class CommandTime {
|
||||
|
||||
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
|
||||
@@ -46,7 +51,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
- worldserver.setDayTime((long) i);
|
||||
+ // CraftBukkit start
|
||||
+ TimeSkipEvent event = new TimeSkipEvent(worldserver.getWorld(), TimeSkipEvent.SkipReason.COMMAND, i - worldserver.getDayTime());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ worldserver.setDayTime((long) worldserver.getDayTime() + event.getSkipAmount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{i}), true);
|
||||
@@ -59,7 +70,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
- worldserver.setDayTime(worldserver.getDayTime() + (long) i);
|
||||
+ // CraftBukkit start
|
||||
+ TimeSkipEvent event = new TimeSkipEvent(worldserver.getWorld(), TimeSkipEvent.SkipReason.COMMAND, i);
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ worldserver.setDayTime(worldserver.getDayTime() + event.getSkipAmount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
int j = a(commandlistenerwrapper.getWorld());
|
||||
Reference in New Issue
Block a user