Clans alpha bug fixes

This commit is contained in:
phobia 2016-02-05 10:12:18 +11:00
parent 5fd089c768
commit 6fd9cffb01
4 changed files with 20 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -40,6 +41,7 @@ import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Dye; import org.bukkit.material.Dye;
@ -271,9 +273,17 @@ public class Gameplay extends MiniPlugin
{ {
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place blocks this high.")); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place blocks this high."));
event.setCancelled(true); event.setCancelled(true);
} else if(event.getBlock().getLocation().getBlockY() == 99 && event.getBlock().getType().name().contains("DOOR") && !event.getBlock().getType().equals(Material.TRAP_DOOR)) {
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place blocks this high."));
event.setCancelled(true);
} }
} }
@EventHandler(priority = EventPriority.LOWEST)
public void GrowTree(StructureGrowEvent event) {
event.getBlocks().stream().filter(blockState -> blockState.getLocation().getBlockY() > 100).forEach(blockState -> blockState.setType(Material.AIR) );
}
/** /**
* Disable all Piston related events in Clans * Disable all Piston related events in Clans
* *
@ -459,6 +469,7 @@ public class Gameplay extends MiniPlugin
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void disableSaplings(BlockPlaceEvent event) public void disableSaplings(BlockPlaceEvent event)
{ {
if(event.isCancelled()) return; //Can't place this block
if (!event.getItemInHand().getType().equals(Material.SAPLING)) if (!event.getItemInHand().getType().equals(Material.SAPLING))
{ {
return; return;

View File

@ -30,7 +30,7 @@ public abstract class AttackAttribute extends ItemAttribute
@Override @Override
public void onAttack(CustomDamageEvent event) public void onAttack(CustomDamageEvent event)
{ {
if(event.GetCancellers().contains("Safe Zone")) return; if(event.IsCancelled() || event.isCancelled()) return;
_attackCount++; _attackCount++;
System.out.println("Attack count " + _attackCount + " - " + _attackLimit); System.out.println("Attack count " + _attackCount + " - " + _attackLimit);
if (_attackCount >= _attackLimit) if (_attackCount >= _attackLimit)

View File

@ -1,10 +1,13 @@
package mineplex.game.clans.items.attributes.weapon; package mineplex.game.clans.items.attributes.weapon;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.gui.page.ClanMainPage;
import mineplex.game.clans.items.attributes.AttackAttribute; import mineplex.game.clans.items.attributes.AttackAttribute;
import mineplex.game.clans.items.attributes.AttributeType; import mineplex.game.clans.items.attributes.AttributeType;
import mineplex.game.clans.items.generation.ValueDistribution; import mineplex.game.clans.items.generation.ValueDistribution;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public class FlamingAttribute extends AttackAttribute public class FlamingAttribute extends AttackAttribute
{ {
@ -34,6 +37,9 @@ public class FlamingAttribute extends AttackAttribute
@Override @Override
public void triggerAttack(Entity attacker, Entity defender) public void triggerAttack(Entity attacker, Entity defender)
{ {
if(attacker instanceof Player && ClansManager.getInstance().isSafe((Player) attacker)) return;
if(defender instanceof Player && ClansManager.getInstance().isSafe((Player) defender)) return;
defender.setFireTicks(_fireDuration); defender.setFireTicks(_fireDuration);
} }

View File

@ -15,8 +15,7 @@ public class GiantsBroadsword extends LegendaryItem
{ {
public static final int SLOW_AMPLIFIER = 43; public static final int SLOW_AMPLIFIER = 43;
public static final int REGEN_AMPLIFIER = 4; public static final int REGEN_AMPLIFIER = 4;
public static final int EFFECT_DURATION = 20; // Duration of potion effect public static final int EFFECT_DURATION = 20; // Duration of potion effect (in ticks)
// (in ticks)
public GiantsBroadsword() public GiantsBroadsword()
{ {
@ -63,6 +62,6 @@ public class GiantsBroadsword extends LegendaryItem
private void buffPlayer(Player player) private void buffPlayer(Player player)
{ {
grantPotionEffect(player, PotionEffectType.SLOW, EFFECT_DURATION, SLOW_AMPLIFIER); grantPotionEffect(player, PotionEffectType.SLOW, EFFECT_DURATION, SLOW_AMPLIFIER);
grantPotionEffect(player, PotionEffectType.REGENERATION, 2, REGEN_AMPLIFIER); //Regen grantPotionEffect(player, PotionEffectType.REGENERATION, EFFECT_DURATION, REGEN_AMPLIFIER); //Regen
} }
} }