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,6 +190,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
private WarPointEvasion _warPointEvasion; private WarPointEvasion _warPointEvasion;
private ObserverManager _observerManager; private ObserverManager _observerManager;
private Punish _punish; private Punish _punish;
private PvpTimer _pvpTimer;
private int _inviteExpire = 2; private int _inviteExpire = 2;
private int _nameMin = 3; private int _nameMin = 3;
@ -317,7 +318,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
new ClanEnergyManager(plugin, this, clientManager, donationManager); new ClanEnergyManager(plugin, this, clientManager, donationManager);
_playTracker = new Playtime(this, statsManager); _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 = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler);
TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager); TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager);
@ -1221,4 +1222,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{ {
return _damageManager; 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); 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; 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 java.util.Stack;
import mineplex.game.clans.clans.pvptimer.PvpTimer;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -183,6 +184,11 @@ public class SiegeManager extends MiniPlugin
return false; 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); ClanTerritory claim = _clansManager.getClanUtility().getClaim(location);
if (claim != null && !claim.Owner.equals(_clansManager.getClan(player).getName())) if (claim != null && !claim.Owner.equals(_clansManager.getClan(player).getName()))
@ -218,6 +224,11 @@ public class SiegeManager extends MiniPlugin
return false; 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); ClanTerritory claim = _clansManager.getClanUtility().getClaim(location);
if (claim != null && !claim.Owner.equals(_clansManager.getClan(player).getName())) if (claim != null && !claim.Owner.equals(_clansManager.getClan(player).getName()))

View File

@ -304,6 +304,12 @@ public class Outpost implements Listener
if (getLifetime() <= 2000) if (getLifetime() <= 2000)
return; 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()))) if (!_ownerClan.equals(_ownerClan.Clans.getClanUtility().getClanByPlayer(event.getPlayer())))
{ {
UtilPlayer.message(event.getPlayer(), F.main("Clans", "This is not yours to activate!")); UtilPlayer.message(event.getPlayer(), F.main("Clans", "This is not yours to activate!"));
@ -325,6 +331,12 @@ public class Outpost implements Listener
{ {
if (event.getBlock().getLocation().equals(_core) && getState() == OutpostState.LIVE) 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!")); UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have destroyed " + F.elem(_ownerClan.getName()) + "'s Outpost!"));
_core.getBlock().setType(Material.AIR); _core.getBlock().setType(Material.AIR);

View File

@ -85,12 +85,19 @@ public class OutpostManager extends MiniPlugin
return false; 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) if (location.getBlockY() < 30)
{ {
UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost this deep.")); UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost this deep."));
return false; return false;
} }
ClanInfo clan = _clansManager.getClan(player); ClanInfo clan = _clansManager.getClan(player);
if (UtilItem.isBoundless(location.clone().subtract(0, 1, 0).getBlock().getType())) if (UtilItem.isBoundless(location.clone().subtract(0, 1, 0).getBlock().getType()))

View File

@ -74,6 +74,11 @@ public class Cannon extends SiegeWeapon
return false; 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()) if (!canBeFired())
{ {
UtilPlayer.message(player, F.main("Clans", "Cannon is not loaded correctly.")); UtilPlayer.message(player, F.main("Clans", "Cannon is not loaded correctly."));
@ -104,6 +109,11 @@ public class Cannon extends SiegeWeapon
return false; 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()); return !player.equals(getRider());
})); }));
} }
@ -144,6 +154,11 @@ public class Cannon extends SiegeWeapon
return false; 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()) if (!canBeFired())
{ {
UtilPlayer.message(player, F.main("Clans", "Cannon is not loaded correctly.")); UtilPlayer.message(player, F.main("Clans", "Cannon is not loaded correctly."));
@ -174,6 +189,11 @@ public class Cannon extends SiegeWeapon
return false; 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()); return !player.equals(getRider());
})); }));
} }

View File

@ -79,6 +79,11 @@ public class Catapult extends SiegeWeapon
return false; 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()) if (!canBeFired())
{ {
UtilPlayer.message(player, F.main("Clans", "Catapult is not loaded correctly.")); UtilPlayer.message(player, F.main("Clans", "Catapult is not loaded correctly."));
@ -109,6 +114,11 @@ public class Catapult extends SiegeWeapon
return false; 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()); return !player.equals(getRider());
})); }));
} }
@ -152,6 +162,11 @@ public class Catapult extends SiegeWeapon
return false; return false;
} }
if(_clans.getPvpTimer().hasTimer(player)) {
UtilPlayer.message(player, F.main("Clans", "You cannotfire a catapult whilst on PvPTimer"));
return false;
}
if (!canBeFired()) if (!canBeFired())
{ {
UtilPlayer.message(player, F.main("Clans", "Catapult is not loaded correctly.")); 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.")); UtilPlayer.message(player, F.main("Clans", "Someone is already riding this Catapult."));
return false; 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()); 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.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.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class JaggedAttribute extends AttackAttribute public class JaggedAttribute extends AttackAttribute {
{ private static ValueDistribution attackGen = generateDistribution(2, 4);
private static ValueDistribution attackGen = generateDistribution(2, 4);
public JaggedAttribute() public JaggedAttribute() {
{ super(AttributeType.PREFIX, attackGen.generateIntValue());
super(AttributeType.PREFIX, attackGen.generateIntValue()); }
}
@Override @Override
public String getDisplayName() public String getDisplayName() {
{ return "Jagged";
return "Jagged"; }
}
@Override @Override
public String getDescription() public String getDescription() {
{ return String.format("Every %d attacks mini-stuns enemies", getAttackLimit());
return String.format("Every %d attacks mini-stuns enemies", getAttackLimit()); }
}
@Override @Override
public void triggerAttack(Entity attacker, Entity defender) public void triggerAttack(Entity attacker, Entity defender) {
{ defender.setVelocity(new Vector(0, 0, 0));
defender.setVelocity(new Vector(0, 0, 0)); if (defender instanceof LivingEntity)
} ((LivingEntity) defender).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20, 1, false, false));
}
} }