mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-08 07:27:39 +01:00
push
This commit is contained in:
commit
060e7a9856
@ -18,7 +18,7 @@ import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
@ -51,7 +51,7 @@ public class Item_Bomb extends Ability implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
final NoInteractItemEntity item = new NoInteractItemEntity(stats.getPlayer().getLocation().add(0, 1.2, 0), itemStack);
|
||||
final NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), itemStack);
|
||||
item.getEntity().setVelocity(((VectorAbilityResult) ability).getTarget().multiply(1.3));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 2, 0);
|
||||
|
||||
|
@ -16,7 +16,7 @@ import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
@ -45,7 +45,7 @@ public class Item_Throw extends Ability implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
final NoInteractItemEntity item = new NoInteractItemEntity(stats.getPlayer().getLocation().add(0, 1.2, 0), itemStack);
|
||||
final NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), itemStack);
|
||||
item.getEntity().setVelocity(((VectorAbilityResult) ability).getTarget().multiply(1.5 * ability.getModifier("force")));
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 0);
|
||||
new BukkitRunnable() {
|
||||
|
@ -23,7 +23,7 @@ import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
@ -69,7 +69,7 @@ public class Present_Throw extends Ability {
|
||||
double damage = ability.getModifier("damage");
|
||||
double radiusSquared = Math.pow(ability.getModifier("radius"), 2);
|
||||
|
||||
final NoInteractItemEntity item = new NoInteractItemEntity(stats.getPlayer().getLocation().add(0, 1.2, 0), present);
|
||||
final NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), present);
|
||||
item.getEntity().setVelocity(stats.getPlayer().getEyeLocation().getDirection().multiply(1.5 * ability.getModifier("force")));
|
||||
|
||||
/*
|
||||
|
@ -18,7 +18,7 @@ import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.AbilityResult;
|
||||
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.api.util.NoClipItem;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
@ -65,7 +65,7 @@ public class Throw_Up extends Ability implements Listener {
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_ZOMBIE_HURT, 1, 1);
|
||||
|
||||
NoInteractItemEntity item = new NoInteractItemEntity(stats.getPlayer().getLocation().add(0, 1.2, 0), MMOLib.plugin.getVersion().getWrapper().getNBTItem(new ItemStack(Material.ROTTEN_FLESH)).addTag(new ItemTag("noStack", random.nextInt(1000))).toItem());
|
||||
NoClipItem item = new NoClipItem(stats.getPlayer().getLocation().add(0, 1.2, 0), MMOLib.plugin.getVersion().getWrapper().getNBTItem(new ItemStack(Material.ROTTEN_FLESH)).addTag(new ItemTag("noStack", random.nextInt(1000))).toItem());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, () -> item.close(), 40);
|
||||
item.getEntity().setVelocity(loc.getDirection().multiply(.8));
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SMOKE_LARGE, stats.getPlayer().getLocation().add(0, 1.2, 0), 0, loc.getDirection().getX(), loc.getDirection().getY(), loc.getDirection().getZ(), 1);
|
||||
|
@ -7,11 +7,12 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
|
||||
public class NoInteractItemEntity implements Listener {
|
||||
public class NoClipItem implements Listener {
|
||||
private final Item item;
|
||||
|
||||
/**
|
||||
@ -23,7 +24,7 @@ public class NoInteractItemEntity implements Listener {
|
||||
* @param item
|
||||
* ItemStack used to summon the entity
|
||||
*/
|
||||
public NoInteractItemEntity(Location loc, ItemStack item) {
|
||||
public NoClipItem(Location loc, ItemStack item) {
|
||||
item.setAmount(1);
|
||||
|
||||
this.item = loc.getWorld().dropItem(loc, item);
|
||||
@ -38,16 +39,20 @@ public class NoInteractItemEntity implements Listener {
|
||||
|
||||
public void close() {
|
||||
item.remove();
|
||||
|
||||
EntityPortalEnterEvent.getHandlerList().unregister(this);
|
||||
InventoryPickupItemEvent.getHandlerList().unregister(this);
|
||||
}
|
||||
|
||||
// @EventHandler(priority = EventPriority.LOWEST)
|
||||
// public void a(InventoryPickupItemEvent event) {
|
||||
// if (event.getItem().equals(item))
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
|
||||
public void a(InventoryPickupItemEvent event) {
|
||||
if (event.getItem().equals(item)) {
|
||||
event.setCancelled(true);
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
|
||||
public void b(EntityPortalEnterEvent event) {
|
||||
if (event.getEntity().equals(item))
|
||||
close();
|
@ -16,7 +16,7 @@ public class CheckStatCommandTreeNode extends CommandTreeNode {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 2)
|
||||
if (args.length < 3)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
@ -24,7 +24,7 @@ public class CheckStatCommandTreeNode extends CommandTreeNode {
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
ItemStat stat = MMOItems.plugin.getStats().get(args[1].toUpperCase().replace("-", "_"));
|
||||
ItemStat stat = MMOItems.plugin.getStats().get(args[2].toUpperCase().replace("-", "_"));
|
||||
if (stat == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Couldn't find the stat called " + args[1].toUpperCase().replace("-", "_") + ".");
|
||||
return CommandResult.FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user