Merge branch 'clans-beta' of http://184.154.0.242:7990/scm/min/mineplex into clans_custom_gear
Conflicts: Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java Additionally: Disable Endermen and Horses from spawning on the server. Fix bug where players could shoot others from within spawn and throw cobwebs from inside spawn. Fix bug where players could use the Travel Hub while combat tagged. Fix bug where Water flowed into Spawn areas. Fix bug where players could abuse BlockToss to pick up water blocks and throw them inside restricted liquid areas. Fix bug where Fissure created cracked StoneBricks which could be exploited for base raiding. Re-organize some Spawn/Safe Zone related logic into a more intuitive location (Spawn class) and add more descriptive documentation to event handlers in Spawn.
This commit is contained in:
commit
9be0ecc598
@ -30,6 +30,21 @@ public class ProjectileManager extends MiniPlugin
|
||||
super("Throw", plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param thrown - the thrown {@link Entity} whose thrower is to be fetched
|
||||
* @return the {@link LivingEntity} that threw the {@code thrown} entity, if one
|
||||
* can be found, null otherwise.
|
||||
*/
|
||||
public LivingEntity getThrower(Entity thrown)
|
||||
{
|
||||
if (_thrown.containsKey(thrown))
|
||||
{
|
||||
return _thrown.get(thrown).GetThrower();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow)
|
||||
{
|
||||
|
@ -80,17 +80,6 @@ public class ClansGame extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void SkillTrigger(SkillTriggerEvent event)
|
||||
{
|
||||
if (!Clans.getClanUtility().isSafe(event.GetPlayer()))
|
||||
return;
|
||||
|
||||
UtilPlayer.message(event.GetPlayer(), F.main("Safe Zone", "You cannot use " + F.skill(event.GetSkillName() + " in " + F.elem("Safe Zone") + ".")));
|
||||
|
||||
event.SetCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void openClanShop(PlayerInteractEvent event)
|
||||
{
|
||||
|
@ -68,6 +68,7 @@ import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler;
|
||||
import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
|
||||
import mineplex.game.clans.clans.regions.ClansRegions;
|
||||
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
|
||||
import mineplex.game.clans.clans.supplyDrop.SupplyDropManager;
|
||||
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
|
||||
import mineplex.game.clans.clans.war.WarManager;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
@ -195,6 +196,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
_clanUtility = new ClansUtility(this);
|
||||
_itemMapManager = new ItemMapManager(this, _worldEvent);
|
||||
new TntGeneratorManager(plugin, this);
|
||||
new SupplyDropManager(plugin, this);
|
||||
|
||||
_explosion = new Explosion(plugin, blockRestore);
|
||||
|
||||
@ -777,11 +779,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
public void onJoin(PlayerLoginEvent event)
|
||||
{
|
||||
Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
|
||||
if (!rank.Has(Rank.MAPDEV) && !event.getPlayer().isWhitelisted())
|
||||
if (!rank.Has(Rank.MEDIA) && !event.getPlayer().isWhitelisted())
|
||||
{
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
// event.setKickMessage("This server is whitelisted!");
|
||||
event.setKickMessage("Only MapDev+ can join this server");
|
||||
event.setKickMessage("Only Media+ can join this server!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
public class MurderManager extends MiniClientPlugin<WeaklingStatus>
|
||||
{
|
||||
private final Material[] weapons = { Material.WOOD_SWORD, Material.STONE_SWORD, Material.IRON_SWORD, Material.DIAMOND_SWORD,
|
||||
Material.WOOD_AXE, Material.STONE_AXE, Material.IRON_AXE, Material.DIAMOND_AXE };
|
||||
Material.WOOD_AXE, Material.STONE_AXE, Material.IRON_AXE, Material.DIAMOND_AXE, Material.BOW };
|
||||
|
||||
private final Material[] armour = { Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS,
|
||||
Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS,
|
||||
Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS,
|
||||
@ -59,6 +60,8 @@ public class MurderManager extends MiniClientPlugin<WeaklingStatus>
|
||||
Player killer = UtilPlayer.searchExact(combatKiller.GetName());
|
||||
if (killer != null)
|
||||
{
|
||||
refreshWeaklingStatus(deadPlayer);
|
||||
refreshWeaklingStatus(killer);
|
||||
if (canMurderOccur(killer, deadPlayer, location) && isWeakling(deadPlayer) && !isWeakling(killer))
|
||||
{
|
||||
// Was a murder
|
||||
|
@ -32,7 +32,7 @@ import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansDataAccessLayer;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.minecraft.game.classcombat.event.SkillTeleportEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTeleportEvent;
|
||||
|
||||
public class ClansRegions extends MiniPlugin
|
||||
{
|
||||
|
@ -0,0 +1,93 @@
|
||||
package mineplex.game.clans.clans.supplyDrop;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.minecraft.server.v1_7_R4.TileEntity;
|
||||
import net.minecraft.server.v1_7_R4.TileEntityBeacon;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
|
||||
public class SupplyDrop
|
||||
{
|
||||
private static int DROP_TICKS = 20 * 50;
|
||||
|
||||
private Block _block;
|
||||
private Player _owner;
|
||||
private int _ticks;
|
||||
private boolean _running;
|
||||
|
||||
public SupplyDrop(Player owner, Block block)
|
||||
{
|
||||
_owner = owner;
|
||||
_block = block;
|
||||
_ticks = 0;
|
||||
_running = true;
|
||||
}
|
||||
|
||||
public void tick()
|
||||
{
|
||||
if (getTicks() == 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
TileEntity tileEntity = ((CraftWorld) _block.getWorld()).getHandle().getTileEntity(_block.getX(), _block.getY(), _block.getZ());
|
||||
Field k = TileEntityBeacon.class.getDeclaredField("k");
|
||||
k.setAccessible(true);
|
||||
|
||||
Field l = TileEntityBeacon.class.getDeclaredField("l");
|
||||
l.setAccessible(true);
|
||||
|
||||
if (tileEntity instanceof TileEntityBeacon)
|
||||
{
|
||||
k.set(tileEntity, true);
|
||||
l.set(tileEntity, 3);
|
||||
tileEntity.update();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (getTicks() > 15 && getTicks() % 10 == 0)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BURST).withColor(Color.AQUA, Color.WHITE, Color.GRAY).withFade(Color.BLACK).withFlicker().build();
|
||||
UtilFirework.playFirework(_block.getLocation().add(0.5, 0.5, 0.5), effect);
|
||||
}
|
||||
|
||||
if (getTicks() >= DROP_TICKS)
|
||||
{
|
||||
// Drop supply drop
|
||||
_running = false;
|
||||
}
|
||||
|
||||
_ticks++;
|
||||
}
|
||||
|
||||
public boolean isRunning()
|
||||
{
|
||||
return _running;
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return _block;
|
||||
}
|
||||
|
||||
public Player getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public int getTicks()
|
||||
{
|
||||
return _ticks;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
package mineplex.game.clans.clans.supplyDrop;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
|
||||
public class SupplyDropManager extends MiniPlugin
|
||||
{
|
||||
public static Material SUPPLY_DROP_MATERIAL = Material.BEACON;
|
||||
|
||||
private ClansManager _clansManager;
|
||||
private List<SupplyDrop> _supplyDrops;
|
||||
|
||||
public SupplyDropManager(JavaPlugin plugin, ClansManager clansManager)
|
||||
{
|
||||
super("Supply Drops", plugin);
|
||||
|
||||
_clansManager = clansManager;
|
||||
_supplyDrops = new LinkedList<SupplyDrop>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void placeSupplyDrop(BlockPlaceEvent event)
|
||||
{
|
||||
ItemStack item = event.getItemInHand();
|
||||
|
||||
if (isSupplyDropItem(item))
|
||||
{
|
||||
ClanTerritory claim = _clansManager.getClanUtility().getClaim(event.getBlock().getLocation());
|
||||
if (claim != null)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can only place " + F.elem("Supply Drop") + " in the Wilderness"));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
event.getPlayer().setItemInHand(null);
|
||||
placeSupplyDrop(event.getPlayer(), event.getBlock());
|
||||
|
||||
Bukkit.broadcastMessage(F.main("Clans", F.name(event.getPlayer().getName()) + " placed a supply drop at " + F.elem(UtilWorld.blockToStrClean(event.getBlock()))));
|
||||
}
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void debug(PlayerCommandPreprocessEvent event)
|
||||
// {
|
||||
// if (event.getMessage().equalsIgnoreCase("/supplydrop"))
|
||||
// {
|
||||
// UtilPlayer.message(event.getPlayer(), F.main("Clans", "You received a " + F.elem("Supply Drop")));
|
||||
// giveSupplyDropItem(event.getPlayer());
|
||||
// }
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<SupplyDrop> iterator = _supplyDrops.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
SupplyDrop supplyDrop = iterator.next();
|
||||
|
||||
if (supplyDrop.isRunning())
|
||||
{
|
||||
supplyDrop.tick();
|
||||
}
|
||||
else
|
||||
{
|
||||
supplyDrop.getBlock().setType(Material.AIR);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cancelInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if (event.getClickedBlock() != null && event.getClickedBlock().getType() == SUPPLY_DROP_MATERIAL)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cancelBreak(BlockBreakEvent event)
|
||||
{
|
||||
for (SupplyDrop supplyDrop : _supplyDrops)
|
||||
{
|
||||
if (supplyDrop.getBlock().equals(event.getBlock()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void placeSupplyDrop(Player player, Block block)
|
||||
{
|
||||
SupplyDrop supplyDrop = new SupplyDrop(player, block);
|
||||
_supplyDrops.add(supplyDrop);
|
||||
|
||||
block.setType(SUPPLY_DROP_MATERIAL);
|
||||
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
Block b = block.getRelative(x, -1, z);
|
||||
_clansManager.getBlockRestore().add(b, Material.DIAMOND_BLOCK.getId(), (byte) 0, 60000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void giveSupplyDropItem(Player player)
|
||||
{
|
||||
ItemStack item = ItemStackFactory.Instance.CreateStack(Material.BEACON, (byte) 0, 1, C.cGold + "Supply Drop");
|
||||
player.getInventory().addItem(item);
|
||||
}
|
||||
|
||||
private boolean isSupplyDropItem(ItemStack item)
|
||||
{
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
return item.getType() == SUPPLY_DROP_MATERIAL;
|
||||
|
||||
// if (item.getType() == SUPPLY_DROP_MATERIAL)
|
||||
// {
|
||||
// CustomItem customItem = GearManager.parseItem(item);
|
||||
// if (customItem != null && customItem instanceof SupplyDropItem)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
}
|
||||
}
|
@ -16,7 +16,8 @@ import org.bukkit.inventory.Recipe;
|
||||
public class CustomCreatures implements Listener
|
||||
{
|
||||
|
||||
private static final EntityType[] DISABLED_CREATURES = { EntityType.WITCH, EntityType.PIG_ZOMBIE };
|
||||
private static final EntityType[] DISABLED_CREATURES = { EntityType.WITCH, EntityType.PIG_ZOMBIE,
|
||||
EntityType.HORSE, EntityType.ENDERMAN };
|
||||
|
||||
@EventHandler
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||
|
@ -6,10 +6,10 @@ 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.classcombat.event.SkillTeleportEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTeleportEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -16,6 +17,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
@ -41,7 +43,8 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.items.generation.WeightSet;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
import mineplex.minecraft.game.classcombat.event.WebTossEvent;
|
||||
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
|
||||
import mineplex.minecraft.game.classcombat.item.event.WebTossEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
@ -82,6 +85,25 @@ public class Spawn extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent liquids from flowing into Safe Zone areas.
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onWaterFlow(BlockFromToEvent event)
|
||||
{
|
||||
Block block = event.getToBlock();
|
||||
|
||||
if (block.isLiquid() && isInSpawn(block.getLocation()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent players from tossing Webs into spawn or from spawn.
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onWebToss(WebTossEvent event)
|
||||
{
|
||||
@ -89,8 +111,22 @@ public class Spawn extends MiniPlugin
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (event.getThrower() instanceof Player)
|
||||
{
|
||||
Player thrower = (Player) event.getThrower();
|
||||
|
||||
if (isInSpawn(thrower))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
attemptNotify(thrower, "You cannot throw webs while in a safe zone!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent Spawn blocks from burning
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onBlockBurn(BlockBurnEvent event)
|
||||
{
|
||||
@ -151,6 +187,10 @@ public class Spawn extends MiniPlugin
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.CRIT, player.getEyeLocation().add(0, 0.75d, 0), 0, 0, 0, 0.2f, 35, UtilParticle.ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent players from targetting spawn protected players using skills
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onSkillTriggered(SkillTriggerEvent event)
|
||||
{
|
||||
@ -165,12 +205,36 @@ public class Spawn extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent players from activating skills while in Spawn
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onSkillTriggeredInSpawn(SkillTriggerEvent event)
|
||||
{
|
||||
Player player = event.GetPlayer();
|
||||
|
||||
if (isInSpawn(player))
|
||||
{
|
||||
UtilPlayer.message(event.GetPlayer(), F.main("Safe Zone", "You cannot use " + F.skill(event.GetSkillName() + " in " + F.elem("Safe Zone") + ".")));
|
||||
event.SetCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure players respawn in Spawn locations.
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerRespawnEvent event)
|
||||
{
|
||||
event.setRespawnLocation(getSpawnLocation());
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure player spawns into a Spawn location if it's their first time on the server.
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPlayerFirstJoin(PlayerJoinEvent event)
|
||||
{
|
||||
@ -180,6 +244,10 @@ public class Spawn extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent creatures from spawning inside Spawn
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onEntitySpawn(CreatureSpawnEvent event)
|
||||
{
|
||||
@ -231,6 +299,10 @@ public class Spawn extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent creatures from targetting players who are in Spawn
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onEntityTarget(EntityTargetEvent event)
|
||||
{
|
||||
@ -240,6 +312,10 @@ public class Spawn extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent players from breaking blocks in spawn
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
@ -251,19 +327,27 @@ public class Spawn extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent players from atacking others while in spawn
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPlayerAttacked(CustomDamageEvent event)
|
||||
public void onPlayerAttack(CustomDamageEvent event)
|
||||
{
|
||||
Player defender = event.GetDamageePlayer();
|
||||
Player attacker = event.GetDamagerPlayer(true); // Get (potentially ranged) attacker
|
||||
|
||||
if (defender != null)
|
||||
if (defender != null && !isCombatTagged(defender))
|
||||
{
|
||||
Player player = (Player) defender;
|
||||
|
||||
if (isInSpawn(player) && !isCombatTagged(player))
|
||||
if (isInSpawn(defender))
|
||||
{
|
||||
event.SetCancelled("Safe Zone");
|
||||
attemptNotify(event.GetDamagerPlayer(true), "You cannot attack players who are in spawn!");
|
||||
attemptNotify(attacker, "You cannot attack players who are in spawn!");
|
||||
}
|
||||
else if (isInSpawn(attacker))
|
||||
{
|
||||
event.SetCancelled("Safe Zone");
|
||||
attemptNotify(attacker, "You cannot attack untagged players while in spawn!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -328,7 +412,7 @@ public class Spawn extends MiniPlugin
|
||||
return new Location(getSpawnWorld(), 8, 111, 200);
|
||||
}
|
||||
|
||||
private boolean isCombatTagged(Player player)
|
||||
public boolean isCombatTagged(Player player)
|
||||
{
|
||||
return _clansManager.getCondition().HasCondition(player, ConditionType.CUSTOM, COMBAT_TAG_NAME);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
|
||||
public class TravelShop extends ShopBase<ClansManager>
|
||||
{
|
||||
@ -24,4 +25,21 @@ public class TravelShop extends ShopBase<ClansManager>
|
||||
{
|
||||
return new TravelPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attemptShopOpen(Player player)
|
||||
{
|
||||
if (Spawn.getInstance().isCombatTagged(player))
|
||||
{
|
||||
notify(player, "You cannot use the Travel Hub while combat tagged!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.attemptShopOpen(player);
|
||||
}
|
||||
|
||||
private static void notify(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Travel Hub", message));
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.event.SkillTeleportEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTeleportEvent;
|
||||
|
||||
public class Blink extends SkillActive
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.event.SkillTeleportEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTeleportEvent;
|
||||
|
||||
public class Flash extends SkillActive
|
||||
{
|
||||
|
@ -37,10 +37,10 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent;
|
||||
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
|
||||
@ -59,7 +59,9 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
Material.CHEST,
|
||||
Material.FURNACE,
|
||||
Material.BURNING_FURNACE,
|
||||
Material.WORKBENCH
|
||||
Material.WORKBENCH,
|
||||
Material.WATER,
|
||||
Material.LAVA
|
||||
};
|
||||
|
||||
public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||
|
@ -129,7 +129,7 @@ public class FissureData
|
||||
//Boost Column
|
||||
if (block.getTypeId() == 1) Host.Factory.BlockRestore().add(block, 4, block.getData(), 14000);
|
||||
if (block.getTypeId() == 2) Host.Factory.BlockRestore().add(block, 3, block.getData(), 14000);
|
||||
if (block.getTypeId() == 98) Host.Factory.BlockRestore().add(block, 98, (byte) 2, 14000);
|
||||
if (block.getTypeId() == 98) Host.Factory.BlockRestore().add(block, 98, (byte) 0, 14000);
|
||||
|
||||
Host.Factory.BlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height));
|
||||
_height++;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.minecraft.game.classcombat.event;
|
||||
package mineplex.minecraft.game.classcombat.Skill.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.minecraft.game.classcombat.event;
|
||||
package mineplex.minecraft.game.classcombat.Skill.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.minecraft.game.classcombat.event;
|
||||
package mineplex.minecraft.game.classcombat.Skill.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.minecraft.game.classcombat.event;
|
||||
package mineplex.minecraft.game.classcombat.Skill.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
@ -7,6 +7,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -14,9 +15,9 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.minecraft.game.classcombat.event.WebTossEvent;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemUsable;
|
||||
import mineplex.minecraft.game.classcombat.item.event.WebTossEvent;
|
||||
|
||||
public class Web extends ItemUsable
|
||||
{
|
||||
@ -71,19 +72,21 @@ public class Web extends ItemUsable
|
||||
|
||||
public void CreateWeb(Entity ent)
|
||||
{
|
||||
LivingEntity thrower = Factory.Throw().getThrower(ent);
|
||||
|
||||
//Effect
|
||||
ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, 30);
|
||||
ent.remove();
|
||||
|
||||
if (canWeb(ent.getLocation()))
|
||||
if (canWeb(thrower, ent.getLocation()))
|
||||
{
|
||||
Factory.BlockRestore().add(ent.getLocation().getBlock(), 30, (byte) 0, 6000);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canWeb(Location location)
|
||||
private boolean canWeb(LivingEntity thrower, Location location)
|
||||
{
|
||||
WebTossEvent webEvent = new WebTossEvent(location);
|
||||
WebTossEvent webEvent = new WebTossEvent(thrower, location);
|
||||
Bukkit.getPluginManager().callEvent(webEvent);
|
||||
|
||||
return !webEvent.isCancelled() && UtilBlock.airFoliage(location.getBlock());
|
||||
|
@ -1,7 +1,9 @@
|
||||
package mineplex.minecraft.game.classcombat.event;
|
||||
package mineplex.minecraft.game.classcombat.item.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -19,8 +21,12 @@ public class WebTossEvent extends Event implements Cancellable
|
||||
private Location _location;
|
||||
public Location getLocation() { return _location; }
|
||||
|
||||
public WebTossEvent(Location location)
|
||||
private LivingEntity _thrower;
|
||||
public LivingEntity getThrower() { return _thrower; }
|
||||
|
||||
public WebTossEvent(LivingEntity thrower, Location location)
|
||||
{
|
||||
_location = location;
|
||||
_thrower = thrower;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user