#help-development

1 messages · Page 1659 of 1

quaint mantle
#

what do you need to do?

#

this is a horrible system and should not be reccommended

#

why?

#

told em that twice and sent a better system

#

and how?

#

Bro

silver shuttle
#

Ok guys wait everyone, I am currently on adding the open inventories to a list and removing them from that list if they are closed, but somehow I keep running into this:
Cannot invoke "java.util.List.isEmpty()" because "this.inventoryList" is null

quaint mantle
#

that breaches the api, instead you can create a custom holder (non-api)

#

although InventoryHolder works perfectly its not intended to be used that way

silver shuttle
#

with what value

#

public List<Inventory> inventoryList = new ArrayList<>();?

#

sec

quaint mantle
#

HashSet to be exact

silver shuttle
#

what is the advantage of using a set in that case?

quaint mantle
silver shuttle
#

okayy

quaint mantle
#

how?

silver shuttle
#

fsr now the events dont fire anymore at all

quaint mantle
#

@sinful egret a custom inventory holder, thats not inside the api

#

expandable

quaint mantle
silver shuttle
#
public List<Inventory> inventoryList = new ArrayList<>();

I am opening the inventory called inv and adding it to the list

inventoryList.add(inv);

This event doesnt fire at all

    public void onInventoryClick(final InventoryClickEvent e) {
        if(inventoryList.isEmpty()) return;
        if((inventoryList.contains(e.getInventory()))) {
            e.setCancelled(true);
        }
    }
quaint mantle
#

EventHandler

#

and registered

silver shuttle
#

it has that, i just left it out in copypasta

#

and it is registered

quaint mantle
#

show where you register it

silver shuttle
#

it worked before without the checks so i know it works

quaint mantle
#

also like I said use a set

silver shuttle
#
getServer().getPluginManager().registerEvents(new inventoryTest(), this);
public HashSet<Inventory> inventoryList = new HashSet<>();
#

like I said, the events work

quaint mantle
#

Map = HashMap
Set = HashSet

silver shuttle
#

lemme print the set when it fires, one sec

quaint mantle
#

use naming conventions

#

MyClass

silver shuttle
#

this happens when i click in the gui i created now.
Above is the set which should contain that inventory, below is the inventory that's opened

#

i dont know why the set is empty

quaint mantle
#

do you add it

silver shuttle
#

yes...

quaint mantle
silver shuttle
#

whats a getter?

quaint mantle
#
private val a

A getA() -> return a
#

Exercise! Write that in java

silver shuttle
#

sorry, it's 3 am rn and I am kinda confused, is that related to the problem we have rn?

quaint mantle
#

better code development -> less errors -> better code

silver shuttle
#
    public Set<Inventory> inventoryList = new HashSet<>();

    public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
        HumanEntity ent = (HumanEntity) sender;
        Inventory inv = Bukkit.createInventory(null, 9, "Example");
        inv.addItem(createGuiItem(Material.DIAMOND_SWORD, "Example Sword", "§aFirst line of the lore", "§bSecond line of the lore"));
        inv.addItem(createGuiItem(Material.IRON_HELMET, "§bExample Helmet", "§aFirst line of the lore", "§bSecond line of the lore"));
        ent.openInventory(inv);
        inventoryList.add(inv);
        return false;
    }
    @EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        Bukkit.broadcastMessage(String.valueOf(inventoryList));
        Bukkit.broadcastMessage(String.valueOf(e.getInventory()));
        if(inventoryList.isEmpty()) return;
        if((inventoryList.contains(e.getInventory()))) {
            e.setCancelled(true);
        }
    }
eternal oxide
#

why have you got final on the event?

quaint mantle
silver shuttle
quaint mantle
#

ive been sending these code snippets for no reason? SadMan

silver shuttle
#

I only started Java 1 month ago

silver shuttle
pliant flame
#

Uh can someone tell me in their dev way why /restart can mess up the server? I'm trying to explain to something that thinks /restart is essential and it's there for a reason

silver shuttle
#

explain to someONE or someTHING?

quaint mantle
pliant flame
#

got it

silver shuttle
# quaint mantle use the system I sent you

I am so confused, I have the "InventoryList" as a public Set, when I open the Inventory and print the Set, it contains the correct inventory data, but when I then try to interact with it, the list is empty even though the closeEvent is not called

quaint mantle
#

are you somehow clearing it?

silver shuttle
#

no, not at all

quaint mantle
#

create a github so I can look over the code more clearly

silver shuttle
#

_>

#

sorry, but I don't really wanna share all this code together

quaint mantle
#

nobodys gonna steal it

#

you know how many plugins are open source

#

thousands

silver shuttle
#

yes i know, it's just a thing of myself

quaint mantle
silver shuttle
#

bruh I just added the definition of the Set to the main class and made it static and now it works

quaint mantle
#

?

#

post the code on github, I genuinly just wanna help make your code better

silver shuttle
#

I moved the definition of the Set from the class where I had all the events to the main class and now it works

quaint mantle
#

ill give you a full java course if I have to

pliant flame
silver shuttle
pliant flame
quaint mantle
pliant flame
#

mk

#

You know a plugin?

quaint mantle
#

?

ancient plank
#

I thought /restart just did basically the same thing as /stop, and that /reload was the only bad thing SC_ZERO_THINK

silver shuttle
#

just use BileTools

quaint mantle
#

stop stops the server and restart runs the startup file specified

silver shuttle
#

it supports most plugins

quaint mantle
#

tf is BileTools lol

silver shuttle
#

reload any plugin individually

#

like /reload for singular plugins and their dependencies

#

very useful and hard to break

quaint mantle
silver shuttle
#

just try the plugin, you'll love it

quaint mantle
#

no

silver shuttle
#

you can just drop your new plugin in and overwrite your old version, it'll automatically reload it from the new file

#

if you're using linux atleast ^^

pliant flame
#

Wait I just realized there are 2 different commands
/reload
/restart

quaint mantle
#

@pliant flame send me one of your github repos

silver shuttle
pliant flame
quaint mantle
#

@silver shuttle you

silver shuttle
#

wa

quaint mantle
#

send me one of your github repos

silver shuttle
#

you mean i should send my github repos?

#

I dont have any

quaint mantle
#

make one of the plugin youre making

silver shuttle
#

na

#

it's probably garbage code, I am getting scolded enough in other areas of my life lol

quaint mantle
#

ok

#

@ancient plank you

ancient plank
#

that used to be my old mentality

quaint mantle
#

do you even make bad code

ancient plank
#

now i just go w/ it

#

yes

#

I can assure u all my public github repos are s h i t

silver shuttle
#

don't try to convince me, not worth it

ancient plank
#

I made a discord-twitch chat relay

ancient plank
#

that one is kekw, first plugin i made

#

all my events are in one class lol

#

i was gonna rework it but I didn't feel like it

#

and it doesn't use a build system iirc?

#

yes.

quaint mantle
#
  1. Im sure thats illegal almost in every country
  2. Its nearly impossible to do safely
#

just use IGC 😩

#

ingame currency

#

yes

#

you are not going to make a bitcoin depositor safely

#

gl on finding help

#

those are payments

#

you can do this manually

#

I dont know why you fucking want to

pliant flame
#

sus

quaint mantle
#

youre losing money

#

?

#

so sketchy i cant help you

#

sounds like you want help creating a scam

#

if this were ever to get popular it'd be taken down by communities immediately

#

just dont 😉

#

who the fuck would fall for that

pliant flame
#

espically on a mc server

dusk flicker
quaint mantle
#

jesus

dusk flicker
#

then you are fucking stupid

ancient plank
#

can I do it

quaint mantle
#

youre bound to fail

dusk flicker
#

do it Adele

ancient plank
#

?b

dusk flicker
#

you should

#

you're gonna loose money in legal fees lol

#

you will lmao

#

you are too arrogant to not be

quaint mantle
#

?kick @unreal slate engaging and requesting help with illegal activities

undone axleBOT
#

Done. That felt good.

ancient plank
#

I was gonna ban em

quaint mantle
dusk flicker
#

honestly expected a ban

quaint mantle
#

go ahead

ancient plank
#

?ban 707431592900952076 engaging and request help w/ illegal activities

undone axleBOT
#

Done. That felt good.

dusk flicker
#

prob even talking about it is against discord TOS

quaint mantle
#

yeah

#

Im too nice

silver shuttle
#

How do you give an item an "invisible" name or just make their DisplayName empty?

#

prefferably via config

dusk flicker
dusk flicker
#

I normally just put a color code

#

&f

silver shuttle
#

both those didnt work fsr

#
redItem.getItemMeta().setDisplayName(Objects.requireNonNull(config.getString("gui.false-item.name")).replace("&", "§"));

Yes, I am not using the color code translator thingy and like this more

quaint mantle
#

that doesnt work

#

it will work

#

if you do it right

dusk flicker
#

I dont see the point of the requireNotNull

#

gonna throw an error either way

#

just put a default

ancient plank
#

y dont u like translate alternate colorcodes

silver shuttle
#

I need to not display the error in ingame chat if the message is empty

dusk flicker
#

either way thats not the problem

silver shuttle
dusk flicker
#

you are applying the name to a copy of the meta not the actual one

#

you need to assign the meta again

silver shuttle
#

oh okay

dusk flicker
#

ItemMeta meta = ItemStack#getItemMeta();
... perform stuff on meta
ItemStack#setItemMeta(meta);

#

cba to find the link on it

quaint mantle
#

?cba

undone axleBOT
#

Imajin#0001 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.

silver shuttle
#

lol

#
                        ItemStack redItem = new ItemStack(Material.valueOf(config.getString("gui.false-item.material")));
                        ItemMeta meta = redItem.getItemMeta();
                        meta.setDisplayName(Objects.requireNonNull(config.getString("gui.false-item.name")).replace("&", "§"));
                        redItem.setItemMeta(meta);

Should'nt that work now?

dusk flicker
#

should

silver shuttle
#

well it don't

dusk flicker
#

really should use the translate tho

silver shuttle
#

I have name: "" in my config file so thats not the problem

dusk flicker
#

put &f

#

in that

#

not sure if a space would work

silver shuttle
#

that works

#

ty

#

space works aswell

#

thank you kind sir

quaint mantle
#

hey hey

#

im wondering how i can make a holograms system, without looking at some 3rd party thing for refrence (Holograms API, etc.)

#

i have the spawning system done

#

and an easy way to see if its a hologram

#

now im just wondering how i can remove them...

#

because they dont delete if i Entity#remove() them

unkempt peak
#

They should definitely be removed

quaint mantle
#

yeahhhh

#

idk why they arent?

#

im just using ServerLoadEvent

#

i tried like, converting it frm a skript i made a while back which used on load

unkempt peak
#

Are you sure the method is running?

quaint mantle
#

not server

quaint mantle
#

it worked on the ServerLoadEvent im pretty usre?? im really not sure

#

plugin loads on starutp

unkempt peak
#

Why not use onEnable?

quaint mantle
#

ummmm

#

onload != onenable

quaint mantle
#

onload is before world gen

unkempt peak
#

Ah ok

quaint mantle
#

ahhh

#

i should use WorldLoad?

#

maybe make a task to wait a bit

#

bruh

#

just use onenable

#

well my plugin loads on startup

unkempt peak
#

Yes and that's after worlds load

quaint mantle
#

then make it post world. what are you even trying to do

quaint mantle
#

onload should be used for async/io preperation

unkempt peak
#

Just remove them onEnable

quaint mantle
#

i'll see about that aswell

#

although im fairly sure they arent even being removed, i can triple check

unkempt peak
#

The Entity#remove is not the issue

#

That most definitely works for armor stands

quaint mantle
#

ya

#

you shouldnt use real armorstamds anyways

#

theyll just die if a plugin clears entities

unkempt peak
#

Yeah you should use nms packets

quaint mantle
#

NMS classes seem to be obfusicated afaik

unkempt peak
#

Deobfuscate them then?

quaint mantle
#

ok

#

how??

unkempt peak
#

Install JD-GUI and open the spigot jar

quaint mantle
#

    @EventHandler
    public void onBlaze (EntityDeathEvent event) {
        if (event.getEntity() instanceof Blaze && event.getEntity().getKiller()instanceof Player) {
            Player player = (Player) event.getEntity().getKiller();

            int money = 25;

            player.giveExp(money);
            player.sendMessage(String.valueOf(money));
        }
    }
}```
#

any1 know y that aint working?

#

when i kill a blaze i dont get the xp or the chat message

quaint mantle
#

i did

bright quartz
#

sorry if this is a dumb question but is there any way to get the amt of ticks left inside of the method? I want to have like a 30 miinute/15 minute warning, and a command that lets players see how much time is left.

            public void run() {

            }
        }.runTaskTimer(this, 0L, 72000L);```
#

in other words, get how long until the task runs again

crude charm
#

and add to an int

#

then check that int

plucky wind
#

anyone know how i can start making plugins?

hasty prawn
#

?learnjava start here

undone axleBOT
plucky wind
#

Ty

sullen dome
#

any idea how to send a heart-symbol into the actionbar? i use ```java
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(Math.round(entity.getHealth() / 2) + " <heart-symbol>"));

but i can't find a way to display that symbol
young knoll
#

You should just be able to copy the emoji into the IDE

#

Or use the hex value

lofty laurel
#

or this ig

#

both should copy into your ide

young knoll
#

Using the Unicode value means you don’t have to save the file as UTF-8

#

\u###

stark marlin
#

Does anyone here have experience with registering placeholders for PlaceholderAPI? I'm trying to register a placeholder but it doesn't seem to work. Either that or there's something wrong with Featherboard that doesn't recognize it, but this is my class for the placeholder %islandalias%. I am calling the register method of PlaceholderExpansion in the onEnable() method
https://pastebin.com/CjijTwSn

sullen dome
#

weird, now it works.. before it just showed a weird rectangle idk

young knoll
#

There are several heart characters

#

Minecraft doesn’t have a texture for all of them

sullen dome
#
    private void checkForSight() {
        Bukkit.getOnlinePlayers().forEach(p -> {
            for (Entity e : p.getNearbyEntities(5, 5, 5)) {
                if (e instanceof LivingEntity && p.hasLineOfSight(e)) {
                    LivingEntity entity = (LivingEntity) e;
                    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(Math.round(entity.getHealth() / 2) + " §l❤"));
                }
            }
        });
    }

i guess i completely misunderstand how it should work? huh

stark marlin
# stark marlin Does anyone here have experience with registering placeholders for PlaceholderAP...

The issue might be that I have load: STARTUP in my plugin.yml and therefor the plugin seems to ignore that PlaceholderAPI is a softdependency, it still loads my plugin before PlaceholderAPI, and therefor I have to delay registering the placeholder with 1 tick so that the PlaceholderAPI plugin is enabled when doing it, but then Featherboard seems to initialize before the placeholder is registered instead. Any idea how I could get around this? 🤔

young knoll
#

Does it load or enable it before placeholder API

#

Or both

stark marlin
#

Not sure, I didn't know there was a difference. Is it possible to check that?

young knoll
#

Watch the messages in console

stark marlin
#

Yeah right, PlaceholderAPI is loaded before my plugin

#

But my plugin is enabled before though

young knoll
#

Huh

#

I would have imagined the opposite

stark marlin
#

Looks that way. It loads PlaceholderAPI, then my plugin, and then it enables my plugin and then enables PlaceholderAPI and Featherboard and lastly (delayed by one tick) it registers my placeholder so perhaps Featherboard ignores it for that reason
https://mclo.gs/KahGBdr

tidal skiff
#

if i wanted to check if an entity was dead or not would i check if its health is < 1?

#

or does that not save when an entity dies

young knoll
#

IIRC there is isDead

#

Or isAlive, one of those

tidal skiff
#

ah ok

#

ty

sage pine
#

My server's memory is constantly adding unnecessary allocated ram all the way to the max, even when a lot of memory is free. The server freezes and CPU usage drops to <.1% and i have to manually kill the server in the panel and start it back up. This happens 1-3x every day and ram just keeps allocating a few MB every minute. Please help.

Server version:

This server is running Purpur version git-Purpur-1331 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: 635d108 on ver/1.17.1)
You are 14 version(s) behind
Previous version: git-Tuinity-"dc9d19c" (MC: 1.17.1)

young knoll
#
  1. Update
  2. #help-server
  3. This is something you should ask Purpur about
ivory sleet
#

Ask in the Purpur discord

#

Really hard to support software we don’t maintain

quiet ice
sullen dome
#

how to get the health including absorption and stuff?

#

getHealth and getHealthScale seems to not include absorption

sage pine
# quiet ice Looks like an OOM, obvious fix is to set the -xmx at a lower value, since the he...

java -Xms128M -Xmx24000M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar purpur.jar nogui

These are my startups

quiet ice
#

Xmx24000M yea

chrome beacon
#

Xms and Xmx should be the same value

quiet ice
#

Do you really have 24 Gb of ram on your system?

tidal skiff
#
    @EventHandler
    public void onEntityHit(EntityDamageByEntityEvent e){

        if (!lastDamager.containsKey((Player) e.getEntity())) {

            e.getEntity().sendMessage("first mob attacked " + e.getDamager().getName());
            lastDamager.put((Player) e.getEntity(), e.getDamager());

        }else{

            e.getEntity().sendMessage("mob attacked " + e.getDamager().getName());
            lastDamager.remove((Player) e.getEntity());
            lastDamager.put((Player) e.getEntity(), e.getDamager());

        }

does anyone know why this isnt working? the messages arent even popping up

#

im trying to store the last entity that attacked a player

#

for every player

#

in a hashmap, as you can tell

young knoll
#

Is it registered

tidal skiff
#

yes

sullen dome
#

probably the map doesnt contain the player

#

tho, that would display the second message

quiet ice
sage pine
#

1g used for proxy bungeecord, and 6g for creative server

sullen dome
#

so yeah, show your event registration

young knoll
#

You are sending the message to the entity you attack

#

Are you attacking a player?

tidal skiff
#

e.getEntity() is the player being attacked

#

which in this case is me

sullen dome
#

try a sysout instead of sending a message.. to see if your event gets called

quiet ice
#

system overhead makes 1 more Gs, panel overhead another G and a half. You are running over your ram allowance.

sage pine
quiet ice
#

Did you ever set xmx=xms?

sage pine
#

I JUST changed it to 24g 2 hours ago

#

let me try rn

tidal skiff
#

a spider is a LivingEntity right

tidal skiff
#

it comes up with an error

#

Could not pass event EntityDamageByEntityEvent to Gammaplugin v1.0-SNAPSHOT
org.bukkit.event.EventException: null

quaint mantle
#

what do you override in nms to make it so an armour stand has no collision so it cant be hit/shot?

tidal skiff
#

im gonan check if the player getting attacked is an instance of a player before checking

#

prob wont do anything

#

i was right

#

it still comes up with an error

#

apparently spiders arent entities anymore

#

the spigot errors are so fking useless

#

it tells me nothing other than its an error

chrome beacon
#

It sends a whole stacktrace

#

If it doesn't you have some filter installed

quiet ice
#

which is dum

#

dont install a filter on a test server

tidal skiff
#

installed a filter

#

unless worldedit is a filter

#

which

#

yeah

#

its not

sage pine
tidal skiff
#

idk if its whats causing it but if u go to ur server.properties, you might have online-mode set to false

sage pine
#

nvm

#

it's back, but it literally took 3 minutes

tidal skiff
#

bruh

tidal skiff
#

nvm its nothing to do with ur server.properties

sage pine
#

online mode has nothing to do with server loading

tidal skiff
#

yes

#

thats waht i said

sage pine
tidal skiff
#

yes as in i agree

sullen dome
#

null error doesnt mean anything casting-related

tidal skiff
#

none of them are mine

#

wait

#

let me try find it

sullen dome
#

it starts with at: <your-package>......

tidal skiff
#

o ok found it

#

its

#

this

#

lie

#

line

#

ItemMeta bandaidMeta = ItemManager.bandaid.getItemMeta();

#

even though

#

this has nothing to do with it???

#

it was fine beforehand

sullen dome
#

did you changed something at this event after getting that error?

#

that could change the line

tidal skiff
#

lemme check

#

nope

sullen dome
#

bandaid is probably null

tidal skiff
#

i didnt change anything in the bandaid section of the event

sullen dome
#

i talk about in the whole class

#

if you did, build the plugin again, put it in your server, and run the event again.. then look at the error again

tidal skiff
#

idk what u mean

#

ok sure

#

ofc i changed something within the entire class

#

but i didnt change anything that should affect it

sullen dome
#

if you get an error, the problematic line of course depends on the current state. if you change anything later, the line changes probably

tidal skiff
#

now its line 142

#

wait

#

oh

#

.

#

Player p = (Player) e.getDamager();

#

a spider was hitting me

sullen dome
#

the damager is null

tidal skiff
#

fuck

#

ok ty lmfao

sullen dome
#

if(e.getDamager() instanceof Player)

#

before that

tidal skiff
#

yeah

lean gull
#

anyone know why this doesn't work?
if (player.getItemOnCursor().equals(null)) {
this doesn't either
if (player.getItemOnCursor().equals(new ItemStack(Material.AIR))) {

i tried to send the getItemOnCursor to console and it said something like ItemStack 0 AIR
so then i tried to add 0 to the second one and it still didn't work

sullen dome
#

Air isn't null

lean gull
#

alr, so what do i do?

sullen dome
#

depends

#

on what you want to do

lean gull
#

i want to see if the cursor doesn't have anything in it

vague oracle
#

Isn’t it meant to be == null

lean gull
#

oh riet

#

that explains why this worked in another class
if (player.getInventory().getHelmet() == null) {

sullen dome
#

if(itemstack != null || itemstack.getType() != Material.AIR)

#

^ returns true if the item is anything except air and null

lean gull
#

if (player.getItemOnCursor() == null) {
this doesn't work, i'll try the other one

#

IntelliJ also says it's always gonna be false

vague oracle
#

Then check if it’s air

lean gull
#

works now

#

if (player.getItemOnCursor().getType() == Material.AIR) {

#

ty

manic furnace
#

how can i check if a server is restarting with packets?

outer sorrel
#

how far is the players reach on blocks in survival?

quaint mantle
#

does anyone know why player.isBlocking() doesnt work?

#

it always returns false

#

has there been a change in 1.17

manic furnace
#

You can not blovk in 1.17

quaint mantle
#

are you serious?

manic furnace
#

you mean block with the sword?

quaint mantle
#

how do you check if someone is holding a shield

#

no

#

im checking if a player is right clicking with a shield

manic furnace
#

Oh

#

Ok

quaint mantle
#

it seems to always return null

#

isthere a way to check with nms?

tidal skiff
#

is there a way to get a skeleton entity from an arrow

#

or to check if the arrow was shot by a skeleton and then get the skeleton from the arrow

thick tundra
#

Im currently in the process of making a audioclient for minecraft.
I want to create speakers that pan from left to right depending on how the player rotates his head.

I currenty have this code, which works to a ceartain degree but it flips the value when im behind a block, and it only works for a certain radius:

public double getAudioLRValue(Player p, Location target){
Vector look = p.getLocation().getDirection().normalize();

Location head = p.getLocation().add(0, p.getEyeHeight(), 0);

Vector direction = head.subtract(target).toVector().normalize();

Vector cp = direction.crossProduct(look);
return cp.normalize().getZ();
}
#

How do I check if a location is to the left or right of a players head?

regal lake
#

Isn't it possible to change the duration of a effect in the EntityPotionEffectEvent Event ? ;o

quaint mantle
#
getNewEffect()
Gets new potion effect of the changed type to be applied.```
#

probably change this maybe

hasty fog
#

Oh how do you post code on discord :P

quaint mantle
#

''' but replace ' with `

tidal skiff
#

like that

regal lake
quaint mantle
#

whats the context of what youre trying to do

#

many ways around something

regal lake
#

I added a custom enchantment and want to reduce the duration of the negativ potion effect's e.g. slowness.

quaint mantle
#

custom enchantment on your armour?

regal lake
#

Yes

quaint mantle
#

why not cancel the event

#

and then apply a new effect copying the old effects attributes

#

i know it would loop infinitely but it looks like you can tag the reason it was applied

#

maybe use that as a guard clause?

#

other than that,

    public Map<String, Object> serialize() {
        return ImmutableMap.builder().put("effect", this.type.getId()).put("duration", this.duration).put("amplifier", this.amplifier).put("ambient", this.ambient).put("has-particles", this.particles).put("has-icon", this.icon).build();
    }```
this is in PotionEffect.class
#

can probably play around with nms if you want to go down that rabbit hole

calm whale
#

Hi, I have a structure on the main island in the end with gateway block as decoration, I want to teleport a player at a custom position when he join the end but he get's stuck in the gateway block, no matters the teleportCause, any ideas ?

regal lake
#

I already thought about that, but i wanted to know if there is a other solution as this looks like a "bad" solution 😄

#

I though there is maybe a way to change the duration and i don't saw it 😄

quaint mantle
#

could make your own custom event

#

cancel the EntityPotionEvent, parse in the potion data and then you can adjust it as you'd like

#

probably simplest way to do it

#

was going to suggest it first but thought you'd thought of it already

regal lake
#

Yea i guess i have to do something like that, i just don't understand why spigot don't implemented a setter for the duration ;o

quaint mantle
#

very niche i guess

manic furnace
#

how can i save the consol output in linux to a txt file

lost matrix
#

java -jar somejar.jar > console.txt

manic furnace
#

i want to save the consol from ngrok

lost matrix
#

What OS is ngrok running on?

manic furnace
#

linux ubuntu server 20.04 LTS

frigid ibex
#

Hi my server crashes as soon as it starts

lost matrix
lost matrix
frigid ibex
lost matrix
#

The version is full of bugs that will never be fixed

frigid ibex
#

is there no way that it will work?

lost matrix
narrow vessel
#

and please stop using 1.8

#

it is 2021

lost matrix
#

^

lost matrix
manic furnace
#

because its my hosting server

lost matrix
#

Anyways. Tell me if it works.

manic furnace
#

I does not work

lost matrix
manic furnace
#

Yes

lost matrix
#

How do you determine failure? What did not work?

manic furnace
#

It do not show the ngrok screen where you see the ip etc.. It just changes the line and do nothing

lost matrix
#

Did you check if a file was created after the command?

manic furnace
#

i created it before i ran the command

lost matrix
#

Because if you pipe then you dont see stdout. It will be written to the file instead.

#

And you dont need to create it.

manic furnace
#

yes t creates one

lost matrix
#

did you check the right location? Call ls from the location you used the command from.
Using the pipe operator should work unless the application does not run in the same terminal.

manic furnace
#

yes

lost matrix
#

This worked fine for me.
ps -ax | tee processes_info.txt

manic furnace
#

or me to

#

*for

sand rune
#

Guys , I learned the Types and Control Flows of java , so is that enough?

manic furnace
lost matrix
hasty fog
#

Anyone know what this could mean? Some of my users randomly get this error. Method is called from protocollib packet interceptor (doesn't matter if I use protocollib or my own packet interceptor, still happens). No idea what temporary players are.

lost matrix
#

Ive had the same issue yesterday. ProtocolLib implements the Player interface with a temporary Player.

chrome beacon
#

Yeah I just implemented a check to ignore them

hasty fog
#

How would you check for a temporary player? No idea what they are

chrome beacon
#

Use an instanceof check and check for TemporaryPlayer

hasty fog
#

Aha, thank you! Appreciate your help!

severe zenith
#

whats the return of Player.getScoreboard() when theres no scoreboard shown to the player?

eternal night
#

the player always has a scoreboard, if no custom one is set the main scoreboard of the server is returned afaik

hybrid spoke
#

there is a default one which every player has by default

severe zenith
calm whale
#

I would like to know if there is a way to cancel tick damage from wither rose ?

hybrid spoke
calm whale
#

nop

#

ah

#

maybe DamageCause.CONTACT

#

didn't try

calm whale
#

ah nop

#

I do not speak about wither

hybrid spoke
#

Damage caused by Wither potion effect

calm whale
#

the effect is already cancel

#

but it seems there is a damage like cactus

hybrid spoke
#

what else then

#

so check for thorns ig

calm whale
#

already canceled :/

hybrid spoke
calm whale
#
@EventHandler
    public void minionsProtection(EntityDamageEvent e){

        if(!(e.getEntity() instanceof Player) && e.getCause() != EntityDamageEvent.DamageCause.ENTITY_ATTACK && e.getCause() != EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK && e.getCause() == EntityDamageEvent.DamageCause.VOID && e.getCause() == EntityDamageEvent.DamageCause.DRAGON_BREATH && e.getCause() == EntityDamageEvent.DamageCause.FIRE)
            e.setCancelled(true);
    }```
#

I cancel all damage that is not from ENTITY_ATTACK, ENTITY_SWEEP_ATTACK, VOID, DRAGON_BREATH, FIRE

eternal night
#

where is wither in that xD

calm whale
#

you didn't read

eternal night
#

what ?

calm whale
#

wither is already cancelled

eternal night
#

oh so you cancel entity potion effect event ?

calm whale
#

🤦‍♂️

#

look, there is damageCause.WITHER

eternal night
#

oh

calm whale
#

I didn't put it in the previous list so it is cancelled

#

my condition is a whitelist, not a black

eternal night
#

LOL 😂 no

#

read your own if statement

#

carefully

#

tho tbh you could also just use a nicer event and not fail at boolean logic

#
@EventHandler
public void on(final EntityPotionEffectEvent event) {
    if (event.getCause() == EntityPotionEffectEvent.Cause.WITHER_ROSE) event.setCancelled(true);
}
#

works great

#

and you won't fail at a == b && a == c && b != c

calm whale
#

lul thnx

eternal night
#

🤦‍♂️ you get one back xD

calm whale
#

xD

eternal night
#

when are you calling the teleport method

#

e.g. what event

calm whale
#

PlayerTeleportEvent

#

in this condition

eternal night
#

you'll have to delay by a tick

calm whale
#
if(e.getTo().getWorld().getEnvironment() == World.Environment.THE_END && e.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL)```
eternal night
#

or change the to location

#

teleporting a player inside a player teleport event will just explode

#

so what exactly are you doing in that event 😅 could you provide a bit more

#

?paste

undone axleBOT
calm whale
#

euh...things 😅

eternal night
#

😅

calm whale
#

the code is very badly written I didn't clean it for the moment

grim ice
#

guys so i have an abstract class with a hashmap

#

i want to accrss the hashmap

#

without extending the abstract class

#

becuz im on a listner class rn

#

and the abstract class implements command executor

eternal night
calm whale
#

I'm trying to change the to location, I'll be back after the try

grim ice
#

how to access protected fields from abstract classes without extending them in java

#

is it even possible

calm whale
#

thnx it works

eternal night
#

no that is the entire point of protected fields

grim ice
#

o

#

can my listener class um

#

extend a abstract class

#

that is uhh

eternal night
#

yes ?

grim ice
#

implementing

eternal night
#

but why

grim ice
#

cmmandexecutor

spark hawk
#

Is there any video to learn how to code minecraft plugins?

grim ice
#

i have a protected hashmap there

eternal night
#

technically your listener just has to be in the same package

#

to access a protected member

grim ice
#

AAA ok ill move it there

#

rip my structure

sand rune
ivory sleet
#

Sounds like a class

sand rune
#

Yes that's what I told

#

So is that enough or I need more to be Pro Spigot Programmer

lost matrix
#

One line of code pls

lost matrix
lost matrix
#

You need to understand what an instance is and at least know the 3 basic data structures and one implementation of each.

#

Ok given the class CarTrader
Create an instance of that class.

sand rune
#

In the Class of CarTrader change the
Public class CarTrader {
}

To
Public instance CarTrader

The to reference it in another class

CarTrader meow = new CarTrader();

#

And the 3 basic data is

String
Int
Double
Boolean
Float
Char

lost matrix
#

Those are data types. Data structures are: List, Set, Map for example.

sand rune
#

Oh , what about the instance is it correct ?

#

@lost matrix

lost matrix
#

Yes. Not every sentence there makes sense to me but the right answer was CarTrader meow = new CarTrader();
One more thing.

sand rune
#

YAY!

#

So I need to learn the 3 basic type of data and is there other things ??? @lost matrix

grim ice
#

?paste

undone axleBOT
grim ice
lost matrix
# sand rune So I need to learn the 3 basic type of data and is there other things ??? <@2206...
public class CarTrader {

  private String carType = "BMW";

  public void setCarType(String type) {
    this.carType = carType;
  }

  public String getCarType() {
    return carType;
  }

}
  public static void main(final String[] args) {
    CarTrader traderA = new CarTrader();
    CarTrader traderB = new CarTrader();

    traderA.setCarType("Audi");
    String carType = traderB.getCarType();
    System.out.println(carType);
  }

What is the outcome of this codes execution?

grim ice
#

wait is this just java?

sand rune
#

Audi

lost matrix
grim ice
#

lemme try solving it @lost matrix

sand rune
#

No is BMW Bec of the setCarType

grim ice
#

yeah this is not audi

sand rune
#

It also cartype not type

lost matrix
grim ice
#

BaseCommand is an abstract class

#

implementing command executor

#

i couldnt just extend it

#

so i abused it being in the same package to access the protected hashmaps.e.tc

grim ice
#

lol

sand rune
#

See my answer

grim ice
#

also that thing u sent will pritn B,W

#

BMW

ivory sleet
grim ice
#

as abdo said

sand rune
grim ice
#

@sand rune ur last answer was correct, but why do u think it is?

ivory sleet
#

?kick @sand rune stop bumping

undone axleBOT
#

Done. That felt good.

grim ice
#

wtf

#

chill conclure lul

#

hes just tryna learn i feel bad for him

#

btw im arabic too @sand rune

sand rune
ivory sleet
#

Doesn’t mean you can inherently break the rules

lost matrix
grim ice
#

its even okay to remove the parameter, am i wrong

hybrid spoke
lost matrix
sand rune
#

String carType = trader.getCartype

ivory sleet
#

Luzifer fr

lost matrix
# sand rune Bec the setCarType , is set to CarType not type !

Maybe this makes it more clear:

    CarTrader traderA = new CarTrader();
    CarTrader traderB = new CarTrader();

    traderA.setCarType("Audi");
    traderB.setCarType("Opel");

    String carTypeAlpha = traderB.getCarType();
    String carTypeBeta = traderA.getCarType();

    System.out.println(carTypeAlpha);
    System.out.println(carTypeBeta);

What is the outcome?

hybrid spoke
sand rune
#

Mmmm
It should be BMW , Bec getCarType , Gets the Car type that's is BMW Bec the String is Private , is this the right answer ?

lost matrix
grim ice
#

"Bec the string is private" no, because the string was never changed from the started, you just got fooled with the method names

sand rune
#

._.

grim ice
#

no?

vital shale
#

Someone help me!

#

I getting error

grim ice
#

you didnt use the parameter

#

how is that?>

vital shale
#

Could not connect to default or fallback server!

#

Help please?

lost matrix
vague oracle
#

oh

#

:/

sand rune
vital shale
#

-_-

#

See config

grim ice
#

lemme try it it

vital shale
lost matrix
vital shale
#

So how can I setup it?

lost matrix
grim ice
#

@lost matrix yep ur wrong

#

it would print BMW BMW

lost matrix
grim ice
#

i did

#

it doesnt matter what u write

#

the param isnt even used

#

??

lost matrix
#

Oh wait i fked up in my CarTrader class

grim ice
#

lmao

#

u could remove the type param and it would still be the exact same

#

?learnjava @sand rune these are links if u wanna learn java

undone axleBOT
grim ice
#

try codecademy

#

youtube tutorials arent the best

calm whale
#

I would like to prevent block (flowers) from being destroyed by fireball explosion or water, I tried the BlockExplodeEvent but it is not triggered when the flower is destroyed, same thing for the BlockPhysicsEvent and the water

grim ice
#

here u go @lost matrix

#

public void setCarType(String type) {
this.carType = type;
}

#

:D

#

now with that it prints ur original outcome

#

u 100% know it, it prob was a blunder lol

lost matrix
grim ice
#

just check if blocks destroyed have flowers above them

calm whale
#

nop it doesn't work

#

and yes my event is registered

#

the blocks isn't destroy by the explosion

#

it is a fireball explosion on end stone block

#

the block resistance is too strong

lost matrix
#

I mean you also have to listen for the EntityExplodeEvent as this one is triggered by creapers and fireballs.

#

BlockExplode only covers beds.

grim ice
#

^

calm whale
#

ah

vale ember
#

when i am using protocollib and sending entity spawn packet with entityuid sometimes i get warning that entity with same entityuid already exist how to fix that i am on 1.17.1

calm whale
#

but there no block option in the EntityExplodeEvent

chrome beacon
grim ice
#

jk dont use that

chrome beacon
#

They are ints

#

I think that's the one they're talking about

vale ember
calm whale
#

my bad I can clear the blockList

lost matrix
# calm whale my bad I can clear the blockList
  @EventHandler
  public void onExplode(final EntityExplodeEvent event) {
    event.blockList().removeIf(this::isProtected);
  }

  @EventHandler
  public void onExplode(final BlockExplodeEvent event) {
    event.blockList().removeIf(this::isProtected);
  }

  private boolean isProtected(final Block block) {
    return Tag.FLOWERS.isTagged(block.getType()) || Tag.FLOWERS.isTagged(block.getRelative(BlockFace.UP).getType());
  }

Try this

opal juniper
#

is there a reason that chunk doesn't implement equals?

vale ember
grim ice
#

dunno i dont mess with nms

calm whale
#

and is there a solution for water ?

lost matrix
calm whale
#

xD

#

not this

#

flower by water

lost matrix
#

Ah. Uhm i think the FromToEvent

grim ice
#

just

lost matrix
#
  @EventHandler
  public void onFlow(final BlockFromToEvent event) {
    if (this.isProtected(event.getToBlock())) {
      event.setCancelled(true);
    }
  }
grim ice
#

boolean ez = true;
block break event {
for(block : blocks){
if(block is flower){
event.cancel
}
}
}

#

ez

calm whale
#

wow first time I see this event

#

thnx

grim ice
calm whale
#

I did

grim ice
#

if u did u wouldve found it easily lol

#

its on first page

#

lol

#

anyway who cares

spark hawk
#

Is there any video to learn to code minecraft plugins?

chrome beacon
#

Do you know Java?

lost matrix
grim ice
#

i recommend KodySimpson

#

his tutorial series has 72 episodes

#

its been going for years

#

and is still continued, he uploaded a vid on it 1 day ago

#

or 2

#

he also has a very good java tutorial

#

over 20 episodes i dont really remember

#

i could recommend it more than websites

spark hawk
#

Thx

queen niche
#

Does someone know a program that is able to check a folder on Malformed JSONs? I have a resource pack full of jsons, deleted the ones I don’t use, validated the ones I edited all seems fine but it keeps giving me a Json malformed error. https://0bin.net/paste/yJmiNBOE#lVn1phBXwG933t8FgPzD+Rwyjo5luZAU+NeNGUPzP0B

opal juniper
#

Im trying to teleport an entity when it is far away from players however i am having an issue where it is not getting teleported when it is that far away (assuming cause it is in unloaded chunks)

im trying to get this to work for both 1.8 and 1.17 so unfortunately i dont have the plugin chunk tickets Sadge

also - the method to cancel chunk unloads has been removed since 1.8 so i cannot use that... any ideas

eternal night
#

Run the same teleportation logic on chunk unload ?

#

To teleport the entity before it is unloaded

opal juniper
#

yeah... how do the methods like Chunk#load work? does it stay loaded for a while or does it immediately unload when mc sees there is no point of it being loaded?

eternal night
#

Pretty much

opal juniper
#

ig the other way to do it is to despawn the entity when it is about to go into empty chunks? that way i could wait until it is in loaded chunks again and respawn it?

for context i have a list of locations i am iterating thru and teleporting them along

#

i also avoid loading a tonne of chunks

grim ice
#

String resultMessage = deliveryMessage;
if(deliveryMessage.contains("@")) {
resultMessage = deliveryMessage.replace('@', ' ');
}

#

is this fine

#

i use result mesage later on

hybrid spoke
opal juniper
#

i think i have found a way

#

well

#

it seems to be working rn

quartz pike
#

just the replace

lofty laurel
#

im new to plugin development, how would i make a command only usable once? like once a player uses the command, they can not use it ever again

eternal night
#

you'd store their uuid in a form of persistency (e.g. a database) and validate that, when they run the command, their uuid does not exist in the persistency layer yet

#

another alternative, maybe better for you as you are new to plugin development, might be the PDC

#

or just writing it into a config file

eternal night
#

?pdc

eternal night
#

basically allows you to write data onto the player object directly that persists over a server restart

#

hence you could simply store a byte or something on the player and check agains tthat

grim ice
#

yes

#

thats only in minecraft 1,13+ tho

#

u gotta use nbt if ur under that

#

which is also ez

#

@lofty laurel LOL

#

I HAVE ANOTHER IDEA

#

give a player the permission to use it when he joins the server and hasnt played before

#

then when he runs it his permission get removed

#

thats the best way to do it imo

#

and simplest

lofty laurel
#

yeah thats probably better for me bc i've tried like 5 times and just getting an internal error when running the command lol

grim ice
#

but u need dependencies

#

like PEX

lofty laurel
#

i have luckperms

grim ice
#

o

#

ok use it

#

u can use that too

#

or just use luckperms or pex or whatever

#

i recommend this way more than nbt if ur under 1.13

#

if ur not

#

its easier to do with persistent data containers

#

i can spoonfeed you if u want

lofty laurel
grim ice
#

aha

#

then use permissions

#

tbh i dont recommend pdc at all

#

theyre too new

lofty laurel
grim ice
#

u cant make ur plugin cross version compatible with pdc

#

you would have to recode the whole thing

#

it can only be 1.14+

#

(there is a 1.13 pdc but no one knows it much LOL)

lean gull
grim ice
#

DONT USE PLAYER NAMES

#

:D

#

use UUIDs

lean gull
#

wdym

lofty laurel
#

yeh uuids alot better

lean gull
#

oh ok

lofty laurel
#

cuz then data doesn't get lost and stuff when someone changes their name

lean gull
#

i got it now

hybrid spoke
#

in this context you should use nothing

#

because its hardcoded

#

and thats the most bad thing you can do

lean gull
#

also how do i do that

hybrid spoke
#

just set the format

grim ice
#

and use switch case

#

not ifs

hybrid spoke
#

and replacing & with § in your sent message

#

the player checks are totally redundant

lofty laurel
lean gull
#

idk what you mean and i use translate cause someone told me it was better

#

and it's also a tiny bit easier to use

hybrid spoke
#

"better" is wrong here

lean gull
#

does it really matter tho

hybrid spoke
#

its better for the future since mojang could always remove § as the colorcode what will probably never happen

hybrid spoke
lean gull
#

alright, anyways so what do i do

hybrid spoke
#

first of all you should work with scoreboard teams

#

and not directly checking for the player

lean gull
#

wdym

hybrid spoke
#

you can prioritise players by their scoreboard team

#

f.e.: owner, admin, developer.

lean gull
#

can i use unicode letters for my custom textured ranks?

hybrid spoke
#

as long as minecraft supports them

#

yes

lean gull
#

alr, what about suffixes?

hybrid spoke
#

too

#

a scoreboard team provides both

#

a prefix and a suffix

lean gull
#

do i do in game or in java

hybrid spoke
#

in java

lean gull
#

aight

#

thanks

vernal pier
eternal night
#

the page has a history button

#

while not very easy to navigate it is possible

tardy delta
#

can i write the contents of a set to a file?

unreal quartz
#

literally on the top right

eternal night
#

tho a bit harder to find the right page for a version 😅

tardy delta
unreal quartz
#

helpfully the editor left a message for the change to 1.17

eternal night
#

yea, tho that message is sadly not uniform for other version updates xD Basically just look for "updated to"

vernal pier
#

thanks

rigid hazel
#

Same problem, but now with the gold blocks. I can't break them, until the chunk unloads and the loads again. How can I fix this? For the beacon I fixed it by get the block by the persistent data container.

#

@lost matrix Can you help again?

true perch
#

This SQL query is taking 10ms, I'm wondering if there's a way to reduce that at all. There's 11,621 rows within the database. java this.sendSQLCommand = this.mySQL.getConnection().prepareStatement("Select * from data_table where id="+id); this.allData = this.sendSQLCommand.executeQuery();

eternal night
#

10ms seems pretty okay for a full db call no ?

hybrid spoke
eternal night
#

10ms already includes the network connection as well

#

also why are you even using a prepared statement if you just hammer the variable into it anyway 😭

true perch
hybrid spoke
#

yes. database operations should be done async

true perch
#

The code is working, but when having to execute the query it takes 10 seconds per query.

#

I'm not sure how to do database operations async, or what that means

young knoll
#

10 seconds or 10 ms

true perch
eternal night
#

yea again, 10 milliseconds is perfectly fine for a DB call

hybrid spoke
#

^

gleaming grove
#

    @Override
    public void run() {
        //executions
               
    }
           
});```
#

Async in spigot

eternal night
#

if you cannot live with that blocking your server thread, then execute it off the main thread

true perch
#

When I do it like 50 times in succession though it causes lag

young knoll
#

You can also use CompletableFutures

young knoll
#

Ideally you shouldn’t be doing it that much

hybrid spoke
#

since you will need the return value

young knoll
#

Cache things

true perch
#

How do I cache things

rigid hazel
#

And don't call it every time

#

For example: By loading the server, store the table in the code and work with. By restarting the server just push the variable to the db

true perch
rigid hazel
#

There are many ways to store a db.

true perch
#

Are there any more efficient ways? I wanna be as efficient as possible

rigid hazel
#

And then add the things to the class a table have and save the table as that class.

#

That should be a very efficient way

true perch
#

Okay cool thank you :>

tardy delta
#

is this a good way to try to add an item to someone inventory at the given slot?

public static void tryToAddItemToInventory(Player player, int slot, ItemStack item) {
        PlayerInventory inventory = player.getInventory();
        while (inventory.getItem(slot) != null || inventory.getItem(slot).getType() != Material.AIR) {
            if (slot < inventory.getSize())
                slot++;
            else return;
        }
        inventory.setItem(slot, item);
    }
rigid hazel
#

@tardy delta Just use inventory.add(item);

tardy delta
#

that doesnt check if the slot is empty?

rigid hazel
#

if(inventory.isEmpty())

#

I think

tardy delta
#

no

stone sinew
tardy delta
#

or the type == material.AIR 🙂

rigid hazel
eternal night
#

just use addItem

tardy delta
#

i understand but i want to add the item at that slot and if that slot isnt empty add it somewhere else

rigid hazel
eternal night
#

it returns you a map that contains items that didn't fit

#

you can just check in there

tardy delta
#

mmmh

#

and to which slot does additem adds the item first?

young knoll
#

Top left

tardy delta
#

i want in hotbar

severe marsh
#

Upon reloading plugin entire config resets and deletes all changes that happened during runtime, how do I prevent this? I basically want those changes to stay.

rigid hazel
stone sinew
rigid hazel
severe marsh
rigid hazel
tardy delta
#

adding an item to slot and if thats not empty check other slots that come after it

severe marsh
#

That's what I was wondering

rigid hazel
young knoll
rigid hazel
#

Wait

rigid hazel
tardy delta
#

firstempty in which direction is that looking for a slot? 🥺

severe marsh
#

Should I put it in onDisable?

#

or it doesn't matter

rigid hazel
severe marsh
#

Alright thanks

tardy delta
#

i just wanted to let the distance between the target slot and the slot where its finnaly placed as small as possible

#

but yea if thats isnt possible : (

rigid hazel
tardy delta
#

math brrr

rigid hazel
severe marsh
#

getConfig().save(fileHere); how do I put file?

tardy delta
#

yea i dunno how

rigid hazel
severe marsh
#

No ;-;

rigid hazel
rigid hazel
stone sinew
#

Its gets the first empty slot of the inventory

#

if its -1 there are no empty slots

tardy delta
#

yea but it checks for empty slots beginning from the top left

young knoll
#

They want it as close to the target slot as possible

stone sinew
tardy delta
#

oh really

stone sinew
young knoll
#

Yes but if you want to put it at slot 10 and it’s full, first empty would still find slot 2 first

tardy delta
#

slot 0, 1, 2 etc are hotbar right?

#

or am i wrong

stone sinew
tardy delta
#

oh ok

stone sinew
#

@young knoll is right about firstEmpty though so keep that in mind

young knoll
#

If you want it close to a specific slot you can just use a loop and check if slot +- loop value is empty

tardy delta
#

bruh

#

i thought i could use firstempty and now its wrong

young knoll
#

First empty will find the first empty slot

#

Which isn’t necessarily the closest empty slot

quaint mantle
#

hello! How can I send a custom sound to a player?

#

but some users add new sounds via a resourcepack

paper viper
#

you cant use that enum for playing custom sound

#

you have to use the playSound method with a String

#

and for the string put the custom sound name

#

from the resourcepack

paper viper
#

Don't really have the time to look at the code closely, but that's not how you use adventure properly

#

you never use color codes in Component.text("")

#

instead, use NamedTextColor

#

like