Merge remote-tracking branch 'origin/clans-beta' into clans-beta
This commit is contained in:
commit
1b6833ae16
@ -49,6 +49,7 @@ public class MurderManager extends MiniClientPlugin<WeaklingStatus>
|
||||
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<WeaklingStatus>
|
||||
|
||||
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<WeaklingStatus>
|
||||
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<WeaklingStatus>
|
||||
if (materials[i].equals(mat))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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<Boolean>(new Weight<Boolean>(10, true), new Weight<Boolean>(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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -59,22 +59,4 @@ public class ClansServerShop extends ShopBase<ServerManager>
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user