cannon 1.9 fixes

This commit is contained in:
Ben 2016-04-03 17:23:55 +01:00
parent f4d4b5c5df
commit ccdd1f901f
3 changed files with 38 additions and 12 deletions

View File

@ -7,6 +7,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.CustomTagFix;
import mineplex.core.FoodDupeFix;
import mineplex.core.PacketsInteractionFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
@ -119,6 +120,8 @@ public class Clans extends JavaPlugin
new IncognitoManager(this, _clientManager, packetHandler);
new PacketsInteractionFix(this, packetHandler);
StatsManager statsManager = new StatsManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());

View File

@ -14,6 +14,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -161,15 +162,15 @@ public abstract class SiegeWeapon implements Listener
_infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth());
_infoHologram.start();
_infoHologram.setInteraction((player, type) -> {
if (player.equals(_rider))
{
if (type.equals(ClickType.LEFT))
{
handleLeftClick(player);
}
}
});
// _infoHologram.setInteraction((player, type) -> {
// if (player.equals(_rider))
// {
// if (type.equals(ClickType.LEFT))
// {
// handleLeftClick(player);
// }
// }
// });
UtilServer.RegisterEvents(this);
@ -502,7 +503,7 @@ public abstract class SiegeWeapon implements Listener
return;
}
if (Recharge.Instance.use(player, "Damage Cannon", 200, false, false))
if (!player.equals(_rider) && Recharge.Instance.use(player, "Damage Cannon", 200, false, false))
{
int health = calculateDamage(player);
@ -713,7 +714,14 @@ public abstract class SiegeWeapon implements Listener
public void onDmg(EntityDamageByEntityEvent event)
{
if (_comprisedOf.contains(event.getEntity()) && event.getDamager() instanceof Player)
handleLeftClick((Player) event.getDamager());
{
if (!((Player) event.getDamager()).equals(_rider))
{
handleLeftClick((Player) event.getDamager());
}
event.setCancelled(true);
}
}
@EventHandler
@ -748,11 +756,24 @@ public abstract class SiegeWeapon implements Listener
@EventHandler
public void onInteract(PlayerInteractEvent event)
{
if (event.getPlayer().equals(_rider))
if (!event.getPlayer().equals(_rider))
{
System.out.println("NOT RIDER");
return;
}
System.out.println(event.getAction());
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
handleRightClick(event.getPlayer());
event.setCancelled(true);
}
else if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
{
handleLeftClick(event.getPlayer());
event.setCancelled(true);
}
}
@EventHandler

View File

@ -135,6 +135,8 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
{
Arrow arrow = shooter.shootArrow();
arrow.setVelocity(UtilAlg.getTrajectory(arrow.getLocation(), player.getLocation()));
Recharge.Instance.use(player, "ShotBy" + shooter.getUniqueId().toString(), 500 + UtilMath.r(2000), false, false);
}
});