Legendaries and other preparation for beta

This commit is contained in:
Ben 2016-03-09 11:55:40 +00:00
parent 5b3da3d06f
commit cf6645cec7
10 changed files with 90 additions and 44 deletions

View File

@ -341,7 +341,7 @@ public class UtilPlayer
{ {
if (cur.getName().equalsIgnoreCase(player)) if (cur.getName().equalsIgnoreCase(player))
return cur; return cur;
if (cur.getName().toLowerCase().contains(player.toLowerCase())) if (cur.getName().toLowerCase().contains(player.toLowerCase()))
matchList.add(cur); matchList.add(cur);
} }

View File

@ -78,6 +78,7 @@ public class ClansGame extends MiniPlugin
} }
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void BlockBurn(BlockBurnEvent event) public void BlockBurn(BlockBurnEvent event)
{ {

View File

@ -95,6 +95,7 @@ import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
import mineplex.game.clans.clans.regions.ClansRegions; import mineplex.game.clans.clans.regions.ClansRegions;
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager; import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
import mineplex.game.clans.clans.siege.SiegeManager; import mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.clans.staff.SilentChestOpen;
import mineplex.game.clans.clans.supplyDrop.SupplyDropManager; import mineplex.game.clans.clans.supplyDrop.SupplyDropManager;
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager; import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
import mineplex.game.clans.clans.war.WarManager; import mineplex.game.clans.clans.war.WarManager;
@ -112,7 +113,6 @@ import mineplex.game.clans.gameplay.Gameplay;
import mineplex.game.clans.gameplay.safelog.SafeLog; import mineplex.game.clans.gameplay.safelog.SafeLog;
import mineplex.game.clans.gameplay.safelog.npc.NPCManager; import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
import mineplex.game.clans.items.GearManager; import mineplex.game.clans.items.GearManager;
import mineplex.game.clans.legacytutorial.Tutorial;
import mineplex.game.clans.spawn.Spawn; import mineplex.game.clans.spawn.Spawn;
import mineplex.game.clans.tutorial.TutorialManager; import mineplex.game.clans.tutorial.TutorialManager;
import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Class.ClassManager;
@ -274,6 +274,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
new Field(plugin, creature, _condition, this, energy, serverName); new Field(plugin, creature, _condition, this, energy, serverName);
new SilentChestOpen(this);
// Required managers to be initialized // Required managers to be initialized
new Spawn(plugin, this); new Spawn(plugin, this);
new NPCManager(this, _hologramManager); new NPCManager(this, _hologramManager);

View File

@ -28,6 +28,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.core.delayedtask.DelayedTask; import mineplex.core.delayedtask.DelayedTask;
import mineplex.core.delayedtask.DelayedTaskClient; import mineplex.core.delayedtask.DelayedTaskClient;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClanRole; import mineplex.game.clans.clans.ClanRole;
@ -357,7 +358,7 @@ public class ClansCommand extends CommandBase<ClansManager>
} }
Player target = UtilPlayer.searchOnline(caller, args[1], true); Player target = UtilPlayer.searchOnline(caller, args[1], true);
if (target == null) return; if (target == null || IncognitoManager.Instance.Get(target).Status) return;
Plugin.getClanUtility().invite(caller, clan, target); Plugin.getClanUtility().invite(caller, clan, target);
} }

View File

@ -57,6 +57,7 @@ import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansBlacklist; import mineplex.game.clans.clans.ClansBlacklist;
import mineplex.game.clans.clans.event.ClansWaterPlaceEvent; import mineplex.game.clans.clans.event.ClansWaterPlaceEvent;
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent; import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent;
import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock; import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock;
import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken; import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken;
import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.core.repository.ClanTerritory;
@ -587,6 +588,18 @@ public class Outpost implements Listener
_ownerClan.inform("Your Clan's Outpost has been destroyed.", null); _ownerClan.inform("Your Clan's Outpost has been destroyed.", null);
} }
@EventHandler
public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event)
{
if (UtilAlg.inBoundingBox(event.getProjectile().getLocation(), _startCorner.clone().subtract(2, 2, 2), _endCorner.clone().add(2, 2, 2)))
{
if (getLifetime() < 15 * 60 * 1000)
{
event.setCancelled(true);
}
}
}
public ClanInfo getOwner() public ClanInfo getOwner()
{ {
return _ownerClan; return _ownerClan;

View File

@ -6,13 +6,18 @@ import java.util.UUID;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.EnclosedObject;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.items.attributes.AttributeContainer; import mineplex.game.clans.items.attributes.AttributeContainer;
import mineplex.game.clans.items.attributes.ItemAttribute; import mineplex.game.clans.items.attributes.ItemAttribute;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -90,6 +95,34 @@ public class CustomItem implements Listener
return _description; return _description;
} }
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
final EnclosedObject<Boolean> success = new EnclosedObject<>(Boolean.FALSE);
UtilServer.getPlayersCollection().forEach(player -> {
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(player);
if (gear.getWeapon() == null)
return;
if (gear.getWeapon().getUuid().equals(getUuid()))
{
success.Set(Boolean.TRUE);
}
});
if (!success.Get().booleanValue())
{
UtilServer.Unregister(this);
}
}
public List<String> getLore() public List<String> getLore()
{ {
List<String> lore = new ArrayList<String>(); List<String> lore = new ArrayList<String>();

View File

@ -164,9 +164,9 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
// TODO: Initialize list of attributes and types // TODO: Initialize list of attributes and types
// Initialize various LegendaryItem types // Initialize various LegendaryItem types
LegendaryWeights = new WeightSet<Class<? extends LegendaryItem>>(MeridianScepter.class, EnergyCrossbow.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class); LegendaryWeights = new WeightSet<Class<? extends LegendaryItem>>(MeridianScepter.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class);
RareWeights = new WeightSet<Class<? extends RareItem>>(RunedPickaxe.class, Crossbow.class); RareWeights = new WeightSet<Class<? extends RareItem>>(RunedPickaxe.class);
// TODO: Add rest of legendaries, find better way? // TODO: Add rest of legendaries, find better way?
// Register listeners // Register listeners

View File

@ -7,6 +7,8 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -83,21 +85,18 @@ public class MeridianScepter extends LegendaryItem
Location eLoc = entity.getLocation(); Location eLoc = entity.getLocation();
// If they are less than 0.5 blocks away // If they are less than 0.5 blocks away
if (eLoc.clone().add(0, projectile.getY() - eLoc.getY(), 0).distance(projectile) <= 0.7) if (eLoc.clone().add(0, entity.getEyeHeight() / 2, 0).distance(projectile) <= 0.7)
{ {
// If it is in their body height ClansManager.getInstance().getDamageManager().NewDamageEvent(entity, player, null,
if (Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.5)) - projectile.getY()) <= entity DamageCause.CUSTOM, damage, true, true, false,
.getEyeHeight() / 2) player.getName(), "Meridian Scepter");
entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 4, 0));
if (entity instanceof Player)
{ {
if (entity != player) UtilPlayer.message(entity, F.main("Clans", F.elem(player.getName()) + " hit you with a " + F.elem("Meridian Scepter") + C.mBody + "."));
{ UtilPlayer.message(player, F.main("Clans", "You hit " + F.elem(entity.getName()) + " with your " + F.elem("Meridian Scepter") + C.mBody + "."));
ClansManager.getInstance().getDamageManager().NewDamageEvent(entity, player, null,
DamageCause.CUSTOM, damage, true, true, false,
player.getName(), "Meridian Scepter");
UtilPlayer.message(entity, F.main("Clans", F.elem(entity.getName()) + " hit you with a " + F.elem("Meridian Scepter") + C.mBody + "."));
UtilPlayer.message(player, F.main("Clans", "You hit " + F.elem(player.getName()) + " with your " + F.elem("Meridian Scepter") + C.mBody + "."));
}
} }
} }
} }
@ -154,7 +153,7 @@ public class MeridianScepter extends LegendaryItem
Vector newDirection = closestPlayer.getLocation().add(0, 1, 0).toVector() Vector newDirection = closestPlayer.getLocation().add(0, 1, 0).toVector()
.subtract(projectile.toVector()); .subtract(projectile.toVector());
direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.25); direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.2);
} }
projectile.add(direction); projectile.add(direction);

View File

@ -1,7 +1,6 @@
package mineplex.game.clans.items.rares; package mineplex.game.clans.items.rares;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -13,16 +12,12 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.RGBData; import mineplex.core.common.util.RGBData;
import mineplex.core.common.util.UtilCollections;
import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilColor;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.game.clans.items.PlayerGear; import mineplex.game.clans.items.PlayerGear;
public class RunedPickaxe extends RareItem public class RunedPickaxe extends RareItem
@ -44,14 +39,15 @@ public class RunedPickaxe extends RareItem
@Override @Override
public void update(Player wielder) public void update(Player wielder)
{ {
if ((System.currentTimeMillis() - _lastBlock) < 98)
System.out.println((System.currentTimeMillis() - _lastBlock) + ", " + (System.currentTimeMillis() - _interactWait));
if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98) if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98)
{ {
_interactWait = System.currentTimeMillis();
if (Recharge.Instance.use(wielder, "Instant Mine", 30000, true, true)) if (Recharge.Instance.use(wielder, "Instant Mine", 30000, true, true))
{ {
fire(wielder);
_interactWait = System.currentTimeMillis();
_instamineEnabled = System.currentTimeMillis(); _instamineEnabled = System.currentTimeMillis();
} }
} }
@ -62,9 +58,21 @@ public class RunedPickaxe extends RareItem
{ {
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(event.getPlayer()); PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(event.getPlayer());
if (gear.getWeapon() == this && !UtilTime.elapsed(_instamineEnabled, 12000)) System.out.println(event.getBlock());
String playerClan = ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()) == null ? null : ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()).getName();
ClanTerritory territory = ClansManager.getInstance().getClanUtility().getClaim(event.getBlock().getLocation());
if (territory != null && !territory.Owner.equals(playerClan))
return;
if (event.getBlock().getType() == Material.BEDROCK)
return;
if (equals(gear.getWeapon()) && !UtilTime.elapsed(_instamineEnabled, 12000))
{ {
event.setInstaBreak(true); event.getBlock().breakNaturally();
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getType(), 10); event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getType(), 10);
@ -72,15 +80,4 @@ public class RunedPickaxe extends RareItem
} }
} }
private void fire(final Player player)
{
}
private void playParticle(Location start, Location end)
{
for (Location loc : UtilShapes.getLinesDistancedPoints(start, end, 0.06))
{
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, UtilCollections.random(colors).ToVector(), 1f, 0, ViewDist.LONG);
}
}
} }

View File

@ -105,9 +105,9 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
} }
}; };
_legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(MeridianScepter.class, EnergyCrossbow.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class); _legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(MeridianScepter.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class);
_rareItems = Arrays.<Class<? extends RareItem>> asList(Crossbow.class, RunedPickaxe.class); _rareItems = Arrays.<Class<? extends RareItem>> asList(RunedPickaxe.class);
_armorSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(LavaAttribute.class); _armorSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(LavaAttribute.class);
_armorPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(PaddedAttribute.class, ReinforcedAttribute.class, SlantedAttribute.class); _armorPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(PaddedAttribute.class, ReinforcedAttribute.class, SlantedAttribute.class);