#help-development

1 messages · Page 505 of 1

ornate patio
#

except now im getting huge lag spikes every time i punch lol

#

might need to make a stepping algorithm

young knoll
#

Oof my old code for it is kinda ugly

#

Might need to update that one day

eternal oxide
#

you could do all your math async after you get the initial entities

ornate patio
#

can i do raytraceblocks async

eternal oxide
#

I don;t believe you can

#

but you can shrink the number you have to check async

ornate patio
#

ill try that ig

#

thanks for all the help

#

Ok one more issue

#

I changed up my code a bit

#

and now when I punch a mob it's completely crashing the server

#

and spamming the console with unreadable errors

#
// Get every mob within 20 blocks of player that is in line of sight
player.getNearbyEntities(Config.CLASSES.BERSERKER.ABILITY_RANGE.XZ_RANGE, Config.CLASSES.BERSERKER.ABILITY_RANGE.Y_RANGE, Config.CLASSES.BERSERKER.ABILITY_RANGE.XZ_RANGE).stream().forEach(nearbyEntity -> {
    if (!(nearbyEntity instanceof Damageable)) {
        return;
    }
    
    Damageable nearbyDamageable = (Damageable) nearbyEntity;

    if (!nearbyDamageable.equals(mob) && isFacing(player, nearbyDamageable) && hasLineOfSight(player, nearbyDamageable)) {
        nearbyDamageable.damage(event.getDamage(), player);
    }
});
#

I could send the error but I don't think it'll be of any use

young knoll
#

Let me guess

#

You do this in the damage event

ornate patio
#

yes

eternal oxide
#

delay damage 1 tick

young knoll
#

.damage calls the damage event

#

Which runs your code again

#

Which calls the event again

ornate patio
#

oh wait

#
if (!(event.getDamager() instanceof Player)) {
    return;
}
if (!(event.getEntity() instanceof Mob)) {
    return;
}
young knoll
#

Well the damager will be a player

ornate patio
#

yeah i just realized

young knoll
#

And the damagee will be a mob

#

You need to toggle a Boolean before you call the .damage method

#

Then ignore the event while that Boolean is set

ornate patio
#

got it thx

eternal oxide
#

add a bolean to teh class

#

boolean ignore = false;

ornate patio
#

mhm

eternal oxide
#

before you apply damage set ignore = true

ornate patio
#
ignore = true;
nearbyDamageable.damage(event.getDamage(), player);
ignore = false;
#

done

#

and put the check at the beginnign

eternal oxide
#

in the start of the event, if (ignore) { ignore = false; return;}

ornate patio
#

wait no it doesnt

eternal oxide
#

mine will

ornate patio
#

cause there can be like 5 mobs getting hit

eternal oxide
#

yours won't

ornate patio
#

wait instead

eternal oxide
#

mine works

ornate patio
#

yeah nvm

#

i see

eternal oxide
#

I use it myself

ornate patio
#

i understand now

#

took me a few seconds

eternal oxide
#

single threaded MC

young knoll
#

Oh no what about folia

ornate patio
#

im still running into an issue where sometimes a few mobs in view wouldn't be hit

tender shard
#

haha

tender shard
ornate patio
#

but ill try to figure this out

tender shard
#

i love how folia devs are always like "this plugin has to fix their issues" while they claim to be bukkit compatible but cannot even manage to implement the scheduler, then claim it's "my job" to get it working lol

#

like wtf

eternal oxide
#

so do your job you slacker 😉

tender shard
#

I got a github bot running that closes every issue mentioning "folia" after 24 hours

#

folia is supposed to fix itself before I try to

#

oh and paper's "paper-plugin.yml" is a bad joke

ornate patio
#

sometimes some mobs behind get hit too

tender shard
#

at first I thought it's actually a joke but somehow, those people are serious haha

ornate patio
#

i've done some testing and when I hit in this angle

#

all the cows including the 2 at the front of the camera get it

#

but when i turn around and try only the two cows next to where im looking get hit

#

actually if i don't use a sword literally only the cow im looking at gets hit only

#

seems to hit all mobs around me when I'm facing south, but no mobs when I'm facing north

#

Ok wait

#

It seems to hit all mobs around me when I'm facing any direction but north

#

its an issue with the isFacing function

#
public boolean isFacing(Player player, Entity entity) {
    Vector playerDir = player.getEyeLocation().getDirection();
    Vector entityDir = entity.getLocation().getDirection();

    double relativeAngle = (Math.atan2(playerDir.getX() * entityDir.getZ() - playerDir.getZ() * entityDir.getX(),
            playerDir.getX() * entityDir.getX() + playerDir.getZ() * entityDir.getZ()) * 180) / Math.PI;

    return (relativeAngle <= 135 && relativeAngle >= -135);
}
eternal oxide
#

sounds like it

ornate patio
#

any ideas?

eternal oxide
#

use teh isBehind method and see if only ones behind you get hit

ornate patio
#

alr

eternal oxide
#

also check to teh sides

ornate patio
#

yeah when im facing east or west

#

it also hits all mobs

eternal oxide
#

try with the isBehind, it shoudl only hit behind you and the one you hit in froint

#

see if that works

ornate patio
#

it only hits mobs behind me when im facing south

#

none in any other direction

eternal oxide
#

bad math then

#

I'll take a look tomorrow

#

can;t tonight

ornate patio
#

alr

#

do you want my code so you can test later

eternal oxide
#

nope

ornate patio
#

alr

#

ill continue debugging this later tho

#

thx for the help again

ornate patio
#

with the damage increase on a backstab

eternal oxide
#

that makes no sense

#

unles

#

I think I see

#

isBehind is anythign out of view, so not just behind but to the side too

ornate patio
#

Isn’t it because isbehind compares where the entities are looking?

eternal oxide
#

no, its body facing

ornate patio
#

Well even then

#

Isinfront needs to compare location tho

eternal oxide
#

so it's just the values

#

sec

#

does the backstab work from teh side?

ornate patio
eternal oxide
#

so only 90 degrees directly behind

ornate patio
#

about

#

I think the issue is that isBehind checks to see if the direction of the player is almost the same as the direction of the entity

isFacing is trying to check if a mob's location is in view of a player's direction, but doesn't really have any logic to compare location in it

strange rain
#

Hi... I feel dumb asking this but how do I delete a world?
Becauses the .delete() doesn't actually work

eternal oxide
#

return (relativeAngle <=-135 || relativeAngle >= 135);

#

thats it

ornate patio
#

lemme test

ornate patio
#

and none in any other direction

eternal oxide
#

I'll have to test myself

ornate patio
#

ok wait

#

but its a ilttle random

#

sometimes itll work

#

sometimes itll hit mobs behind me and not in front

#

i cant really describe the behavior precisely

#

its a little random

#

the thing i dont understand is why Vector entityDir = entity.getLocation().getDirection(); this exists in the first place

#

because i don't need the entity's direction at all

#

I just need to know if the entity's location is within my direction

eternal oxide
#

yeah it doesn;t look quite right to me either

#

it can;t deduce teh behind/in front just from the directions

#

as they are unit vectors

#

it shoudl be taking a vector from their locations

#

then usign teh direction of the target to see if it's behind or in front

#

Probably ```java
public boolean isBehind(Entity player, Entity ent) {
Vector playerDir = ent.getLocation().subtract(player.getLocation().toVector());
Vector entityDir = ent.getLocation().getDirection();

    double relativeAngle = (Math.atan2(playerDir.getX() * entityDir.getZ() - playerDir.getZ() * entityDir.getX(), playerDir.getX() * entityDir.getX() + playerDir.getZ() * entityDir.getZ()) * 180) / Math.PI;

    return (relativeAngle <= 60 && relativeAngle >= -32);
    // inFront return (relativeAngle <=-135 || relativeAngle >= 135);
}```
#

but not tested

ornate patio
#

isBehind?

eternal oxide
#

look at the last line

ornate patio
#

oh

eternal oxide
#

just a different return depending on which method you do

ornate patio
#

I'm assuming you meant ent.getLocation().toVector()

eternal oxide
#

yes

#

typing in notepad 🙂

#

while playing kenshi

ornate patio
#

ok backstab works

#

the splash attack is still very erroneous

#

idk how to describe it

#

just random cows get hit every time

eternal oxide
#

I'll have to look tomorow

#

finishing up my kenshi play then off to bed

ornate patio
#

when i punch this cow the two cows in the circles get hit

ornate patio
#

thx for the help thus far

tender shard
ornate patio
#

no

tender shard
#

post the output of /version please

ornate patio
rough ibex
#

font scaling not 100 😭

ornate patio
#

@eternal oxide I got it fixed

public boolean isFacing(Player player, Entity entity) {
    Vector toEntity = entity.getLocation().add(0, entity.getHeight() , 0).toVector().subtract(player.getEyeLocation().toVector());
    double dot = toEntity.normalize().dot(player.getEyeLocation().getDirection());
    
    return dot > 0.5;
}

I just altered some code from an online thread and it works

#

Idk how it works but it just does

eternal oxide
#

lol ok 🙂

ornate patio
#

Is it possible to make a moving particle effect

regal scaffold
#
EnumWrappers.PlayerInfoAction.REMOVE_PLAYER
#

Is removed in 1.19.4

#

What's the new one

wary topaz
#

who is the guy who helps with 1.8.8

#

choose = new ItemStack(Material.STAINED_GLASS_PANE);
How can I make this light gray stained glass?

#

ah nvm ItemStack nop = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.LIGHT_BLUE.getData());

wary topaz
#

Patterns in 'instanceof' are not supported at language level '8'

Is there a way to use this in language 8? (For 1.8purposes)

#

Same goes with the advances switch blocks (I can just use static to normal switch if itcomes to that)

wary topaz
#

or would
static boolean isPlayer(CommandSender sender) { try { Player player = (Player) sender; player.getWorld(); } catch (Exception ignore) { return false; } return true; } just work

young knoll
#

I mean… you could do that

#

But why

river oracle
#

are you doing this

young knoll
#

What’s wrong with if (sender instanceof Player)

river oracle
#

you really should be learning java more if this is your solution to an instanceof check

wary topaz
#

well than what should I put?

river oracle
young knoll
#

And?

wary topaz
#

did you not see my message?

river oracle
#

okay I fail to see the issue then

young knoll
#

What I wrote is perfectly valid for java 8

river oracle
#

instanceof checks have been around since day 1 afaik

wary topaz
#

Patterns in 'instanceof' are not supported at language level '8'
And I cant upgrade

young knoll
#

(sender instanceof Player) = fine

wary topaz
#

Patterns in 'instanceof'

river oracle
#

clearly you did it wrong or your IDE is just hallucinating

young knoll
#

(sender instanceof Player player) = not fine

river oracle
#

more likely the former

wary topaz
river oracle
wary topaz
#

??

#

wdym

river oracle
#

that is not valid java 8 code

#

exactly what I said

wary topaz
#

it works though

river oracle
#

it won't if you're using java 8

#

if you really are targeting java 8 it won't work on compile

wary topaz
#

doesnt give me a error in the ide

river oracle
#

I don't know what to tell you

#

you will have an error if you are targeting java 8

#

may not be right now

wary topaz
#

ill try compiling

river oracle
#

may not even be on compile could be a RuntimeException

#

though I'd lean towards a Compiletime if your IDE is really targeting java 8

#

as that wouldn't be valid syntax

wary topaz
#

it works

river oracle
#

You aren't using Java 8 in that case

cobalt dust
#

How to make gun recoil

wary topaz
#
04:33:02 [INFO] [EthanGarey] <-> ServerConnector [lobby1] has connected
04:33:02 [INFO] [EthanGarey] <-> DownstreamBridge <-> [limbo] has disconnected
04:33:06 [INFO] [EthanGarey] <-> ServerConnector [survival] has connected
04:33:07 [INFO] [EthanGarey] <-> ServerConnector [limbo] has connected
04:33:07 [INFO] [EthanGarey] <-> ServerConnector [survival] has disconnected
04:33:07 [INFO] [EthanGarey] <-> DownstreamBridge <-> [lobby1] has disconnected
04:33:34 [INFO] [EthanGarey] <-> ServerConnector [lobby1] has connected
04:33:35 [INFO] [EthanGarey] <-> DownstreamBridge <-> [limbo] has disconnected
04:33:37 [INFO] [EthanGarey] <-> ServerConnector [survival] has connected
04:33:37 [INFO] [EthanGarey] <-> ServerConnector [limbo] has connected
04:33:37 [INFO] [EthanGarey] <-> ServerConnector [survival] has disconnected
04:33:37 [INFO] [EthanGarey] <-> DownstreamBridge <-> [lobby1] has disconnected

Now can someone explain this to me...

ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF("survival"); player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); player.sendMessage("debug");

#

No errors

fierce prawn
#

Is there a way to speed up hopper movement and the rate it absorbs items?

blissful wagon
#

how i can check if a plugin installed on server ? there is any way to get a list of installed plugin on server ? (Ping Me pls)

jagged monolith
blissful wagon
#

thx for help

jagged monolith
wet breach
#

there is config settings for hoppers in spigot.yml

#

if I am not mistaken

jagged monolith
#

Those are the only settings I could see that would relate to it, so maybe what you're after @fierce prawn

wet breach
buoyant viper
#

so in the README of CraftBukkit... what does PAIL actually mean when it is used?..

undone axleBOT
ocean hollow
#

When comparing ItemStacks, does their amount compares too? If so, is it possible to check the item, but not pay attention to the amount?

wet breach
#

IE lets say the method is named unload, but instead you want it renamed to save you would do

// PAIL: rename save
#

you add that to the end of the closing bracket of the method in question

buoyant viper
#

yes i understand that part of the why, but not why its called PAIL..

wet breach
#

because it makes it easier to find

buoyant viper
#

dam SadCat

wet breach
#

I am not aware of any utility called pail so the only thing I can think of

buoyant viper
#

the only thing i can think of is a clever play on words actually

#

not to say that i forgot what a pail was IRL but i definitely had to look it up to refresh my memory

#

a bucket

#

like

#

bukkit

opal juniper
#

normally they are called Access Transformers, but it’s probably Public Access Something Something

young knoll
#

Maybe it was originally chosen because yknow

#

Pail is like a bucket

#

And bukkit

buoyant viper
#

mayb

ocean hollow
#

Help me please. I have a config with List<ItemStack>, it is filled in the format as in the screenshot. I need to know if the inventory contains the first item? If so, get the second item.

#

I wrote this, but I'm not sure if it will work correctly.

young knoll
#

There’s Inventory#contains and containsAtLeast

ocean hollow
#

like that?

cinder abyss
#

Hello, how can I check if an entity is moving ?

sullen marlin
#

x/z velocity > 0 maybe?

cinder abyss
#

or something like that

sullen marlin
#

event.getEntity() [x z velocity > 0]

cinder abyss
#

I want to make a quick sand block, and only players are killed by it

sullen marlin
#

how is that related to an entity moving

cinder abyss
#

There isn't a EntityMoveEvent

sullen marlin
#

I am confused what killing only players has to do with entities moving

#

what happens instead

#

or use words

cinder abyss
sullen marlin
#

can you say what you want to do

cinder abyss
#

and I want to kill all entities

sullen marlin
#

what is the code of TempBlock

#

isnt the sand just going to replace the cobweb

#

yes but wont it solidify once it falls onto something

#

also you use blockLock for both blocks

#

shouldnt the location be different in that case?

#

well if a falling block touches a solid block it will solidify

#

think what happens when sand falls...

#

dont know if its possible

#

cancel the event maybe?

ocean hollow
sullen marlin
#

I think that kills the block

#

so guess not possible

#

open a feature request, although it might be glitchy

#

?jira

undone axleBOT
sullen marlin
#
  1. this is the development channel; 2) you tried to give it more ram than your system has. reduce xmx
novel shuttle
#

i realised wrong channel

vivid cave
#

hello can anyone explain me about minecart speed?

#

i wanna make them like 10 times faster

#

i see minecart#setMaxSpeed

#

but i don't really know how that will work, will minecart always reach that max speed?

#

if not, when does it reach max speed

cinder abyss
#

Use BlockDisplay instead of FallingBlock for 1.19+

#

this will be better 😉

orchid trout
#

how to name them

tender shard
orchid trout
#

pain

tender shard
#

what is cat fm

opal juniper
#

a radio channel? idk

rotund ravine
tender shard
#

I'm in

#

where do I signup

vale kiln
#

hi

#

Does anyone know how to use DecentHologram

rough basin
#

What should I do to make rate of fire?
I found one thread and i cant understand

tender shard
opal juniper
vale kiln
#

wiki was not enough to solve my error

#

i had opened ticket them dc server

#

but they didnt returned me

opal juniper
#

as a developer myself, they may be busy

quiet ice
#

Then state your error

#

Like we aren't all-knowing

opal juniper
#

you are, aren’t you?

vale kiln
#

just i want create a hologram with this code

    public void onClaimBlockPut(BlockPlaceEvent event) {

        Block placedBlock = event.getBlockPlaced();
        Player player = event.getPlayer();

            if(placedBlock.getType() == Material.BEDROCK && player instanceof Player) {
                player.sendMessage("+2");

                double placedBlockX = placedBlock.getX();
                double placedBlockY = placedBlock.getY();
                double placedBlockZ = placedBlock.getZ();
                Location placedBlocksHologram = placedBlock.getLocation().add(0.5, 1.0, 0.5);

                List<String> lines = Arrays.asList("Line 1", "Line 2");

                Hologram hologram = DHAPI.createHologram("claimlan", placedBlocksHologram, lines);
                hologram.setDefaultVisibleState(true);
                hologram.show(player, 0);
            }
    }````

and i had this error: Caused by: java.lang.ClassNotFoundException: eu.decentsoftware.holograms.api.DHAPI
opal juniper
#

you need to shade it

#

or repackage

vale kiln
opal juniper
#

are you using maven?

vale kiln
#

yep

opal juniper
#

?paste your pom

undone axleBOT
vale kiln
chrome beacon
opal juniper
#

oh i forget about plugin libs

vale kiln
chrome beacon
#

Well yeah

#

Code that does not exist cannot run

vale kiln
#

hmm
I'm trying right away

vale kiln
#

but will the user of this plugin always have to use this plugin?

chrome beacon
#

Yes

vale kiln
#

Any chance of integrating?

chrome beacon
#

Find another hologram library that allows for shading

#

or make your own

vale kiln
#

hmm okey thank you so

tender shard
#

(if you use maven)

#

if you use gradle, you need the shadow plugin instead

vale kiln
#

hmm thank you i will try that now

tender shard
#

oki. are you using maven?

vale kiln
#

yes

tender shard
#

great, then just do what the blog post says, and it should (hopefully) work

vale kiln
#

👍

tender shard
#

oh and then use mvn package to compile. do NOT use "File -> Build artifacts" or anything

vale kiln
#

okey

chrome beacon
vale kiln
#

What do you mean another plugin?

#

wouldn't it be a decenthologram?

tender shard
#

I thought it was a library or sth

vale kiln
#

but with api integrated

chrome beacon
tender shard
#

did you add the other plugin as depend in plugin.yml?

rough basin
#

How can I make events fire faster (more in the same amount of time) than they fire when the mouse is held down?

#

I mean, let's say pressing the left mouse for 1 second fires an event 5 times. So what if I want the click event to fire 6 times in 1 second?

sullen canyon
#

how do I store base64 string in a config

#

When I try to, it turns into something horrible

      \ndmEvdXRpbC9NYXA7eHBzcgA1Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFibGVNYXAk\r\
      \nU2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAlsABGtleXN0ABNbTGphdmEvbGFuZy9PYmplY3Q7WwAG\r\
      \ndmFsdWVzcQB+AAR4cHVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAR0AAI9\r\
      \nPXQAAXZ0AAR0eXBldAAGYW1vdW50dXEAfgAGAAAABHQAHm9yZy5idWtraXQuaW52ZW50b3J5Lkl0\r\
      \nZW1TdGFja3NyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5s\r\
      \nYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAoadAAGU1RSSU5Hc3EAfgAOAAAAAg==\r\n"```

Why does it put \n and \r there, even if I remove them with .replace I can't deserialize it to itemstack


```java
public static ItemStack itemStackFromBase64(final String data) throws IOException {
        try {
            final BukkitObjectInputStream bukkitObjectInputStream = new BukkitObjectInputStream((InputStream)new ByteArrayInputStream(Base64Coder.decodeLines(data)));
            final ItemStack itemStack = (ItemStack)bukkitObjectInputStream.readObject();
            bukkitObjectInputStream.close();
            return itemStack;
        }
        catch (ClassNotFoundException ex) {
            throw new IOException("Unable to decode class type.", ex);
        }
    }

    public static String itemStackToBase64(final ItemStack item) {
        try {
            final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            final BukkitObjectOutputStream bukkitObjectOutputStream = new BukkitObjectOutputStream((OutputStream)byteArrayOutputStream);
            bukkitObjectOutputStream.writeObject((Object)item);
            bukkitObjectOutputStream.close();
            return Base64Coder.encodeLines(byteArrayOutputStream.toByteArray());
        }
        catch (Exception ex) {
            throw new IllegalStateException("Unable to save item stacks.", ex);
        }
    }````
sullen marlin
sullen canyon
#

I will try, thank you

warm mica
sullen canyon
warm mica
#

I mean that you should Base64.getDecode().decode("") instead if Base64Coder.decodeLines

#

Same thing for the other method. That one is adding these new line characters /n/r

ocean hollow
#

How do I remove pressing F in the inventory?

ocean hollow
#

version api 1.16

chrome beacon
#

Is that rust mc 👀

#

also show code

chrome beacon
ocean hollow
ocean hollow
chrome beacon
#

You're not using the event I sent ._.

ocean hollow
#

i used it

chrome beacon
#

It's fixed in 1.17+

young knoll
#

Or try the word around in the comments ig

ocean hollow
#

did not help

chrome beacon
#

Try survival

ocean hollow
twilit roost
#

i havent done anything with bows..
but sometimes my bow just doesn't fire at all
even tho its loaded

#

any ideas why?

chrome beacon
#

Are you cancelling the interact event anywhere?

ocean hollow
#

me?

chrome beacon
#

Not you

twilit roost
#

ooh yes im
didn't thought of that :D

#

but only for block interactions

twilit roost
quaint mantle
#

how cna i get all online players on a server

remote swallow
#

Bukkit.getOnlinePlayers()

rough basin
#

If I give the same ItemStack to two players, are they still the same ItemStack? Is there a difference?

tall saffron
#

help why does my plugin say it needs to update like idk why does the api says the version is 1.0.0 altho i already realesed the 1.0.1

chrome beacon
#

It says 1.0.1 for me

remote swallow
#

^^

chrome beacon
#

Probably cached somewhere

tall saffron
#

oh wierd

#

it says 1.0.0 for me

#

and in my server it says update needed

#

wait let me check one more time in my sv

#

see it says the last plugin version is 1.0.0

#

its wierd

remote swallow
#

im guessing its how you check the version then

tender shard
#

imagine not using SpigotUpdateChecker

young knoll
#

This is why we make sure the new version is actually newer than the installed version

tall saffron
#

wth i putted my plugin on a host

#

and it doesnt say that

#

like the same exact file

chrome beacon
# ocean hollow same
    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getClick() == ClickType.SWAP_OFFHAND) event.setCancelled(true);
    }

Works for me

remote swallow
tender shard
#

use this ^

remote swallow
#

how you check the version from the api is before or after the current version

tall saffron
#
          try {
              HttpURLConnection con = (HttpURLConnection) new URL(
                      "https://api.spigotmc.org/legacy/update.php?resource=109696").openConnection();
              int timed_out = 1250;
              con.setConnectTimeout(timed_out);
              con.setReadTimeout(timed_out);
              latestversion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
              if (latestversion.length() <= 7) {
                  if(!version.equals(latestversion)){
                      Bukkit.getConsoleSender().sendMessage(ChatColor.RED+name+ " | There is a new version out there! | We highly recomend you to update to it | New version : "+latestversion);
                      Bukkit.getConsoleSender().sendMessage(ChatColor.RED+"You can download it at: "+ChatColor.WHITE+"https://www.spigotmc.org/resources/109696/");  
                  }            
              }
          } catch (Exception ex) {
              Bukkit.getConsoleSender().sendMessage(name + ChatColor.RED +"Error while checking update.");
          }
      }``` i am new making plugins
tender shard
remote swallow
#

yeahhh that isnt gonna work how you want it

tall saffron
#

i barely understand what i done

tender shard
#

read it

tall saffron
#

k lol

tall saffron
#

whos updated do i use

chrome beacon
#

I tested on 1.19.4

remote swallow
ocean hollow
remote swallow
#

alex's is probably easier

chrome beacon
#

And you said you did ._.

ocean hollow
#

That is, I can use api 1.17 on the server 1.16.5?

remote swallow
#

update server ¯_(ツ)_/¯

ocean hollow
#

I can't do that.

young knoll
#

No you can’t use the new api on an old server

#

Well you can, but it won’t fix your issue

#

And can very easily lead to problems

chrome beacon
#

You need to update

tall saffron
remote swallow
#

did you add the dependency

chrome beacon
#

Probably not

tall saffron
#

no, but hwo

remote swallow
#

maven or gradle

chrome beacon
#

Read the forum post*

#

._.

remote swallow
#

^^

tall saffron
#

oh i saw it it was at the end

#

my bad

chrome beacon
#

Do read things before copy pasting

strange rain
#

Hey does anyone know how to delete a world? .delete() isn't consistent and when I tried to use FileUtils it made my .jar file 35MB in size.

tall saffron
#

sorry, i am really new to making plugins do i have to create a git repository to host my html web?

chrome beacon
#

What does HTML web even have to do with your plugin

livid dove
#

What's the best approach to register listeners only when a game mode or something specific is about to begin?

tall saffron
chrome beacon
strange rain
remote swallow
strange rain
#

FileUtils worked for some reason it makes my jar absurdly big though

tall saffron
#

so how and where do i implement the maven

remote swallow
#

do you have a pom.xml

chrome beacon
tall saffron
remote swallow
#

do you have a pom.xml

tall saffron
#

o sorry i thought it was for another personm

cinder abyss
#

Hello, how can I paste a schematic in my plugin ?

tall saffron
#

no i dont have

young knoll
cinder abyss
young knoll
#

Or make your own schematic reader

strange rain
chrome beacon
#

So what that code does it recursively loop all contents and deletes them

strange rain
#

Alright how do I integrate it I am not necessarily sure where to put the path/file

chrome beacon
#

dir

#

is the path to be deleted

strange rain
#

Alr ty

#

I'll give it a shot

tall saffron
strange rain
#

Btw you know anyway to remove unused dependencies using maven in intellij?

remote swallow
chrome beacon
strange rain
tall saffron
chrome beacon
#

An update checker might be too advanced for you then

tall saffron
#

i thought it would be easier

quaint mantle
#

any way i can count a players playtime through a whole bungecoord network

tall saffron
#

well i will start again with another plugin to learn more i guess, any tutorial series recomendation? as i also have the wrong code editor i guess

rotund ravine
ivory sleet
quaint mantle
# tall saffron well i will start again with another plugin to learn more i guess, any tutorial ...

https://www.youtube.com/watch?v=lJyTEuqLQfU i watched this series when i started its goog

Learn to code your own Spigot plugin in this complete tutorial series! In this episode, we setup our workspace, download our dependencies, and get ready to begin development.

--- Important Links ---

● Java JDK8: https://www.oracle.com/java/technologies/javase-jdk8-downloads.html
● IntelliJ: https://www.jetbrains.com/idea/download/#section=wind...

▶ Play video
#

TechnoVision is making good stuff in general

rotund ravine
quaint mantle
ivory sleet
#

techno vision is good but u wont learn the language itself

rotund ravine
quaint mantle
#

is it complicated to work with a database? i have one set up for luckperm but i never really used one for my own plugins

young knoll
#

Do you know SQL

quaint mantle
#

sorta

#

basics ig

rotund ravine
#

Not that hard.

quaint mantle
#

0kay i will see what i can do thx for the help

worn tundra
#

Yummy logic visualization for conditions

ivory sleet
#

but it becomes complicated if u wna write it robustly

#

just setting it up doesn't take long on a whim

quaint mantle
#

setting up part isnt the problem i just dont know how to make my plugins acsess it

young knoll
worn tundra
quaint mantle
worn tundra
timid scarab
#

may i get some help with something probably hundreds of people already asked for

undone axleBOT
livid dove
tall saffron
#

is there like an optimized version for the spigot that you put on your plugin, cause i made a really quick first plugin and it was like 20mb

pseudo hazel
#

using maven?

tall saffron
#

Oh yeah that must be

pseudo hazel
#

so is that a no?

#

building with maven my jar is usually no bigger than 0.5mb

tall saffron
#

nono, that means a yes lol the thing is i dont now how to use maven but dont worry as i am really new

pseudo hazel
#

do you have any dependencies?

#

meaning other plugins you deliberately chose to depend on

buoyant viper
tall saffron
#

No, is just a simple welcome event that sends a message and you can configurate it in the config.yml

pseudo hazel
#

hmm

#

how do you build the jar?

#

and what IDE are you using

tall saffron
#

eclipse lol

pseudo hazel
#

I see

river oracle
#

He probably shaded spigot

pseudo hazel
#

well I have 0 experience with eclipse

river oracle
#

Spigot tends to be a bit big in your plugin :P

tall saffron
#

what is to shade spigot?

pseudo hazel
#

what does your pom.xml look like?

#

you included all of spigots code in your jar file

#

which you dont need

tall saffron
#

i dont jave no pom.xml i dont understand that

pseudo hazel
tall saffron
#

i alredy read that, i cant seem to understand it, is there a video?

pseudo hazel
#

probably

#

yourtube has a bunch of videos

#

just look for spigot maven setup in eclipse

tall saffron
#

Kay thanks+

#

i have no idea how IntelliJ works

#

how can i create a maven file on my folder

river oracle
#

not specifically for spigot

#

you are narrowing down your search results by including "spigot"

#

firstly look on how to setup Maven with java

#

it will give you a more comprehensive setup guide than adding with spigot to the end

tall saffron
#

Okay but firstly with maven does it import the spigot file for the plugin?

#

this is what i got

river oracle
#

just create a scratch maven project with Intellij

#

IntelliJ actually has a Spigot Dev plugin

#

I'd reccomend using that

remote swallow
#

called Minecraft Development

tall saffron
#

k so i delete everything i got on my plugins and i create a new maven proyect named as i want my plugin

#

what do i put

#

java and maven?

pseudo hazel
#

download the minecraft development plugin first

#

then create a spigot project

#

I think that will be the easiest way

remote swallow
#

^^

tall saffron
#

k

remote swallow
#

File>settings>plugins>marketplace

olive lance
#

who knows how to use flask cors and sqlalchemy, i am trying to create a database and its not working, thanks to chat gpt

tall saffron
#

sorry i am taking long i have to smth i am back in 10m i already instralled the plugin

olive lance
#

chat gpts choice man

chrome beacon
#

So what is your goal?

#

Just starting a database?

#

Or connecting your python program

olive lance
#

i fixed it, i defined the models after creating the tables

#

which was why there was no tables

#

probably still ownt work tho. my end goal is a web interface manageble access control system. i already made the physical boards with arduino and it works with card scanning and door locks but i want to add a database and have multiple boards manageable from one place

buoyant viper
#

this man using a RFID chip to remote into his minecraft server

olive lance
#

actuslly nothing to do with minecraft this is just my safe space

chrome beacon
#

Well the arudino communication

#

and a web interface

olive lance
#

Sounds like exactly what im doing. Except one of the big problems i need to solve is the thing will still need to work without network. So it stores credentials from the server priodically and updates them. Authorization happens locally

#

in case of network outage

#

dont want to be locked out

tall saffron
pseudo hazel
#

okay

#

then create a new project

#

there should be more options

tall saffron
#

yess i saw them thanks now i have the maven

#

great plugin

#

How can i export my plugin to test it ?

chrome beacon
#

Run package

#

See the maven tab on the right

#

Open it and click package

remote swallow
#

its eclipse so we need an @eternal oxide

tall saffron
#

nono i passed to intellij

remote swallow
#

oh

eternal oxide
#

?

#

another traitor

tall saffron
#

eclipse was a lit easier but i couldnt get help, and there wasnt many tutorials lol

remote swallow
#

do what olivo said

tall saffron
#

i see the mavent tab on the right but where is the "package"

remote swallow
#

its under lifecycles

tall saffron
#

oh there is it it exported it to "target" right?

remote swallow
#

correct

tall saffron
#

and whats the difference between the 3 exports

pseudo hazel
#

idk, I just take the one without the extra wordings xD

tall saffron
#

lol kay

#

[13:08:04 INFO]: SimpleServerRestart Enabled | Creator : Chiru | Version : 1.0.0 now this, this is what i love to see lol

rigid otter
#

If my server is offline server, can I get real uuid in case from a premium account player?

brisk estuary
#

is it possible to trade with a villager in code?

tall saffron
#

why does it create an empty config folder? this is my main code :

#

it was too long

#

this is my config : Config: enabled: true time: 120 message: "&e&l[Simple Server Restart] &4&lServer Restarting In : "

remote swallow
#

you dont need the register config method, use saveDefaultConfig() on onEnable

tall saffron
#

k although it now works, the config wasnt on the resources part

#

although my broadcast and restart dont work lol

zealous scroll
#

Does anyone know why if I get a player's yaw and pitch, and give it to an entity by using Entity#setRotation, if the yaw is in the range of 90 to 180 it will be completely off when given to the entity?

zealous scroll
quaint mantle
#

how can i convert into for example: 1 year ago

tall saffron
#

asked chatgtp and says to use in a apart of the code loadConfig(); but it says it doesnt exist

quaint mantle
#

expecially when working with older versions too

tall saffron
#

I asked him and said to create a funciton ```public void loadConfig() {
// Load the configuration file
FileConfiguration config = getConfig();

// Set the default values if they are not present in the configuration file
config.addDefault("enabled", true);
config.addDefault("time", 120);
config.addDefault("message", "&e&l[Simple Server Restart] &4&lServer Restarting In : ");

// Save the configuration file if the defaults were added
if (config.getDefaults() != null) {
    config.options().copyDefaults(true);
    saveConfig();
}

// Get the values from the configuration file
time = config.getInt("time");
message = config.getString("message");

}

#

i think this will work

tall saffron
quaint mantle
#

well if you are very exact it can still help. In a new session try to explain that you want him to use spigot and the version you are making the plugin for

#

if you get an error send chat gpt the error and he will try to correct his code

#

it ofc not a perfect solutiojn but can help with smal parts

hazy parrot
#

i think errors in java are pretty self explanatory, no need to use ai for it

quaint mantle
#

not if you are new to spigot

hazy parrot
#

new to java *

quaint mantle
#

well theres java errors and errors that come from spigot itself

#

someone thats perfect with java may still have issues using the libary

hazy parrot
#

im sure someone thats perfect with java will understaind error that is thrown

quaint mantle
#

okay well perfect may be the wrong word

#

but still

#

it doesnt hurt

#

better to have help you dont need then to need help but not get it

tall saffron
#

Oh my bad i didnt respond i have been using it, i resolved it

#

the only thing the load config that he gave me, makes like the config have the "config" 2 times in the same file ``` public void loadConfig() {
// Load the configuration file
FileConfiguration config = getConfig();

    // Set the default values if they are not present in the configuration file
    config.addDefault("enabled", true);
    config.addDefault("time", 120);
    config.addDefault("message", "&e&l[Simple Server Restart] &4&lServer Restarting In : ");

    // Save the configuration file if the defaults were added
    if (config.getDefaults() != null) {
        config.options().copyDefaults(true);
        saveConfig();
    }

    // Get the values from the configuration file
    time = config.getInt("time");
    message = config.getString("message");
}```
hexed tendon
#

hey, does anyone have a, idea on how i can modify a player's reach ? None of the solutions i tried worked

tall saffron
#

and here is like the config i made for my plugin : Config: enabled: true time: 120 message: "&e&l[Simple Server Restart] &4&lServer Restarting In : "

remote swallow
#

do you have saveDefaultConfig on enable

wet breach
#

the method you have there is only useful if you have yaml files that you want to load that are not config.yml

golden turret
#

Hi, I am using the Build Gradle action from GitHub Actions to build my project. The problem is that I have a dependency in my build.gradle that is hosted on GitHub Packages and everytime the action tries to build it gives a 401 error. How can I fix that?

remote swallow
#

are you passing the env vars to the workflow for it to grab it

#

github packages is dumb and you cant access their repo unauthed

golden turret
tall saffron
golden turret
wet breach
remote swallow
#

the loadConfig can be condensed down to ```java
public void loadConfig() {
FileConfiguration config = getConfig();
this.time = config.getInt("Config.time", 120);
this.message = config.getString("message", "&e&l[Simple Server Restart] &4&lServer Restarting In : ");
}

wet breach
#

the easiest way is to just include a config.yml in your jar and extract that, the second is the way you are adding defaults

#

or the code above like Epic has

remote swallow
wet breach
remote swallow
wet breach
#

also, you probably should check for the presence of the config.yml file as well and not just assume it is there

#

otherwise you will encounter some NPE's

tall saffron
#

I don't understand anything but, when I get back home I'll try it

remote swallow
#

if you dont understand that check

#

?jd-s

undone axleBOT
remote swallow
#

and this might help

#

?learnjava

undone axleBOT
wet breach
#

this way, you get the help while we are here instead of waiting till some unknown time where we most likely will forget about your problem and or you forgetting some of the things presented 🙂

#

in other words it doesn't waste either of our time

golden turret
remote swallow
#

show the parent build.gradle

#

but most likely you need to add a username and password to that repo

tall saffron
#

Yes my bad I was home, but I ended up having to quickly rush outside because of smth, my bad I undertand

wet breach
#

no problem

golden turret
wet breach
#

take care of what you have to go do, someone will be here when you get back most likely 😛

golden turret
remote swallow
#

yeah github packages is fucking dumb and annoying

#

you cant access the repos un authorized

golden turret
#

then how do I authorize😭

#

I read about a GITHUB_TOKEN

golden turret
remote swallow
#

iirc you can add a username + github secret so you just have to add a username = "username" & password = System.getenv("github_secret") then in the workflow just pass an env var as github_secret: ${{GITHUB_TOKEN}}

buoyant viper
#

to host HTML web content, u would use software like Nginx or Apache

wise mesa
#

they may be referring to github pages

buoyant viper
#

oh

#

then yes they will need a git repository

#

<github username>.github.io will be the repo name

golden turret
#

thanks

remote swallow
golden turret
hazy parrot
#

Env is not inside with

#

Read link I sent

golden turret
#

bruh

#

didnt see

#

thanks again

#

it worked now

#

thanks

hazy parrot
#

👍

hollow birch
#

hey yall i was just wondering how stressfull upating a players persitentdatacontainer is because i want to have like player levels and instead of storing them in a database you can store them in persistent data container for that player, but i dont know if it is better on the server to store them in a map and save it to the player every once in a while or if i should just save it directly to the persistentdatacontainer

cinder abyss
#

Hello, how can I get the highest block in a chunk ? (with a good accurate)

pseudo hazel
#

im only unsure about when you like relog or whatever but I assume its getting stored in player data

hollow birch
#

e.getview.getttitle i think

hollow birch
#

thats why im worried about stress on the server

pseudo hazel
#

oh nah you are fine

#

there is already a lot of player data that gets saved already

#

so adding like an int doesnt make it bad

#

thats what pdc is meant for

river oracle
#

don't compare inventories using titles

hollow birch
#

my problem is id be updating it constantly, like whenever a player breaks a block or kills a mob

pseudo hazel
#

thats fine

river oracle
#

there is always a better alternative to using titles

#

to compare

pseudo hazel
#

as long as its not like every tick or whatever

#

but even then

hollow birch
#

ok good to go thank you

river oracle
#

please read the thread I sent above it pertains to actual well managed inventories

#

I highly reccomend reading and understanding what the thread has to say

hollow birch
#

is there a good way to have text above a players head besides sending armor stands with packets?

pseudo hazel
#

or create an inventory holder class

buoyant viper
buoyant viper
#

those new 1.19.4 display entities AbsoluteHalal

pseudo hazel
#

yes they are sexy arent they

buoyant viper
#

idk i havent used them

pseudo hazel
#

well, they are

river oracle
#

I hope my new Inventory#setTitle PR discourages people from using InventoryView#getTitle to check what inventory they are in

#

Now knowing that it can be changed it should be obvious its nolonger a safe way to compare inventories

pseudo hazel
#

well

worn tundra
cinder abyss
pseudo hazel
#

"hey I can change the title at any point, this means I can make wacky comparisons"

wet breach
wet breach
#

that is what it means

pseudo hazel
#

maybe, but it would not surprise me

river oracle
pseudo hazel
#

like it would be an easy way to change what events are handled by which inventories just by checking an setting their titles dynamically

buoyant viper
#

"You've logged in" 😭

worn tundra
river oracle
#

it was out of scope for the PR

buoyant viper
worn tundra
remote swallow
#

yep

river oracle
#

Choco is working on all things components

remote swallow
#

still waiting on choco

buoyant viper
#

yes choco has a PR to Component-ize spigot

pseudo hazel
cinder abyss
#

with a populator

#

so I think it's a bad idea loading chunks

pseudo hazel
#

well

#

have you actually tested to see how inaccurate it is?

buoyant viper
#

now we need a native Bukkit implementation of Components and well be golden

cinder abyss
#

I'll use it

river oracle
cinder abyss
#

my structure replace blocks so it will be good x)

#

a tree can be decapitated 🙂

buoyant viper
#

oh i just got a disgusting idea

#

what does java yell at, same method name, different return type, or same method name, different parameter types

pseudo hazel
#

the former one if any

#

because the second is just operator overloading

#

which is a feature believe it or not

buoyant viper
#

yea as i was typing it i was like wait this is literally overloading

worn tundra
remote swallow
#

on spigot stash

#

?stash

undone axleBOT
remote swallow
#

wrong

#

its spigot

river oracle
#

oh yeah

buoyant viper
#

u also need a stash account to see the PRs p sure :v

river oracle
#

yes ^

river oracle
#

which means you need to sign CLA

buoyant viper
#

sacrifice ur life to Michael D5

pseudo hazel
#

ur a CLA

remote swallow
#

michale tardis 5

worn tundra
#

Aight

river oracle
#

💀 wtf happened that PR hasn't been updated since october

remote swallow
#

choco a lazy

#

@worldly ingot when component pr

young knoll
#

impl is a sperate patch

#

nerd

river oracle
#

Spigot gets components when the sun engulfs earth

#

jkjk ofc

buoyant viper
#

me personally i am a big bungee chat components enjoyer

wet breach
#

so not entirely sure what the issue is

river oracle
#

you'll get ripped apart

buoyant viper
#

frostalf feels like talking to chatgpt except its a real person behind the screen

pseudo hazel
#

i like chat components until I want item names and lore

buoyant viper
#

idk

pseudo hazel
#

cuz u are robotic

buoyant viper
#

gotta bug Choco sus_dance

#

jk dont do that, i already do

wet breach
buoyant viper
#

think ive pinged choco at least once a month mentioning components the past 3 months

remote swallow
buoyant viper
#

true

#

we all want components anguish

buoyant viper
#

theyve already had one of the 2 methods i pr'd since 1.16 api

wet breach
buoyant viper
#

true

#

Folia 💪🏻

wet breach
#

yeah I am not a fan of it, I will probably never use it either

buoyant viper
#

all theyll have to do is remove like 2 patch files anyway

#

1 api 1 server

#

i basically had the same implementation anyway by coincidence, only now i just directly access a field instead of using a setter

#

same method name too so their api wont need a redundant entry :p

wet breach
#

I suppose it was eventually bound to happen some sort of implementation for what they are doing

wet breach
#

one day paper will finally stop using spigot

buoyant viper
buoyant viper
pseudo hazel
#

nah im joking

remote swallow
#

how could you hannah

pseudo hazel
#

i havevnt talked to you enough to know if you are robotic

buoyant viper
#

i am my reviewer ChadSmile

#

i removed him bc i looked at other PRs n saw like they didnt have a reviewer assigned

#

so i was like maybe i shouldnt have done that

#

so i removed md

remote swallow
#

its fineeee

buoyant viper
#

funnily enough he checked out the PR like a few hours later

#

commented on my CB impl to do a more minimal diff

remote swallow
#

hes only gonna delete you off the face of the earth

buoyant viper
#

true

buoyant viper
#

why is it blue

remote swallow
#

stash borkered

buoyant viper
#

fr?

#

on god?

#

just like that?

remote swallow
#

real

buoyant viper
#

its only the actual repo i cant load

#

the landing page is just fine anguish

remote swallow
#

git goober

wet breach
buoyant viper
#

it loadsed now

late sonnet
jagged bobcat
#

yes?

pseudo hazel
#

dw, we are all waiting for the question

#

its not just you

glossy venture
#

?paste

undone axleBOT
wet breach
#

this allows one to change or add blocks to a chunk that generates automatically

#

or to a chunk that loads

glossy venture
#

does anyone know why this error is occuring?

im dynamically loading all libraries in a file libraries.txt, downloading them from repos, into a URLClassLoader called libraryLoader
all libraries are loaded into libraryLoader successfully as Class.forName("someLibraryClass", true, libraryLoader) completes successfully
but when i try to execute the actual program using

// find URL for JAR of bootstrap class
ProtectionDomain domain = ClusterBootstrap.class.getProtectionDomain();
CodeSource source = domain.getCodeSource();
URL file = source.getLocation();

// create child loader with our JAR file
URLClassLoader appLoader = new URLClassLoader(
        new URL[] { file }, libraryLoader);

// load cluster class and execute
Class<?> cluster = Class.forName(
        "net.neonpvp.Cluster",
        /* initialize */ true,
        appLoader
);

cluster.getMethod("execute", String[].class)
        .invoke(null, (Object) args);

i get an error saying it cant find one of the library classes, which did pass the direct Class.forName test

the boostrap (main) class: https://paste.md-5.net/fedaruwine.java
the error: https://paste.md-5.net/ovasiluket.txt

wet breach
#

The name of that class should give it away in what it does or its purpose is anyways

#

it populates blocks to be used

#

hence, if you read the javadoc comment, it says it can also be used in combination with a chunkgenerator

#

which is ideal if you wanted to alter or have custom chunks generated automatically instead of just changing them after they are created

#

so the chunkgenerator needs a blockpopulator to know what blocks it needs to have

quaint mantle
#

Can someone help me with this
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), new,(this), 1,p); 2L)
It says:
Identifier expected Not a statement Unexpected token

alpine swan
#

how can i make a command in my plugin override the command from another plugin

quaint mantle
buoyant viper
#

its okay

#

u almost got it right so thats good, just a little off the mark

#

the new,(this) part is very not right

#

that should be a Runnable that executes code inside a run() method

#

the part after it isnt very correct either

regal scaffold
#

Which one is more efficient

#
    public static Collection<Component> mm(List<String> strings) {
        Collection<Component> components = new java.util.ArrayList<>(Collections.emptyList());
        for (String string : strings) {
            components.add(miniMessage.deserialize(string));
        }
        return components;
    }

or

public static List<Component> mm(List<String> strings) {
    return strings.stream()
                  .map(miniMessage::deserialize)
                  .collect(Collectors.toList());
}
quaint mantle
buoyant viper
#

?jd-s 1 sec i gotta see the params of the run task method

undone axleBOT
craggy cypress
#
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```

Why did they remove spigot?
buoyant viper
#

alright, so scheduleSyncDelayedTask takes 4 arguments

#

or wait i read the repeating one woops

#

alright

#

it takes 3 arguments

alpine swan
buoyant viper
#

the first one is an instance to ur Plugin, which u provide via Core.getInstance(), the second is a Runnable, this is what code will actually get executed when the task runs, and the third is a delay (in ticks) that the server will wait before running ur code @quaint mantle

#

ie.

scheduleSyncDelayedTask(Core.getInstance(), () -> Bukkit.getServer().broadcastMessage("hello, world!"), 20L);

#

that code will print "hello, world!" into the game chat after 20 ticks (1 second)

#

the () -> broadcastMessage... part is the actual task, theres many ways to write it

quaint mantle
#

So i can replace mine getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), new,(this), 1,p); 2L) with Bukkit.getServer().broadcastMessage("hello, world!"), 20L); right?

buoyant viper
#

that will send a message immediately; not delayed

#

ur original code doesnt hint at what it does, either

#

its not valid code, either :v

#

ur erroneous code is the new,(this), 1,p); part

quaint mantle
#

Sorry im completely losted right now

buoyant viper
#

u would do getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> { /* DO CODE */ }, 2L);

#

where /* DO CODE */ is whatever u need to run 2 ticks later

wet breach
buoyant viper
#

i can sign off with this tho

#

?learnjava

wet breach
undone axleBOT
quaint mantle
#

So is this right?
getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> { 1,p }, 2L);

buoyant viper
#

ur getting close-ish

#

what is 1, p ?

#

that still is not valid java code

#

what exactly are you trying to do?

quaint mantle
#

Its on a player death listener
Here is it all

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;

import static org.bukkit.Bukkit.*;

public class PlayerDeathListener implements Listener {
    public PlayerDeathListener() {
        RegisterClass.newListener(this);
    }

    @EventHandler
    public void onDeath(PlayerDeathEvent e) {
        Player p = e.getEntity().getPlayer();
        e.getDrops().clear();
        getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> { 1,p }, 2L);
        p.updateInventory();
    
buoyant viper
#

but what are you trying to do 2 ticks after that event (in the scheduled task)

lost matrix
buoyant viper
#

yeaaa, i did mention new class somewhere instead

quaint mantle
buoyant viper
#

oh maybe i didnt

remote swallow
wet breach
#

you should explicitly declare the specific imports you are needing

buoyant viper
wet breach
#

fortunately in most cases the star import typically gets turned into a proper one, however on some occasions you can inadvertently add all the imports under the package you put the star for which just clutters and wastes space on the metadata

quaint mantle
#

I cant this....
Do your guys have any method on how i can fix it, i just wanna get it fixed

buoyant viper
#

you are running a task, one that will run 2 server ticks after a player dies, what is it that youre trying to run those 2 ticks later

#

1, p is not valid java, and your code has no context for what is supposed to happen

#

we just need to understand why youre trying to do, your end goal

lucid gazelle
#

hey, im working on a custom spawners plugin, and i change the spawner types by CreatureSpawner#setCreatureTypeByName()

the spawners work fine normally when the player is opped, but when deop players place it, its an empty spawner (or a pig spawner if server is 1.17.1)

glossy venture
#

does anyone know why this error is occuring?

im dynamically loading all libraries in a file libraries.txt, downloading them from repos, into a URLClassLoader called libraryLoader
all libraries are loaded into libraryLoader successfully as Class.forName("someLibraryClass", true, libraryLoader) completes successfully
but when i try to execute the actual program using

// find URL for JAR of bootstrap class
ProtectionDomain domain = ClusterBootstrap.class.getProtectionDomain();
CodeSource source = domain.getCodeSource();
URL file = source.getLocation();

// create child loader with our JAR file
URLClassLoader appLoader = new URLClassLoader(
        new URL[] { file }, libraryLoader);

// load cluster class and execute
Class<?> cluster = Class.forName(
        "net.neonpvp.Cluster",
        /* initialize */ true,
        appLoader
);

cluster.getMethod("execute", String[].class)
        .invoke(null, (Object) args);

i get an error saying it cant find one of the library classes, which did pass the direct Class.forName test

the boostrap (main) class: https://paste.md-5.net/fedaruwine.java
the error: https://paste.md-5.net/ovasiluket.txt

quaint mantle
glossy venture
#

identifiers cant start with a number

undone axleBOT
glossy venture
#

thats exactly what im trying not to do

#

im trying to dynamically load the libs

#

so the jar isnt like a gigabyte

chrome beacon
glossy venture
#

this is a standalone application

#

i know of the libraries section in plugin.yml

chrome beacon
#

ah

#

If it's standalone just shade it

glossy venture
#

but it takes so long to build and transfer bruh

lost matrix
#

You might have two different classloaders. And the one trying to instantiate CredentialsProvider
might not have it on its classpath.

glossy venture
#

and the loading works

lost matrix
#

Check which instance the classloader is before you get this exception

glossy venture
glossy venture
#

i think

#

oh wait maybe

wet breach
#

this way problems like this are not encountered, assuming the libs/jars being loaded also don't load their own classloaders and if they do hope they delegate to the higher one as well

glossy venture
#

the library loader has the jvm app loader as its parent if thats what you mean

buoyant viper
#

all i remember is uhh

#

Thread#setContextClassLoader and uh

#

URLClassLoader

wet breach
#

there is a hierarchy when it comes to class loaders

#

and this is how classes can see each other or not see each other