#help-development

1 messages · Page 190 of 1

fluid river
#

server is null

#

for some reason

fresh timber
#

hmm

#

I did change bungeecord names recently

#

server names

#

but that shouldnt do anything

#

cus its getting the name

#

well getting the server

#

this is what it thinks is wrong then

hazy parrot
#

I mean, it should throw if getServer is null

fluid river
#

you can't get the name

#

cuz the info is null

#

info is null cuz server is null too

hazy parrot
#

Npe would be thrown then

fluid river
#

exactly what's been thrown

hazy parrot
#

Oh lol, I was still at the part where he said there is no error

fluid river
#

hehe

#

from what i can see event doesn't provide server player is connecting to

#

and player doesn't have a server set

#

so it will always be null

#

you probably need

#

ServerConnectedEvent @fresh timber

dry forum
#
            <groupId>jerefla.com</groupId>
            <artifactId>sGUI</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>provided</scope>
            <systemPath>${project.basedir}/src/main/resources/sGUI-1.0-SNAPSHOT.jar</systemPath>
        </dependency>``` ```Cannot resolve jerefla.com:sGUI:1.0-SNAPSHOT ``` why is this happening
fluid river
#

scope compile maybe

dry forum
#

same error

fluid river
#

u sure your plugin is called same way in system path

dry forum
#

yea

fluid river
#

as in folder

dry forum
#

same directory, group id, artifact and everything

fluid river
#

hmm

river oracle
fluid river
#

have you tried to use maven update

river oracle
#

just install the other plugin into your m2

#

especially if its your own you'd be silly not to

dry forum
#

is there a doc or smthn on how to do that

river oracle
#

mvn install or mvn clean install

#

on the other project

#

than depend on it following the version and all and your good to go

dry forum
#

on the dependency project?

river oracle
#

yes

fluid river
dry forum
#

ok ty

fluid river
#

gtg sleep

#

cya guys

river oracle
#

if you for some reason don't have the source code you'll need to look up the format

dry forum
#
this environment variable is needed to run this program. ``` n i c e
river oracle
#

😂 oh boy you need to do that bud

#

surprised you made it that far without it

dry forum
#

i did

#

maven is broken or smthm...

#

ive literally had no problems for like a year making plugins but out of nowhere it does this

#

😕

river oracle
#

usually if you use intellij it will handle this for you

dry forum
#

it is

river oracle
#

did you check your environment variables

dry forum
#

yeah

#

jre/bin/java.exe

river oracle
#

why is it set to the jre?

dry forum
#

i tried the jdk as well

river oracle
#

🤷🏽‍♂️ idk then prob just a windows issue

#

who knows windows is wack make sure its setup in intellij or whatever if ur using that

dry forum
#

Caused by: java.lang.ClassNotFoundException: jerefla.com.smgui.GUI
<dependency> <groupId>jerefla.com</groupId> <artifactId>sGUI</artifactId> <version>1.0-SNAPSHOT</version> <scope>provided</scope> </dependency>

river oracle
#

thus not shading your dependency

#

your jar has to be in the server or shaded

dry forum
#

the dependency is just a library its not a plugin so i assumed provided would work alone

river oracle
#

do you know what provided does?

dry forum
#

kind of

river oracle
#

provided means your telling maven its going to be there

#

so maven doesn't add the classes to your jar when you run mvn package

#

you need to shade the dependency you can do this with maven shade plugin

dry forum
#

ah

#

ok i got it to work ty 😄

wet breach
#

Take a look at your variable and ensure it is pointing to the right place

fringe hemlock
#

Would you guys recommend a for loop or a .forEach() method? and why?

wet breach
#

It should be set to the bin directory and not the exe itself

wet breach
#

Foreach uses iterator and a for loop doesnt

#

If you don't need an iterator or need to iterate go with for loop

#

Also foreach works with using lambda more easily. Not that should mean it is better in your case

fringe hemlock
wet breach
#

Use a for loop then

#

No

river oracle
#

I use forEach just cuz its easier to read in some cases imo though thats not really a good reason as forEach has more overhead as far as Im aware

wet breach
#

Well in offline mode there is no security since the server doesnt bother to verify players. That is what happens in prelogin. Login happens after that and that is where they finally start joining the server

river oracle
# wet breach Use a for loop then

I'm curious what is the overhead of forEach like idk why but I often find myself using it where I could use a for loop also curious when you'd use forEach versus for loop

wet breach
#

Iterating is slower usually. But you get more you can do in foreach

wet breach
river oracle
#

ok I'm stupid but where would you use an iterator I don't think i've found myself ever neading to use one outside of file IO on non spigot related projects

wet breach
#

For instance if you want a set.

#

Some collections only have iterating

#

When you want to manipulate maps sometimes as well

#

Think of it like this. Foreach thing I want to do this other thing as well

#

No, but client does cache some stuff from last login. Not sure if coords is one of those

river oracle
#

curious on another random thing as well I know java streams has an initial overhead, but I often use it for sorting and filtering my lists is there any reason I should just not switch to normal for loop with a sort algo. TBH every time I think of anything java streams and end up using it there is always the thought in the back of my mind wondering why I use it. One would be convenience as its easier to do, but other than that can't think

wet breach
#

Streams are usually just as efficient. Anyways back to work for me. Be back in a couple of hours

river oracle
#

👋🏽

upper tendon
#

Could I execute code once a task ends? I’m thinking of having a runnable/task run itself once it ends, but am worried it may cause some stack overflow if i just put a new runnable in itself. I don’t want it on a timer, because I want a player to be able to end it early if wanted.

ocean ginkgo
#

schedule repeated tasks can be canceled.

upper tendon
#

but i don’t want it to quite cancel, i want it to run itself again, just sooner

vocal cloud
#

Is it guaranteed to be run?

#

You can always schedule them all at once

#

You can even store them so that they're cancelable

upper tendon
#

it’s game turns (on a time limit) so i want a player to be able to end their turn early, but also use up their full time - it’ll be completely canceled once the game ends

#

so it could be run like 2 times, or it could be run like 200 times -

#

wait no i think i’ve got an idea on how to do it

river oracle
#

Just make a class to handle this you'd want a timer class with a cancel method that executes your task on cancel

#

You could just tik down and if the player decides their turn is over or their turn Is over the cancel would be manually called triggering your function

wet breach
#

Then just schedule your runnable

mighty pine
#

is there a sculk related event at all

#

nvm i found it

sacred prairie
#

Hi, is there a way to disable / cancel that the elder guardian gives you his lovely Mining Fatigue Effect

jagged monolith
sacred prairie
#

ye, but still there is this animation, but i found a workaround by extending the EntityGuardianElder class and override the customServerAiStep() function

young knoll
#

You could just cancel the EntityPotionEffectEvent

fast path
#

java.lang.RuntimeException: java.io.IOException: Failed to deserialize object

#

import org.bukkit.inventory.ItemStack;
import org.bukkit.util.io.BukkitObjectInputStream;
import org.bukkit.util.io.BukkitObjectOutputStream;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class _Serializer {
    public static byte[] toBytes(ItemStack itemStack) throws IOException {
        try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
             BukkitObjectOutputStream objectOutputStream = new BukkitObjectOutputStream(outputStream)
        ) {
            objectOutputStream.writeObject(itemStack);
            return outputStream.toByteArray();
        }
    }

    public static ItemStack fromBytes(byte[] input) throws IOException, ClassNotFoundException {
        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
             BukkitObjectInputStream objectInputStream = new BukkitObjectInputStream(inputStream)
        ) {
            return (ItemStack) objectInputStream.readObject();
        }
    }

}
#

What did I do wrong?

tender shard
fast path
#
Caused by: java.io.IOException: Failed to deserialize object
        at org.bukkit.util.io.BukkitObjectInputStream.newIOException(BukkitObjectInputStream.java:59) ~[purpur-api-1.19.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.util.io.BukkitObjectInputStream.resolveObject(BukkitObjectInputStream.java:51) ~[purpur-api-1.19.1-R0.1-SNAPSHOT.jar:?]
        at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1795) ~[?:?]
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1744) ~[?:?]
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:514) ~[?:?]
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:472) ~[?:?]
eternal oxide
#

?paste FULL stacktrace

undone axleBOT
tender shard
#

yeah it's annoying when you only always post parts of it

#

the stacktraces are long for a reason, since every line there has a different information that might be useful

fast path
#
    ItemStack testA = new ItemStack(Material.DIAMOND) {{
            ItemMeta im = getItemMeta();
            assert im != null;
            im.setDisplayName(Colorful.convert("#123456testaaaaaa"));
            im.setLore(List.of("1", "2"));
            setItemMeta(im);
        }};
        try {
            byte[] testAByte = _Serializer.toBytes(testA);

            System.out.println(Arrays.toString(testAByte));
            String testAString = Base64.encode(testAByte);
            System.out.println((testAString));

            System.out.println(_Serializer.fromBytes(testAByte));
            System.out.println(_Serializer.fromBytes(Base64.decodeToByte(testAString)));
        } catch (IOException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
tender shard
#

these are my methods btw:

    public static byte[] toBytes(final ItemStack itemStack) throws IOException {
        try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final ObjectOutput objectOutputStream = new BukkitObjectOutputStream(outputStream)) {
            objectOutputStream.writeObject(itemStack);
            return outputStream.toByteArray();
        }
    }

    @SneakyThrows
    public static ItemStack fromBytes(final byte[] input) {
        try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(input); final BukkitObjectInputStream objectInputStream = new BukkitObjectInputStream(inputStream)) {
            return (ItemStack) objectInputStream.readObject();
        }
    }
fast path
#

It's same I think.

tender shard
#

what always helps in debugging faulty itemstacks, is to create a new YamlConfiguration, then do set("test",myItemStack), then print it out (saveAsString() or similar)

#

then see what it says

#

if that also fails, then your itemstack is somehow broken

#

or if reading it again fails

#

i once had this problem while using strings that look like json inside itemstack's PDC

fast path
chrome beacon
#

Why are you using the ItemStack constructor to change the item

#

Uhh wrong name

fast path
#

What

tender shard
#

why are you suddenly doing base64 stuff there?

#

I thought you were serializing to byte[] and not to a base64 string?

chrome beacon
#

But yeah you're creating your own item stack class

fast path
#

The problem is in byte deserialize

tender shard
#

is your object even a bukkit itemstack?

fast path
#

that is

chrome beacon
tender shard
#

and what's getItemMeta() and setItemMeta() ? How does that compile? those are instance methods

fast path
#

I notice that.

#

sorry

tender shard
#

that explains why they can use getItemMeta() without calling it on an instance lol

chrome beacon
#

Yeah I forgot what that thing is called

tender shard
#

anonymous class

#

?

chrome beacon
#

Not that the {}
And static {}

#

Inside a class

tender shard
#

it's like

Object object = new Object() {
  public String toString() {
    return "NO!";
  }
}
tender shard
#

it's like a constructor

chrome beacon
#

Yeah I know what it is

fast path
#

inherit

chrome beacon
#

Just forgot the name

tender shard
#

i think it's init block

#

at least that's what I always call it

chrome beacon
fast path
#

k working well, thanks y'all

iron palm
#

Any idea how to open a gui on villager right click ? (1.8)
PlayerInteractAtEntityEvent calls before the trade gui so i cannot cancel it

chrome beacon
#

Cancel the event and open your own gui

iron palm
#

As i said this doesnt work

chrome beacon
#

You said the event fires beforr the trade gui

#

Which means you can cancel it

#

Your statement is a conflicting one

iron palm
#

Yeah but idk why its not cancelling it

chrome beacon
#

I'm not sure if that event even exists in 1.8

iron palm
chrome beacon
#

I don't remember it was 7 years ago

iron palm
#

ikr

#

even with canceling event this god damn gui is opening itself

#

i might have to set the villager profession to nitwit

chrome beacon
#

You can remove all the trades from the villager

#

That should stop it

#

Iirc

iron palm
golden turret
#

1.8 moment

#

why dont people just throw it

iron palm
jagged monolith
#

If you have to support over version, atleast support 1.13+ no lower.

iron palm
iron palm
hollow pelican
#

Does anyone know how to directly unban a player in the same way that you'd ban a player in the first place? (UUID-based)

jagged monolith
#

Just unban them?

hollow pelican
#

I'm trying to make a custom unban command currently but it's not unbanning me properly other than clearing my ban data in my database.

#

But as far as the server is concerned, I'm still banned from the server.

#

I've looked into the NMS classes for the player and still haven't found any method to unban them.

glossy venture
#

handle the banning manually

#

with a join event

#

no need to add them to a ban list or whatever

jagged monolith
#

bukkit.getBanList().pardon(<target>)

hollow pelican
#

It's just not unbanning me properly.

jagged monolith
#

Check if the target is in the banlist, if they are, pardon them.

hollow pelican
#

I'd have to call the unban method from an AsyncPlayerPreLoginEvent.

#

If they're currently banned, a standard join event will not fire.

glossy venture
#

cant you not add them to the ban list and then do like

@EventHandler
void onJoin(PlayerJoinEvent e) {
    if (checkBannedInDatabase()) {
        e.getPlayer().kick(ChatColor.RED + "🚫 Banned!");
    }
}
hollow pelican
#

I've tried that.

glossy venture
#

then theres an issue with your database or ban code

jagged monolith
robust sinew
#

how do I set up the remapped NMS jar with gradle?

hollow pelican
#

Because it's just kicking them instead of actually banning them at that rate.

glossy venture
#

do it in pre login event then

glossy venture
hollow pelican
#

I'm not sure how I'd target a player in that event since you can't get a username, only a UUID.

#

I'd have to replicate it but I'm already in the process of changing the code to work with .banPlayer() instead of kicking the player every time they join.

glossy venture
#

disallow the login

#

the sync event is deprecated but doesnt mean it wont work

#

its useful in this case

#

kinda have to use it if you want to handle bans

hollow pelican
#

I can see why it's deprecated, It was changed to an Async event for stuff such as database lookups to avoid server lag.

jagged monolith
#

Best to avoid depreciated methods though.

glossy venture
#

yeah but then you gotta halt the player from joining until you did your work in the async event anyways

#

though thats probably better than server lag

#

so true

hollow pelican
#

I'm just trying to directly unban them in a similar way to .banPlayer() but I don't know how to do that in a AsyncPlayerPreLoginEvent since I can only use UUIDs in that, unless there's some way of getting the offline player reference from that UUID in my unban function.

glossy venture
#
@EventHandler
void onJoin(AsyncPlayerPreLoginEvent e) {
    if (checkBannedInDatabase()) {
        e.disalllow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, ChatColor.RED + "🚫 Banned!");
    }
}
hollow pelican
#

I might have just fixed my own issue.

jagged monolith
glossy venture
#

Bukkit.getOfflinePlayer iirc

hollow pelican
#

The only issue is that as far as I can see, the pardon function only works with usernames.

glossy venture
#

bruh wtf

hollow pelican
#
Gets a ban list for the supplied type.
-- Bans by name are no longer supported and this method will return null when trying to request them. The replacement is bans by UUID.```
glossy venture
#

then do the bans manually i guess

jagged monolith
glossy venture
#

also possible though what if they changed their name or smth

hollow pelican
#

Well, if it's by UUID then it wouldn't really be an issue if I was getting the name from their UUID.

jagged monolith
#

Exactly.

glossy venture
#

its based on a server cache

#

its not retrieved from the mojang servers

#

so it might be different

jagged monolith
#

Uuids don't change.

glossy venture
#

no but names do

#

and the names are retrieved from the server usercache

#

so they might not be up to date

#

with the users recent name changes

jagged monolith
#

Which can be avoided by just storing user data as the uuid and doing everything based off that instead of names

glossy venture
#

yeah but the bukkit ban list doesnt support that

#

so you gotta do it manually

#

which is what i was saying

eternal oxide
#

bukkit ban list supports UUID

glossy venture
#

where

#

do you toString it

eternal oxide
#

it just a badly named enum

glossy venture
jagged monolith
#

BanList is uuid now.

glossy venture
#

ah

#

so you toString the uuid or smth

jagged monolith
#

So do everything via uuid an not playernames and won't have an issue

eternal oxide
glossy venture
#

tf

#

ok confusing

#

but if it works alright

eternal oxide
#

I raised a ticket for it, but it's not been fixed as it's quite a mess in that part of the docs

jagged monolith
#

I agree that is confusing.

jagged monolith
brave goblet
#

I have a method to find a players group

    public static String getPlayerGroup(Player player, List<String> possibleGroups) {
        for (String group : possibleGroups) {
            group.toLowerCase();
            if (player.hasPermission("group." + group)) {
                System.out.println(group);
                return group;
            }
        }
        return null;
    }```
How would I make it return the players highest group?
quaint mantle
#

hey! how can i make a "local" int for every player? so every player has a different int value (i want to make a leveling system)

eternal oxide
#

?pdc

iron palm
#

whoops

#

that was too long

#

i'd better use pastebin first

brave goblet
#

and then return list.get max index

vocal cloud
#

Why not cache the groups and a list of groups the player is in inside of an ordered list so you can get the first element or last?

brave goblet
#

List<> groups
list.add("group1")
list.add("group2")
list.add("group3")
list.add("group4")

#

then i call
getPlayerGroup(player, groups)

vocal cloud
#

Then you proceed to check the whole list

#

I'm saying you cache what groups a players in. Then you just cache.get(player).first()

brave goblet
#

Ok makes sense

vocal cloud
#

You can even then quickly rule out needing to check all the groups with a cache.get.isempty

brave goblet
#

but i don't understand how cacheing works

vocal cloud
#

You use a hashmap or similar

brave goblet
#

Ok welp for now ill just run through the list till i find the players highest rank index then get it

vocal cloud
#

W/e works for you

quaint mantle
#

how i save a inventory player?

wet breach
drowsy helm
#

Your question is vague

quaint mantle
#

idk, what is the best method?

drowsy helm
#

What are you trying to accomplish??

quaint mantle
#

staff mode

wet breach
drowsy helm
#

I cant read your mind

#

Give me some details

quaint mantle
#

so, I do the command / staffmode, and it has to save me the inventory so what it does / staffmode restores it

drowsy helm
#

Well if you dont need to persist over restarts just hold an ItemStack[] of the contents

#

And armour contents

quaint mantle
#

thanksssssssssss

civic wind
#

And then on enable/disable of staff mode add and remove the inventory, this is how i did it anyway

quaint mantle
#

okok, tysm

civic wind
#

No problem mate if you get stuck let me know 🙂

quaint mantle
#

🙂

robust sinew
#

how do I use the remapped NMS stuff with gradle?

echo basalt
#

paperweight

robust sinew
#

do I need to remake the project?

echo basalt
#

nah

robust sinew
echo basalt
#

Why do you want or possibly need NMS with a few days of experience

robust sinew
#

good question

eternal oxide
#

Spigot uses Maven not Gradle so it has no suppport for Gradle

robust sinew
#

it seems to be the best way to add noclip to an armor stand

echo basalt
#

Why do you need to noclip an armorstand

robust sinew
#

but an easier way to do what I want is to check if my armor stand's hitbox is in / touching a block

civic wind
#

What is noclipping an armorstand?

eternal oxide
#

he wants to push a stand through blocks using velocity

civic wind
#

Like no clip on cod bops 2?😂

echo basalt
#

you could just setGravity false and teleport it instead

robust sinew
#

I just need to know if it's touching a block

echo basalt
eternal oxide
#

there is a noclip setting but its not exposed in the API. There is also no collition event

robust sinew
#

is there an easier way to do that?

eternal oxide
#

no, NMS is your only way if you really need noclip

robust sinew
#

I don't really need it

#

I just need to know if my armor stand is touching a block and remove it if it is

eternal oxide
#

then you could check its bounding box on a schedule

robust sinew
#

I already have a schedule thing checking if the block it's in is air, but idk how to check the bounding box

eternal oxide
#

get it's boundingbox and check for an overlap of teh blocks N/E/S/W two high

quaint mantle
#

how i create a ENDERCHEST gui?

#

on google i found only classic Inventory

quaint mantle
#

equals on my course

eternal oxide
civic wind
eternal oxide
#

I don;t remember it before Quake though. I believe it originated there

robust sinew
eternal oxide
#

^

wet breach
#

in case you need collision

crimson terrace
eternal oxide
#

all you have to do it use the overlaps in teh BoundingBox class

eternal oxide
worldly ingot
#

Note that the collision shape isn't accurate. It's always a 1x1x1 cube

#

So for things like slabs it's not correct

quaint mantle
#

how i create a ENDERCHEST gui?

echo basalt
#

enderchest is just a regular chest

#

but the inventory instance never gets wiped, just recycled

wet breach
#

just half the size

echo basalt
#

nah it's 27 lsots, regular chest

#

not double chest

wet breach
#

I was referring to double chest

#

its half the size of that

worldly ingot
#

Or the size of a singular chest

robust sinew
#

sorry for the code taking up a big space, ill delete it after

eternal oxide
#

Don;t use Collision shape

#

use BoundingBox

robust sinew
#

ok lemme try that then

eternal oxide
#

stand.getBoundingBox().overlaps(stand.getLocation().getBlock().getRelative(BLOCKFACE_NORTH).getBoundingBox())

#

or somethign close

#

for each cardinal direction

robust sinew
#

I just added 1 in every direction for each different block

#

should I do that instead? since it seems like it does the same thing

#

yeah nope this still doesn't work

eternal oxide
#

you check the boundingbox of the stand for overlaps with the boundingbox of each block N/E/S/W

robust sinew
#

and down right?

eternal oxide
#

if you want to check down

robust sinew
#

in case it's touching a block like that

eternal oxide
#

no

#

you would check the block at teh stands location

robust sinew
#

should I do both?

#

I was already checking the block at it's location

eternal oxide
#

you need to check the cardinal blocks, and the block the stand is on, to see if any are not AIR

neon nymph
#

Hello, friends! Could I possibly have some insights why all the set<armor>(ItemStack)s of class PlayerInventory are not working (at least for me)? Here is my code:

PlayerInventory inv = pl.getInventory();

inv.clear();
inv.setHelmet(kit.getHelmet());
inv.setChestplate(kit.getChestplate());
inv.setLeggings(kit.getLeggings());
inv.setBoots(kit.getBoots());
inv.setContents(kit.getInventory());

I am sure the getters themselves aren't null as I've tested here:

public ItemStack getHelmet() {
    System.out.println("Helmet is not null: " + (helmet != null));
    return helmet;
}

// Returns true

It seems that setContents() works, but not the individual armor pieces itself. setArmorContents(ItemStack[]) also doesn't work. Any idea why?

Some background info, I am currently migrating my plugin's mc version compatibility from 1.8 to 1.19.2. This worked in the former version, but for some reason it doesn't in the latter.

twilit roost
#
public Location getCagePosition1(String color){
        ConfigurationSection section = getConfig().getConfigurationSection("cages");
        String key = "_cage_pos1";
        Location loc = section.getLocation(color.toLowerCase() + key);
        System.out.println(color.toLowerCase()+key);
        if (loc == null){
            Event.getPlugin().getLogger().severe(color + " Position 1 == null!");
            return null;
        }
        return loc;
    }
#

Any clues why?

eternal oxide
#

if any of the blocks are not AIR, check for an overlap

robust sinew
#

should I check if they aren't air, or just go check anyways? because air doesn't have a boundingbox right?

eternal oxide
#

you only need to check non AIR blocks as thats the only way you will have a possible collision

robust sinew
#

okay

#

I tried it without checking if it was air or not but it still doesn't do anything

eternal oxide
#

then your code is bad 😦

#

I don;t have ny IDE open to write a sample

robust sinew
#

(code deleted again to not spam chat)
does anything immediately appear wrong with this?

#

I'll delete the code after to not spam chat

eternal oxide
#

no need to check down, but your code looks fine

#

it will only detect blocks around the stands base, not its head

robust sinew
#

yeah I'l work that out later

#

I just want to be able to detect things first

#

is there a way to check if the entities bounding box is overlapping with anything at all?

neon nymph
eternal oxide
brave goblet
# brave goblet Ok welp for now ill just run through the list till i find the players highest ra...

I tried this using

    public static String getPlayerGroup(Player player, List<String> possibleGroups) {
        int max = 0;
        for (String group : possibleGroups) {
            group.toLowerCase();
            if (player.hasPermission("group." + group)) {
                max = possibleGroups.indexOf(group);
            }
        }
        System.out.println(max);
        System.out.println(possibleGroups.get(max));
        return possibleGroups.get(max);
    }```But its returning the highest group in the list not the highest group the player has
#

is it because i am op?

robust sinew
#

"Checks if the given bounding box intersects this block shape."

#

intersects would be partial overlaps right?

eternal oxide
#

no, well the intersection IS the overlap

#

overlaps is teh correct one

#

check the box you get from teh blocks is a unit in size

robust sinew
#

also, if I wanted to make this work for entities as well, is there a way I could just make the armor stand check if it overlaps with anything at all?

eternal oxide
#

there is a method for getNearbyEntities

drowsy helm
#

It cant just interpret your config and do it

twilit roost
drowsy helm
#

Just make your own interpreter

twilit roost
#

never worked/created one
so idk where to start with that

drowsy helm
#

Just read each value manually

#

And create a location

twilit roost
#

ooh right

#

thx

robust sinew
# eternal oxide there is a method for getNearbyEntities

if (stand.getNearbyEntities(stand.getBoundingBox().getWidthX() / 2, stand.getBoundingBox().getHeight() / 2, stand.getBoundingBox().getWidthZ()).size() > 0) overlaps = true;
would that work for checking all entities touching it?

#

you know what lemme try it and I'll see what happens

eternal oxide
#

use a size of 1.1 for touching

robust sinew
#

ok I'll try that

#

if this doesn't work

#

oh wait

#

this works I think

#

it just explodes instantly since it technically spawns in the player

#

although its making an error in the log thing

quaint mantle
#

How can I store data on players past server reboot? Maybe even past getting a new .jar file for the plugin? I tried doing stuff with config.yml but it resets when I reboot the server

eternal oxide
#

?pdc

vocal cloud
#

dammit Elgar

eternal oxide
#

🙂

golden turret
#

?pdc again

golden turret
#

pdc

robust sinew
#

Welp my computer died

#

I’ll finish this later

#

Thanks anyways

quaint mantle
golden turret
glad prawn
#

Photo to gif 💀

stoic vigil
#

what do i need to import/add to the dependencies to use this?

 PacketPlayOutCustomPayload packet = new PacketPlayOutCustomPayload(new MinecraftKey("minecraft:book_open"), new PacketDataSerializer(buf));
vocal cloud
#

You need to import NMS

small current
#

what is the pathfinder so i can make zombies run away from players

vocal cloud
#

Look at cats

#

or creepers reaction to cats

small current
#

and how can i clear goals in 1.17

stoic vigil
brazen hollow
#

Is there a way to save a custom value into an ItemStack? In my case I want to save an id from the database

vocal cloud
#

?pdc

brazen hollow
#

ty

small current
#

this.bP.a(3, new PathfinderGoalAvoidTarget(this, EntityCat.class, 6.0F, 1.0, 1.2));
soo

sand vector
#

I'm making a plugin which once finished can also be a dependency aswell. How do I it up to get a instance of the main class. And access it inside the other plugins

#

I've tried multiple times ways I thought would work but they didnt

vocal cloud
#

You probably don't want a dependency where you're getting the main class if by main class you mean the plugin itself

brazen hollow
# vocal cloud ?pdc

Do I setup the NamespacedKey once or at operation in the PersistentDataHolder?

vocal cloud
#

You can create a constants section and create it there

brazen hollow
#

okay

sand vector
vocal cloud
small current
#

i done this to the zombie but its doing its own thing why

vocal cloud
#

wym "doing it's own thing"

small current
#

attacking the player

#

instead of running

#

its overrided

hasty prawn
#

Zombies have 2 methods that grant their goals

small current
#

initPathfinder and n

#

n() is the method

#

i overrided it and made it empty

#

btw what is the difference of goalSelector and targetSelector

#

oh target is the attacking nvm

hasty prawn
#

What version are you on?

small current
#

1.17.1

hasty prawn
#

?paste your whole class

undone axleBOT
ivory sleet
small current
#

its the constructor that addWorlds

ivory sleet
#

and the normal goal selector usually selects other behavior

small current
#

and the override

hasty prawn
small current
#

should i call the method ?

hasty prawn
#

You're not calling initPathfinder?

small current
#

changed to villager, fixed

hasty prawn
#

You shouldn't have to call it if you're calling super() in the constructor, which I think it makes you

#

wat

#

ok KEKW

small current
#

it shows as a player anyways

#

im cancelling the spawn packet and sending a namedentityspawn with the id

deep furnace
#

I have a problem.

I was about to make a localhost minecraft server with bungeecord on version 1.19.2. I started the first server and everything worked. when I wanted to start the second server afterwards it didn't work and in the crashreports it said java.lang.IllegalStateException: Failed to initialize server.

Does anyone have a solution. Thanks

vivid skiff
#

How can i block a player from jumping?

eternal oxide
#

In the statisitic event if it's for jumping set Y velocity to 0

shadow gate
#

Please tell me how to make sure that the condition is met. It is necessary that the player is sent either a message from the mes1 variable or from the mes2 variable when entering

tardy delta
#

Where private

shadow gate
#

I look like this and I understand that it looks stupid somehow 🙂

remote swallow
#

if (something.equals("somethiing")) { /* do something */ }

quaint mantle
#

hey! i want to develop a custom world generator, is it possible to only "replace" some of the biomes?

#

so i dont want to rewrite the whole minecraft world generator, just some biomes

brazen hollow
#

How can I hide that stuf?

#

I need to hide it for weapons and armor too

#

So hide every vanilla lore

fluid river
#

ITEM_FLAG

#

HIDE_STUFF

#

on ItemMeta

brazen hollow
#

thx

serene sigil
#

how do u send subtitles in spigot?

eternal night
eternal night
#

why not ?

#

certainly takes that as a parameter

fluid river
#

if you want ActionBar

#

you need player.spigot().sendMessage() where you set type to ACTION_BAR

eternal night
#

Ehh, that field stores the additional properties in an optional

brazen hollow
#

Why is nothing except for the button click being cancelled?

fluid river
#

?

torn badge
#

Anyone know an easy way to determine what and especially how many items have been crafted?

brazen hollow
torn badge
#

So not CraftItemEvent but when the item is actually taken out

fluid river
#

inventoryClickEvent

torn badge
#

Any easier way than InventoryClickEvent

fluid river
#

idk

torn badge
#

Because you can't easily check the amount there

#

Especially on shift click

fluid river
brazen hollow
#

I can still take the flower

#

And I can take the sweet berries

fluid river
brazen hollow
#

thx xd

fluid river
#

i guess you need to check this even instead

crimson terrace
#

but I guess thats paper

#

so if youre using paper instead of spigot, go for it

fluid river
#

player flying backwards?

#

or what

glad prawn
#

flying backward and still fast?

small current
fluid river
#

packets to show player is rotated

small current
#

but its a player

glad prawn
#

Wtf

fluid river
#

sad

#

😭

small current
#

yeah cancelled the spawn packet

#

sent a namedentityspawn with the dragon's id

#

and set the state to circling

#

phase*

fluid river
#

now use a packet to make player lie on the back

#

while walking or flying

#

dig a hole and make player fly up from it

#

would look like resurrection

small current
#

no they are paying me to code a plugin so a girl npc runs from the players

#

i needed pathfinders so i did villagers

fluid river
#

bruh

#

girls irl

molten hearth
#

Bruh

#

Pov you can't find a real girl 💀

fluid river
#

not me

molten hearth
#

Same same

fluid river
#

we had a year together on 9th oct

molten hearth
#

Bro still remembers

fluid river
#

hehe

molten hearth
#

I wait for mine to be like "babe our anniversary is coming up" and my mind is like FUCK which day

fluid river
molten hearth
#

And i check the calendar before opening her texts to make sure she hasn't asked me which day is it

fluid river
#

girls running away

molten hearth
#

I know it's may but idk which day exactly

fluid river
#

i was born in may

#

let's pretend it's on 7th

#

get ready

molten hearth
#

Lmao

#

I think its the 20-something

fluid river
#

sad

molten hearth
#

It's between 10 and 29

#

Actually the real anniversary is a bit before

#

I broke up with her for a week and then we dated again

tall dragon
#

mans playing hard to get eh

molten hearth
#

No actually my ex came back crying so I broke up with my gf and dealt with my ex then told her to fuck off and dated my gf again

echo basalt
#

And my face wants me to solve all my problems

molten hearth
#

Not having a girlfriend hinders yout ability of getting head

echo basalt
#

So it does all the hard work

tall dragon
#

having a gf also hinders your ability of having money

molten hearth
#

Fuck

#

cries

#

My gf makes more money than me tho

fluid river
#

having a gf which gives you money

molten hearth
#

Bruh she babysits and makes racks and I go to uni and become an alcoholic

fluid river
#

❤️

tall dragon
#

prolly also spends it twice at fast

#

😄

echo basalt
#

This kid at the gym just cleaned his phone by spitting at it wtf

molten hearth
#

yeah she does she just invests it all in genshin impact lol

fluid river
#

no worries

echo basalt
#

Looks like it

tall dragon
molten hearth
fluid river
#

genshin investment pakt

molten hearth
#

spits on their car and rubs with sleeve good as new

molten hearth
#

So I guess she actually has a high worth account

fluid river
#

there is a famous russian proverb

tall dragon
#

i have no idea if thats good tbh

#

i dont play the game

echo basalt
#

I never understood spending mad money on games

fluid river
#

Крякнуть, плюнуть и надёжно склеить скотчем

echo basalt
#

Sure I drop 5 bucks here and there

molten hearth
#

it is usually people spend weeks saving up for 1 cjaracter

#

Character*

fluid river
#

Grunt, spit and securely glue with adhesive tape

#

nice trasnlation

molten hearth
#

I have 3 five stars and I've been playing for 1 year and she has 24 and every 4 star

molten hearth
#

BAN

fluid river
#

instead of grunt should say kick

molten hearth
#

Moan
Spit
Glue 😉
With adhesive protection

remote swallow
#

Use flexseal Because It Works.

molten hearth
#

Durex on their way to hire me rn

#

Personally I never broke something that needed tape

#

Like last time i broke my chair the back of the chair just snapped off I'd need a lot of tape for that and it wouldnt support me

frail gale
#

What to return when creating a new class which is extending BukkitRunnable and then overriding the method runTaskLater the method needs to return a BukkitTask but I don't know how to get it

tall dragon
#

you override the run() method and call runTaskLater on the class

#

you dont override runTaskLater

fluid river
#

true

#

or just use anonymous version of bukkitrunnable

#

() -> {

}

frail gale
#

yeah I was thinking of this

#

for run()

frail gale
fluid river
#

?

frail gale
#

if I need Anonymous and wanna edit variables I would need to use an array but this will be a shortcut task so I don't wanna create everytime a new array

frail gale
#

and final variables cannot be changed

fluid river
#
BukkitRunnable runnable = new BukkitRunnable() {
    // here you declare and initialize fields
    public void run() {
        // here you work with them
    }
};
runnable.runTaskLater(...);```
remote swallow
#

scheduler > BukkitRunnable

frail gale
ivory sleet
fluid river
fluid river
#

ChatMessageType.

serene sigil
#

the enum doesnt exist

fluid river
#

you imported right version?

frail gale
fluid river
#

1.19

serene sigil
fluid river
#

ChatMessageType

#

here it is

serene sigil
#

it knows it exists but ITS NOT THERE

#

ik

#

but the class doenst exist

fluid river
#

hehe

#

restart IDE or smth

#

strange that javadocs are loaded but sources not

serene sigil
fluid river
#

reimport your dependency

#

update project

serene sigil
fluid river
#

??

#

don't shade entire spigot-api to your plugin please

serene sigil
#

spigot-api-1.19-R0.1-20220710.051022-43-shaded.jar

remote swallow
#

using maven or gradle

#

its 100% easier

serene sigil
#

ik but i hate both of them

remote swallow
#

whats the big problem with them

#

they both do their job

fluid river
#

to setup maven project

#

and include spigot api

#

and one command to build

serene sigil
hasty prawn
#

IntelliJ can convert it I believe

remote swallow
#

you can convert it

fluid river
#

i hate converting

#

new project is better

hasty prawn
#

It's not really better for someone who hasn't ever used Maven or Gradle before.

#

Both would do a sloppy job converting it but atleast the IDE won't ask a million questions peepoGiggles

fluid river
#

literally takes less than a minute

glad prawn
#

😮

tardy delta
#

dang server on pi still alive after i bombed it with tnt

modern vigil
#

82 days...

rocky tree
#

Hi, anyone know if I can set in authors (.setAuthor()) in 2 Lines?
Ex.

"\nAnd: " + player2);```
modern vigil
#

i don't rlly think so

worldly ingot
#

You could try it, but if it doesn't work then I'm afraid not

rocky tree
#

nop, It isn't possible

#

Minecraft read \n with a symbol

#

Original is possible to change? I'd never tryed

sullen canyon
#

is there any way i can find out what the task its exactly?

#

its aikar's timings

sinful rapids
remote swallow
rocky tree
rocky tree
#

mi serviva per un server tra amici

sinful rapids
#

Guarda privato

serene sigil
#

how to check if an end rod is facing up?

sinful rapids
#

ok, sorry

sullen canyon
#

as timings provide it

warm token
#

how to change the head skin of a player only in the tab

remote swallow
warm token
sterile token
#

I love swearing with configuration sections

#

When ever i write this on a file and then do Configuration#getConfigurationSection() they always are null!

#

😂

sand vector
#

So i know in different plugins they are called prefix, suffix, group etc. But if I wanted more before the message, like in the photo above. What would be the best thing to search up to get info on them?

#

idk what youd call them xD

sterile token
#

I mean they should be this order:

everything before name Prefix
everything after name Suffix

sand vector
#

ok

sterile token
#

That what i think

remote swallow
#

thats correct

sterile token
#

Also i need help with fucked yaml sections they are all time giving problems

#

Exactly its telling that its null, when the section is already in the file

chrome beacon
#

Show us the code and the config

sterile token
#

ok

chrome beacon
#

?paste

undone axleBOT
sterile token
#

thanks mate but please dont start like people yesterday that they were treating me like an idiot

#

I mean they were all time saying black, when i was saying white. Also the same with telling me how to paste code

#

😂

#

Yaml file:

Regions:

Yaml code:

public void reload() {
   FileHandler data = new FileHandler(this.plugin, "data/regions.yml");
   ConfigurationSection section = data.getConfigurationSection("Regions");
   this.plugin.getLogger().info("Regions section is null"); 
}

sterile token
chrome beacon
sterile token
#

in my code is written

chrome beacon
#

Send all your code

sterile token
#

ok

chrome beacon
#

And all of the config

sterile token
#

Yeah the config is only that

#

i mean config is only that

remote swallow
#

there isnt a null check in that code

sterile token
#
public void reload() {
   FileHandler data = new FileHandler(this.plugin, "data/regions.yml");
   ConfigurationSection section = data.getConfigurationSection("Regions");
   if (section == null) this.plugin.getLogger().info("Regions section is null"); 
   for (String path : section.getKeys(false)) {
     this.regions.put(path, section.getObject(section.getCurrentPath() + "." + path, Region.class));
  }
}```
sterile token
#

I mean its really weird the isues

#

Because section should not be null

#

Because the file contains it

sterile token
#

I mean should be happening smth else

fluid orbit
#

What you want to do?

#

You check if it’s null and just print it out in the console

#

Right now

sterile token
#

im doping that

#

And its printing null

#

Basically its laugthing at me because the section in the file is not null, while code tell me that is null

#

🤡

remote swallow
#

iirc That file would return null because it has nothing below/in it. Just itself

sterile token
#

what?

#

I mean the section is empty, but it cannot say me that section is null because its there

#

🤔

remote swallow
#

If i remember correct that file would return null on a null check because it has no follow up sections

remote swallow
#

Regions:
    notnull: I would no longer return null

sterile token
#

Hmn, that wont work, because its a storage file

#

Which would contain content once sever goes down

remote swallow
#

use spigots config system and custom config and #saveConfig()

sterile token
#

oh no

#

that is ca**

fluid orbit
#

Try print out what this file has inside and check if it contain section

remote swallow
glad prawn
#

He was check section is null.

sterile token
#

So why is null?

#

Doesnt make sense

#

And my FileHandler is not the problem - answering to epicepic

remote swallow
fluid orbit
#

It isn’t

#

I really like it lol

remote swallow
#

thats what im thinking

sterile token
#

i just dont like it, i prefer using my own impl of YamlConfiguration

#

but that not the point

#

The point is that the section is being null, when in the file itself is not null

remote swallow
#

does it even get the file, i have a feeling it doesnt

sterile token
#

I know what i code

#

I have say it many times i could be dumb, but not idiot🧐

#

So dont treat me in that way

remote swallow
#

add an extra section inside of it eg:

Regions:
  testregion:
      true: false
``` and just System.out it to check it can actually get sections
#

it seems dumb but just try it

native nexus
#

Relax, he never implied that you were dumb he is just asking you a question no need to get defensive about your code, they are trying to help

sterile token
#

I know

#

But since yesterday he is being like that

remote swallow
#

what did i do

#

the entire time ive just tried to help

sterile token
#

Its not the point to argue

#

I will try that epic

native nexus
#

The section is null is because your if statement literally is not checking the section you think you are checking

native nexus
#

Yes lmao

sterile token
fluid orbit
#

I think the problem is that your file is empty

sterile token
fluid orbit
#

Did you save it?

#

😂

sterile token
#

what?

fluid orbit
#

Did you save file

sterile token
#

I mean, the filehandler just create a file with the content from the one inside resources folder

fluid orbit
#

I see

remote swallow
#

The only way i can guess that ConfigurationSection section = data.getConfigurationSection("Regions"); can be null if its not getting the section

sterile token
#

Which doesnt make sense

remote swallow
#

iirc the only way for that to return null is because it cant get the config section

sterile token
#

why?

remote swallow
#

could be that its not getting the file or cant access the file

sterile token
#

i have try that and file is loaded correctly

remote swallow
#

if its not the file being null, i dont have a clue why that would return null

fluid orbit
#

I think empty section return null

sterile token
#

And the word Regions is inside the file

remote swallow
sterile token
fluid orbit
#

Check if file is null

sterile token
#

ok

fluid orbit
#

Or it’s empty

#

And check if this section is empty

native nexus
#

Java doc should tell you what behaviour it should expect.

#

I use json for flat file storage and yaml for flat file configuration :3

sterile token
#

No, file is not null

fresh timber
#

sry for late reply I had to go

sterile token
#

Amazing bruh

#

fucked spigot file system

#

And the ** section is not null

#

Really LMFAO im getting mad right now

vocal cloud
#

You probably made a mistake

tall dragon
#

^ thats very often the root of the problem when something does not work VojkeaClap

sterile token
#

I have been looking the code 100th times

#

And i still cannot find what is the reason

vocal cloud
#

Well maybe take a break and come back. Or send the code in a paste

sterile token
#

ok

#

Yaml file

tall dragon
#

did you try putting data in the section

native nexus
#

Do you have your source code on git?

fresh timber
#

oh wait

#

.getserver still null;

#

pretty much the same

sterile token
#

I have find that the error only happens the first time

#

But then if the file already exists then i dont have any issues

vocal cloud
#

Well if you don't save the config of course you'll have an error lol

fresh timber
#

How do I get the name of the server that I put in the BungeeCord config.yml in a spigot plugin on a paper server on a subserver of a bungeecord (waterfall) network?

fresh timber
#

ohhh ok

sterile token
#

why would isave it=

#

I mean that "Regions" comes by default

#

i mean my filehandler does a JavaPlugin#saveResource() and the YamlConfiguration#load()

#

So the section is not null

fluid river
#

saveResource saves file from jar's resource folder to plugin's folder

sterile token
#

I mean saveResource, take a resource fom resource folder

#

And put it inside the data folder

fluid river
#

well what is your config in ide

sterile token
#

Yes, the config is inside the resource folder

fluid river
#

and when do you use saveResource

fluid river
sterile token
fluid river
#

bro inside

sterile token
fluid river
#

and what is the problem

sterile token
#

config section is being null

fluid river
#

show your config loading code

sterile token
#

this section gives null

fluid river
#

It might be a stringlist tho

#

not a configuration section

sterile token
#

i mean i cannot use a list

#

Because im saving key-value pairs

glad prawn
#

💀

sterile token
#

That is my file handler

#

if someone want to use it

echo basalt
#

💀

vocal cloud
#

uh yeah no

fluid river
#

so much this's

sterile token
#

what?

#

I have been all day with this

fluid river
#

this's everywhere

sterile token
#

I should be the one who sais that

vocal cloud
#

Didn't you claim it doesn't work why would someone use it

sterile token
#

No no, the Filehandler works perfect

#

It should be something else

fluid river
#

you are getting configuration section Regions

#

but it's a string list

#

by default

sterile token
#

Oh shit

#

Why?

fluid river
#

if has no params

sterile token
#

How i can do it so?

fluid river
#

even here it switches to {}

sterile token
#

Because by default should be empty

fluid river
sterile token
#

Because the content will be saved once sever goes down

fluid river
#

you can just not use this section

#

and only create it when using .set

#

as a part of path

sterile token
#

ok, so, just keep the file empty?

fluid river
#

which would be created automatically anyways

#

yeah

sterile token
#

ok

fresh timber
sterile token
#

LMAo pretty thanks

fluid river
#

i'm smort

sterile token
#

I have been all day with that

fresh timber
#

:|

sterile token
#

nuke

#

Can u explain that what people can join inside another player?

#

Someone told me about that happening on 1.19

fluid river
#

wait what

sterile token
#

"yk in mc u can run into someone's character and they move
in the newer versions
it is very annoying
u can push afk ppl into things where they die
"

fluid river
#

i can join my pen is to some typical minecraft player's butt

fluid river
#

you can 100% disable per-player collision in some bukkit/spigot config

sterile token
#

oh ok

sterile token
#

He said you can disable it from a config file

fresh timber
#

oh

#

I already did it in my plugin

#

I can try that tho

fresh timber
sterile token
fresh timber
#

ah its in paper-global.yml

fluid river
#

lol

sterile token
fresh timber
#

paper is great

#

wait

sterile token
#

i mean i have some personal with them hahaha

fresh timber
#

it says its disabled and it still works

#

wdym personal?

fluid river
#

yeah that's only in paper

fluid river
fresh timber
#

ill just stick to spigot plugin

#

I got it

#

its literally one line of code

#

if u have ur listener made

sterile token
fluid river
#

that's spigotmc

#

bro

sterile token
#

oh lmao

#

I didnt realize

#

Spigot is so changed

fresh timber
#

yea I was gonna say

#

looks like spigot

fluid river
#

you should spend more time on bukkit

remote swallow
#

bukkit still looking like it was made in 2010

fluid river
#

it's really different

sterile token
#

Shit i have started to smoke again and its affecting me again

vocal cloud
#

Kids smoking YanSigh

whole stirrup
#

When I set the minimum permission for my command in plugin.yml the command still works and it correctly doesn't display in /help for people without the permission but now regardless of player permission I get this when I start typing the command:

#

This is in my plugin.yml:

commands:
  setrank:
    description: Sets a player's rank.
    permission: ml.setrank
#

I also tried adding the permission to plugin.yml like this:

permissions:
  ml.setrank:
    description: Allows you to use /setrank.
    default: false

But it didn't do anything.

remote swallow
#

are you setting executor

whole stirrup
#

Yeah my command and tab completer worked perfectly before I set the command's permission.

#

The command still runs but the tab completion is completely broken.

remote swallow
#

do you have the permission

whole stirrup
#

Yup.

remote swallow
#

is the command op only?

whole stirrup
#

No, it checks for ml.setrank.

remote swallow
#

if it is try changing default to op instead of false

whole stirrup
#

I just tried that and there's no change.

glad prawn
#

Can you use tabcomplete when op?

sterile token
whole stirrup
#

Yeah it works when I'm op.

remote swallow
#

luckperms im guessing?

whole stirrup
#

But it doesn't work without op. I definitely have the permission that I set.

#

No I'm granting player permissions manually in my plugin via PermissionAttachment.

sterile token
#

oh no