Merge branch 'clans/beta' of https://github.com/Mineplex-LLC/Minecraft-PC into clans/beta

This commit is contained in:
Ben 2016-03-09 11:56:25 +00:00
commit 51e5552e2d
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 ObserverManager _observerManager;
private Punish _punish;
private PvpTimer _pvpTimer;
private int _inviteExpire = 2;
private int _nameMin = 3;
@ -319,7 +320,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);
@ -1223,4 +1224,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;
@ -183,6 +184,11 @@ public class SiegeManager extends MiniPlugin
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);
if (claim != null && !claim.Owner.equals(_clansManager.getClan(player).getName()))
@ -218,6 +224,11 @@ public class SiegeManager extends MiniPlugin
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);
if (claim != null && !claim.Owner.equals(_clansManager.getClan(player).getName()))

View File

@ -305,6 +305,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())))
{
UtilPlayer.message(event.getPlayer(), F.main("Clans", "This is not yours to activate!"));
@ -326,6 +332,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

@ -85,12 +85,19 @@ public class OutpostManager extends MiniPlugin
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

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

@ -79,6 +79,11 @@ public class Catapult extends SiegeWeapon
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."));
@ -109,6 +114,11 @@ public class Catapult extends SiegeWeapon
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());
}));
}
@ -152,6 +162,11 @@ public class Catapult extends SiegeWeapon
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
{
public class JaggedAttribute extends AttackAttribute {
private static ValueDistribution attackGen = generateDistribution(2, 4);
public JaggedAttribute()
{
public JaggedAttribute() {
super(AttributeType.PREFIX, attackGen.generateIntValue());
}
@Override
public String getDisplayName()
{
public String getDisplayName() {
return "Jagged";
}
@Override
public String getDescription()
{
public String getDescription() {
return String.format("Every %d attacks mini-stuns enemies", getAttackLimit());
}
@Override
public void triggerAttack(Entity attacker, Entity defender)
{
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));
}
}