Skip to content

Commit

Permalink
Merge pull request #415 from VolmitSoftware/Development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
NextdoorPsycho committed Apr 20, 2023
2 parents a73de7e + e9c8760 commit 2492537
Show file tree
Hide file tree
Showing 14 changed files with 1,796 additions and 9 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}

version '1.7.1-1.19.4'
version '1.7.2-1.19.4'
def nmsVersion = "1.19.4" //[NMS]
def apiVersion = '1.19'
def specialSourceVersion = '1.11.0' //[NMS]
Expand Down Expand Up @@ -155,9 +155,7 @@ dependencies {
implementation "com.github.TechFortress:GriefPrevention:16.18.1"
compileOnly fileTree(dir: 'libs', include: ['*.jar'])


// Shaded
implementation 'io.papermc:paperlib:1.0.5'
implementation 'net.kyori:adventure-text-minimessage:4.12.0'
implementation 'net.kyori:adventure-platform-bukkit:4.1.2'
implementation 'net.kyori:adventure-api:4.12.0'
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/volmit/adapt/Adapt.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.volmit.adapt.content.protector.FactionsClaimProtector;
import com.volmit.adapt.content.protector.ResidenceProtector;
import com.volmit.adapt.content.protector.WorldGuardProtector;
import com.volmit.adapt.nms.GlowingEntities;
import com.volmit.adapt.nms.NMS;
import com.volmit.adapt.util.*;
import com.volmit.adapt.util.secret.SecretSplash;
Expand Down Expand Up @@ -64,6 +65,8 @@ public class Adapt extends VolmitPlugin {
private final CommandAdapt commandAdapt = new CommandAdapt();
public boolean usingMagicCosmetics = Bukkit.getServer().getPluginManager().getPlugin("MagicCosmetics") != null;
@Getter
private GlowingEntities glowingEntities;
@Getter
private Ticker ticker;
@Getter
private AdaptServer adaptServer;
Expand All @@ -75,6 +78,7 @@ public class Adapt extends VolmitPlugin {
@Getter
private Map<String, Window> guiLeftovers = new HashMap<>();



public Adapt() {
super();
Expand Down Expand Up @@ -255,12 +259,14 @@ public void start() {
if (getServer().getPluginManager().getPlugin("Factions") != null) {
protectorRegistry.registerProtector(new FactionsClaimProtector());
}

if (getServer().getPluginManager().getPlugin("ChestProtect") != null) {
protectorRegistry.registerProtector(new ChestProtectProtector());
}
if (getServer().getPluginManager().getPlugin("Residence") != null) {
protectorRegistry.registerProtector(new ResidenceProtector());
}
glowingEntities = new GlowingEntities(this);
}

@Override
Expand Down
61 changes: 57 additions & 4 deletions src/main/java/com/volmit/adapt/api/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@
import org.bukkit.util.Vector;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.function.Predicate;

import static xyz.xenondevs.particle.utils.MathUtils.RANDOM;

public interface Component {
default void wisdom(Player p, long w) {
XP.wisdom(p, w);
Expand Down Expand Up @@ -267,6 +266,22 @@ default double getValue(Block block) {
return MaterialValue.getValue(block.getType());
}

default void vfxDome(Location center, double range, Color color, int particleCount) {
Particle.DustOptions dustOptions = new Particle.DustOptions(color, 1);
World world = center.getWorld();

for (int i = 0; i < particleCount; i++) {
double theta = 2 * Math.PI * RANDOM.nextDouble();
double phi = Math.PI / 2 * RANDOM.nextDouble(); // Adjusted range of phi to create a dome
double x = range * Math.sin(phi) * Math.cos(theta);
double y = range * Math.sin(phi) * Math.sin(theta);
double z = range * Math.cos(phi);

Location particleLocation = center.clone().add(x, y, z);
world.spawnParticle(Particle.REDSTONE, particleLocation, 0, 0, 0, 0, dustOptions);
}
}

default void vfxSphereV1(Player p, Location l, double radius, Particle particle, int verticalDensity, int radialDensity) {
for (double phi = 0; phi <= Math.PI; phi += Math.PI / verticalDensity) {
for (double theta = 0; theta <= 2 * Math.PI; theta += Math.PI / radialDensity) {
Expand Down Expand Up @@ -428,6 +443,44 @@ default void vfxPrismOutline(Location placer, double outset, Particle particle,
}
}

default void vfxCreateSphereAlt(Location center, double range, Color color, int particleCount) {
Particle.DustOptions dustOptions = new Particle.DustOptions(color, 1);
World world = center.getWorld();

for (int i = 0; i < particleCount; i++) {
double x, y, z;
do {
x = RANDOM.nextDouble() * 2 - 1;
y = RANDOM.nextDouble() * 2 - 1;
z = RANDOM.nextDouble() * 2 - 1;
} while (x * x + y * y + z * z > 1);

double magnitude = Math.sqrt(x * x + y * y + z * z);
x = x / magnitude * range;
y = y / magnitude * range;
z = z / magnitude * range;

Location particleLocation = center.clone().add(x, y, z);
world.spawnParticle(Particle.REDSTONE, particleLocation, 0, 0, 0, 0, dustOptions);
}
}

default void vfxSphereV3(Location center, double range, Color color, int particleCount) {
Particle.DustOptions dustOptions = new Particle.DustOptions(color, 1);
World world = center.getWorld();

for (int i = 0; i < particleCount; i++) {
double theta = 2 * Math.PI * RANDOM.nextDouble();
double phi = Math.acos(2 * RANDOM.nextDouble() - 1);
double x = range * Math.sin(phi) * Math.cos(theta);
double y = range * Math.sin(phi) * Math.sin(theta);
double z = range * Math.cos(phi);

Location particleLocation = center.clone().add(x, y, z);
world.spawnParticle(Particle.REDSTONE, particleLocation, 0, 0, 0, 0, dustOptions);
}
}


default void vfxLevelUp(Player p) {
p.spawnParticle(Particle.REVERSE_PORTAL, p.getLocation().clone().add(0, 1.7, 0), 100, 0.1, 0.1, 0.1, 4.1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ private boolean breakStuff(Block b, int power, Player player) {
b.getWorld().playSound(ll.getLocation(), Sound.ITEM_AXE_STRIP, 0.75f, 1.3f);

player.breakBlock(ll);
// ll.breakNaturally();
return true;
}

Expand Down

0 comments on commit 2492537

Please sign in to comment.