Merge branches 'develop' and 'feature/report-v2' of github.com:Mineplex-LLC/Minecraft-PC into feature/report-v2
This commit is contained in:
commit
abea5bbf81
@ -71,7 +71,7 @@ public class YoutubeButton implements GuiItem
|
||||
message = "Click here to visit our YouTube page!";
|
||||
}
|
||||
|
||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0").sendToPlayer(_player);
|
||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,6 +44,7 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
private boolean _damageeBrute = false;
|
||||
private boolean _damageToLevel = true;
|
||||
private boolean _arrowShow = true;
|
||||
private boolean _projectileDamageSelf = false;
|
||||
|
||||
public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, Location knockbackOrigin,
|
||||
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String initialSource,
|
||||
@ -169,6 +170,27 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
return _projectile;
|
||||
}
|
||||
|
||||
public boolean getProjectileDamageSelf()
|
||||
{
|
||||
return _projectileDamageSelf;
|
||||
}
|
||||
|
||||
public void setProjectileDamageSelf(boolean projectileDamageSelf)
|
||||
{
|
||||
_projectileDamageSelf = projectileDamageSelf;
|
||||
if(!projectileDamageSelf)
|
||||
{
|
||||
_cancellers.remove("Self Projectile Damage");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!_cancellers.contains("Self Projectile Damage"))
|
||||
{
|
||||
_cancellers.add("Self Projectile Damage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setShowArrows(boolean show)
|
||||
{
|
||||
_arrowShow = show;
|
||||
|
@ -8,24 +8,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
|
||||
import net.minecraft.server.v1_8_R3.DamageSource;
|
||||
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -48,6 +30,24 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
|
||||
import net.minecraft.server.v1_8_R3.DamageSource;
|
||||
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
public class DamageManager extends MiniPlugin
|
||||
{
|
||||
private CombatManager _combatManager;
|
||||
@ -240,18 +240,33 @@ public class DamageManager extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void removeDemArrowsCrazyMan(EntityDamageEvent event)
|
||||
/**
|
||||
* Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void removeArrows(EntityDamageEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
Projectile projectile = GetProjectile(event);
|
||||
Projectile projectile = GetProjectile(event);
|
||||
|
||||
if (projectile instanceof Arrow)
|
||||
{
|
||||
projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0));
|
||||
projectile.remove();
|
||||
}
|
||||
if (projectile instanceof Arrow)
|
||||
{
|
||||
projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0));
|
||||
projectile.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void removeArrows(CustomDamageEvent event)
|
||||
{
|
||||
Projectile projectile = event.GetProjectile();
|
||||
|
||||
if (projectile instanceof Arrow)
|
||||
{
|
||||
projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0));
|
||||
projectile.remove();
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -318,6 +333,12 @@ public class DamageManager extends MiniPlugin
|
||||
event.SetCancelled("0 Health");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetProjectile() != null && event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) && !event.getProjectileDamageSelf())
|
||||
{
|
||||
event.SetCancelled("Self Projectile Damage");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
{
|
||||
@ -378,6 +399,10 @@ public class DamageManager extends MiniPlugin
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee != null)
|
||||
{
|
||||
if (event.GetDamage() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()) > 0)
|
||||
{
|
||||
event.AddMult("Ench Prot", damagee.getName(), getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()), false);
|
||||
@ -435,6 +460,8 @@ public class DamageManager extends MiniPlugin
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player != null)
|
||||
{
|
||||
if (player.equals(event.GetDamageeEntity()) && !event.getProjectileDamageSelf()) return;
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
@ -459,6 +486,11 @@ public class DamageManager extends MiniPlugin
|
||||
if (event.GetDamageeEntity().getHealth() <= 0)
|
||||
return;
|
||||
|
||||
if (event.GetProjectile() != null &&
|
||||
event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) &&
|
||||
!event.getProjectileDamageSelf())
|
||||
return;
|
||||
|
||||
//Player Conditions
|
||||
if (event.GetDamageePlayer() != null)
|
||||
{
|
||||
@ -513,14 +545,21 @@ public class DamageManager extends MiniPlugin
|
||||
origin = event.GetDamagerEntity(true).getLocation();
|
||||
if (event.getKnockbackOrigin() != null)
|
||||
origin = event.getKnockbackOrigin();
|
||||
else if (event.GetProjectile() != null)
|
||||
origin = event.GetProjectile().getLocation();
|
||||
|
||||
//Vec
|
||||
Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation());
|
||||
trajectory.multiply(0.6 * knockback);
|
||||
trajectory.setY(Math.abs(trajectory.getY()));
|
||||
|
||||
|
||||
//Special handling for projectiles
|
||||
if(event.GetProjectile() != null && event.getKnockbackOrigin() == null)
|
||||
{
|
||||
trajectory = event.GetProjectile().getVelocity();
|
||||
trajectory.setY(0);
|
||||
trajectory.multiply(0.6 * knockback / trajectory.length());
|
||||
trajectory.setY(0.5);
|
||||
}
|
||||
|
||||
//Apply
|
||||
double vel = 0.2 + trajectory.length() * 0.8;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user