all siege items shouldn't be able to be placed or used while on PvP timer.

Fixes to Jagged prefix
This commit is contained in:
phobia 2016-03-09 22:46:45 +11:00
parent 5b3da3d06f
commit e3fb40805c
8 changed files with 103 additions and 32 deletions

View File

@ -190,7 +190,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
private WarPointEvasion _warPointEvasion;
private ObserverManager _observerManager;
private Punish _punish;
private PvpTimer _pvpTimer;
private int _inviteExpire = 2;
private int _nameMin = 3;
private int _nameMax = 10;
@ -317,7 +318,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
new ClanEnergyManager(plugin, this, clientManager, donationManager);
_playTracker = new Playtime(this, statsManager);
new PvpTimer(this, _playTracker, statsManager);
_pvpTimer = new PvpTimer(this, _playTracker, statsManager);
_tutorialManager = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler);
TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager);
@ -1221,4 +1222,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{
return _damageManager;
}
public PvpTimer getPvpTimer() { return _pvpTimer; }
}

View File

@ -274,7 +274,7 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
return (TIMER_LENGTH <= time ? 0 : TIMER_LENGTH - time);
}
private boolean hasTimer(Player victim)
public boolean hasTimer(Player victim)
{
return victim != null && getPvPTimerLeft(victim) > 0 && !Get(victim).Skipped;
}

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.clans.siege;
import java.util.Stack;
import mineplex.game.clans.clans.pvptimer.PvpTimer;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -182,6 +183,11 @@ public class SiegeManager extends MiniPlugin
UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place a Cannon."));
return false;
}
if(_clansManager.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot place a cannon whilst on PvPTimer"));
return false;
}
ClanTerritory claim = _clansManager.getClanUtility().getClaim(location);
@ -217,6 +223,11 @@ public class SiegeManager extends MiniPlugin
UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place a Catapult."));
return false;
}
if(_clansManager.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot place a catapult whilst on PvPTimer"));
return false;
}
ClanTerritory claim = _clansManager.getClanUtility().getClaim(location);

View File

@ -303,6 +303,12 @@ public class Outpost implements Listener
if (getLifetime() <= 2000)
return;
if(_outpostManager.getClansManager().getPvpTimer().hasTimer(event.getPlayer())) {
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot activate an outpost whilst on PvPTimer"));
return;
}
if (!_ownerClan.equals(_ownerClan.Clans.getClanUtility().getClanByPlayer(event.getPlayer())))
{
@ -325,6 +331,12 @@ public class Outpost implements Listener
{
if (event.getBlock().getLocation().equals(_core) && getState() == OutpostState.LIVE)
{
if(_outpostManager.getClansManager().getPvpTimer().hasTimer(event.getPlayer())) {
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot destroy an outpost whilst on PvPTimer"));
event.setCancelled(true);
return;
}
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have destroyed " + F.elem(_ownerClan.getName()) + "'s Outpost!"));
_core.getBlock().setType(Material.AIR);

View File

@ -84,13 +84,20 @@ public class OutpostManager extends MiniPlugin
UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place an Outpost."));
return false;
}
if(_clansManager.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot create an outpost whilst on PvPTimer"));
return false;
}
if (location.getBlockY() < 30)
{
UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost this deep."));
return false;
}
ClanInfo clan = _clansManager.getClan(player);
if (UtilItem.isBoundless(location.clone().subtract(0, 1, 0).getBlock().getType()))

View File

@ -73,6 +73,11 @@ public class Cannon extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "This cannon is not owned by your Clan."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot fire a cannon whilst on PvPTimer"));
return false;
}
if (!canBeFired())
{
@ -103,6 +108,11 @@ public class Cannon extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "Someone is already riding this cannon."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot sit in a cannon whilst on PvPTimer"));
return false;
}
return !player.equals(getRider());
}));
@ -143,6 +153,11 @@ public class Cannon extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "This cannon is not owned by your Clan."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot fire a cannon whilst on PvPTimer"));
return false;
}
if (!canBeFired())
{
@ -173,6 +188,11 @@ public class Cannon extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "Someone is already riding this cannon."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot sit in a cannon whilst on PvPTimer"));
return false;
}
return !player.equals(getRider());
}));

View File

@ -78,7 +78,12 @@ public class Catapult extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "This Catapult is not owned by your Clan."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot fire a catapult whilst on PvPTimer"));
return false;
}
if (!canBeFired())
{
UtilPlayer.message(player, F.main("Clans", "Catapult is not loaded correctly."));
@ -108,6 +113,11 @@ public class Catapult extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "Someone is already riding this Catapult."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot sit in a catapult whilst on PvPTimer"));
return false;
}
return !player.equals(getRider());
}));
@ -151,7 +161,12 @@ public class Catapult extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "This Catapult is not owned by your Clan."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannotfire a catapult whilst on PvPTimer"));
return false;
}
if (!canBeFired())
{
UtilPlayer.message(player, F.main("Clans", "Catapult is not loaded correctly."));
@ -181,6 +196,10 @@ public class Catapult extends SiegeWeapon
UtilPlayer.message(player, F.main("Clans", "Someone is already riding this Catapult."));
return false;
}
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannot sit in a cannon whilst on PvPTimer"));
return false;
}
return !player.equals(getRider());
}));

View File

@ -3,35 +3,34 @@ package mineplex.game.clans.items.attributes.weapon;
import mineplex.game.clans.items.attributes.AttackAttribute;
import mineplex.game.clans.items.attributes.AttributeType;
import mineplex.game.clans.items.generation.ValueDistribution;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
public class JaggedAttribute extends AttackAttribute
{
private static ValueDistribution attackGen = generateDistribution(2, 4);
public JaggedAttribute()
{
super(AttributeType.PREFIX, attackGen.generateIntValue());
}
public class JaggedAttribute extends AttackAttribute {
private static ValueDistribution attackGen = generateDistribution(2, 4);
@Override
public String getDisplayName()
{
return "Jagged";
}
@Override
public String getDescription()
{
return String.format("Every %d attacks mini-stuns enemies", getAttackLimit());
}
@Override
public void triggerAttack(Entity attacker, Entity defender)
{
defender.setVelocity(new Vector(0, 0, 0));
}
public JaggedAttribute() {
super(AttributeType.PREFIX, attackGen.generateIntValue());
}
@Override
public String getDisplayName() {
return "Jagged";
}
@Override
public String getDescription() {
return String.format("Every %d attacks mini-stuns enemies", getAttackLimit());
}
@Override
public void triggerAttack(Entity attacker, Entity defender) {
defender.setVelocity(new Vector(0, 0, 0));
if (defender instanceof LivingEntity)
((LivingEntity) defender).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20, 1, false, false));
}
}