diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java index 64637f164..6f965128d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java @@ -49,6 +49,7 @@ public class MurderManager extends MiniClientPlugin if (event.GetEvent().getEntity() instanceof Player) { Player deadPlayer = ((Player) event.GetEvent().getEntity()); + refreshWeaklingStatus(deadPlayer); Location location = deadPlayer.getLocation(); CombatComponent combatKiller = event.GetLog().GetKiller(); @@ -136,22 +137,9 @@ public class MurderManager extends MiniClientPlugin private boolean canMurderOccur(Player killer, Player dead, Location location) { - ClanInfo killerClan = _clansManager.getClan(killer); - ClanInfo deadClan = _clansManager.getClan(dead); ClanTerritory territory = _clansManager.getClanUtility().getClaim(location); - if (territory != null) - { - // Check Borderlands, Fields - if (territory.Owner.equalsIgnoreCase("Borderlands") || territory.Owner.equalsIgnoreCase("Fields")) - return false; - - // Check killer/dead territory - if ((killerClan != null && territory.Owner.equals(killerClan.getName())) || (deadClan != null && territory.Owner.equals(deadClan.getName()))) - return false; - } - - return true; + return (territory == null); // Murder can only occur in unclaimed land } private void refreshWeaklingStatus(Player player) @@ -161,8 +149,11 @@ public class MurderManager extends MiniClientPlugin int inventorySize = player.getInventory().getSize() + 4; // Add 4 for armor contents for (int i = 0; i < inventorySize && weakling; i++) { - if (contains(weapons, player.getInventory().getItem(i)) || contains(armour, player.getInventory().getItem(i))) + ItemStack item = player.getInventory().getItem(i); + if (contains(weapons, item) || contains(armour, item)) + { weakling = false; + } } Get(player).setStatus(weakling); @@ -179,6 +170,7 @@ public class MurderManager extends MiniClientPlugin if (materials[i].equals(mat)) return true; } + return false; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java index 981b1d3a3..7b4dcd4ff 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java @@ -6,6 +6,9 @@ import java.util.HashSet; import mineplex.core.MiniPlugin; import mineplex.minecraft.game.classcombat.Class.ClientClass; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.event.BlockTossEvent; +import mineplex.minecraft.game.classcombat.event.BlockTossExpireEvent; +import mineplex.minecraft.game.classcombat.event.BlockTossLandEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.core.itemstack.ItemStackFactory; @@ -27,6 +30,7 @@ import mineplex.game.clans.items.generation.WeightSet; import org.bukkit.ChatColor; import org.bukkit.Effect; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Biome; @@ -74,7 +78,16 @@ public class Gameplay extends MiniPlugin _foodDecrease = new WeightSet(new Weight(10, true), new Weight(90, false)); } - + @EventHandler + public void onBlockToss(BlockTossEvent event) + { + Location location = event.getLocation(); + if (_clansManager.getClanUtility().isClaimed(location)) + { + event.setCancelled(true); + } + } + @EventHandler public void onBowShoot(EntityShootBowEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/armor/LavaAttribute.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/armor/LavaAttribute.java index a9b01ae2c..383ffee75 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/armor/LavaAttribute.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/armor/LavaAttribute.java @@ -25,6 +25,6 @@ public class LavaAttribute extends PercentReductionAttribute @Override public String getDescription() { - return String.format("Reduces damage from fire and lava by %.1f%.", getReductionPercent() * 100d); + return String.format("Reduces damage from fire and lava by %.1f%%.", getReductionPercent() * 100d); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java index e69521ea8..4e787233c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java @@ -29,7 +29,7 @@ public class HeavyArrowsAttribute extends ItemAttribute @Override public String getDescription() { - return String.format("Increase knockback by %.2f%", _knockbackPercent); + return String.format("Increase knockback by %.2f%%.", _knockbackPercent); } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/weapon/HeavyAttribute.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/weapon/HeavyAttribute.java index 0f85c87dd..22411c538 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/weapon/HeavyAttribute.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/weapon/HeavyAttribute.java @@ -27,7 +27,7 @@ public class HeavyAttribute extends ItemAttribute @Override public String getDescription() { - return String.format("%.1f% additional knockback.", _knockbackBoost); + return String.format("%.1f%% additional knockback.", _knockbackBoost); } @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java index 404612ec7..faa191cd7 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java @@ -59,22 +59,4 @@ public class ClansServerShop extends ShopBase { getPlugin().getHubManager().GetVisibility().removeHiddenPlayer(player); } - - // TODO: REMOVE THIS, JUST FOR DEBUGGING - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) - { - System.out.println("CALLED"); - if (event.getPlayer().getName().equalsIgnoreCase("Elinoo") - || event.getPlayer().getName().equalsIgnoreCase("MrTwiggy") - || event.getPlayer().getName().equalsIgnoreCase("GetGrimyWits")) - { - System.out.println("CALLED2"); - if (event.getPlayer().isSneaking() && event.getAction() == Action.RIGHT_CLICK_AIR) - { - System.out.println("CALLED3"); - this.attemptShopOpen(event.getPlayer()); - } - } - } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index 965fce9e4..8dfc1592d 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -14,6 +14,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -38,6 +39,8 @@ import mineplex.minecraft.game.classcombat.Skill.SkillCharge; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; +import mineplex.minecraft.game.classcombat.event.BlockTossExpireEvent; +import mineplex.minecraft.game.classcombat.event.BlockTossLandEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class BlockToss extends SkillCharge implements IThrown @@ -305,24 +308,51 @@ public class BlockToss extends SkillCharge implements IThrown if (block.getType() != fall.getMaterial()) continue; - block.setTypeIdAndData(0, (byte)0, false); + // Call and trigger block expiry event + BlockTossExpireEvent expireEvent = new BlockTossExpireEvent(block); + Bukkit.getServer().getPluginManager().callEvent(expireEvent); - //Block Replace - Factory.BlockRestore().add(block, fall.getBlockId(), (byte) 0, 10000); + if (!expireEvent.isCancelled()) + { + block.setTypeIdAndData(0, (byte)0, false); + + //Block Replace + Factory.BlockRestore().add(block, fall.getBlockId(), (byte) 0, 10000); - //Effect - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + } + } + } + + @EventHandler + public void onBlockLand(EntityChangeBlockEvent event) + { + if (event.getEntity() instanceof FallingBlock) + { + if (event.getBlock().getType() == Material.AIR) // Falling block is landing and turning block from air to type + { + BlockTossLandEvent landEvent = new BlockTossLandEvent(event.getBlock()); + Bukkit.getServer().getPluginManager().callEvent(landEvent); + + if (landEvent.isCancelled()) + { + event.setCancelled(true); + } + } } } @EventHandler public void ItemSpawn(ItemSpawnEvent event) { - int id = event.getEntity().getItemStack().getTypeId(); - for (FallingBlock block : _falling.keySet()) + { if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1) + { event.setCancelled(true); + } + } } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossEvent.java new file mode 100644 index 000000000..340cdb5a9 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossEvent.java @@ -0,0 +1,27 @@ +package mineplex.minecraft.game.classcombat.event; + +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class BlockTossEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + public static HandlerList getHandlerList() { return handlers; } + public HandlerList getHandlers() { return handlers; } + + private boolean _cancelled; + public boolean isCancelled() { return _cancelled; } + public void setCancelled(boolean cancelled) { _cancelled = cancelled; } + + private Block _block; + public Block getBlock() { return _block; } + public Location getLocation() { return _block.getLocation(); } + + public BlockTossEvent(Block block) + { + _block = block; + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossExpireEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossExpireEvent.java new file mode 100644 index 000000000..a3514cdb0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossExpireEvent.java @@ -0,0 +1,12 @@ +package mineplex.minecraft.game.classcombat.event; + +import org.bukkit.Location; +import org.bukkit.block.Block; + +public class BlockTossExpireEvent extends BlockTossEvent +{ + public BlockTossExpireEvent(Block block) + { + super(block); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossLandEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossLandEvent.java new file mode 100644 index 000000000..9b6ac631e --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/BlockTossLandEvent.java @@ -0,0 +1,17 @@ +package mineplex.minecraft.game.classcombat.event; + +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.FallingBlock; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class BlockTossLandEvent extends BlockTossEvent +{ + + public BlockTossLandEvent(Block block) + { + super(block); + } +}