Implement 5 year particle and title

This commit is contained in:
Sam 2018-07-09 23:46:31 +01:00 committed by Alexander Meech
parent b72bf772e2
commit 24a1d09f18
7 changed files with 161 additions and 53 deletions

View File

@ -259,6 +259,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
import mineplex.core.gadget.gadgets.particle.ParticleDeepSeaSwirl; import mineplex.core.gadget.gadgets.particle.ParticleDeepSeaSwirl;
import mineplex.core.gadget.gadgets.particle.ParticleFiveYear;
import mineplex.core.gadget.gadgets.particle.ParticleInfused; import mineplex.core.gadget.gadgets.particle.ParticleInfused;
import mineplex.core.gadget.gadgets.particle.ParticleEmerald; import mineplex.core.gadget.gadgets.particle.ParticleEmerald;
import mineplex.core.gadget.gadgets.particle.ParticleEnchant; import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
@ -738,6 +739,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleRainbowTrail(this)); addGadget(new ParticleRainbowTrail(this));
addGadget(new ParticleDeepSeaSwirl(this)); addGadget(new ParticleDeepSeaSwirl(this));
addGadget(new ParticleInfused(this)); addGadget(new ParticleInfused(this));
addGadget(new ParticleFiveYear(this));
// Arrow Trails // Arrow Trails
addGadget(new ArrowTrailFrostLord(this)); addGadget(new ArrowTrailFrostLord(this));

View File

@ -0,0 +1,71 @@
package mineplex.core.gadget.gadgets.particle;
import java.awt.*;
import java.awt.image.BufferedImage;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
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.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.gadget.util.CostConstants;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleFiveYear extends ParticleGadget
{
private final BufferedImage _bufferedImage;
public ParticleFiveYear(GadgetManager manager)
{
super(manager, "Five Years of Mineplex", new String[]
{
C.cGray + "",
C.blankLine,
C.cBlue + "Earned by joining the server during",
C.cBlue + "the Mineplex 5 Year Anniversary."
}, CostConstants.NO_LORE, Material.ENDER_CHEST, (byte) 0);
_bufferedImage = UtilText.stringToBufferedImage(new Font("Tahoma", Font.PLAIN, 12), "5");
}
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
Location location = player.getLocation().add(0, 1, 0);
location.setPitch(0);
Vector direction = location.getDirection();
location.add(UtilAlg.getRight(direction).multiply(0.3));
location.subtract(direction.multiply(0.5));
int color, height = _bufferedImage.getHeight() / 2, width = _bufferedImage.getWidth() / 2;
double yaw = Math.toRadians(location.getYaw());
for (int y = 1; y < _bufferedImage.getHeight(); y++)
{
for (int x = 0; x < _bufferedImage.getWidth() - 1; x++)
{
color = _bufferedImage.getRGB(x, y);
Vector vector = new Vector(width - x, height - y, 0).multiply(0.2);
UtilAlg.rotateAroundYAxis(vector, yaw);
UtilParticle.PlayParticleToAll(Color.black.getRGB() == color ? ParticleType.FLAME : ParticleType.SMOKE, location.add(vector), null, 0, 1, ViewDist.NORMAL);
location.subtract(vector);
}
}
}
}

View File

@ -28,6 +28,7 @@ import mineplex.core.titles.tracks.award.CCIIPublicTrack;
import mineplex.core.titles.tracks.award.CCIITrack; import mineplex.core.titles.tracks.award.CCIITrack;
import mineplex.core.titles.tracks.award.CastleSiegeTesterTrack; import mineplex.core.titles.tracks.award.CastleSiegeTesterTrack;
import mineplex.core.titles.tracks.award.ClansRaidTrack; import mineplex.core.titles.tracks.award.ClansRaidTrack;
import mineplex.core.titles.tracks.award.FiveYearTrack;
import mineplex.core.titles.tracks.award.MapSub2018Track; import mineplex.core.titles.tracks.award.MapSub2018Track;
import mineplex.core.titles.tracks.award.Minestrike2017Track; import mineplex.core.titles.tracks.award.Minestrike2017Track;
import mineplex.core.titles.tracks.award.NewHub2018Track; import mineplex.core.titles.tracks.award.NewHub2018Track;
@ -131,6 +132,7 @@ public class TrackManager extends MiniPlugin
registerTrack(new Bridges2017WinterTrack()); registerTrack(new Bridges2017WinterTrack());
registerTrack(new NewHub2018Track()); registerTrack(new NewHub2018Track());
registerTrack(new MapSub2018Track()); registerTrack(new MapSub2018Track());
registerTrack(new FiveYearTrack());
// Staff tracks // Staff tracks
registerTrack(new BuilderTrack()); registerTrack(new BuilderTrack());

View File

@ -0,0 +1,31 @@
package mineplex.core.titles.tracks.award;
import net.md_5.bungee.api.ChatColor;
import mineplex.core.titles.tracks.ItemizedTrack;
import mineplex.core.titles.tracks.TrackFormat;
import mineplex.core.titles.tracks.TrackTier;
public class FiveYearTrack extends ItemizedTrack
{
public FiveYearTrack()
{
super(
"five-years",
ChatColor.GOLD,
"Five Year",
"Mineplex 5th Year Anniversary",
"This track is awarded to players who participated in the Mineplex 5th Year Anniversary Event.",
true
);
getRequirements()
.addTier(new TrackTier(
"5 Year Anniversary",
null,
this::owns,
new TrackFormat(ChatColor.GOLD, ChatColor.BLACK)
));
}
}

View File

@ -19,6 +19,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.Glide;
@ -79,7 +80,6 @@ public class SquidShooters extends SoloGame
NightVision = true; NightVision = true;
WorldTimeSet = 6000; WorldTimeSet = 6000;
GlideCheckEnabled = false;
AntiHack antiHack = Managers.get(AntiHack.class); AntiHack antiHack = Managers.get(AntiHack.class);
antiHack.addIgnoredCheck(Speed.class); antiHack.addIgnoredCheck(Speed.class);
antiHack.addIgnoredCheck(Glide.class); antiHack.addIgnoredCheck(Glide.class);
@ -90,7 +90,7 @@ public class SquidShooters extends SoloGame
@EventHandler @EventHandler
public void ScoreboardUpdate(UpdateEvent event) public void ScoreboardUpdate(UpdateEvent event)
{ {
if (!InProgress()) if (event.getType() != UpdateType.FAST || !InProgress())
{ {
return; return;
} }
@ -139,7 +139,21 @@ public class SquidShooters extends SoloGame
return; return;
} }
Manager.runSyncLater(() -> UtilTextMiddle.display(null, C.cYellow + "Hold Sneak to Swim", 10, 40, 10, UtilServer.getPlayers()), 20); Manager.runSyncTimer(new BukkitRunnable()
{
int line = 0;
@Override
public void run()
{
UtilTextMiddle.display(null, DESCRIPTION[line], 10, 50, 10, UtilServer.getPlayers());
if (++line == DESCRIPTION.length)
{
cancel();
}
}
}, 20, 50);
} }
@EventHandler @EventHandler

View File

@ -103,7 +103,7 @@ public class KitRetroSquid extends Kit
return; return;
} }
Manager.GetDamage().NewDamageEvent(hit, player, null, DamageCause.CUSTOM, 15 * scale, true, true, true, player.getName(), GetName()); Manager.GetDamage().NewDamageEvent(hit, player, null, DamageCause.CUSTOM, 15 * scale, true, true, true, player.getName(), NAME);
}); });
break; break;

View File

@ -76,7 +76,8 @@ public class NewGameLobbyManager extends LobbyManager
try try
{ {
readFile(); readFile();
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
@ -149,7 +150,6 @@ public class NewGameLobbyManager extends LobbyManager
} }
int shift = 0; int shift = 0;
float yaw = 90;
if (doShift) if (doShift)
{ {
@ -178,11 +178,6 @@ public class NewGameLobbyManager extends LobbyManager
Collections.reverse(list); Collections.reverse(list);
} }
if (isMPS())
{
yaw = 0;
}
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)
{ {
GameTeam team = list.get(i); GameTeam team = list.get(i);
@ -191,12 +186,13 @@ public class NewGameLobbyManager extends LobbyManager
if (isMPS()) if (isMPS())
{ {
entLoc.add(shift, 0, 0); entLoc.add(shift, 0, 0);
} else }
else
{ {
entLoc.add(0, 0, shift); entLoc.add(0, 0, shift);
} }
entLoc.setYaw(yaw); entLoc.setYaw(getYawToSpawn(entLoc, true));
entLoc.getChunk().load(); entLoc.getChunk().load();
spawnTeamSheep(entLoc, team); spawnTeamSheep(entLoc, team);
@ -219,7 +215,6 @@ public class NewGameLobbyManager extends LobbyManager
.filter(entity -> !(entity instanceof Player) && !(entity instanceof ArmorStand) && !(entity instanceof Item)) .filter(entity -> !(entity instanceof Player) && !(entity instanceof ArmorStand) && !(entity instanceof Item))
.filter(entity -> entity.isCustomNameVisible() && entity.getCustomName() != null) .filter(entity -> entity.isCustomNameVisible() && entity.getCustomName() != null)
.filter(entity -> !getTeams().containsKey(entity)) .filter(entity -> !getTeams().containsKey(entity))
.collect(Collectors.toList())
.forEach(Entity::remove); .forEach(Entity::remove);
List<Kit> kitList = Lists.newArrayList(game.GetKits()).stream() List<Kit> kitList = Lists.newArrayList(game.GetKits()).stream()
@ -237,7 +232,8 @@ public class NewGameLobbyManager extends LobbyManager
Location entLoc = _singleLocs.get(name); Location entLoc = _singleLocs.get(name);
setKit(kit, entLoc); setKit(kit, entLoc);
} }
} else }
else
{ {
int shift = 0; int shift = 0;
@ -368,7 +364,8 @@ public class NewGameLobbyManager extends LobbyManager
if (kit.GetAvailability() == KitAvailability.Gem) if (kit.GetAvailability() == KitAvailability.Gem)
{ {
data = 5; data = 5;
} else if (kit.GetAvailability() == KitAvailability.Achievement) }
else if (kit.GetAvailability() == KitAvailability.Achievement)
{ {
data = 2; data = 2;
} }
@ -446,24 +443,7 @@ public class NewGameLobbyManager extends LobbyManager
return; return;
} }
entLoc.getChunk().load(); entLoc.setYaw(getYawToSpawn(entLoc, true));
Location yawLoc = entLoc.clone();
float yaw = 90;
if (yawLoc.getBlockX() < 0)
{
yaw = 270;
}
if (yawLoc.getBlockZ() == 13)
{
yaw = 180;
}
entLoc.setYaw(yaw);
kit.getGameKit().createNPC(entLoc); kit.getGameKit().createNPC(entLoc);
} }
@ -514,17 +494,20 @@ public class NewGameLobbyManager extends LobbyManager
if (locations.size() == 1) if (locations.size() == 1)
{ {
_singleLocs.put(lastName, locations.get(0)); _singleLocs.put(lastName, locations.get(0));
} else }
else
{ {
_multipleLocs.put(lastName, locations); _multipleLocs.put(lastName, locations);
} }
} else if(name.equalsIgnoreCase("MAP_NAME")) }
else if (name.equalsIgnoreCase("MAP_NAME"))
{ {
if(tokens[1].toLowerCase().contains("halloween")) if (tokens[1].toLowerCase().contains("halloween"))
{ {
WORLD.setTime(13850); WORLD.setTime(13850);
} }
} else }
else
{ {
lastName = tokens[1]; lastName = tokens[1];
} }
@ -536,8 +519,7 @@ public class NewGameLobbyManager extends LobbyManager
if (carl != null) if (carl != null)
{ {
carl.add(0, 0.5, 0); carl.add(0, 0.5, 0);
float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(carl, getSpawn())); carl.setYaw(getYawToSpawn(carl, false));
carl.setYaw(yaw);
setCarl(carl); setCarl(carl);
} }
@ -546,8 +528,7 @@ public class NewGameLobbyManager extends LobbyManager
if (missions != null) if (missions != null)
{ {
missions.add(0, 0.5, 0); missions.add(0, 0.5, 0);
float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(missions, getSpawn())); missions.setYaw(getYawToSpawn(missions, false));
missions.setYaw(yaw);
setMissions(missions); setMissions(missions);
} }
@ -555,7 +536,7 @@ public class NewGameLobbyManager extends LobbyManager
Location amp = _singleLocs.get(DataLoc.AMP.name()); Location amp = _singleLocs.get(DataLoc.AMP.name());
if (amp != null) if (amp != null)
{ {
amp.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(amp, getSpawn()))); amp.setYaw(getYawToSpawn(missions, false));
setAmpStand(amp); setAmpStand(amp);
} }
} }
@ -567,7 +548,8 @@ public class NewGameLobbyManager extends LobbyManager
try try
{ {
return new Location(WORLD, Integer.valueOf(coords[0]) + 0.5, Integer.valueOf(coords[1]), Integer.valueOf(coords[2]) + 0.5); return new Location(WORLD, Integer.valueOf(coords[0]) + 0.5, Integer.valueOf(coords[1]), Integer.valueOf(coords[2]) + 0.5);
} catch (Exception e) }
catch (Exception e)
{ {
System.out.println("World Data Read Error: Invalid Location String [" + loc + "]"); System.out.println("World Data Read Error: Invalid Location String [" + loc + "]");
} }
@ -585,4 +567,10 @@ public class NewGameLobbyManager extends LobbyManager
} }
return ret; return ret;
} }
private float getYawToSpawn(Location location, boolean rounded)
{
float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory(location, getSpawn()));
return rounded ? Math.round(yaw / 90) * 90 : yaw;
}
} }