#development

1 messages · Page 11 of 1

lyric gyro
#

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public class Nvod implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player){
            Player playerWhoToggled = (Player) sender;

            if(playerWhoToggled.hasPotionEffect(PotionEffectType.NIGHT_VISION)){
                playerWhoToggled.removePotionEffect(PotionEffectType.NIGHT_VISION);
                playerWhoToggled.sendMessage(ChatColor.RED + "Visão noturna desativada.");
            }else{
                playerWhoToggled.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 2147483647, 1, false, false));
                playerWhoToggled.sendMessage(ChatColor.GREEN + "Visão noturna ativada!");
            }






        }

        return false;
    }
}
#

and the actual command

proud pebble
#

RETURN TRUE

#

other then that should be ok

merry knoll
#

return TRUE

#

not false

#

otherwise it will spam the usage text

#

each time you use the command

lyric gyro
#

lmao

proud pebble
#

everytime

merry knoll
#

and clean up the empty lines

proud pebble
#

you added the command to the plugin.yml yes?

merry knoll
#

you are triggering my ocd

proud pebble
#

that too

merry knoll
lyric gyro
#

i did

#
version: '1.0 Birth'
main: me.systemoutprintln.nvod.Nvod
description: Enables/Disables Minecraft Nightvision effect when the command is toggled.

commands:
  nv:
    description: Liga e desliga a visão noturna.
    usage: /<command>



merry knoll
#

you are gucci then

#

try it

lyric gyro
#

i will

proud pebble
#

also please put a space between ){, if(, }else,else{

lyric gyro
#

i did this by myself (with help of course) 😎

lyric gyro
proud pebble
#

i dont have ocd

#

it just looks wrong if you don't

merry knoll
#

it clicks at one point then becomes easy

lyric gyro
#

how hard could it be ig

#

it isn't exactly a 3 headed monster

proud pebble
#

cerberus

merry knoll
#

general rule of thumb about any topic

#

is if it feels too easy, then chances are you just have no idea yet

lyric gyro
#

i struggle way to often

#

but its not as hard as i thought it was

merry knoll
#

or, you just dont know enough yet

lyric gyro
#

i mean coding is pretty hard

#

but the media portrays coding as something like

#

like that

merry knoll
#

you are currently at the top of mt.stupid

lyric gyro
#

i think im currently at valley of despair

lyric gyro
#

everyone goes through mt stupid at some point

merry knoll
#

exactly

lyric gyro
#

you already went through it

#

uhh Lunaiskey already went trough it

#

even kevin mitnick

#

considered one of the worlds best hackers

#

@merry knoll

#

question

#

can I just rename the folder i created my project without any problem?

#

or move it

merry knoll
#

depends

#

if you are using gradle / maven

#

then there should be no issues

lyric gyro
#

im using maven as a compiler

#

is that what you mean

merry knoll
#

for your dependencies etc

#

so yes

#

maven is not a compiler specifically

#

it keeps your project setup basically is the simplest way to explain it

lyric gyro
#

@merry knoll

#

it didnt work

#

what did i do wrong

#

i think i did something wrong while registering the code

merry knoll
#

whats the error

lyric gyro
#

the command i mean

merry knoll
#

or no error at all?

lyric gyro
#

the command doesnt exist

merry knoll
#

check console

#

ah

#

then show your on enable

#

oh

lyric gyro
#

ok

merry knoll
#

i got what the issue is

#

click on your jar

#

then open it with winrar

#

does it have plugin.yml in it

lyric gyro
#

it does

merry knoll
#

whats on your onEnable?

lyric gyro
#

im opening intellij hold up

#

launching i mean

#

whatever

lyric gyro
merry knoll
#

that looks correct

lyric gyro
#

the main class is called NvodMain btw

#

not Nvod

merry knoll
#

Nvod extends CommandExecutor right?

#

whats in your plugin.yml

lyric gyro
#

it implements command executor

#

not extends

#
version: '1.0 Birth'
main: me.systemoutprintln.nvod.Nvod
description: Enables/Disables Minecraft Nightvision effect when the command is toggled.

commands:
  nv:
    description: Liga e desliga a visão noturna.
    usage: /<command>
#

plugin.yml

merry knoll
#

whats on your console?

hoary scarab
#

me.systemoutprintln.nvod.Nvod
Isn't your main.

me.systemoutprintln.nvod.NvodMain is

merry knoll
#

oh yeah

#

main needs to point to your class

merry knoll
#

that extends JavaPlugin

lyric gyro
#

ok ok

hoary scarab
#

Console would tell you this BTW

lyric gyro
#

ill compile it and try again

shell moon
#

Someone?

lyric gyro
#

it still doesnt work @merry knoll

hoary scarab
#

But test it.

hoary scarab
merry knoll
#

you need to send it to every new player that logs in

hoary scarab
merry knoll
#

yes and they wouldnt be

#

you need to send the packet for them to be visible

lyric gyro
hoary scarab
#

Server would register them as mounted wouldn't it?

lyric gyro
#

but it's implementing command executor

merry knoll
#

not if they send a packet to clients

#

showing them as mounted

#

server doesnt know that they are mounted

hoary scarab
lyric gyro
#
org.bukkit.plugin.InvalidPluginException: main class `me.systemoutprintln.nvod.Nvod' does not extend JavaPlugin
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:87) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:327) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:248) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:305) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at java.lang.Thread.run(Thread.java:750) [?:1.8.0_342]
Caused by: java.lang.ClassCastException: class me.systemoutprintln.nvod.Nvod
        at java.lang.Class.asSubclass(Class.java:3404) ~[?:1.8.0_342]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:85) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]```
hoary scarab
lyric gyro
#

oh

#

main: me.systemoutprintln.nvod.NvodMain

#

here

hoary scarab
#

Yeap

hoary scarab
lyric gyro
#

i did everything you said

#

but now when i try to input /nv

#

it just says "/nv"

#

and nothing happens

hoary scarab
lyric gyro
#

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public class Nvod implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player){
            Player playerWhoToggled = (Player) sender;

            if(playerWhoToggled.hasPotionEffect(PotionEffectType.NIGHT_VISION)){
                playerWhoToggled.removePotionEffect(PotionEffectType.NIGHT_VISION);
                playerWhoToggled.sendMessage(ChatColor.RED + "Visão noturna desativada.");
            }else{
                playerWhoToggled.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 2147483647, 1, false, false));
                playerWhoToggled.sendMessage(ChatColor.GREEN + "Visão noturna ativada!");
            }






        }

        return true;
    }
}
lyric gyro
#

also

#

heres the main class

proud pebble
#

you beat me to it

lyric gyro
#

import org.bukkit.plugin.java.JavaPlugin;

public final class NvodMain extends JavaPlugin {

    @Override
    public void onEnable() {
        this.getCommand("nv").setExecutor(new NvodMain());
    }



    }

lyric gyro
proud pebble
#

thats the issue

#

new Nvod());

hoary scarab
lyric gyro
#

of course

lyric gyro
#

i-

hoary scarab
merry knoll
#

armor stand does not exist serverside

lyric gyro
#
    public void onEnable() {
        this.getCommand("nv").setExecutor(new Nvod());
    }```
#

is this correct

#

?

proud pebble
#

yes

hoary scarab
lyric gyro
#

YES

#

its working!!

hoary scarab
#

If you send a mount packet to the player won't the server also receive the packet to tell others its mounted?

lyric gyro
#

thank you guys

shell moon
#

Question would be then

#

how would they look like?

lyric gyro
#

now i can enjoy my 60 years of night vision 2

hoary scarab
shell moon
#

trynna make my mount system for a minigame but at this point everything bugs xd

hoary scarab
#

I'm pretty sure it shows as mounted because when I was testing my teacups ride I did this.

merry knoll
#

would be my guess

#

they are just normal from the server side

#

so thats how they will show to new players

olive dirge
#

Is there a way to append to a component a newline?

olive dirge
#

just looked through chat history

#

Component.newLine() is a thing I guess

hoary scarab
dark garnet
merry knoll
#

you just move it manually no?

#

and you can set its gravity

#

and as marker

#

to make it go through blocks etc

dark garnet
shell moon
#

mmmm

merry knoll
#

i would probably teleport it each tick

#

with grav off

dark garnet
#

looks rly choppy

merry knoll
#

hmm, you could maybe send location packets

#

instead of teleport packets

#

@dark garnet

#

this is the packet you need

#

not sure if there is an api method thats exposed that does it

dark garnet
#

is there anyway to do it without packets?

dusky harness
#

Maybe u have to set the velocity

#

So that the client can predict the next place the entity will be

#

Oh wait ur trying to disable gravity

#

Didn't read context

#

Can u show code

dark garnet
dark garnet
# dusky harness Can u show code
// Spawn ArmorStand
final ArmorStand stand = (ArmorStand) getWorld().spawnEntity(new SceneManager(id, "1", "1").getPoint(), EntityType.ARMOR_STAND);
stand.setInvulnerable(true);
stand.setPersistent(true);
stand.setCollidable(false);
//stand.setVisible(false);
//stand.setGravity(false);

// Set velocity towards next point
stand.setVelocity(points.get(nextPoint).toVector().subtract(stand.getLocation().toVector()).normalize().multiply(0.75));```
dusky harness
#

Assuming u uncommented out the gravity?

dark garnet
dense galleon
#

If PVP is turned off, player shot arrows are supposed to go through players right

lyric gyro
#

I think they bounce off

proud pebble
#

i thought they just hit the player but do no damage?

dense galleon
#

Well this is weird

#

I think it's a Minecraft bug actually

lyric gyro
#

what happens?

dense galleon
#

The arrow goes through players

#

But

#

The arrow shot becomes invisible to the shooter

#

Yet it's visible to everyone else + it can hit entities

lyric gyro
#

huh

dense galleon
#

You seeing that right

lyric gyro
#

if other players can still see it, issue is more than likely a client bug

dense galleon
#

It's vanilla 1.19.2 though

#

It's definitely an issue with Minecraft right

#

Could Paper maybe find a solution to it? Just looks like it's packets that are not being sent/received properly

dusky harness
#

i didn't know you could

dense galleon
#

pvp=false

dusky harness
#

o

broken elbow
#

lmao

lyric gyro
#

I'm just saying it's most likely a client bug

dense galleon
#

yeah it is

lyric gyro
#

e.getCursor().getItemMeta().getDisplayName() ChatColor.RED + "test item"
im checking if these two are equal. when i send a message containing both of them, they both appear as "test item" in red text yet they aren't equal. how do i fix this?

proud pebble
#

why do you want to see if they are equal? are you trying to identify the item?

lyric gyro
#

im trying to see if the item the player has in their cursor is the same as another item.

proud pebble
#

then the strings arent the same

#

i believe on new versions you can control + up to extract the item's data

#

do that and check the displayName

lyric gyro
#

on intellij or minecraft?

proud pebble
#

minecraft

#

tbh, your better off stripping the color codes from the string before you check them

#

tho if your trying to identify itemstacks, using pdc and setting an id on the item would be better.

#

cause using an items displayname and lore for identifying if its the same as another item or not is pain

lyric gyro
#

yeah i'll try out persistent data.

#

thanks

proud pebble
#

personally i just avoided using pdc and went with straight nms nbt

merry knoll
#

but packets is most likely way simpler

merry knoll
dark garnet
#

but in a thread i read they said that nms resets the velocity every tick when gravity is off

merry knoll
#

use the method on the last page instead

#

they override the whole velocity calculation part

dark garnet
# merry knoll use the method on the last page instead

this?

@Override
public void g(float f, float f1) {
    if (!hasGravity()) { // hasGravity() actually means hasNoGravity(), probably a mistake in deobfuscating.
        super.g(f, f1);
    } else {
        move(motX, motY, motZ); // Give them some velocity anyways ;3
    }
}
@Override
public void n() { // This method is called each tick. This also slowly multiplies each velocity by 0.98, so I just reset those values.
    if (hasGravity()) {
        double motX = this.motX, motY = this.motY, motZ = this.motZ;
        super.n();
        this.motX = motX;
        this.motY = motY;
        this.motZ = motZ;
    } else super.n();
}```
merry knoll
#

yes

dark garnet
#

i tried but im not sure what class and imports and such i would use

merry knoll
#

you are going to extend the nms version of armor stand

#

then use the new custom armor stand as your armor stand basically

dark garnet
merry knoll
#

you need the full server dependency

#

not just the spigot-api

dark garnet
merry knoll
#

just spigot is enough

#

you need to have it on your mavenlocal though

dark garnet
lyric gyro
#

p.getInventory().setHelmet(e.getCursor()); this line is in an inventory click event. it is setting the helmet before i click which is an issue because then i just pickup the helmet again. (i.e. if i click with red stained glass, i get 2 red stained glass because im picking up the one in my helmet slot). how do i fix this.

dusky harness
#

if you cancel the event, nothing will happen

#

(and don't set the helmet when cancelling it)

lyric gyro
#

ohhh cancel the click, thanks! do i set the helmet after cancelling it?

dark garnet
merry knoll
#

you can find how on spigot site

#

or if you are lazy, you can depend on a compiled jar (which you normally get from buildtools as well)

dark garnet
merry knoll
#

you dont, if you do it properly it will put the dependency on your maven local

#

then you put mavenlocal as your repo

#

and depend as normal

dark garnet
#

ok so i have BuildTools.jar, do i run it and keep the files it generates somewhere safe?

dusky harness
merry knoll
dusky harness
#

found in %USERHOME%\.m2

#

(I think that's the folder name)

#

and then just change spigot-api to spigot

proud pebble
#

all i had to do was run buildtools and change from spigot-api to spigot in the pom.xml

dark garnet
#

can i delete the files buildtools.jar generates in the folder its in?

dusky harness
dark garnet
#

alright

dark garnet
# merry knoll yes

There is no default constructor available in 'net.minecraft.world.entity.decoration.EntityArmorStand'

#
public class ArmorStandGravity extends EntityArmorStand {
    @Override
    public void g(float f, float f1) {
        if (!hasGravity()) { // hasGravity() actually means hasNoGravity(), probably a mistake in deobfuscating.
            super.g(f, f1);
        } else {
            move(motX, motY, motZ); // Give them some velocity anyways ;3
        }
    }
    @Override
    public void n() { // This method is called each tick. This also slowly multiplies each velocity by 0.98, so I just reset those values.
        if (hasGravity()) {
            double motX = this.motX, motY = this.motY, motZ = this.motZ;
            super.n();
            this.motX = motX;
            this.motY = motY;
            this.motZ = motZ;
        } else super.n();
    }
}```
winged pebble
#

You need to state which constructor you want to use

#

It can't infer it automatically

dark garnet
#

yea nothing is working idk y

#

'x()' in 'net.minecraft.world.entity.decoration.EntityArmorStand' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type

#

and for @Override for g:

Method does not override method from its superclass

#

'n()' in 'network.venox.lasertag.bukkit.ArmorStandGravity' clashes with 'n()' in 'net.minecraft.world.entity.decoration.EntityArmorStand'; attempting to use

#

Cannot resolve method 'hasGravity' in 'ArmorStandGravity'

#

Cannot resolve method 'move' in 'ArmorStandGravity'

#

Cannot resolve symbol 'motX'
Cannot resolve symbol 'motY'
Cannot resolve symbol 'motZ'

proud pebble
#

what version is this?

dark garnet
lyric gyro
#

i have a while loop with a certain condition inside. at the end of each loop i want to wait a second so that it does not lag servers. how would i do this? i've seen stuff like this

                    p.sendMessage("timer");
                }, 20L);```
but i don't think it's working.
dusky harness
#

while loops "stop time" until the loop has ended

#

what exactly do you want to do?

#

run code every second?

lyric gyro
#

yeah, i want to run certain code every second while a certain condition is met. do i replace the while loop with the scheduler instead?

dusky harness
#

yes, and here's an example:

#
new BukkitRunnable() { // not using normal scheduler since we want to cancel inside
    @Override
    public void run() {
        if (!condition) {
            cancel();
            return; // stop the code below from running
        }
        p.sendMessage("timer");
    }
}.runTaskTimer(sh, 10L, 20L); // runs 10 ticks after this timer is created, then 20 ticks after that until cancelled
lyric gyro
#

thanks!

#

sorry, what does it mean 10 ticks after it's created?

dusky harness
#
p.sendMessage("hello");
new BukkitRunnable() { // not using normal scheduler since we want to cancel inside
    @Override
    public void run() {
        if (!condition) {
            cancel();
            return; // stop the code below from running
        }
        p.sendMessage("timer");
    }
}.runTaskTimer(sh, 10L, 20L); // runs 10 ticks after this timer is created, then 20 ticks after that until cancelled
```It will send "hello", then 0.5 seconds later (which is 10 ticks) it will send "timer", then 1 second later (which is 20 ticks) it will send "timer" and keep sending every second until cancelled
lyric gyro
#

thank you so much :)

dark garnet
dark garnet
#

btw, for reference, im adding players as passengers to the armor stand

lyric gyro
#

i have a conditional that checks the item data of the item in a player's cursor slot. when this appears as air, i get errors as air does not have any item data and therefore is null. how would i fix this? Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()" because the return value of "org.bukkit.inventory.ItemStack.getItemMeta()" is nul

robust flower
#

can somebody explain to me why this code still spawn a visible Shulker head?

player.world.spawn(location, Shulker::class.java) {
    it.setAI(false)
    it.isInvisible = true
    it.isInvulnerable = true
    it.isGlowing = true
    it.addPotionEffect(INFINITE_INVISIBLE)
}
robust flower
dark garnet
#

or u can check if item meta is null

viral moth
#

check if the item is not null, and that it has itemmeta, and that the pdc is not null

dark garnet
robust flower
#

if you're lazy you can also do something like

Optional.ofNullable(item).map(ItemStack::getItemMeta).map(ItemMetadata::getPersistentDataContainer)
#

but you're probably going to need to keep a reference of item meta if you want to persist changes in the PDC

dark garnet
robust flower
#

I'm solving that problem that apparently 99% of devs face one day, which is to make a block "glow" (have a distinct colored outline that is visible through walls)

robust flower
dark garnet
lyric gyro
#

if i have something such as if (item.hasItemMetadata && item.getItemMeta.getPers... etc
pretend item is an item stack

would that still give an error or would it cancel after the first req and not go to the second if it's air.

viral moth
#

they go in order

dark garnet
robust flower
#

apparently spawning falling blocks destroy the current block in that location :/

hoary scarab
robust flower
#

how to get the block state id (ID of the block state that the falling block will represent) to send on the spawn entity packet?

winged pebble
olive dirge
#

outgoingRequests.get(p).remove(pl); why does this cause an error

#

Im getting a List from a map and removing a value

robust flower
olive dirge
#

I googled it and it seems like I needed to initialize it as a linkedlist

#

rather than just array.aslist

robust flower
#

could you copy paste the error here?

olive dirge
#
Caused by: java.lang.UnsupportedOperationException: remove
    at java.util.Iterator.remove(Iterator.java:102) ~[?:?]
    at java.util.AbstractCollection.remove(AbstractCollection.java:283) ~[?:?]
    at dev.failures.core.Commands.FriendsCommand.onCommand(FriendsCommand.java:72) ~[DrugCore.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
    ... 17 more
#

I couldn't .remove() from the list

robust flower
#

yeah, seems line your map is holding an immutable list

#

idk about your code, but to solve this you can either change whatever populates this map to use mutable lists, or create a copy of the current list without the undesired item(s) and set that back to the map (you could use java 8 Stream for that)

olive dirge
#

Yeah I solved it my creating a linkedlist<>(array.aslist())

robust flower
#

fyi you could use any implementation of list and that would work

olive dirge
#

got it

#

does entitydamagebyentityevent work if they're spawn protected

#

is spawn protected same as creative

robust flower
#

wdym with work? it does fire whenever an entity is damaged by another entity, and is only fired is the target is vulnerable to damage iirc

#

so it most likely does not fire against players immune to damage (like players on creative)

olive dirge
#

would it work in spawn protected regions

#

like pvp disabled in spawn

#

or is that the same protection as being in creative

robust flower
#

you mean a plugin disabling pvp in certain places (like WG) or disabling it through vanilla MC configurations? because basically plugin related stuff still fires the events, while vanilla MC stuff may not

olive dirge
#

okay got it

#

I've also been trying to disable console messages from mongo

#

but it still sends

#

Logger.getLogger("org.mongodb.driver").setLevel(Level.SEVERE);

#

I have this in onEnable()

robust flower
olive dirge
#

wow thats a lot more complicated than I thought

robust flower
#

idk maybe mongo has its own configuration for the log messages too 🤷‍♂️

robust flower
#

considering this byte table, to get a flag for both invisible and glowing I would have to do 0x20 | 0x40, right?

torpid raft
#

seems right

robust flower
#

nice, how do I get this thing?

robust flower
torpid raft
#

what if you do just the invisible effect

robust flower
#

let me try

torpid raft
#

seems like it might not work for falling blocks? 🤷‍♂️

#

never used packets so idrk what other options you have

lyric gyro
#

what if you spawn a falling block for air?

#

or void air or cave air

robust flower
#

idk even how to properly set the packet object data, it seems that for some reason Jungle Wood id works (WrappedBlockData.createData(Material.JUNGLE).data), but most materials give me ID 0, which does nothing

#

yup, with air set, nothing happens

#

when using this code:

val block = player.world.getBlockAt(location)
val blockId = WrappedBlockData.createData(block.type, block.data.toInt()).data```
the spawned "falling block" also becomes a jungle wood
robust flower
#

aaaaa was able to make it work, but at a cost I cannot pay

#
val block = player.world.getBlockAt(location)
val entityFallingBlock = EntityFallingBlock((player.world as CraftWorld).handle, location.x, location.y, location.z, (block as CraftBlock).nms)
val blockId = Block.getCombinedId(entityFallingBlock.block)

This Block.getCombinedId NMS method was the only thing so far that gave me the correct ID so the block materials matched the real thing

olive dirge
#

anyone know why I run into this error when using an online host

dense drift
#

Wrong version / jar?

#

d;PlayerAttemptPickupItemEvent

uneven lanternBOT
#
public class PlayerInteractAtEntityEvent
extends PlayerInteractEntityEvent```
PlayerInteractAtEntityEvent has 1 extensions, 1 all implementations, and  4 methods.
Description:

Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked.
Note that the client may sometimes spuriously send this packet in addition to PlayerInteractEntityEvent. Users are advised to listen to this (parent) class unless specifically required.

olive dirge
#

Actually that might be it, I used 1.19.2 paper

#

When my plugin was 1.19 paper

#

hmm, is that a big deal?

dense drift
#

AsyncChatEvent exists on 1.19 paper

#

Make sure you are using paper on the server, and not bukkit

olive dirge
#

got it

#

Also I'm getting Missing profile public key

#

is that a pebblehost thing?

#

I have viaversion in and I'm tryna join w/ 1.19.2

dense drift
#

Idk

lyric gyro
#

No that is a normal Minecraft server thing new to 1.19 server

dusky harness
#

But if he's connecting online mode on 1.19.2 shouldn't that error not happen?

#

Or could it be bc of viaversion

broken elbow
dusky harness
#

Yes but he said he's connecting with latest

broken elbow
#

he did?

#

ahh. he said with. yeah

#

I thought the server version was 1.19.2

robust flower
#

does the invisibility potion also acts on the Entity Metadata packet, or is it a separated thing?

grand zodiac
#

Is there any specific java version vendor I should use when making 1.19 spigot plugins?

sterile hinge
#

not really

olive dirge
#

for itembuilder.skull(), is there a way to use UUID to get skull

#

I see one option for texture and uuid

broken elbow
#

if so, you can use an offline player

#

and you can get an offline player from an uuid

olive dirge
#

Yeah I’m using skull from triumph

#

I don’t need an option for offline player for .texture

#

I don’t see*

broken elbow
#

itemBuilder.skull().owner(OfflinePlayer)

edgy lintel
#

does bytebuffer.asIntBuffer make the new buffer created share the old buffer's memory? or it is copied?

icy shadow
#

Creates a view of this byte buffer as an int buffer.
So it shares memory

edgy lintel
#

oh alr thx
i didnt know what view meant for real

#

thought it was like some reference map or sth idk

icy shadow
#

nah it usually means it will update if the underlying thing changes, but can't be modified itself

#

for example @UnmodifiableView

edgy lintel
#

ohhhhhhhhh

lyric gyro
#

can I have different servers in different versions?

edgy lintel
#

if you mean in bungeecord,yes

lyric gyro
#

k

edgy lintel
#

np

tight junco
lyric gyro
#

never heard of

tight junco
#

its a server software that can connect multiple spigot servers together allowing players to cross between them easily

lyric gyro
#

no

#

I just want to have different test servers

#

personal test servers

tight junco
#

are the test servers spigot servers

lyric gyro
#

yeah

#

one in 1.12.2

#

and the other in 1.19+

tight junco
#

well yeah you can use bungeecord to connect them al

edgy lintel
#

how do you truncate a nio bytebuffer

lyric gyro
#

why do i have to connect them

tight junco
#

i mean you dont have to

#

bungeecord for example would let someone join Test server 1, then type a command and switch to test server 2

lyric gyro
#

thats not what I want

tight junco
#

okay

lyric gyro
#

im just asking if I can just have two different spigot servers in my computer

tight junco
#

oh well then

#

yes

lyric gyro
#

one for testing plugins in 1.12.2 and the other in 1.19

tight junco
#

just make the ports different

lyric gyro
#

even if i just run one at a time?

tight junco
#

one server port by default can be 25565 and you could just set the other to 25566

#

you can start them at the same time

#

it just means connecting to the server will be a different ip

lyric gyro
#

i dont want to start them at the same time

tight junco
#

i know, but you can

lyric gyro
#

how do I change ports though

tight junco
#

server.properties

lyric gyro
#

k

lyric gyro
# tight junco server.properties

how do i start my spigot server specifically with java 17? (i have both java 8 and 17 installed for different versions of minecraft.)

grand zodiac
#

Does anyone know why my plugin doesnt load when I add this to my plugins main.java?

    @Override
    public void onEnable() {
        this.getCommand("gamemodecreative").setExecutor(new Main());
    }```

It loads when the this.getCommand part isnt there
tight junco
#

you need to find the path to the java.exe for the specific version you want

#

"<pathToJar>" -jar server.jar

#

i assume your command is your main class

#

First, Don't name your main class Main, name it the same as your plugin name because its good practice

#

secondly, you're making a new instance of your plugin when doing new Main(), you need to provide an already existing instance of it

#

so instead you can do setExecutor(this)

grand zodiac
#

ahh thank you

lyric gyro
#

i made this question once...

#

and im asking it once again

#

whats the event when a player sounds a goat horn

#

is it player consume event or interact event

#

they really could add a specific event just for this

proud pebble
#

its what ive done before when i wasnt entirely sure which event it was

lyric gyro
#

thats actually

#

a really good idea

#

ill do that

proud pebble
#

for figuringnout the type of sound you have to use nms to pull the nbt tag currently, woupdnt suprise me if they release an itemmeta for goat horns for getting the sound

lyric gyro
#

i just have to figure out the event first

hoary scarab
#

Why would the goat horn fire the "consume" event?

lyric gyro
#

I just want to make sure

#

its player interact event

proud pebble
#

consume is usually when you eat stuff

lyric gyro
#

hope i wrote the code correctly

#

would be embarrassing messing up such simple plugin

hoary scarab
#

Everything is simple until you start making it.

lyric gyro
#

its player interact event

#

i did what you said

#

thank you for the tip

#

by the way

#

ill always do that now

dusky harness
#

it's eating food, drinking potions/bottles, and drinking milk buckets

#

afaik

lyric gyro
#

time to starting coding fr

#

yay

lyric gyro
#

both consume and interact event

dusky harness
#

interact is when you first click

lyric gyro
#

just to make sure

dusky harness
#

and interact is also for regular left/right clicking too

lyric gyro
#

there is a way to prevent calling another interact event on cooldowns correct?

#

like the goat horn cooldown

dusky harness
#

uhhh idk how goat horns work

#

i didn't even know they were in the game

#

lol

#

interact event is always called though

#

you can cancel it though

#

you can't disable the event

lyric gyro
#

i can sound a goat horn and it will be on cooldown, but if i try to sound them again

#

it will still trigger the vent

dusky harness
#

yes

#

because you are clicking

lyric gyro
#

thus triggering the code again

#

that is a problem

#

i hope you understand what i mean

dusky harness
#

is it possible to see if it's on cooldown in spigot api?

#

yes i do

lyric gyro
#

i think it is

#

if it isnt possible with spigot then its probably possible with nms

#

why wouldnt it be though

dusky harness
#

I don't think it's possible in spigot yet

#

not from what i can see

#

huh what are bundles

#
Minecraft Wiki

A bundle is a storage item that can be used for managing items inside the player's inventory, and allows for combination of multiple item types within single inventory slots.

#

since when was this a thing 🥲

#

was looking in ItemMeta

#

theres no meta for horn

lyric gyro
dusky harness
#

oh ik about telescopes

#

hmm

lyric gyro
#

in minecraft ofc

dusky harness
#

i didn't know bundles were a thing though

lyric gyro
#

they were announced in 1.17

dusky harness
#

o wow

lyric gyro
#

i think it does

dusky harness
#

I can't find out how to do it in nms

#

although im not in intellij rn so I can't search as well

lyric gyro
#

here's a checklist of what i need to do:

#
  1. i need to get what horn the player just sounded
#

with nms

#
  1. i need to write a code on what should happen when the player sounds that specific horn
#
  1. i also need to check if its not on cooldown
#
  1. i need to increase the cooldown
#

sounds easy right? it isnt

dusky harness
lyric gyro
#

maybe i can do it all but step 3 will be hell

dusky harness
#

oh and getCooldown

#

try that

lyric gyro
#

hmm

dusky harness
#

._.

#

d;Player#getCooldown

uneven lanternBOT
#
int getCooldown(@NotNull Material material)```
Description:

Get the cooldown time in ticks remaining for the specified material.

Returns:

the remaining cooldown time in ticks

Parameters:

material - the material to check

dusky harness
#

oh

#

i cant type

#

try that

lyric gyro
#

that will be really helpful

#

i should start with something simple

#

so each horn

dusky harness
#

wait a minute

lyric gyro
#

will do something different

dusky harness
#

why don't you have any roles on my screen

lyric gyro
#

idk

#

im on level 10 iirc

dusky harness
#

does it say you have one

lyric gyro
#

but the bot simply removed my roles

dusky harness
#

lol

lyric gyro
#

and didnt add any new roles

dusky harness
#

💀 💀

lyric gyro
#

i don't have any roles 💀

#

they really should fix that bot

dusky harness
#

smh

#

bad @neat pier

lyric gyro
#

kind of embarrassing if you ask me

#

server where most members are programmers and we have a bot that doesnt even work properly

#

💀

dusky harness
#

mhm

#

💀

lyric gyro
#

i mean

#

whats harder

#

developing a plugin or a discord bot

dusky harness
#

none

#

just depends on what you want to do

icy shadow
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

dusky harness
#

HI BRISTER MITTEN_ _ _ _

#

How's your day

icy shadow
#

HI DKIM19375

#

not bad

#

hows yours

dusky harness
#

good

#

no school tomorrow

#

🎉

#

and no school monday

#

🎉

icy shadow
#

ha imagine having school

dusky harness
#

:(

icy shadow
#

didnt know the us starts that early

dusky harness
#

what

#

when does yours start

icy shadow
#

most people here dont go back for a few more weeks

dusky harness
#

WHAT

#

HUH

icy shadow
#

but the break starts in mid july

dusky harness
#

Oh

#

🤢

#

early june 😌

icy shadow
#

😭

dusky harness
#

😔

#

sorry brister mitten

icy shadow
#

it's ok

lyric gyro
#

currently i have a bukkitrunnable that stops once the helmet the person is wearing does not have certain nbt data. i want to add another conditional that stops the bukkitrunnable when they change their helmet and the items are the same (for example changing 1 diamond helmet with another). how would i do this?

stuck hearth
#

Add a conditional statement in the runnable that stops it

olive dirge
#
    private HashMap<String, Double> convertToMap(List<String> values) {
        HashMap<String,Double> data = new LinkedHashMap<>();
        Bukkit.broadcast(Component.text("" + values.size()));
        for(String value: values) {
            String[] split = value.split("-");
            data.put(split[0]+"-"+split[1], Double.valueOf(split[2]));
        }
        Bukkit.broadcast(Component.text("test"));
        return data;
    }

anyone know why it gets stuck in the for loop? I checked the size and it shows up as 1

#

the test message is never sent

icy shadow
#

what input are you giving?

lyric gyro
olive dirge
#

im dumb, I just checked it's cause I split by - and the UUIDs have -, so the map is messed

#

gosh darn

grand zodiac
broken elbow
grand zodiac
#

I have

#

but would that really cause the entire plugin to stop on startup?

icy shadow
#

yes, it cant register it properly without being in plugin.yml

broken elbow
#

it doesn't stop the plugin bcz the command doesn't exist, but bcz there's an NPE being thrown

grand zodiac
#

oh

#
name: HepnosEssentials
version: 1.0
author: Hepno
main: dev.hepno.hepnosessentials.HepnosEssentials
api-version: 1.19
commands:
  heal:
    description: Heals player to max health.
    usage: /<command>```
did i do it right?
broken elbow
#

show us your code as well

grand zodiac
#

okay

#
package dev.hepno.hepnosessentials;

import dev.hepno.hepnosessentials.commands.Heal;
import org.bukkit.command.CommandExecutor;
import org.bukkit.plugin.java.JavaPlugin;

public final class HepnosEssentials extends JavaPlugin implements CommandExecutor {

    @Override
    public void onEnable() {
        getCommand("heal").setExecutor(new Heal());
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}```

```java
package dev.hepno.hepnosessentials.commands;

import org.bukkit.attribute.Attribute;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class Heal implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player)) { return true; }
        Player player = (Player) sender;

        if (cmd.getName().equalsIgnoreCase("heal")) {
            double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
            player.setHealth(maxHealth);
            return true;
        }
        return true;
    }
}```
#

Here you go

broken elbow
#

if you open the jar, and check the plugin.yml file is the commands: part there?

grand zodiac
#

It's not

#

Strange, do you know why that may be?

broken elbow
#

hmm

#

where did you put the plugin.yml file in your project?

#

and what build tool do you use if you do use any

grand zodiac
grand zodiac
broken elbow
#

I believe with maven you have to put it in /src/resources/

grand zodiac
#

Ahh

#

That explains a lot tysm

broken elbow
#

tho. I wonder how it's creating another plugin.yml if yours is in the wrong place

grand zodiac
#

I believe it is because it created one automatically when using the IntelliJ plugin I am using

#

I was wondering why it asked for plugin.yml option when creating it without creating a file

#

It just put it in a different directory

#

Makes sense now

#

Tysm

broken elbow
#

just try to see if it works first

#

xD

grand zodiac
#

No issue on startup, lemme open MC and see if it works

#

WOO IT WORKS!!

#

Thank you so much!!

#

That feeling of both relief and frustration when youve been debugging for hours just to realise its the simplest of errors

warm steppe
# grand zodiac ```java package dev.hepno.hepnosessentials; import dev.hepno.hepnosessentials.c...
package dev.hepno.hepnosessentials.commands;

import org.bukkit.attribute.Attribute;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class Heal implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player player) {
            if (!cmd.getName().equalsIgnoreCase("heal")) return false;

            double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
            player.setHealth(maxHealth);
            return true;
        }
    }
}
grand zodiac
#

Already fixed it but thank you

olive dirge
#

I can't get skull().texture(String) to work

#

ItemBuilder.skull().texture("bfdf6d33294dec03f449a97c0fdca701773f2e218ec11771d6b48bb71322ab03").build()

#

It comes out like this

broken elbow
#

this is the one you want

olive dirge
#

I use the bigger one? gg

grand zodiac
#
target.sendMessage(ChatColor.translateAlternateColorCodes('&', "&d&lHepnosEssentials &8» &a" + player + "&7 healed you full max HP!"));```
```java
Player target = Bukkit.getPlayerExact(args[0]);```

Does anyone know how to get it to display "Hepno" instead of "CraftPlayer{name=Hepno}
broken elbow
#

or player.getDisplayName() to get the display name

lyric gyro
#

so i have a system where when you put on a certain block, you get a rainbow glass helmet. it constantly checks if the item on your head has certain nbt data, and if so, continues the loop. the issue, i want it so when you click on your helmet slot with the same item it stops the loop. although i do not know how to do this since they are same exact item. (clicking on rainbow glass helmet currently on head with glass would continue the loop as it would check for nbt data and obviously it would have that since same item).

grand zodiac
#

Is there a feature like world.getTime() that gets the time in AM/PM time or 24h time, instead of in ticks?

wintry grove
#

no

#

and I dont think there will

#

you will need to parse it yourself

#

but it is easy

grand zodiac
#

Ah, how do I do it?

wintry grove
#

1000 ticks is a minute iirc

#

let me check

#

no my bad

#

1800 ticks its a minute

#

you can parse it

#

to a 24h format

#

but it takes some thinking

grand zodiac
#

thanks

lyric gyro
#

why cant I get world?

broken elbow
#

hmm?

lyric gyro
#

import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;

public class Listeners implements Listener {

    @EventHandler
    public void usedGoatHorn (PlayerInteractEvent e){
        Player p = e.getPlayer();
        Material goatHorn = e.getMaterial();
        if (goatHorn == Material.GOAT_HORN){
            World world = e.getWorld
        }

        }


    }

#

I cant get world for material

#

which is odd

#

atleast for me

broken elbow
#

umm

#

p.getWorld()

lyric gyro
#

wait

#

yeah

#

I still cant do it

#

oh waait

#

now I can

#

I was copying code from another plugin I made

#

that one wasnt using a player object

#

just a projectile

#

so ig thats why

lyric gyro
# broken elbow umm

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;

public class Listeners implements Listener {

    @EventHandler
    public void usedGoatHorn (PlayerInteractEvent e){
        Player p = e.getPlayer();
        Material goatHorn = e.getMaterial();
        if (goatHorn == Material.GOAT_HORN){
            World world = p.getWorld();
            world.spawnEntity((Location) world, EntityType.GOAT);
        }

        }


    }```
#

Will this work?

#

Ill just test it

broken elbow
#

it will throw an error

#

to be more specific, this cast will throw an errir (Location) world

#

error*

lyric gyro
#

let me try to fix it rq

#

@broken elbow How do i fix this actually

#

yo

#

will anyone help me though

broken elbow
#

you don't cast the world to a location

broken elbow
lyric gyro
broken elbow
#

I'm assuming you want to spawn the goat where the player is?

lyric gyro
#

exactly

#

cause its a goat horn

broken elbow
#

yeah

lyric gyro
#

its calling a goat

broken elbow
#

player.getLocation()

lyric gyro
#

in this case

#

p.getlocation

#

right?

lyric gyro
# broken elbow player.getLocation()

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;

public class Listeners implements Listener {

    @EventHandler
    public void usedGoatHorn (PlayerInteractEvent e){
        Player p = e.getPlayer();
        Material goatHorn = e.getMaterial();
        if (goatHorn == Material.GOAT_HORN){
            World world = p.getWorld();
            world.spawnEntity(p.getLocation(), EntityType.GOAT)
        }

        }


    }```
#

i think im good now

broken elbow
#

probably yeah

lyric gyro
#

let's try this out

#

its like

#

the first time i do something like this

#

only trigger a specific action from a specific item

#

so i guess my confusion is reasonable

lyric gyro
#

guys

#

will a plugin made for 1.19.2 work on versions up to 1.18.1?

#

its a simple plugin

#

just a command that gives you infinite night vision

dusky harness
#

Set api-version in plugin.yml to 1
18

#

1.18

dusky harness
#

Not 1.19

lyric gyro
#

do I only have to do that

dusky harness
#

Yes

lyric gyro
#

or do I have to do something else

dusky harness
#

Then it will work

#

The only thing afaik is that spigot doesn't convert Sounds

#

The Sound names changed in 1.13

#

Besides that it should work fine I think

lyric gyro
#

thanks kotlin lover

dusky harness
#

Np

#

And also

#

For 1.12 and below, do not include api-version in plugin.yml

#

That will tell spigot that it is a legacy plugin

#

And will provide some conversions automatically

#

Sorta neat

lyric gyro
#

oh cool

lyric gyro
#

so uh

#

I just a code I made for a plugin to another project

#

its basically the same plugin

#

just in a more recent version

#

and I got 4 new warnings that weren't existent in the first project

#

is this an issue?

#

Not annotated parameter overrides @NotNull parameter

#

that's the warning

#

it repeats 4 times

#

in the same line

#

public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

#

thats the code causing the warnings

#

it's also happening in my main class

#

Method invocation 'setExecutor' may produce 'NullPointerException'

#

this.getCommand("nv").setExecutor(new Nvod());

#

is this a problem?

dusky harness
dusky harness
#

spigot has command aliases built-in

#

unless the cmd is actually just nv

lyric gyro
#

the command is just nv

#

and its already registered

#

properly

dusky harness
lyric gyro
#

i do

#

so

#

I asked that because sometimes

dusky harness
#

alr

lyric gyro
#

warnings can invalidate your code

#

idk if you understand

dusky harness
#

ye its good to know what the warnings mean

dusky harness
#

but again that doesn't really matter here

#

it is helpful at times which is why intellij shows the warning, but in this case it's not needed

lyric gyro
dusky harness
lyric gyro
#

I FINALLY

#

HAVE MY

#

LEVEL 10 ROLE

#

goddamint that took a while

dusky harness
#

🤣 🤣

#

🤣

#

🤣

lyric gyro
#

it gave it to me at level 11

dusky harness
#

wait no

#

not level 10

#

you're level 210

#

20

#

🤣

#

aka tier 2

#

wait no

#

ur level 11

lyric gyro
#

yeah im on tier 2

#

yeah

dusky harness
#

actually i dont know lol

lyric gyro
#

im on level 11

dusky harness
#

oh yea

#

im mixing it up

lyric gyro
#

just evolved

dusky harness
#

hmmm

#

@neat pier still bad

lyric gyro
#

I can send files now ✨

dusky harness
#

🎉

lyric gyro
#

no more imgur

#

i literally avoided sending screenshots of my code here just because i had to use imgur and i was lazy

dusky harness
#

?imgur

neat pierBOT
#
FAQ Answer:

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.

dusky harness
#

💀

#

code screenshot = bad

lyric gyro
#

yeah lol

robust flower
#

does anyone know why this code does not work? it runs just fine, the location of the block is correct, but it doesn't get updated (or removed in this case) by my client, the block still there. OBS.: checked with debugger, the player is me and the location is correct

// does nothing
player.sendBlockChange(location, Material.AIR.createBlockData())
// also does nothing
player.sendBlockChange(location, Material.JUNGLE_WOOD.createBlockData())```
pulsar ferry
#

Is something causing a block update as soon as you send the change which causes it to reset?

robust flower
#

nop, I return as soon as I set that from the event listener

#

apparently scheduling this code 1 tick later works...

#

does an invisible block that has collision exist?

pulsar ferry
proud pebble
robust flower
grand zodiac
#

Does player.setPlayerWeather(); set the weather for just the player, or the entire server?

icy shadow
#

d;spigot Player#setPlayerWeather

uneven lanternBOT
#
void setPlayerWeather(@NotNull WeatherType type)```
Description:

Sets the type of weather the player will see. When used, the weather status of the player is locked until resetPlayerWeather() is used.

Parameters:

type - The WeatherType enum type the player should experience

icy shadow
#

the former

#

as the name suggests

grand zodiac
#

Ah. Is there any way to set the worlds weather?

icy shadow
#

yeah idk the exact method lol

#

d;spigot weather

uneven lanternBOT
#
public enum WeatherType
extends Enum<WeatherType>```
WeatherType has 1 extensions, 3 all implementations, 2 methods, and  2 fields.
Description:

An enum of all current weather types

icy shadow
#

i guess a mix of setStorm and setThundering

grand zodiac
#

But that can only change weather theres a storm

hoary scarab
#

Is there really no event called when a shulker box is opened? (I can use InventoryOpenEvent but was hoping not to)

broken elbow
#

umm. I mean shulker boxes are inventories? why wouldn't you want to use IOE?

hoary scarab
#

Basically I was hoping for a lazy way to do what I needed lol

#

Oh nvm canceling the event won't open the shulker at all.

hoary scarab
#

ShulkerOpenEvent would still be nice cause the box has the opening animation so to run after the box is fully open or when it starts opening would be helpful

dusky harness
#

doesn't the inventory open immediately?

#

and I think the animation would be client side

hoary scarab
hoary scarab
dusky harness
#

Ohh

#

true

#

i forgot about that

#

I wonder if theres like some NMS method

hoary scarab
#

Yeah caused a dupe with my revamped minions cause I saved based on the entities last location and not their saved location.

dusky harness
#

💀

hoary scarab
#

Just gonna cancel opening the box if it moves the minion.

dusky harness
#

shouldn't you save the UUID?
Or I guess if it's in an unloaded chunk it could still dupe

dusky harness
#

wdym

#

I can only find AnimationStatus btw

#

for the shulker

#

which is just opened, closing, opening, and closed

#

oh wait

#

nvm

#

I found progress

hoary scarab
#

Like the entity can be renewed at any time. Removed, edited etc...

#

I would have to explain all my code to explain why lol

dusky harness
#

also can't pistons also move entities

#

or did you fix that already

hoary scarab
dusky harness
#

and water

hoary scarab
dusky harness
#

ah

#

doesn't seem like spigot has a method for shulker progress

#

weird

#

what versions of mc?

hoary scarab
#

1.19.2 - 1.8.8

wintry grove
#

Why

hoary scarab
wintry grove
#

Bruh

dusky harness
#

wait a minute

#

yapperyapps

#

you only need to know if the animation is opening, right?

dusky harness
#

but can't it push while opening?

hoary scarab
dusky harness
#

but it will still dupe

#

you need to stop it before it starts opening

hoary scarab
#

(When the server stops or minions are reloaded)

dusky harness
#

but what's the harm in checking when it's opening?

#

you won't have to change any data (or tp the minion back)

hoary scarab
dusky harness
hoary scarab
dusky harness
#

so you want to keep the shulker inventory open

#

and then after it opens

#

you close it again?

#

there probably is some nms method to cancel the animation

hoary scarab
#

Yes I want the inventory to open but not the shulker

dusky harness
#

Or maybe

#

is it possible to cancel the event

#

but still have the inventory access

#

I don't really touch inventories so I don't know about the details

hoary scarab
#

I was thinking get its inventory and send it to the player, but IDK if that would still use the shulkers inventory properly

dusky harness
#

ye thats what i was suggesting
I'd recommend trying that first

#

since it's prob much easier than nms

#

especially with both <1.14.4 and 1.14.4+

floral nacelle
#

I need help!

dusky harness
neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

dusky harness
#

this is coding help

#

just saying in advance since many get confused

somber gale
#

Has anyone here made a GitHub Action before where you create a jar in one job and then use that jar in another job?
I currently use a matrix to publish jars for four different platforms, but this currently has the major issue, that it basically creates all 4 jars 4 times.
I was considering using mvn --project :core,:${{ matrix.platform }} clean install to only build the required jars, but this would still make 4 separate calls to build core (Resulting in large amounts of dependency downloads), so preferrably would I like to make a single mvn clean install call here in the end...

dense drift
#

I mean, if the projects dont depend on eachother, you can run the maven tasks by targeting each plugin one by one

#

Can you share the workflow? You probably have it setup so it goes over the matrix once and then again for each element

hoary scarab
#

sigh because the code is in the InventoryOpenEvent I can't send the player the shulkers inventory because its creates an infinite loop

icy shadow
#

do a check for the shulker inventory then?

hoary scarab
icy shadow
#

so there shouldnt be any infinite loop

hoary scarab
broken elbow
#

just don't cancel the event

#

or do you want to completely cancel the animation?

hoary scarab
broken elbow
hoary scarab
dusky harness
#

oh wait

#

sorry for ping

#

didn't read

hoary scarab
#

Yeah I'm just canceling the event. They shouldn't try to push minions with shulkers anyways lol

dusky harness
hoary scarab
#

Message isn't needed. I do the same thing for pistons

robust flower
hoary scarab
robust flower
#

What I understood of what you wrote is that you want players to open the Shulker inventory but not play the animation, right? Or is the other way around? Cause you can do both with packets

hoary scarab
#

Its all written above lol.

Shulkerbox inventory opens the shulkerbox. I don't want the shulkerbox to open. Opening the shulkerboxes inventory opens the shulkerbox and causes an infinite loop.

robust flower
#

I'm sorry, I didn't get what you meant with all you wrote, what is the difference between "shulker box" and "shulkerbox"? Which one is the block and which one is the inventory?

grim oasis
#

shulker box opening = playing animation = moves entities, so it's not just client-side packets
and he wants the inventory to be openable by players

hoary scarab
robust flower
grim oasis
#

I presume using 1.19.2 as source and viaversion does the rest?

#

oh nvm

#

just only runs the shulker checks on 1.11+ servers, still no clue tho

robust flower
#

there's also possibility of using nms to disable Shulker collision, maybe that would work?

dusky harness
#

in nms you can get the animation state

#

and the progress

#

and so I assume you can set it

#

(didn't check)

hoary scarab
#

Lidded was shown earlier but it doesn't stop the animation

#

Only thing at the point that would work is create an inventory and mimic the shulkerbox but I didn't wanna do that. so I just cancel the event if its gonna push a minion

clever relic
#

anyone know of a good file converter API?

dusky harness
lyric gyro
#

yes

lyric gyro
#

how do you use getCooldown?

#

im kinda struggling with it

dense drift
#

d;HumanEntity#getCooldown

uneven lanternBOT
#
int getCooldown(@NotNull Material material)```
Description:

Get the cooldown time in ticks remaining for the specified material.

Returns:

the remaining cooldown time in ticks

Parameters:

material - the material to check

dense drift
#

What's the problem?

lyric gyro
#

wanted to check the cooldown for goat horn

dense drift
#

Player#getCooldown(Material here)

lyric gyro
#

ok

lyric gyro
#

that was really simple

lyric gyro
# dense drift Player#getCooldown(Material here)

import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.checkerframework.checker.nullness.qual.NonNull;

import static org.bukkit.Material.*;

public class Listeners implements Listener {

    @EventHandler
    public void usedGoatHorn (PlayerInteractEvent e){
        Player p = e.getPlayer();
        Material goatHorn = e.getMaterial();
        if (goatHorn == GOAT_HORN){
            p.getCooldown(GOAT_HORN);
            
            if (p.hasCooldown(GOAT_HORN)){
              return;  
            } else {
                World world = p.getWorld();
                world.spawnEntity(p.getLocation(), EntityType.GOAT);
            }
            
            
        }

        }


    }```
#

check if this is correct

#

please

dense drift
#

you don't need the getcooldown, I checked the wrong method, sorry

lyric gyro
#

why not

dense drift
#

well getCooldown will give you the remaining cooldown, and you don't need that

lyric gyro
#

oh hell

#

i just realised

hoary scarab
#

Your method is wrong anyways... You would need to put goatHorn not GOAT_HORN

lyric gyro
#

i really dont need it

#

since p.hasCooldown is a thing

dense drift
#

yup

lyric gyro
#

programming is cool but only when you are good at it

#

like most things in life