Change a bit of how Wizards works
This commit is contained in:
parent
99b37097c6
commit
5b9f5e1678
@ -116,7 +116,7 @@ public abstract class ScoredSoloGame extends SoloGame
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_scores.put(player, _scores.getOrDefault(player, 0) + score);
|
_scores.put(player, Math.max(0, _scores.getOrDefault(player, 0) + score));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
@ -135,7 +135,7 @@ public class GameCompassComponent extends GameComponent<Game>
|
|||||||
|
|
||||||
private Player getClosest(Player player)
|
private Player getClosest(Player player)
|
||||||
{
|
{
|
||||||
if (getGame().isAlive(player))
|
if (getGame().isAlive(player) && getGame().getTeams().size() > 1)
|
||||||
{
|
{
|
||||||
return UtilPlayer.getClosest(player.getLocation(), getGame().getTeam(player).getAlivePlayers());
|
return UtilPlayer.getClosest(player.getLocation(), getGame().getTeam(player).getAlivePlayers());
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class DoubleJumpComponent extends GameComponent<Game>
|
|||||||
|
|
||||||
public DoubleJumpComponent(Game game)
|
public DoubleJumpComponent(Game game)
|
||||||
{
|
{
|
||||||
super(game, GameState.Live);
|
super(game, GameState.Live, GameState.End);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,7 +47,7 @@ public class DoubleJumpComponent extends GameComponent<Game>
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void updateJump(UpdateEvent event)
|
public void updateJump(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK || !getGame().isLive())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -76,6 +76,13 @@ public class DoubleJumpComponent extends GameComponent<Game>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!getGame().isLive())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.setAllowFlight(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Vector velocity = player.getLocation().getDirection();
|
Vector velocity = player.getLocation().getDirection();
|
||||||
|
|
||||||
if (_directional)
|
if (_directional)
|
||||||
|
@ -149,19 +149,15 @@ public class MineKart extends SoloGame
|
|||||||
|
|
||||||
if (checkpoint != null)
|
if (checkpoint != null)
|
||||||
{
|
{
|
||||||
player.sendMessage("Lap node = " + checkpoint.getIndex());
|
|
||||||
kart.setLapCheckpoint(checkpoint.getIndex());
|
kart.setLapCheckpoint(checkpoint.getIndex());
|
||||||
|
|
||||||
if (checkpoint.isKey())
|
if (checkpoint.isKey())
|
||||||
{
|
{
|
||||||
int keyIndex = _keyCheckpoints.indexOf(checkpoint);
|
int keyIndex = _keyCheckpoints.indexOf(checkpoint);
|
||||||
|
|
||||||
player.sendMessage("Lap key node = " + keyIndex + " kart node = " + kart.getLapKeyCheckpoint());
|
|
||||||
|
|
||||||
if (kart.getLapKeyCheckpoint() + 1 == keyIndex)
|
if (kart.getLapKeyCheckpoint() + 1 == keyIndex)
|
||||||
{
|
{
|
||||||
kart.setLapKeyCheckpoint(keyIndex);
|
kart.setLapKeyCheckpoint(keyIndex);
|
||||||
player.sendMessage("Lap key node = " + keyIndex + " goal = " + (_keyCheckpoints.size() - 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,14 +198,13 @@ public class MineKart extends SoloGame
|
|||||||
|
|
||||||
double velocityLength = kart.getVelocity().length();
|
double velocityLength = kart.getVelocity().length();
|
||||||
|
|
||||||
// player.sendMessage("v=" + velocityLength);
|
|
||||||
|
|
||||||
location.add(kart.getVelocity());
|
location.add(kart.getVelocity());
|
||||||
location.setDirection(kart.getVelocity());
|
location.setDirection(kart.getVelocity());
|
||||||
UtilEnt.setPosition(vehicle, location);
|
UtilEnt.setPosition(vehicle, location);
|
||||||
UtilEnt.CreatureLook(vehicle, location.getYaw());
|
UtilEnt.CreatureLook(vehicle, location.getYaw());
|
||||||
|
|
||||||
location.getWorld().playSound(location, Sound.PIG_IDLE, (float) (.1 + velocityLength / 2), (float) (.5 + velocityLength));
|
location.getWorld().playSound(location, Sound.PIG_IDLE, (float) (.1 + velocityLength / 2), (float) (.5 + velocityLength));
|
||||||
|
player.setExp((float) velocityLength);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public enum ChallengeType
|
|||||||
RED_BLOCKS(ChallengeRedBlocks.class, "Don't fall into the void!"),
|
RED_BLOCKS(ChallengeRedBlocks.class, "Don't fall into the void!"),
|
||||||
POLE(ChallengePole.class, "Get as high as you can!"),
|
POLE(ChallengePole.class, "Get as high as you can!"),
|
||||||
CROUCH(ChallengeCrouch.class, "Crouch/Sneak!"),
|
CROUCH(ChallengeCrouch.class, "Crouch/Sneak!"),
|
||||||
ZOMBIES(ChallengeZombies.class, "Survive the Zombie Hoard!"),
|
ZOMBIES(ChallengeZombies.class, "Survive the Zombie Horde!"),
|
||||||
SPLEEF(ChallengeSpleef.class, "Spleef other players into the void!"),
|
SPLEEF(ChallengeSpleef.class, "Spleef other players into the void!"),
|
||||||
BLOCK_SNAKE(ChallengeBlockSnake.class, "Avoid the Block Snake!"),
|
BLOCK_SNAKE(ChallengeBlockSnake.class, "Avoid the Block Snake!"),
|
||||||
THROW_EGGS(ChallengeThrowEggs.class, "Throw all your eggs!"),
|
THROW_EGGS(ChallengeThrowEggs.class, "Throw all your eggs!"),
|
||||||
|
@ -4,12 +4,11 @@ import java.util.Collections;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.lifetimes.Lifetime;
|
import mineplex.core.lifetimes.Lifetime;
|
||||||
@ -51,7 +50,7 @@ public abstract class Spell extends ListenerComponent implements Lifetimed
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerInteract(PlayerInteractEvent event)
|
public void playerInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!UtilEvent.isAction(event, ActionType.R))
|
if (event.getAction() == Action.PHYSICAL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,14 @@ import org.bukkit.Sound;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.mineplex.anticheat.checks.move.Glide;
|
||||||
|
import com.mineplex.anticheat.checks.move.Speed;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.MapUtil;
|
import mineplex.core.common.util.MapUtil;
|
||||||
@ -33,6 +39,7 @@ import mineplex.game.nano.game.games.wizards.spells.SpellTNT;
|
|||||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class Wizards extends ScoredSoloGame
|
public class Wizards extends ScoredSoloGame
|
||||||
{
|
{
|
||||||
@ -94,13 +101,19 @@ public class Wizards extends ScoredSoloGame
|
|||||||
.build()
|
.build()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_compassComponent.setGiveToAlive(true);
|
||||||
|
|
||||||
new DoubleJumpComponent(this);
|
new DoubleJumpComponent(this);
|
||||||
|
|
||||||
|
_manager.getAntiHack().addIgnoredCheck(Speed.class);
|
||||||
|
_manager.getAntiHack().addIgnoredCheck(Glide.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void parseData()
|
protected void parseData()
|
||||||
{
|
{
|
||||||
|
// Legacy support for old wizard maps
|
||||||
|
_mineplexWorld.getSpongeLocations(String.valueOf(Material.CHEST.getId())).forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.AIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -112,6 +125,22 @@ public class Wizards extends ScoredSoloGame
|
|||||||
{
|
{
|
||||||
player.getInventory().addItem(spell.getItemStack());
|
player.getInventory().addItem(spell.getItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void damage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
||||||
|
{
|
||||||
|
event.SetCancelled("Entity Explosion");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.GetDamageeEntity().equals(event.GetDamagerEntity(true)))
|
||||||
|
{
|
||||||
|
event.AddMod("Self", -event.GetDamage() * 0.75);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -161,6 +190,6 @@ public class Wizards extends ScoredSoloGame
|
|||||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.getInRadius(location, radius + 2).forEach((player, scale) -> _manager.getDamageManager().NewDamageEvent(player, source, null, DamageCause.ENTITY_EXPLOSION, damage, true, true, false, source.getName(), reason));
|
UtilPlayer.getInRadius(location, radius + 2).forEach((player, scale) -> _manager.getDamageManager().NewDamageEvent(player, source, null, DamageCause.CUSTOM, damage, true, true, false, source.getName(), reason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import mineplex.game.nano.game.games.wizards.Spell;
|
import mineplex.game.nano.game.games.wizards.Spell;
|
||||||
import mineplex.game.nano.game.games.wizards.Wizards;
|
import mineplex.game.nano.game.games.wizards.Wizards;
|
||||||
|
|
||||||
@ -29,8 +28,6 @@ public class SpellFireball extends Spell
|
|||||||
|
|
||||||
Fireball fireball = player.launchProjectile(Fireball.class);
|
Fireball fireball = player.launchProjectile(Fireball.class);
|
||||||
fireball.setVelocity(velocity.clone().multiply(2));
|
fireball.setVelocity(velocity.clone().multiply(2));
|
||||||
|
|
||||||
UtilAction.velocity(player, velocity.multiply(-0.7));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -7,8 +7,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
@ -48,8 +46,6 @@ public class SpellFortify extends Spell
|
|||||||
}
|
}
|
||||||
|
|
||||||
location.getWorld().playSound(location, Sound.ZOMBIE_REMEDY, 0.5F, 1);
|
location.getWorld().playSound(location, Sound.ZOMBIE_REMEDY, 0.5F, 1);
|
||||||
|
UtilPlayer.health(player, 10);
|
||||||
UtilPlayer.health(player, 4);
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 10 * 20, 0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class SpellTNT extends Spell
|
|||||||
TNTPrimed tnt = location.getWorld().spawn(location, TNTPrimed.class);
|
TNTPrimed tnt = location.getWorld().spawn(location, TNTPrimed.class);
|
||||||
|
|
||||||
tnt.setVelocity(location.getDirection());
|
tnt.setVelocity(location.getDirection());
|
||||||
tnt.setFuseTicks(80);
|
tnt.setFuseTicks(10);
|
||||||
|
|
||||||
_owner.put(tnt, player);
|
_owner.put(tnt, player);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user