mirror of
https://github.com/SimplexDevelopment/FreedomNetworkSuite.git
synced 2025-06-26 19:44:27 +00:00
Update
This commit is contained in:
@ -1,16 +1,25 @@
|
||||
package me.totalfreedom.fossil;
|
||||
|
||||
import me.totalfreedom.base.CommonsBase;
|
||||
import me.totalfreedom.base.Registration;
|
||||
import me.totalfreedom.fossil.trail.Trailer;
|
||||
import me.totalfreedom.service.SubscriptionProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Fossil extends JavaPlugin
|
||||
{
|
||||
private final Trailer trailer = new Trailer();
|
||||
private final Registration registration = CommonsBase.getInstance()
|
||||
.getRegistrations();
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
CommonsBase.getInstance()
|
||||
.getRegistrations()
|
||||
.getModuleRegistry()
|
||||
.addModule(this);
|
||||
registration.getModuleRegistry()
|
||||
.addModule(this);
|
||||
|
||||
registration.getServiceRegistry()
|
||||
.registerService(
|
||||
SubscriptionProvider.syncService(this, trailer));
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class TrailItem extends ShopItem
|
||||
{
|
||||
public TrailItem(final Material material)
|
||||
public TrailItem()
|
||||
{
|
||||
super(material);
|
||||
super(Material.LINGERING_POTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,41 +1,37 @@
|
||||
package me.totalfreedom.fossil.trail;
|
||||
|
||||
import me.totalfreedom.particle.Trail;
|
||||
import me.totalfreedom.particle.TrailType;
|
||||
import me.totalfreedom.service.Service;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Trailer extends Service
|
||||
{
|
||||
private final List<Trail> trailList = new ArrayList<>();
|
||||
private final List<Trail> activeTrails = new ArrayList<>();
|
||||
|
||||
public Trailer() {
|
||||
// Cannot be async due to interaction with the world, and API interactions MUST be synchronized.
|
||||
public Trailer()
|
||||
{
|
||||
super("trailer_service");
|
||||
}
|
||||
|
||||
public void addTrail(final Trail trail) {
|
||||
this.trailList.add(trail);
|
||||
public void addTrail(final Trail trail)
|
||||
{
|
||||
this.activeTrails.add(trail);
|
||||
}
|
||||
|
||||
public void removeTrail(final Trail trail) {
|
||||
this.trailList.remove(trail);
|
||||
public void removeTrail(final Trail trail)
|
||||
{
|
||||
this.activeTrails.remove(trail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
for (final Trail trail : trailList) {
|
||||
if (trail.getAssociatedPlayer().isOnline()) {
|
||||
final Player player = (Player) trail.getAssociatedPlayer();
|
||||
|
||||
}
|
||||
for (final Trail trail : activeTrails)
|
||||
{
|
||||
trail.spawnParticle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package me.totalfreedom.fossil.trail.types;
|
||||
|
||||
import me.totalfreedom.particle.TrailType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public final class FlameTrail extends SimpleTrail
|
||||
{
|
||||
public FlameTrail(final Player player)
|
||||
{
|
||||
super(player, TrailType.FLAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle()
|
||||
{
|
||||
if (!getAssociatedPlayer().isOnline() || !isActive()) return;
|
||||
|
||||
final Player player = (Player) getAssociatedPlayer();
|
||||
final Location location = player.getLocation()
|
||||
.clone()
|
||||
.subtract(0, 1, 0);
|
||||
final Vector direction = location.getDirection();
|
||||
location.getWorld()
|
||||
.spawnParticle(getTrailType().getType(), location, 0, direction.getX(), direction.getY(),
|
||||
direction.getZ(), 0.1);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package me.totalfreedom.fossil.trail.types;
|
||||
|
||||
import me.totalfreedom.particle.TrailType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class HeartTrail extends SimpleTrail
|
||||
{
|
||||
public HeartTrail(final Player player)
|
||||
{
|
||||
super(player, TrailType.HEART);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle()
|
||||
{
|
||||
if (!getAssociatedPlayer().isOnline() || !isActive()) return;
|
||||
|
||||
final Player player = (Player) getAssociatedPlayer();
|
||||
final Location location = player.getLocation()
|
||||
.clone()
|
||||
.subtract(0, 1, 0);
|
||||
location.getWorld().spawnParticle(getTrailType().getType(), location, 1, 0.0, 0.5, 0.0);
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ public final class RainbowTrail extends SimpleTrail
|
||||
final Color color = currentColor.next();
|
||||
final Player player = (Player) getAssociatedPlayer();
|
||||
final Particle particle = getTrailType().getType();
|
||||
final Particle.DustOptions options = new Particle.DustOptions(color, 3);
|
||||
final Particle.DustOptions options = new Particle.DustOptions(color, 3F);
|
||||
final Location location = player.getLocation()
|
||||
.clone()
|
||||
.subtract(0, 1, 0);
|
||||
|
@ -0,0 +1,30 @@
|
||||
package me.totalfreedom.fossil.trail.types;
|
||||
|
||||
import me.totalfreedom.particle.TrailType;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class StrobeTrail extends SimpleTrail
|
||||
{
|
||||
private final Particle.DustTransition dustTransition;
|
||||
|
||||
public StrobeTrail(final Player player, final Color from, final Color to)
|
||||
{
|
||||
super(player, TrailType.STROBE);
|
||||
this.dustTransition = new Particle.DustTransition(from, to, 3F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle()
|
||||
{
|
||||
if (!getAssociatedPlayer().isOnline() || !isActive()) return;
|
||||
|
||||
final Player player = (Player) getAssociatedPlayer();
|
||||
final Location location = player.getLocation()
|
||||
.clone()
|
||||
.subtract(0, 1, 0);
|
||||
location.getWorld().spawnParticle(getTrailType().getType(), location, 1, 0.0, 0.5, 0.0, dustTransition);
|
||||
}
|
||||
}
|
@ -8,5 +8,4 @@ public final class TrailProvider
|
||||
return new BasicTrail(player);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user