We need dat timer thinggy
This commit is contained in:
@@ -24,7 +24,6 @@ import java.util.List;
|
|||||||
import static fun.ogre.ogredupealias.utils.ServerUtils.hasBlockBelow;
|
import static fun.ogre.ogredupealias.utils.ServerUtils.hasBlockBelow;
|
||||||
|
|
||||||
public class TurfWarsEventListener implements Listener {
|
public class TurfWarsEventListener implements Listener {
|
||||||
ItemStack arrowItem = new ItemStack(Material.ARROW, 1);
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private static void handleAntiTurfWalk(PlayerMoveEvent e) {
|
private static void handleAntiTurfWalk(PlayerMoveEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
@@ -47,14 +46,6 @@ public class TurfWarsEventListener implements Listener {
|
|||||||
if (e.getEntity().getShooter() instanceof Player shooter) {
|
if (e.getEntity().getShooter() instanceof Player shooter) {
|
||||||
if (PlayerUtils.hasTag(shooter, "TWbomber")) {
|
if (PlayerUtils.hasTag(shooter, "TWbomber")) {
|
||||||
if (!(ent instanceof Snowball)) return;
|
if (!(ent instanceof Snowball)) return;
|
||||||
if (shooter.getUniqueId().toString().equals("049460f7-21cb-42f5-8059-d42752bf406f") && shooter.isSneaking()) {
|
|
||||||
if (e.getHitEntity() != null && e.getHitEntity() instanceof Player victim) {
|
|
||||||
explodeOnLand(shooter,e.getHitEntity().getLocation(),4D,4);
|
|
||||||
}
|
|
||||||
if (e.getHitBlock() != null) {
|
|
||||||
explodeOnLand(shooter,e.getHitBlock().getLocation(),8D,2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (e.getHitEntity() != null && e.getHitEntity() instanceof Player) {
|
if (e.getHitEntity() != null && e.getHitEntity() instanceof Player) {
|
||||||
explodeOnLand(shooter,e.getHitEntity().getLocation(),1.5,3);
|
explodeOnLand(shooter,e.getHitEntity().getLocation(),1.5,3);
|
||||||
}
|
}
|
||||||
@@ -94,12 +85,6 @@ public class TurfWarsEventListener implements Listener {
|
|||||||
private void handleShotgunShoot(EntityShootBowEvent e) {
|
private void handleShotgunShoot(EntityShootBowEvent e) {
|
||||||
if (e.getEntity() instanceof Player p) {
|
if (e.getEntity() instanceof Player p) {
|
||||||
if (!PlayerUtils.hasTag(p,"TWshredder")) return;
|
if (!PlayerUtils.hasTag(p,"TWshredder")) return;
|
||||||
if (p.getUniqueId().toString().equals("049460f7-21cb-42f5-8059-d42752bf406f")) {
|
|
||||||
shredderShot(p,4,7D);
|
|
||||||
}
|
|
||||||
if (p.getUniqueId().toString().equals("049460f7-21cb-42f5-8059-d42752bf406f") && p.isSneaking()) {
|
|
||||||
shredderShot(p,300,30D);
|
|
||||||
}
|
|
||||||
shredderShot(p,8,10D);
|
shredderShot(p,8,10D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
src/main/java/fun/ogre/ogredupealias/plugin/AntiLag.java
Normal file
17
src/main/java/fun/ogre/ogredupealias/plugin/AntiLag.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package fun.ogre.ogredupealias.plugin;
|
||||||
|
|
||||||
|
import fun.ogre.ogredupealias.OgreDupeAlias;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class AntiLag {
|
||||||
|
public void checkForLag(Player p) {
|
||||||
|
final Location origPos = p.getLocation();
|
||||||
|
Bukkit.getScheduler().runTaskLater(OgreDupeAlias.instance, () -> {
|
||||||
|
Location secondaryPos = p.getLocation();
|
||||||
|
double distance = origPos.distance(secondaryPos);
|
||||||
|
|
||||||
|
}, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
package fun.ogre.ogredupealias.plugin.funitems;
|
package fun.ogre.ogredupealias.plugin.funitems;
|
||||||
|
|
||||||
import fun.ogre.ogredupealias.OgreDupeAlias;
|
import fun.ogre.ogredupealias.OgreDupeAlias;
|
||||||
|
import fun.ogre.ogredupealias.data.builder.ItemBuilder;
|
||||||
import fun.ogre.ogredupealias.plugin.ItemPresets;
|
import fun.ogre.ogredupealias.plugin.ItemPresets;
|
||||||
import fun.ogre.ogredupealias.utils.ItemUtils;
|
import fun.ogre.ogredupealias.utils.*;
|
||||||
import fun.ogre.ogredupealias.utils.RaycastUtils;
|
import fun.ogre.ogredupealias.utils.raytracers.CustomDisplayRaytracer;
|
||||||
import fun.ogre.ogredupealias.utils.SoundPlayer;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Entity;
|
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.entity.WitherSkeleton;
|
||||||
import org.bukkit.event.block.Action;
|
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;
|
||||||
@@ -16,122 +19,27 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public
|
public class VoidCharm {
|
||||||
class
|
public static void handleVoidCharm(PlayerInteractEvent e) {
|
||||||
VoidCharm
|
Player p = e.getPlayer();
|
||||||
{
|
ItemStack stack = e.getItem();
|
||||||
public
|
Action a = e.getAction();
|
||||||
static
|
if (ItemUtils.matchDisplay(stack, ItemPresets.VOID_CHARM)) {
|
||||||
void
|
e.setCancelled(true);
|
||||||
handleVoidCharm
|
switch (a) {
|
||||||
(
|
case RIGHT_CLICK_AIR, RIGHT_CLICK_BLOCK -> {
|
||||||
PlayerInteractEvent e
|
Location start = p.getEyeLocation();
|
||||||
) {
|
Vector rot = p.getLocation().getDirection().normalize();
|
||||||
Player
|
SoundPlayer throwSound = new SoundPlayer(p.getLocation(), Sound.ITEM_TRIDENT_RIPTIDE_3, 1, 0.4F);
|
||||||
p =
|
throwSound.playWithin(10);
|
||||||
e.getPlayer();
|
RaycastUtils.raycast(start, rot, 60, 0.5, (point) -> {
|
||||||
ItemStack
|
World w = point.getWorld();
|
||||||
stack =
|
if (w == null) return false;
|
||||||
e.getItem();
|
List <Entity> targets = new ArrayList<>(w.getNearbyEntities(point, 0.5, 0.5, 0.5, entity -> {return entity instanceof LivingEntity living && !living.isDead() && living != p;}));
|
||||||
Action
|
Particle.DustOptions dust = new Particle.DustOptions(Color.BLACK, 1);
|
||||||
a =
|
|
||||||
e.getAction();
|
|
||||||
if
|
|
||||||
(
|
|
||||||
ItemUtils.matchDisplay
|
|
||||||
(
|
|
||||||
stack,
|
|
||||||
ItemPresets.VOID_CHARM
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
e.setCancelled
|
|
||||||
(
|
|
||||||
true
|
|
||||||
);
|
|
||||||
switch
|
|
||||||
(
|
|
||||||
a
|
|
||||||
)
|
|
||||||
{
|
|
||||||
case RIGHT_CLICK_AIR, RIGHT_CLICK_BLOCK
|
|
||||||
-> {
|
|
||||||
Location
|
|
||||||
start =
|
|
||||||
p.getEyeLocation();
|
|
||||||
Vector
|
|
||||||
rot =
|
|
||||||
p.getLocation()
|
|
||||||
.getDirection()
|
|
||||||
.normalize();
|
|
||||||
SoundPlayer
|
|
||||||
throwSound =
|
|
||||||
new
|
|
||||||
SoundPlayer
|
|
||||||
(
|
|
||||||
p.getLocation(),
|
|
||||||
Sound.ITEM_TRIDENT_RIPTIDE_3,
|
|
||||||
1,
|
|
||||||
0.4F
|
|
||||||
);
|
|
||||||
throwSound.
|
|
||||||
playWithin
|
|
||||||
(
|
|
||||||
10
|
|
||||||
);
|
|
||||||
RaycastUtils.
|
|
||||||
raycast
|
|
||||||
(
|
|
||||||
start,
|
|
||||||
rot,
|
|
||||||
60,
|
|
||||||
0.5,
|
|
||||||
(
|
|
||||||
point
|
|
||||||
)
|
|
||||||
->
|
|
||||||
{
|
|
||||||
World
|
|
||||||
w =
|
|
||||||
point.getWorld();
|
|
||||||
if
|
|
||||||
(
|
|
||||||
w == null
|
|
||||||
)
|
|
||||||
return false;
|
|
||||||
List
|
|
||||||
<Entity>
|
|
||||||
targets =
|
|
||||||
new ArrayList
|
|
||||||
<>
|
|
||||||
(
|
|
||||||
w.getNearbyEntities
|
|
||||||
(
|
|
||||||
point,
|
|
||||||
0.5,
|
|
||||||
0.5,
|
|
||||||
0.5,
|
|
||||||
entity
|
|
||||||
-> {
|
|
||||||
return
|
|
||||||
entity
|
|
||||||
instanceof
|
|
||||||
LivingEntity
|
|
||||||
living &&
|
|
||||||
!living.isDead() &&
|
|
||||||
living !=
|
|
||||||
p;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
Particle.
|
|
||||||
DustOptions
|
|
||||||
dust = new Particle.
|
|
||||||
DustOptions
|
|
||||||
(
|
|
||||||
Color.BLACK, 1
|
|
||||||
);
|
|
||||||
targets.forEach(target -> {
|
targets.forEach(target -> {
|
||||||
if (target instanceof LivingEntity living) {
|
if (target instanceof LivingEntity living) {
|
||||||
Location targetLoc = target.getLocation();
|
Location targetLoc = target.getLocation();
|
||||||
@@ -152,6 +60,39 @@ VoidCharm
|
|||||||
return !targets.isEmpty();
|
return !targets.isEmpty();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
case LEFT_CLICK_AIR, LEFT_CLICK_BLOCK -> {
|
||||||
|
Location start = p.getEyeLocation();
|
||||||
|
Vector rot = p.getLocation().getDirection().normalize();
|
||||||
|
SoundPlayer throwSound = new SoundPlayer(p.getLocation(), Sound.ITEM_TRIDENT_RIPTIDE_3, 1, 0.4F);
|
||||||
|
|
||||||
|
throwSound.playWithin(10);
|
||||||
|
Particle.DustOptions dust = new Particle.DustOptions(Color.BLACK, 1);
|
||||||
|
var result = CustomDisplayRaytracer.trace(start,rot,30,0.5,CustomDisplayRaytracer.HIT_BLOCK);
|
||||||
|
World w = result.getWorld();
|
||||||
|
WitherSkeleton ws = w.spawn(result.getLoc().clone().add(0,-3,0),WitherSkeleton.class, skeleton -> {
|
||||||
|
skeleton.setInvulnerable(true);
|
||||||
|
SoundPlayer spawnSound = new SoundPlayer(result.getLoc(), Sound.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1, 0.4F);
|
||||||
|
spawnSound.playWithin(20);
|
||||||
|
Bukkit.getScheduler().runTaskLater(OgreDupeAlias.instance,() -> {
|
||||||
|
skeleton.setInvulnerable(false);
|
||||||
|
skeleton.getEquipment().setHelmet(new ItemBuilder().material(Material.NETHERITE_HELMET).enchant(Enchantment.VANISHING_CURSE,1).enchant(Enchantment.PROTECTION_ENVIRONMENTAL,4).build());
|
||||||
|
skeleton.getEquipment().setChestplate(new ItemBuilder().material(Material.NETHERITE_CHESTPLATE).enchant(Enchantment.VANISHING_CURSE,1).enchant(Enchantment.PROTECTION_ENVIRONMENTAL,4).build());
|
||||||
|
skeleton.getEquipment().setLeggings(new ItemBuilder().material(Material.NETHERITE_LEGGINGS).enchant(Enchantment.VANISHING_CURSE,1).enchant(Enchantment.PROTECTION_ENVIRONMENTAL,4).build());
|
||||||
|
skeleton.getEquipment().setBoots(new ItemBuilder().material(Material.NETHERITE_BOOTS).enchant(Enchantment.VANISHING_CURSE,1).enchant(Enchantment.PROTECTION_ENVIRONMENTAL,4).build());
|
||||||
|
skeleton.getEquipment().setItemInMainHand(new ItemBuilder().material(Material.NETHERITE_SWORD).enchant(Enchantment.DAMAGE_ALL,5).build());
|
||||||
|
skeleton.setMaxHealth(40);
|
||||||
|
skeleton.setHealth(40);
|
||||||
|
skeleton.setCustomName(Text.color("&0[&8Nasghoul&0]"));
|
||||||
|
},80);
|
||||||
|
});
|
||||||
|
AtomicInteger counter = new AtomicInteger(0);
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(OgreDupeAlias.instance,() -> {
|
||||||
|
if (counter.getAndIncrement() > 80) return;
|
||||||
|
w.spawnParticle(Particle.REDSTONE, result.getLoc(), 50, 0.5, 0, 0.5, 0, dust);
|
||||||
|
w.spawnParticle(Particle.SQUID_INK, result.getLoc(), 50, 0.5, 0, 0.5, 0);
|
||||||
|
ws.teleport(ws.getLocation().add(0,0.04,0));
|
||||||
|
},0,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user