#help-development

1 messages · Page 1972 of 1

young knoll
#

Yes

tender shard
#

you'll also see your own inv in the lower half

blazing scarab
#

yeah, that's possble via-command. But, chat has a 255 symbols limit iirc

#

for longer commands use command blocks

young knoll
#

512

tender shard
#

well to get skulls, why not just use /give @p minecraft:skull 1 3 {SkullOwner:username}

#

not sure what the 3 is for, I just copied it from some website

young knoll
#

Oh no it is 255

#

It was increased from 100

young knoll
tender shard
#

oh

young knoll
#

3 was the old metadata for a player head

chilly haven
#

Look i am very confused. when i did + it took away 10 lol i guess it works now

quaint mantle
#

What are you trying to do

tender shard
tender shard
#

0 durability = perfect item, higher "durability" = broken item

quaint mantle
#

And what does it do

#

because just checking material may be nit enough

chilly haven
#

what u tryna do

quaint mantle
#

Ah

shrewd sentinel
#

How would I change how much damage my custom mob does?

#

Pretty sure there is a nms way

#

I am using nms but not sure what the remapped function is called

lost matrix
shrewd sentinel
#

How do I do that?

tender shard
#

ping someone? 😦

shrewd sentinel
#

Max_name_length only exists

#

nothing more

tender shard
grim ice
#

@lost matrix So did you fix the Workload distributing thing

shrewd sentinel
#

Should I import the bukkit one or nms one

tender shard
#

bukkit, obviously

shrewd sentinel
#

It doesn't work with this.getAttribute doe

tender shard
#

send a screenshot of your code pls

#

you must be doing sth wrong

young knoll
#

You’d have to do this.getBukkitEntity.getAtrribute iirc

lost matrix
tender shard
#

oooh

#

you are talking about NMS entities

#

sorry I missed that

grim ice
#

tysm

tender shard
#

I know

shrewd sentinel
tender shard
#

what I want is to send the request to a specific IP address

#

e.g. something like new HttpUrlConnection("1.2.3.4", "https://myserver.com");

#

yeah but how

opal juniper
shrewd sentinel
tender shard
#

nah

#

it must include the vhost of course

#

every webserver uses the "Host: " header to decide which website to deliver

#

e.g.

#

it's all the same IP of course

#

the webserver needs the proper header to know what website to deliver

#

read my above messages pls

lost matrix
#

What is the problem?

tender shard
#

I need to create a HttpUrlConnection but I also want to specify the IP

lost matrix
#

What do you mean by "also"? Cant you just define an URL by using the IP?

tender shard
#

no

tender shard
#

no. Http works like this:

#

so in my case

lost matrix
#

Ok but thats for the DNS to decide. Im not sure what you are asking. You cant tell the DNS what to resolve...

tender shard
#

I can't just say "I need 1.2.3.4 from 1.2.3.4" but "I need api.jeff-media.com from 1.2.3.4"

tender shard
#

and so I am pretty sure that it's possible with java too

grim ice
#

i dont get why

proud basin
#

You don't get why what

grim ice
#

"we did once full cycle"

#

and the second line of comment

tender shard
lost matrix
# grim ice and the second line of comment

We poll an element. Then we compute it. Then we add it at the back.
If we would do that without stopping at the last entry then we would constantly cycle over the elements until the time is up.

lost matrix
tender shard
#

yeah probably. I just thought maybe there's an easier way. but yeah I guess I'll just do it using headers then 🙂

#

thanks

vast river
#

I need help in vault economy plugin..

tender shard
#

you might want to be a tiny bit less specific in your question. all those details about what exactly you need help with are hurting our brains

lost matrix
tender shard
#

lol that means you're still alive, which is good I guess 😄

#

@vast river

#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

vast river
#

If i have 100,000 and someone pays me just 500 is it a very small amt. he payed me? @tender shard

tender shard
#

I'm out

vast river
#

wdym

tender shard
#

hmm I wonder

#

if I have a a string

#

abab

#

and I split it using split("b)"

#

then [0] is a and [1] is a too

#

but what if I split it using "split("a")"

#

since a is the first char

lost matrix
#

I think empty Strings are truncated

vast river
tender shard
#

so split[0] won't be null or sth?

tender shard
lost matrix
vast river
#

Bro i asked for support please

eternal oxide
#

10

vast river
tender shard
#

3.2 is a number

lost matrix
#

Without rounding

vast river
#

really but how?

tender shard
#

on some systems it might be 3.199999999999999999

#

yes

#

because how

vast river
#

what r u guys tlling?

eternal oxide
#

C3500

lost matrix
tender shard
vast river
#

i am having 100k right so if it is 300k is it a high amt.?

tender shard
#

in zimbabwe dollars it's still not very much

lost matrix
eternal oxide
#

the value of an amount all depends on how easy it is to earn that amount.

tender shard
grim ice
#

i still dont see the problem

lost matrix
#

If they return false then they get discarded.

grim ice
#

yes

#

so whats the problem

#

i dont see it

lost matrix
#

One moment ill make an animation

tender shard
#

fancy boiii

grim ice
#

okay srry for wasting ur time

#

the load wont run if u just stop the code if u reach the load

#

cuz like when u compute, and readd the load its added to the tail

#

and ur checking if tail is the next load

#

and then stopping the code

#

so it will never run after running the first time

red sedge
#

gosh im overcommenting

grim ice
#

or am i missing something

red sedge
#

how bad can that be right

young knoll
#

The tail will be updated the next time it runs

tender shard
#

huh

#
        String asd = "delim1userdelim2";
        System.out.println(asd.split("delim1")[1].split("delim2")[0]);
#

this prints "user"

#

so it actually does NOT ignore starting "null" elements

young knoll
#

Basically it just doesn’t let a load run twice in a single execution loop (in the event the load is rescheduled)

grim ice
#

so it doesnt let it get ran twice in the execution run, but it lets it leaves it for the next time run() function is ran?

#

well still

grim ice
#

is that last one in the queue

#

this is confusing

#

i dont get it

#

what if the shouldBeRescheduled is the last workload added, when the run runs, the lastElement will be the shouldBeRescheduled workload, and when its its turn to run, it will check if next load == shouldBeRescheduled, it will return true and stop it from running

lost matrix
#

So here is the problem:
This animation represents a single tick.
If we dont stop at the first element then all elements will constantly be
re-added to the queue and maybe called several 100 times. But in one tick
we want a workload to only tick a single time.

tender shard
#

fancy

#

what did you make that with

young knoll
#

If there is only 1 workload it will never run

lost matrix
#

Just using diagrams (drawio) then exporting single pngs and adding them to a gif

grim ice
#

last workload will never run either

lost matrix
young knoll
#

do while loop perhaps

grim ice
#

if its last, it will be checked in the run(), and it will get not run

lost matrix
#

I updated the code to reduce nesting and missed that part. Let me update it right away.

grim ice
#

even if theres more than 1 workload

#

the last one wont run

#

it checks if the last one is the next one

#

or actually

#

yeah

lost matrix
#

Wait. With one element it will def run because in the first conditional check the nextLoad is null.

grim ice
#

what about the last one

#

it will get saved as last element before the loop, and when itss turn comes it will not work

lost matrix
#

But the last element wont run. I have to change peekLast() to just peek()

grim ice
#

so I was somehow right?

lost matrix
#

Hmm. changing to just peek wont solve it either.

grim ice
#

maybe

#

hasRan()

#

in the workload interface

#

its default false

#

u set it to true when it ran

#

then u check if it ran and if so stop it from running

lost matrix
#

Huh? No. I will def do this with identity checks.

grim ice
#

oh ok

lost matrix
#

Also this would destroy the workload as it removes its FunctionalInterface status

grim ice
#

yeah ig

lost matrix
#

To be honest... the code looks right to me.
The last element will run and the loop will also work if there is only one element in it.

tender shard
#

why the fuck does this work

    public static void doStuff(Plugin plugin) {
        Bukkit.getScheduler().runTaskAsynchronously(plugin, InnerRunnable::new);
    }

    private static class InnerRunnable {
    }
lost matrix
#

But then again im tiered

tender shard
#

shouldn't that throw an error because InnerRunnable doesnt extend BukkitRunnable

young knoll
#

Won’t having only 1 element immediately trigger the check if the current element is the last one

tardy delta
#

because it takes a runnable?

tender shard
#

yeah but InnerRunnable is just an Object

tardy delta
#

returns nothing so its valid

#

i guess

tender shard
lost matrix
tender shard
#

oh I understand now why it works

tardy delta
#

InnerRunnable::new is already a lambda

#

thats why

tender shard
#

a method reference always is a runnable

#

yeah

tardy delta
#

it just wants a lambda which returns nothing

next stratus
lost matrix
lost matrix
young knoll
#

The question is

olive lance
young knoll
#

Does it automatically stop if the tick time reaches 50ms

tender shard
lost matrix
tender shard
#

isn't there sth like ServerTickEvent?

tardy delta
#

nop

lost matrix
#

Thats why it works there

tender shard
#

ah ok

olive lance
tender shard
#

yeah okay but in theory, couldn't you schedule a running task that runs every tick, then puts the timestamp in a map, then in all remaining tasks you can check how much time has passed?

lost matrix
tender shard
#

I could also ask "get me website yahoo.com" also to IP 1.2.3.4

lost matrix
#

You dont know if relativePointsWE7.setCorner1(blockVector3); clones the object internally

tender shard
olive lance
#

But you don’t want a host name right

tender shard
#

I wont to use a vhost name

next stratus
tender shard
#

but I also want to be able to specify the IP address that gets called

#

I want to be able to specify the value of 1.2.3.4 AND google.com myself

lost matrix
olive lance
#

1.2.3.4 bring some public dns server?

#

Being

tender shard
#

no in this example, 1.2.3.4 is the webserver that actually hosts google.com

lost matrix
olive lance
#

Oh ok

tender shard
#

the reason I need this:

#

have you ever cracked photoshop, etc?

olive lance
#

Ofc

tender shard
#

you can avoid their license by just saying "adobe.com = 127.0.0.1" in your hosts file

#

and that's what I want to prevent

olive lance
#

Oh ok

#

I never cracked it with hosts they always had 1 file that was the authentication basically

next stratus
#

idk if i'm just dumb or if this is stupidly hard

tender shard
olive lance
#

Yeah lol

next stratus
#

I thought this would be a quick thing to code but nope as it's world edit it can't be a easy thing to code

lost matrix
olive lance
#

Idk if this is what you are looking for

#

If you are using Java 8 or older you can do:

You can set the system property sun.net.spi.nameservice.nameservers

next stratus
olive lance
#

Well I guess that’s not what you’re trying to do

#

I’m still not very clear on the desired outcome

next stratus
#

I thought checking that it's not the same block vector 3 would be correct

tender shard
#

I don't wanna mess with the system's DNS servers, and also those will never be called if someone just uses /etc/hosts

lost matrix
#

So you set corner1 as A
Then you check if corner1 is not A
And in this case you set corner2 as A

But if you set corner1 as A then it never be not A

olive lance
#

Yea true

tender shard
#

and I also can't use the IP directly because my webserver obviously doesn't have any certificate for the IP itself

#

😦

olive lance
#

I think in any case that you use a host name hosts will be able to block it

lost matrix
next stratus
tender shard
#

I think I'll just get an additional IP that's used only for this API but that's another 3€ / months lol

olive lance
#

I wish you could block ips in hosts that easily

tender shard
next stratus
#

would

blockVector3 != relativePointsWE7.getCorner1()

be better?

tardy delta
#

dont compare objects with != or ==

lost matrix
next stratus
#

I thought that was not equals?

#

what about !blockVector3.equals(corner) {
}
?

#

I'm getting so confused here sorry

lost matrix
# next stratus I thought that was not equals?
  public static void main(final String[] args) {

    final Data data = new Data();

    data.cornerA = 100;
    if (data.cornerA != 100) {
      data.cornerB = 100;
    }

  }

  private static class Data {
    int cornerA;
    int cornerB;
  }

Does this make sense to you?
Do you grasp why the if statement will always be false?

olive lance
next stratus
#

yeah i do

lost matrix
#

Ok. Good. That is 1:1 what you are doing right now.

olive lance
#

HostsFileNameService.extractHost

next stratus
#

I gotta somehow fix this

#

I know how dumb I look but i'm trying to do it :/

tender shard
#

that's very interesting

#

thanks, I'll take a look ❤️

#

hm I doubt that it'll work in some kind of chrooted environments, like e.g. pterodactyl that runs all servers in a docker container

olive lance
#

Oh yeah I wouldn’t even know where to start with that

tender shard
#

nothing

#

an itemstack will never be equal to any Material enum value

#

well

#

it will throw an error once any slot in the inv is empty

#

but besides from that, it won't do anything

#

yeah but first check if the itemstack is not null

eternal oxide
#

if (itemStack == null) continue;

dapper sapphire
#

Is there anyway to combine these events?

#

One fires when clicking a player the other when clicking the air

ivory sleet
#

Nope

lost matrix
dapper sapphire
# ivory sleet Nope

Is there anyway to make it more efficient? Because if you click the player in the head it fires the playerinteractevent even when the player is flying.

dapper sapphire
rough drift
#

not sure tho

tender shard
#

there's PlayerInteractEntityEvent for entities

#

for blocks or air, it's PlayerInteractEvent

rough drift
#

but... then why is PlayerInteractAtBlockEvent a thing? (I don't remember exact name)

hasty prawn
#

PlayerInteractAtEntityEvent?

#

PlayerInteractAtBlockEvent isn't a thing

brave sparrow
#

PlayerInteractAtEntity is for armorstands and whatnot

hasty prawn
#

Isn't that PlayerArmorStandManipulateEvent

#

PlayerInteractAtEntity just contains the location of the interaction

brave sparrow
#

there might be an event for it these days

#

there didn't used to be

hasty prawn
#

Ah

neon nymph
#

Hello, could I store any object in an itemmeta's PDC?

#

I'm stumped on how it's supposed to work, I wanted to store maybe a runnable to it but idek if it's possible

tardy delta
#

why would you want to store a runnable?

deft forum
#

anyone know why my playerInteract event runs twice?

tardy delta
#

each hand?

crimson terrace
# tardy delta why would you want to store a runnable?

possibly to run it whenever something happens with that specific entity? like "teleport the player up 10 blocks with a certain chance 2 seconds after the entity is hit". A workaround would be to store a key in the PDC and have a hasmap with <String, Runnable> to activate it

deft forum
tardy delta
#

that it calls an interactevent for both the left and the right hand

lost matrix
tender shard
#

what do you think

#

is this dirty hack acceptible or not

#
Bukkit.getScheduler().runTaskLater(this, () -> {
            if(Bukkit.getPluginManager().getPlugin("ChestSort") != null) {
                Bukkit.getPluginManager().registerEvents(new ChestSortListener(), this);
            }
        },40L); // Yeah, waiting 2 seconds is a dirty hack. But since ChestSort softdepends on ShulkerPacks, I don't see another way. And tbh noone will use any shulkers within 2 seconds of server start
#

that's in ShulkerPack's onEnable()

#

(well not yet but I think I'll PR it like this)

lost matrix
#

Ive had a similar problem with PAPI placeholders because they are registered async on another thread. So even when i did depend
on PAPI i could not use their placeholder right away. My fix at first was also to wait 2 seconds. But after some thinking i just made
my dependant parts lazy.

tender shard
#

but tbh I don't care, I guess it'll work fine

#

and if it works fine, no need to worry I guess

lost matrix
#

Are you authoring both plugins?

tender shard
#

chestsort softdepends on shulkerpacks

#

but I have to add this listener to shulkerpacks to avoid a weird duplication/item loss bug

#

so shulkerpacks can't softdepend on chestsort

tender shard
#

probably waiting 1 tick would be enough

visual tide
#

are socket connections still open when shutdownhooks run

quiet ice
#

netty connections? Unlikely. NIO connections? Not sure

waxen plinth
#

Just make a listener that listens for ChestSort being enabled which unregisters itself once it is

sacred mountain
#

does raw use of parameterized hashmap affect my code

#

new HashMap();
new HashMap<>();

ivory sleet
#

not really

sacred mountain
#

alr ty

ivory sleet
#

its just sloppy

sacred mountain
#

mk

lost matrix
sacred mountain
#

anyone got recommendations of a nice intellij syntax highlighter

#

or theme

lost matrix
#

good old dracula

viral crag
#

What is the proper way to define what a @command annotation does? commandExecutor method conflicts with it

lost matrix
sacred mountain
#

im using an @interface

ivory sleet
sacred mountain
viral crag
sacred mountain
#

well

#

mines weird

ivory sleet
#

LowOnEspresso

waxen plinth
#

What

ivory sleet
#

thats annotation processing

waxen plinth
#

You take an array of names

#

But then you still just split on | to get aliases?

sacred mountain
#

yep

#

:)

waxen plinth
#

bruh

#

Why not just take a string instead of a string[] then

lost matrix
#

Never seen that before. But to be fair i have used the spigot command api for like 3 months and then i switched to something else because i thought it was tiring.

waxen plinth
#

It is very tiring

viral crag
ivory sleet
#

maybe send a screenshot*

lost matrix
viral crag
#

doesnt need a screenshot, the issue is pretty clear:
error: incompatible types: Command cannot be converted to Annotation @Command(name = "Author", desc = "Author command", aliases = {"author", "authors", "Authors"},

#

if I disable the commandExecutor it goes away but is not useful

#

and vice-versa

sacred mountain
#

yay finished tabcomplete api

ivory sleet
#

uh

#

veri col

sacred mountain
#

wtfrik where did my hikaricp maven dependency go

viral crag
#

so bukkit command is overriding the spigot plugin-annotations - hmm maybe

ivory sleet
#

to me it merely sounds like you use erroneous imports

lost matrix
sacred mountain
#

java.lang.NoClassDefFoundError: com/clonkc/vlands/kitpvp/utils/ColorUtil

#

any ideas

#

i literally just

#

its there

#

?

lost matrix
#

Do you use this class from a dependency?

sacred mountain
#

nope its literally my class

#

it just converts the chatColor.translatewhatever into a sinple .translate()

lost matrix
#

This sometimes happens if an exception in a static initializer block is thrown

sacred mountain
#

hm

#

was working before tho

#

i havent changed that class since i started this project

#

last edited 03/02/22, 07:13

lost matrix
#

So you dont have any dependencies and this is just a random class in your project?

sacred mountain
#

i have dependencies

#

just this is a random class

lost matrix
#

And this class is not used by one of the dependencies you have?

sacred mountain
#

i read it wrong, it was my logger class:


import org.bukkit.Bukkit;
import org.bukkit.ChatColor;

public class Logger {
    public static void log(String msg) {
        Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
    }
}
sacred mountain
#

maven?

lost matrix
#

java... dont care what dependency manager.

sacred mountain
#

its my class and its not used by any dependencies

lost matrix
#

Full stack trace pls

viral crag
# lost matrix Would you mind providing some code?

not really anthing to share, but i figured out where i need to look for more information. The annotation processing is not actually generating the command and permissions in plugin.yml, so I need to see why. It is possible they are not fully implemented in 1.2.3

sacred mountain
viral crag
lost matrix
# sacred mountain

Just recompile. And make sure the class is actually in the compiled jar

sacred mountain
#

i can check if i decompile it

#

right

#

because if it isnt then my IDE is doing some funky stuff

lost matrix
#

You can also just open it. Its just a compressed archive like zip

sacred mountain
#

open the compiled jar?

#

just used jd gui as i have it on my desktop

#

its. clearly in the jar

#

idk whats wrong with it

lost matrix
#

And if you run the plugin now? Does the exception still occur?

sacred mountain
#

yea

#

same exact thing

quaint mantle
#

so i have a json file like this (IGNORE THE NULLS IT IS INTENTIONAL FOR POSITIONING) and as you can see it includes itemstacks AS WELL AS other data, how would i serialize the itemstacks AND this other data together?

sacred mountain
#

i legit do not know why this is happening :/

lost matrix
lost matrix
sacred mountain
#

should i reload my ide

#

i refactored all of them like an hour ago to become lowercase

quaint mantle
lost matrix
quaint mantle
tardy delta
#

imagine that i'd have this field in a class, would the compiler do optimisations on it? just wondering

private final Integer i = null;```
lost matrix
lost matrix
#

Where do you get this json from?

quaint mantle
#

with gson

sacred mountain
#

ok so uh my ide isnt even compiling my code properly

quaint mantle
#

it can serialize but not deserialize

sacred mountain
#

when i compile it, it works but everything isnt updated

viral crag
lost matrix
quasi patrol
#

How do I get an url of an image of the texture of a player’s skin’s face?

sacred mountain
#

on what might be causing it

#

(intellij btw)

lost matrix
# quaint mantle ok thanks
public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> {
  @Override
  public ItemStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObject = json.getAsJsonObject();
    Map<String, Object> data = context.deserialize(jsonObject.get("item"), new TypeToken<Map<String, Object>>() {}.getType());
    return ItemStack.deserialize(data);
  }

  @Override
  public JsonElement serialize(ItemStack src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject jsonObject = new JsonObject();
    jsonObject.add("item", context.serialize(src.serialize()));
    return jsonObject;
  }
}
lost matrix
#

Then when building your Gson instance.

Gson gson = new GsonBuilder().registerTypeHierarchyAdapter(ItemStack.class, new ItemStackSerializer()).disableHtmlEscaping().create();
waxen plinth
#

ItemUtils.toString(item) 🚎

tardy delta
#

kek

lost matrix
waxen plinth
#

Nope

#

JSON string

lost matrix
#

Using spigots serialize method?

waxen plinth
#

Yep

#

Takes the Map<String, Object> and uses my json library to serialize to a string

lost matrix
#

Or you just use Gson to serialize that map as shown above...

waxen plinth
#

Nah

#

I like doing everything myself

lost matrix
lost matrix
#

Get his PlayerProfile and read the URLs from that

tardy delta
#

oh god

waxen plinth
#

bruh

dire marsh
tardy delta
#

combined with lombok

waxen plinth
#

Why would you do a repeatable annotation

quaint mantle
waxen plinth
#

Yes let me ping someone and then say sorry for ping in the same message rather than just not pinging them

quaint mantle
waxen plinth
#

If you want you could always use my library which has ItemUtils.toString and ItemUtils.fromString, zero effort

lost matrix
waxen plinth
#

Besides that I dunno how to use gson so I can't help with this lol

grim ice
#

like

#

you store a workload if its last

quaint mantle
grim ice
#

then u check if nextload is the one u stored

#

if it is then u do not compute it

#

which means the last workload will never work

sacred mountain
#

my ide is just completely ignoring my changes :/ any help?

quaint mantle
#

in fact what does null safe even mean

lost matrix
waxen plinth
#

What does "completely ignoring my changes" mean

grim ice
#

How am I wrong then

sacred mountain
waxen plinth
#

How are you exporting

sacred mountain
#

and did it again and still nothing

#

maven package

waxen plinth
#

Try deleting the old jar

grim ice
#

It probably does work, since you have more experience than me you wouldnt code something that would just break but I want to know where am I wrong

waxen plinth
#

Run it again and make sure it generates it again

sacred mountain
#

i used a diff version number

#

so it made a new jar

waxen plinth
#

Then make sure all your changes were saved

grim ice
#

Maybe you can help 7smile explain

lost matrix
# grim ice How am I wrong then

Im too tiered for this. Redempt could you pls verify that this works?
Concern is that the queue gets cycled once when the run() method is called.
Pretty sure my code is fine.

grim ice
#

Redempt, my point is the last element workload that gets stored

#

will never run since nextload != l ast element check

sacred mountain
#

it isnt saving rhe changes

waxen plinth
#

Wait are you just trying to have a loop of the same tasks that will be repeated in the same order forever

sacred mountain
#

i move 3 packages into a new package and it didnt show up in rhe build

grim ice
#

No

#

only if it has shouldBeRescheduled

lost matrix
waxen plinth
#

Ah

grim ice
#

Wut

waxen plinth
#

That's not how I would do it

lost matrix
waxen plinth
#

No

grim ice
#

.poll

waxen plinth
#

Though a linked list would also work

#

I was thinking of using a LinkedHashSet

grim ice
#

so its not the same taks looped

#

some are looped, some are not

waxen plinth
#

Rather than moving stuff around you just loop over it and only call remove if shouldBeRescheduled is false

lost matrix
waxen plinth
#

Depends on scale

#

For random remove you'd want LinkedHashSet

quaint mantle
#

two questions: what is null safe and how do i do it

waxen plinth
#

Though I suppose you could always do Iterator#remove on a linked list as well

#

I don't like messing with iterators directly though, they're very annoying

grim ice
#

Anyways redempt may you help us

#

Sorry for bothering you

lost matrix
lost matrix
quaint mantle
waxen plinth
#

It seems a little strange but it looks like it should work

grim ice
#

How am I wrong then

lost matrix
grim ice
#

the last element is stored, then when used it checks if its not the last element stored

lost matrix
grim ice
#

Yes, but hoow

waxen plinth
#

Yeah you can't use removeIf

#

But you could easily keep a list of the tasks that were run and then call removeAll

#

Or just keep two separate queues why don't you

#

One for tasks that should never be rescheduled and only run once

#

Though I guess that would run them out of order, which you probably don't want

grim ice
#

Object x = ...;
Object y = ...;
ArrayList<Object> list = ...;
list.add(x); list.add(y);
for(Object o : list){
if(o.equals(x) continue;
System.out.println(o);
}

#

will not print x

waxen plinth
grim ice
lost matrix
grim ice
#

it just doesnt make sense, u store an object, loop through a list of similar objects, and if the object at the position is the object u stored u dont run code for it, so how does it run

waxen plinth
#

It starts as null

#

It's assigned at the start of every loop

#

And then the condition is run before the start of the next loop

#

So at the beginning of loop it will always be the value from the previous loop

#

On the last loop, it will be the second-to-last element. Then the last element will be put in the variable, and the next time it checks the condition, it will be equal to lastElement, so it'll stop iterating

#

Like I said it's a bit strange but it should work

tardy delta
#

wait i got eclipse on my pc

somber sequoia
#

how could I make a player stop eating? I don't want to use e.setCancelled() as it doesn't stop the eating animation

waxen plinth
#

You could cancel the PlayerInteractEvent which is fired when they begin eating

grim ice
somber sequoia
grim ice
#

the order of the loads will be the order you addLoad()'d in

waxen plinth
#

Do you mean if there's only one task in the queue?

grim ice
#

No, many but you added them

lost matrix
# grim ice Object x = ...; Object y = ...; ArrayList<Object> list = ...; list.add(x); list....
  public static void main(String[] args) {

    ArrayDeque<Task> tasks = new ArrayDeque<>();
    tasks.add(new Task(0));
    tasks.add(new Task(1));
    tasks.add(new Task(2));
    tasks.add(new Task(3));
    tasks.add(new Task(4));
    tasks.add(new Task(5));

    Task lastElement = tasks.peekLast();
    Task nextElement = null;

    while (nextElement != lastElement) {
      nextElement = tasks.poll();
      System.out.println(nextElement);
      tasks.add(nextElement);
    }

  }

  private static class Task {
    int id;

    public Task(int id) {
      this.id = id;
    }

    @Override
    public String toString() {
      return "Task: %d".formatted(id);
    }
  }

Outputs

Task: 0
Task: 1
Task: 2
Task: 3
Task: 4
Task: 5
waxen plinth
grim ice
#

but its the first time run() runs

tardy delta
#

whaa my first plugin

lost matrix
#

oops

tardy delta
grim ice
#

Oh right

#

it starts out as null

tardy delta
#

old shit

grim ice
#

fuck im dumb

waxen plinth
#

smh

grim ice
#

ok plain java was better

waxen plinth
#

Could you not just keep a counter though?

#

Get the initial size, and a counter that starts at 0

lost matrix
waxen plinth
#

Stop once the counter reaches the initial size

grim ice
#

just understanding what nerds in this chat say is a flex alone tbh, yall geniuses

waxen plinth
#

Unless tasks are scheduled by other tasks that should work fine

grim ice
#

cant believe yall are teens, if u dont mind can u say how old r u

#

im 16

waxen plinth
#

I'm 20

grim ice
#

Imagine If I can get maybe half of your knowledge in 4 years

#

must be hard

#

if not impossible

#

dunno

waxen plinth
#

I dunno

tardy delta
#

💀

waxen plinth
#

I'm not a programming god or anything

#

Just keep at it

grim ice
#

u still have like 10 years of experience dont u

#

or like 8

waxen plinth
#

8

grim ice
#

yeah thats a ton of time holy

tardy delta
#

teach em while they are young

lost matrix
#

Its not. Ive started a bit over 3 years ago. You just need to keep digging.

grim ice
#

ic

waxen plinth
#

Yeah it's been 8 years since I started java but I didn't really do much with it for a long time

grim ice
#

what ill do is when i finish the list of sort of advanced topics conclure sent me

#

ill ask here again

waxen plinth
#

I'd say I started actually going hard with java ~4 years back

tardy delta
#

i started two years ago 👀

waxen plinth
#

Wait fuck

#

2015 was 7 years ago

#

🗿

unkempt peak
#

im 17 and i started 2 years ago, I'm definitly not the best but I'd like to think I am atleast decent at java and spigot

waxen plinth
#

I don't know what time is

grim ice
#

My first running java code was 7 months ago

#

is my progression good

waxen plinth
#

Yeah

lost matrix
# grim ice ill ask here again

I can provide you with one or two quite hard java assignments from the technical university of munich if you want to. (1st semester but still damn hard)

grim ice
#

yayy

waxen plinth
#

I'd be interested

#

I like a good challenge

rough drift
waxen plinth
#

I can share interview questions I've seen with you guys if you want

visual tide
rough drift
#

wanna see how hard they are

grim ice
#

one price to this is my ego going up, but ig i can just come here and lose a bunch of it again /j

somber sequoia
waxen plinth
waxen plinth
#

Is that even a program

#

There's no main

grim ice
waxen plinth
#

I am not a clean shaven boy

grim ice
#

i would always shave

waxen plinth
#

Too much work

tardy delta
#

too lazy

visual tide
#

imagine having a beard

waxen plinth
#

I used to shave back when my facial hair was all scraggly and uneven but it's pretty nice now

grim ice
#

cant imagine a developer looking fancy (im totally not insecure about my looks!)

rough drift
waxen plinth
#

nah

#

If you want we can compare libraries

rough drift
#

I made brigadier but annotations lol

#

you can also redirect stuff

waxen plinth
#

We can do commands in both and see which is cleaner

rough drift
#

(missing autocompletions)

#

sure, lets go for it

grim ice
#

my bet is redempt

rough drift
#

lets go to #general

waxen plinth
#

Ok

grim ice
#

does peekLast return 0????? - no, it returns last out which is 5

grim ice
#

or wait

#

its while(1 isnt 5):
next = 2; i think

#

yep

#

its while(n isnt x):
next = n++;

grim ice
#

as I seem to locate a fellow

cold field
#

Heya guys, does anyone know a good lib for custom recipes?

grim ice
#

I don't think you should .run() tho @lost matrix

#

cuz like

#

what if it was the last time the runnable should run

#

and then u still ran it agaain

#

why is the stuff in compute() even necessary

#

it will stop being rescheduled with the boolean below it

lost matrix
#

Its all in germen. Ill translate on of them over the days and send it

ivory sleet
#

😮

lost matrix
grim ice
#

whats the point of the code in the compute method

lost matrix
#

incrementing a tick counter, checking if its a mod of the delay and then executing the runnable if it is.

grim ice
#

u couldve done if(!(ticksAlive++ % delay == 0)) return;
without runnable.run(); right?

#

or wait

#

OH

#

the runnable passed is supposed to be a new runnable

#

to be ran alr

#

alright okay i thought you were passing in the WorkloadRunnable

lost matrix
young knoll
#

Pfft

#

That’s silly

grim ice
#

But I don't know if I understand it or not

#

it might've been some weird shit i dont know, thats why I asked

#

not because you're wrong lol

quiet ice
#

How do I achieve


        ShapedRecipe compassRecipe = new ShapedRecipe(new NamespacedKey(plugin, "compasst1"), tier1Compass) {
            @Override
            @NotNull
            public ItemStack getResult() {
                ItemStack result = super.getResult();
                ItemMeta im = result.getItemMeta();
                im.getPersistentDataContainer().set(compassShelfLife, longType, System.currentTimeMillis() + ThreadLocalRandom.current().nextLong(60_000L, 240_000L));
                result.setItemMeta(im);
                return result;
            }
        }

correctly? (this does not work as bukkit seems to cache the item result)

young knoll
#

PrepareItemCraftEvent

#

You can’t have a dynamic output in a recipe

fervent gate
#

double increment = 1 + (plugin.getConfig().getInt("FarmLevelIncrement") / 100);

Is there anything in this line that shouldn't work? This is the line in my code that doesn't work. The output value is 1.0 with an input value of 10... This shouldn't be the case.

lost matrix
#

Kind of

young knoll
#

Not in the recipe object itself

quiet ice
lost matrix
#

Sure you need to listen for the event and change the output. But you can do it via a custom recipe implementation

young knoll
#

Yeah but that’s not having a dynamic output in the recipe object itself

#

That’s having a dynamic output using the event

lost matrix
#

I mean. Technically its in the object.

young knoll
#

:p

lost matrix
#

true

quaint mantle
#

Dont even try to implement custom recipe choices

fervent gate
young knoll
quaint mantle
#

Thats a minecraft limitation

lost matrix
#

Wont be implemented because it could leak quite easily

lost matrix
quaint mantle
#

it can be, but i doubt spigot will support such hacks

lost matrix
#

Its just not implemented because it will lead to memory leaks as devs are dumb

quaint mantle
#

Recipes are sent to client

quasi patrol
lost matrix
young knoll
#

The game knows what area to use

quiet ice
#

uh, I don't think that PrepareItemCraftEvent even works as there is no way to set the itemstack afterwards

lost matrix
quiet ice
#

Eh, hopefully just setting the item meta suffices and it isn't cloning anything there

young knoll
#

You need to get the inventory and then setResult

lost matrix
#

^

quiet ice
#

Ah, I'd need to implement my own recpie class

#

but that is the thing I'm already doing, gah

#

oh, just setItemStack

lost matrix
#

Eh. You dont need to. But thats a clean way of keeping track. You could also just have a Map<NamespacedKey, Function<ItemStack, ItemStack>> laying around

quiet ice
#

I'm already using the PDC to store stuff that is unique to that item, so i'll just use pdc

fickle ivy
#

do we have a place here to hire a plugin developer?

lost matrix
#

Sure

fickle ivy
#

Where?

lost matrix
fickle ivy
#

It wont let me post there.

#

says insufficient privileges

quiet ice
#

You need a given amount of posts iirc

fickle ivy
#

well that's silly.

quiet ice
#

And how do I make a compass point to a given location?

((CompassMeta)im).setLodestone(new Location(evt.getPlayer().getWorld(), x, 0, z));

Does not appear to work from what I see (it changes the compass to a loadstone, but that is it)

quiet ice
fickle ivy
#

and people like me that rarely post are paying the price for it.

quiet ice
#

Though it could also be to enourage a give-and-take environment, idk what the actual plan is. You'd have to ask md for that

fickle ivy
#

That actually would ENCOURAGE spamming. spam a bunch of posts so I can post that i want to hire a developer? hmmmm.. would be their own fault for doing it that way

#

lmao

quiet ice
#

Another prominent thing is to DM a bunch of people on here - but it has meager changes of working and if it does the quality you get is according to what you ask for (i. e. pretty bad)

fickle ivy
#

lmao. yeah.. I understand that. Seems like what I want would be simple but then I know absolutely ZERO about creating mods. I don't even know apps they use for it.

quiet ice
#

My avatar is one of those apps actually heh

lost matrix
fickle ivy
#

small. Basically a container like a single chest that holds just 1 type of item such as iron ingots but will hold unlimited of that item.

opal juniper
#

Oh

#

redempt had a plugin for that i think

fickle ivy
#

I liked energetic storage until I realized there was a limit and I was losing stuff.

opal juniper
#

@waxen plinth

grim ice
#

it doesnt work like that

opal juniper
#

you got that crate plugin

fickle ivy
#

crate?

grim ice
#

they make you post messages, if you spam none of their business

opal juniper
#

yeah

grim ice
#

your fault

#

you can answer threads and just gain messages

quiet ice
#

So? It does the exact opposite of what it intends to do

grim ice
#

Spamming is a problem with the user, not the requirement

#

which has its solution (aka punishments)

quiet ice
#

However the spamming is encouraged (post farming) by such requirements

fickle ivy
#

yep. it is. also drives up the forums post count as well. I used to mod at another site. They never deleted members or posts. Just had a hidden forum they moved all outdated posts too to keep the post count high.

grim ice
#

Spamming is sending useless messages over and over which may end up as annoying, you're encouraged to talk, not to send garbage over the website

grim ice
#

It never encouraged spam

sullen marlin
#

'more and more'

grim ice
#

if you get encouraged to send garbage when there are requirements to talk, it's your fault, not the website

quiet ice
#

Well, PMs are locked behing a post-requirement system, services & recruitment, hiring, premium. Sure, some of those used to be there for some time, but others are rather new from my perspective

fickle ivy
#

actually someone like me that doesn't post much has to send garbage to get the post count up to make the post otherwise we would never be able to find developers to do what we need. as such it encourages garbage

sullen marlin
#

services and recruitment - since the entire existence of the site

#

premium resources - since the entire existence of premium resources

#

PMs - since spammers signed up and sent pornography to 30,000 members

grim ice
#

all of these requirements make sense

fickle ivy
#

to a point they do yes. but also to a point they do not.

sullen marlin
#

which one's don't make sense?

lost matrix
grim ice
#

even if people somehow own very weird working brains, and get encouraged to spam by such requirements, it has more Good results than side effects.

quiet ice
#

Uh.


                ((CompassMeta)im).setLodestone(new Location(evt.getPlayer().getWorld(), p2d.x(), 0, p2d.z()));
                ((CompassMeta)im).setLodestoneTracked(true);

Also does not work. What the hell am I doing wrong?

sullen marlin
#

services and recruitment / premium - to ensure community contribution

#

PMs - spam filter

#

people overuse PMs anyway

#

plugins have public support threads for a reason

#

your support doesn't need to be in private, especially for a free plugin

quiet ice
#

Yeah, that I can agree

fickle ivy
#

ohh. That advanced chestst might work. worth a few bucks to try. Thanks.

quiet ice
waxen plinth
#

Oh yeah

#

@fickle ivy BetaBarrels

fickle ivy
#

ill try that too.

olive lance
#

if a player equips armor by a dispenser what event is that

shrewd sentinel
#

?paste

undone axleBOT
tardy delta
#

BlockDispenseArmorEvent? not sure

shrewd sentinel
#

Why does world guard give me an error when I am trying to spawn a custom mob

world.addFreshEntityWithPassengers(mob, CreatureSpawnEvent.SpawnReason.CUSTOM);

https://paste.md-5.net/uhoyebocuf.sql

olive lance
#

anybody know of a library with an event that gets called whenever a players armor is changed? including death, dispenser, etc

#

redempt should make that

hasty prawn
#

I think alex had forked something like that

olive lance
#

honestly i think md5 should consider

fickle ivy
#

im trying beta barrels now

olive lance
#

has 4 ItemStack methods and a ItemStack[] method

#

for getting the new armor

#

maybe 5 more for the old set

#

maybe not

olive lance
#

thanks

floral pewter
#

Are middle mouse inventory click packets no longer sent to the server in 1.18?

fickle ivy
#

ok so betabarrels cannot be hopper fed. dang

quaint mantle
#

(Paper)

fickle ivy
#

But its still awesome. I like it.

granite burrow
#

How can I tell if a player has a lead attatched to a mob?

fickle ivy
#

@waxen plinth Thank you so much for pointing me at that beta barrels. I LOVE it. Its perfect with the exception of not being able to be hopper fed. Im gonna be using it until I find a hopper fed one like it.

hasty prawn
waxen plinth
#

They can be fed by hoppers though

granite burrow
waxen plinth
#

You can insert items into them with hoppers and remove them with hoppers as well

fickle ivy
#

how? I hooked hopper up and it didn't feed it

#

hang on let me try again

waxen plinth
#

Make sure you have hopper events enabled

#

Sometimes people disable hopper events in their paper.yml to reduce lag

#

But there's no way to know when items move between inventories without it

fickle ivy
#

I have spigot

waxen plinth
#

Version?

#

I've tested it on latest and it works with hoppers

hasty prawn
# granite burrow no

I'm not sure that you can then. If you have the mob, you can check if the player is leashing them. But afaik not the other way around.

fickle ivy
#

how do I find my version?

grim ice
#

U can

granite burrow
#

hmm, ig brute force with checking the mobs 10 blocks around the player is the best option then

fickle ivy
#

my minecraft is 1.18.1

grim ice
#

PlayerInteractAtEntityEvent

#

Check if it's a leash

#

Add to hash map

young knoll
#

There is a leash event iirc

grim ice
#

Then later just use it

hasty prawn
grim ice
#

Then do that

grim ice
real palm
#

and another time - when standing on a big dripleaf, the playerinteractevent with the action PHYSICAL is fired, however it is not supposed to cancel that but just to not destroy wheat, how can I differ between wheat and a big dripleaf?

grim ice
#

Or make a scheduler every period of time to check, which maybe inefficient but you can do it asynchronous if that's worth it

granite burrow
#

Ill test that out but since im pressed for time today ima do a quick and dirty fix for it then implement the best practice

fickle ivy
#

ok yeah. Hoppers are working now.

grim ice
#

Asynchronous in the main thread btw, or another thread if the methods are safe, but u might need to ask other people about this

grim ice
real palm
#

well, I should define every dripleaf on the server? 🤔

grim ice
#

What

#

No

#

Check the block type

real palm
#

you said location - aka defining every dripleaf location to check if it's matching with the player xd

grim ice
#

That's not how anyone would understand it but ok

real palm
#

so, how can I check the block type if there is just BlockFace but not Block/Material itself? 🤔

waxen plinth
#

BlockFace is a direction

grim ice
#

Why is there just BlockFace

waxen plinth
#

You can get one block relative to another

#

But you can't just get a type from a BlockFace and nothing else, because there's no position there

real palm
#

yeah, I just could use the player location, calculate -1 in the height and check if it's a big dripleaf and if, it should not be cancelling

#

that's one thing I could do

grim ice
#

Don't do that, possibly use relatives

#

Block Relative

#

But you can do it

waxen plinth
#

player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType()

grim ice
#

I'm not sure if it's any different, but it might be more consistent using relatives

real palm
#

ah

#

that way

#

well, it is still cancelled

#

and it spams my chat xd

#

and wheat is cancelled as well

minor garnet
#

how do i obfuscate a plugin without obfuscating library inside of .jar

waxen plinth
#

Step 1. don't obfuscate

#

Step 2. ???

#

Step 3. profit

minor garnet
#

why not

hexed hatch
#

Why not not

ancient jackal
ivory sleet
#

:x

hasty prawn
quaint mantle
#

Why am I unable to make World into String? I have World world = block.getWorld(); String blockWorld = world; and IntelliJ is giving error: Incompatible types. Found: 'org.bukkit.World', required: 'java.lang.String' even though I have java.lang.String already imported.

young knoll
#

getName

#

A world is not a string

maiden thicket
#

hey @quaint mantle (i dont know if im allowed to ping you, sorry if not), im trying to compile plotsquared, and i cant seem to because it keeps checking for checkLicenseMain task and failing there

#

should i just ignore it?

#
> Task :PlotSquared-Bukkit:checkLicenseMain FAILED
Execution failed for task ':PlotSquared-Bukkit:checkLicenseMain'.
> Header does not contain any of the required keywords: map(extension 'license' property 'keywords')

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

#

oh nevermind, i did compile a jar

#

i guess it did not matter

quaint mantle
quaint mantle
#

what tf does this mean???

#

how do i fix it

#

what is args

#

i never made anything called args

young knoll
#

Your config has a custom object without the type being specified

quaint mantle
hasty prawn
#

Ah there you go

#

I didn't know that existed NODDERS

quaint mantle
ancient jackal
#

the docs are gold

quaint mantle
#

what it means

ancient jackal
#

except for where they fall short

hasty prawn
#

Apparently that's not good enough for it to filter UnleashEvent also

ancient jackal
#

rip

quaint mantle
fierce salmon
#

I am working on a minecraft plugin that makes a sound when a player is mentioned in chat and I was wondering how I would be able to check to see if a player's sent message contains a player from the list of online players?

sterile token
#

Anyone could link me to a resource where talk how to create a custom abstract event and them show how to implement the abstract event?

#

Really thanks, and sorry for being egg breaking all time

patent horizon
#

if (Bukkit.getOfflinePlayer(uuid) instanceof Player) .sendMessage(u.f(message)); isn't there a way to do this that also makes a var out of the getOfflinePlayer?

ivory sleet
#

yes

#

if ((Object)Bukkit.getOfflinePlayer(uuid).getPlayer() instanceof Player player) {
player.do();
}

valid solstice
#

after doing some testing this is not true ://

#

from player.damage it'll also factor in your armor enchants

#

protection can negate it

quaint mantle
fierce salmon
#

How can I make it so it checks to see if a player from the list of online players is mentioned?

sterile token
#

That would generate an error

fierce salmon
sterile token
#

?learnjava

undone axleBOT
ivory sleet
patent horizon
#

ah

fierce salmon
patent horizon
#

xd now it's calling the cast redundant

ivory sleet
#

Yeah

patent horizon
#

intellijelly dont know how to think 2 steps ahead

#

advanced vending machine

fierce salmon
#

That would be only checking to see if you said your name

paper zealot
#

can anyone help me with intelij idea

ivory sleet
#

?justask

undone axleBOT
sterile token
#

Its not difficult

#

We cannot cut and serve you the food on plate

fierce salmon
paper zealot
sterile token
undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

paper zealot
fierce salmon
#

ok

paper zealot
#

oh i need to be verifyed

#

ok

sterile token
#

Looks like Java problems¿?

sterile token
# ivory sleet ?justask

Conclure, handlerlist should be put it on my custom event implementation right? Because i have a custom event called MenuEvent and then implementations like: MenuOpenEvent, etc. So in this case the Handlerlist should be done on MenuOpenEvent right?

Sorry for tag

ivory sleet
#

Yes

patent horizon
ivory sleet
#

Strange

quaint mantle
ivory sleet
#

Might wanna turn or sth like code reformation wally

#

In case you got that on

paper zealot
#

i already have jdk installed

low temple
ivory sleet
fierce salmon
paper zealot
paper zealot
paper zealot
#

as i remember i instaled the 64 bit

fierce salmon
paper zealot
sterile token
#

You already explained him....

paper zealot
#
  • i dont have a java_home
sterile token
#

Looking him imagine me when i was like him. Asking everybody to cut and serve food on plate

#

I remember that i ask everybody discord when having issues

golden turret
#

guys

#

how do i send a valid http response

sterile token
undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!