Spigot fixes

This commit is contained in:
Beaness 2022-07-13 20:29:37 +02:00
parent 0d4fcf4a97
commit 57973a9bec
5 changed files with 33 additions and 7 deletions

View File

@ -69,8 +69,8 @@ public class VersionCommand extends BukkitCommand {
private void describeToSender(Plugin plugin, CommandSender sender) { private void describeToSender(Plugin plugin, CommandSender sender) {
PluginDescriptionFile desc = plugin.getDescription(); PluginDescriptionFile desc = plugin.getDescription();
sender.sendMessage(ChatColor.AQUA + desc.getName() + ChatColor.DARK_AQUA + " version " + ChatColor.AQUA + desc.getVersion()); sender.sendMessage(ChatColor.DARK_AQUA + "Name: " + ChatColor.AQUA + desc.getName());
sender.sendMessage(ChatColor.DARK_AQUA + "Version: " + ChatColor.AQUA + desc.getVersion());
if (desc.getDescription() != null) { if (desc.getDescription() != null) {
sender.sendMessage(ChatColor.DARK_AQUA + "Description: " + ChatColor.AQUA + desc.getDescription()); sender.sendMessage(ChatColor.DARK_AQUA + "Description: " + ChatColor.AQUA + desc.getDescription());
} }

View File

@ -101,6 +101,12 @@ public class eSpigotConfig
fixSprintEatExploit = getBoolean( "settings.fix-sprint-eat-exploit", true ); fixSprintEatExploit = getBoolean( "settings.fix-sprint-eat-exploit", true );
} }
public static boolean fixBouncingArrows;
private static void fixBouncingArrows()
{
mobAI = getBoolean( "settings.fix-bouncing-arrows", true );
}
public static boolean obfuscatePlayerHealth; public static boolean obfuscatePlayerHealth;
private static void obfuscatePlayerHealth() private static void obfuscatePlayerHealth()
{ {

View File

@ -19,6 +19,7 @@ import com.google.common.base.Function;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.util.CraftPotionUtil; import org.bukkit.craftbukkit.util.CraftPotionUtil;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
@ -775,7 +776,23 @@ public abstract class EntityLiving extends Entity {
this.aB = 1.5F; this.aB = 1.5F;
boolean flag = true; boolean flag = true;
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { // Beanes start
boolean isArrow = false;
if (eSpigotConfig.fixBouncingArrows && damagesource instanceof EntityDamageSourceIndirect) {
EntityDamageSourceIndirect indirectDamage = (EntityDamageSourceIndirect) damagesource;
Entity dmgSource = indirectDamage.getProximateDamageSource();
if (dmgSource.getBukkitEntity() instanceof Arrow) {
isArrow = true;
// If the player had the no damage ticks activated we set the arrow knockback to 0 to prevent it from giving double knockback
if (((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F)) {
Arrow arrow = (Arrow) dmgSource.getBukkitEntity();
arrow.setKnockbackStrength(0);
}
}
}
// Beanes end
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F || isArrow) {
if (f <= this.lastDamage) { if (f <= this.lastDamage) {
this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback
return false; return false;

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.config.eSpigotConfig;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@ -14,14 +15,18 @@ import org.apache.logging.log4j.Logger;
// CraftBukkit start // CraftBukkit start
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import com.elevatemc.spigot.knockback.KnockbackProfile; import com.elevatemc.spigot.knockback.KnockbackProfile;
import org.spigotmc.SpigotConfig;
// CraftBukkit end // CraftBukkit end
public class EntityPlayer extends EntityHuman implements ICrafting { public class EntityPlayer extends EntityHuman implements ICrafting {

View File

@ -636,10 +636,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
return; return;
case 3: // RELEASE_USE_ITEM case 3: // RELEASE_USE_ITEM
if (eSpigotConfig.fixSprintEatExploit) this.player.bU();
this.player.bU(); // eSpigot - Patch eat while running glitch
this.player.setSprinting(true);
return; return;
case 4: // START_DESTROY_BLOCK case 4: // START_DESTROY_BLOCK
@ -1317,6 +1314,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
case 3: case 3:
this.player.setSprinting(true); this.player.setSprinting(true);
if (eSpigotConfig.fixSprintEatExploit) this.player.bU();
break; break;
case 4: case 4: