#development

1 messages · Page 71 of 1

proud pebble
#

then i just modify the item's lore to have all enchantments on it

#

its not the best solution probably but it works

#

having to check for the enchantment manually is also kinda a pain

hoary scarab
#

It's just for adding the glow so I would just add unbreaking or something if I can't get it to work.

proud pebble
#

i add the glow enchant by using protection 0

#

protection's effect calculation is (4*level)%

#

so if its level 0 it doesnt boost it

hoary scarab
#

It's not for useable items so it won't affect anything.

proud pebble
#

fair enough

fading stag
#

Is it not possible to give potion effect higher than duration 32767 ticks (2^15-1)
I can't give more than that, using 1.8 (I know, it is outdated, but not my preference)
looks like a ViaVersion issue

rigid mountain
#

Question, Im just getting back into making some plugins in my free time. And iv always wondered about this. So is it not static abuse to use singleton to construct an instance of a class and do ThatClass.getInstance()? Or is that fine to use static for something like this? The previous ways iv done this is having a instance in the Main class and refrencing that, but then i have to pass in the main class to every class I want to use it in

#

if that makes any sense at all..

dusky harness
neat pierBOT
rigid mountain
#

Alright thanks, I juse DI for most things I was just curious

merry knoll
#

DI allows you to mock modules while testing

graceful hedge
#

It can also be a design issue long term, and you do have powermocks to mock static stuff (though if you actually need powermocks, jokes on you)

agile valve
#

hey what is this channel for

icy shadow
#

⚙️ Development Support - Stay on topic! - Not configuration help - No favourite IDE arguments.

#

coding help

fading stag
#

Is it possible create splash potion with custom duration?

dense drift
#

Ye why not

fading stag
#

tried using PotionMeta but it just didn't work

dense drift
#

Do you mean splash or lingering?

fading stag
#

splash

rigid mountain
#

Anyone have a good guide for unit testings?

graceful hedge
#

There are some really good books about it I can give you

#

But yea ru just aiming to learn how to unit test (like using Junit in java with mockito etc?) or do you want to learn unit tests in the industry as well as test practices such as tdd?

signal grove
#

does anyone know an instance where a tameable can be owned by a non entity?

#

or why does this even require a cast

torpid raft
#

looking at the docs, an offline player can be an animal tamer

#

so yeah if the owner is an offline player that wont be an entity

signal grove
#

ahh i see, thanks

proud pebble
#

a player can be an entity but an offline player isnt

sonic nebula
#

check the interface wtf

#

u can cast / manipulate do something tricky

signal grove
#

thanks team

proud pebble
#

and since offline player isnt an entity ,thats why its not set as entity

royal hedge
#

Classic tony

sonic nebula
#

nms party tonight?

torpid raft
#

every night is nms party night

river solstice
#

i assume spawners spawn and seeds grow and are regulated by main thread. if so, is it possible, without folia, to move them to separate thread? even if it involves some sketchy methods

dusky harness
#

if you want to edit it using a plugin, you'd have to modify the server jar or edit the config via reflection

river solstice
#

but they are still being ticked on the main thread? Im not looking for a way to disable growing or spawning, just move it to a separate thread. Though my understanding of how it works might be a bit wrong, or if it was possible then it would of probably be already done.

hoary scarab
#

Nothing like that would be possible without heavly modifying the server jar.

river solstice
#

oof

#

might start looking into modifying paper

hoary scarab
#

You might beable to disable the ticking then make your own threads and run the NMS methods.

dusky harness
#

then yeah you need to modify the server jar

#

sorry i completely misunderstood/misread lol

river solstice
#

on a scale of 1-10, how difficult would it be to modify the paper jar? assuming someone with fairly good java knowledge

river solstice
dusky harness
#

i think paper gives a guide and so you just edit it and then ij makes a diff file (at least I'm assuming/hoping that the devs aren't manually typing out diffs?)

dusky harness
#

at least as of paper 1.20.1
net.minecraft.world.level.BaseSpawner line 82 (serverTick)
net.minecraft.world.level.block.CropBlock line 72 (randomTick)

river solstice
#

Might just hire someone to do that since I dont have much time to do so lol

dusky harness
#

🥲

river solstice
#

is what i'm trying to do would even do any good in terms of performance?

#

cuz I assume if it was it probably would have been done already in some shape or form

hoary scarab
#

If you have the source it really shouldn't be that hard just remove the code from the worlds tick method. Then have your own thread running the methods you want multi threaded.

sterile hinge
#

I doubt there would be much benefit, especially considering there is no way to do that without at least breaking plugins

river solstice
#

yeah, but folia isnt really an option for me lol

sterile hinge
#

Folia doesn't do specific things off the main thread, it splits the world into multiple regions

hoary scarab
river solstice
#

cant check rn but we have around 40 plugins

#

a lot of them rely on events

hoary scarab
#

Gamemode* Skyblock, survival, factions?

river solstice
#

survival

#

mostly relies on spawners and farms, hence the idea

hoary scarab
#

Then your server is what folia was made for lol

sterile hinge
#

I mean, just think about how many plugins are written in a way that they support what you're trying to do

river solstice
#

hmm. i guess ill try running folia on a testserver and check the damages

dusky harness
river solstice
#

funnily enough folia if translated letter by letter would sound like folija in my language which means tinfoil

river solstice
hoary scarab
#

Yeah definitely gonna be a challenge finding which plugins support folia since its not even fully supported itself lol.
You could ask @spare marsh though as I see him requesting plugins to be modified for folia alot.

river solstice
#

recently upgraded from 5900x to 7950x3d and ddr5 but have only seen a slight degrade in performance

#

been wondering why is that the case

hoary scarab
#

Bottleneck from your motherboard?

river solstice
#

also the server owner insists on running the server on 30gb+ ram, though from what I know it's not ideal, plus I've noticed on grafana that we only use about 14-15 lol

sterile hinge
#

that's definitely too much for G1GC

river solstice
#

thats with 180+ players

hoary scarab
#

Survival with a big online playerbase, I can see the need for 30gb.

river solstice
dusky harness
sterile hinge
#

yes

hoary scarab
#

Ah true

dusky harness
#

i think you can view gc times in spark though

sterile hinge
#

GenZGC won't have a problem with that though

river solstice
dusky harness
#

g1gc
don't know much about other gcs 🥲

merry knoll
#

zgc can handle terabytes of heap no issue

river solstice
hoary scarab
river solstice
#

I mean 5900x uses AM4 and 7950x3d AM5, so cant be due to using an old MB, though they could have cheaped out on it

torpid raft
#

no decent software support yet, maybe

spare marsh
torpid raft
#

although the 7000 series came out in 2022 according to google so that doesnt seem that recent any more

spare marsh
spare marsh
#

Hello, I was wondering how do I build DeluxeMenus on Ubuntu? I tried ./gradlew build, but it doesn't work? It just says permission denied.

dusky harness
#

that should give permission

spare marsh
dusky harness
#

or an actual linux computer

spare marsh
dusky harness
#

then it should be in build/libs/DeluxeMenus-1.41.1-DEV-null.jar

#

but note that you probably need gradlew(.bat) shadowJar

#

not build

spare marsh
dusky harness
#

and yes intellij and ubuntu should both work

spare marsh
sonic nebula
#

when registering NMS entities

#

should be matching ID to the entityType or not existing one?

dusky harness
sonic nebula
#

im in a very old version and i highly depend on nms. i still depend on it..

#

😉

#

ill do trial and error i guess

cyan spear
#

or you can connect it to the menu by clicking, after which the item will be enchanted?

craggy zealot
#

can someone help me with this build issue so i have a list of canPlaceIn (glass) and target block meaning for example lets say i want to palce a tree the target block would be grass_block 0,1,0 so we would find a grass_block and place the tree 0,1,0 on the grass block but for my senario the target block is air 2,0,0
so what should happen is it should be placed on the right side where the build should be inside the glass 2 blocks on the x axis away from air but it isnt placing there
its not placing at all my other tree and grass block senario works

#
int randomIndex = random.nextInt(cubeLocations.size());
                        Location targetLocation = cubeLocations.get(randomIndex);
                        for (TargetBlock t : targetBlock) {
                            if (targetLocation.add(t.getX(), t.getY(), t.getZ()).getBlock().getType() == t.getMaterial()) {
                                if (canPlaceBlocksAtLocation(getUpperBuild(), targetLocation, t)) {
                                    System.out.println("there glass");
                                    int lowestY = getUpperBuild().stream().mapToInt(WorldBlock::getY).min().orElse(0);
                
                                    if (randomValue <= percentage) {
                                        for (WorldBlock worldBlock : getUpperBuild()) {
                                            int offsetX = worldBlock.getX() - getUpperBuild().get(0).getX() + t.getX();
                                            int offsetY = worldBlock.getY() - lowestY + t.getY();
                                            int offsetZ = worldBlock.getZ() - getUpperBuild().get(0).getZ() + t.getZ();

                                            int targetX = targetLocation.getBlockX() + offsetX;
                                            int targetY = targetLocation.getBlockY() + offsetY;
                                            int targetZ = targetLocation.getBlockZ() + offsetZ;
                                              }```
#
public boolean canPlaceBlocksAtLocation(List<WorldBlock> worldBlocks, Location location, TargetBlock targetBlock) {
        int lowestY = worldBlocks.stream().mapToInt(WorldBlock::getY).min().orElse(0);
        for (WorldBlock worldBlock : worldBlocks) {
            int offsetX = worldBlock.getX() - worldBlocks.get(0).getX() + targetBlock.getX();
            int offsetY = worldBlock.getY() - lowestY + targetBlock.getY();
            int offsetZ = worldBlock.getZ() - worldBlocks.get(0).getZ() + targetBlock.getZ();

            int targetX = location.getBlockX() + offsetX;
            int targetY = location.getBlockY() + offsetY;
            int targetZ = location.getBlockZ() + offsetZ;

            Location targetLocation = new Location(world, targetX, targetY, targetZ);
            if (!canPlaceIn.contains(targetLocation.getBlock().getType())) {
                return false;
            }
        }
        return true;
    }``` my issue is the the canPlaceBlocksAtLocation
hoary scarab
#

Does constructing an armorstand (or any entity) using new EntityArmorStand(world, x, y, z) cache the object anywhere?
I brought this up before when I was showing how physics aren't applied to these entities but pistons are somehow able to push them.

I looked through all the constructors and super classes and can't find anywhere that it would cache this object so I don't see how a piston is able to move it while everything else is negated.

icy shadow
#

it's impossible for constructors to perform caching, they always make a brand new object

atomic trail
#

What is the reason for not being able to change variables in lambda functions?

#

Is smth like this bad?

hoary scarab
icy shadow
edgy pelican
#

how should I get started, making plugins and stuff

icy shadow
#

learn java

edgy pelican
#

how

#

how do I learn the paper API,

#

how it works and stuff

#

spigot API too

icy shadow
#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

icy shadow
#

focus on having a good knowledge of java first, then the spigot stuff will be easy

#

other way around is very hard

edgy pelican
#

how long would it take me to learn?

hoary scarab
#

Read javadocs, open source plugins, tutorials etc...

icy shadow
icy shadow
atomic trail
icy shadow
#

that's not the reason why

#

but kind of

#

there are 2 good explanations that i like

#

the first is that it's because java is pass by value, not pass by reference

#

which is the actual reason why

#

the second is that suppose you could do something like this, this code would be legal: ```java
void blah() {
int x = 0
Runnable r = () -> {
x = 1;
}
runTaskLater(r, 1000);
}

by the time that `r` runs, the method has finished, and so `x` doesn't exist anymore
#

it's already been cleaned up

atomic trail
icy shadow
#

well no, the whole point of lambdas is to capture a computation that you can run at arbitrary points

#

how would it sync? would blah() not finish until r runs?

atomic trail
#

So this wouldn't necessarily get the final amount?

            AtomicReference<Double> autosellMoney = new AtomicReference<>((double) 0);
            event.getItems().forEach(item -> {
                autosellMoney.updateAndGet(v -> /* update blah*/);
            });

            double finalAutosell = autosellMoney.get();
#

Just imagine its atomic double

#

Changing it now lol

icy shadow
#

sure, in this case it's fine

#

because you know that forEach will actually run the function every time

#

but the compiler doesn't

#

just to be clear, this isn't the actual reason why this isn't allowed

icy shadow
atomic trail
#

But yeah I just changed to a regular foreach

icy shadow
#

maybe this isnt the best explanation since it relies on you knowing about the java memory model a bit

atomic trail
#

Yeah not sure I understand why lol

Because wouldn't the variable always exist if the code still runs in order from top to bottom?

#

Or well obviously not but yeah

#

I don't understand why

icy shadow
#

it doesn't run in order

#

you create the lambda without running it, the method finishes, and then the last line jumps back to the lambda body 1000ms later

#

thats the important bit, the 1000ms

dark garnet
#
player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 300, 0));
Bukkit.broadcastMessage("amount 1: " + player.getAbsorptionAmount());
player.setAbsorptionAmount(20);
Bukkit.broadcastMessage("amount 2: " + player.getAbsorptionAmount());
```worked fine on 1.19.4, but now on 1.20.2 its only giving 2 absorption hearts (4)
#

did the function of Damageable#setAbsorptionAmount changed between 1.19.4 and 1.20.2?

#

ping if reply pls

tight junco
#

@dark garnet ^

#

something about attributes

dark garnet
#

oh were those the versions when they changed/added a bunch of attibute stuff

tight junco
#

probably

dark garnet
#

nice ty

#

i assume i can just get away with setting the maximum to 20 whenever a player joins

tight junco
#

the max is is likely already 20

#

well no

#

whatever you need i guess

dark garnet
#

wait this makes no sense lmao

#

how was i even getting 4 if it was 0 🤔

tight junco
#

spigot

#

all i can say is try raising the limit and balling from there

dark garnet
#

yeah just gonna play around with it, thx

dark garnet
#

worked btw ^

south kite
#

Hey I'm working on a server and i need developers. If you're interested lmk

queen plank
#

I'm working on a plugin and want SQL support. Since I've change some major things I need to rewrite my sql code and need some help with how to do it. Currently I have a proxy that saves in local java.io.File objects or in a MySQL db depending on settings. I realised that this is kinda annoying and would like to just save them all in a db so that I don't need implementation for both Files and SQL. So, is it possible to store the data in a local MySQL file or smth? If so, can someone give me an idea where to start looking, internet is useless and I can't find anything helpful on the topic.

torpid raft
#

you can use SQLite if you want a local database

queen plank
#

Ah perfect! Thank you

edgy pelican
#

Currently learning java using w3schls, finished everything in the tutorial, now will be learning java methods. any tips/ advice?

graceful hedge
#

Keep it simple, there is usually more than one way to solve a problem, your code is fine - you don’t always have to correct yourself after every opinion or programmer meta you hear of :) gl

#

Also, no lombok cat_nice_glasses

river solstice
#

yes lombok

#

🦅

#

stop writing 100s of getters and setters, builders manually, use a single annotation

#

🦅🦅🇺🇸🇺🇸

warm steppe
#

use records

worn jasper
#

they are good but not mutable lol

#

also, lombok is good and bad at the same time tbh

hoary scarab
#

Records are suppose to not be edited.

sterile hinge
#

just note that lombok is not java

edgy pelican
#

What are some core things around plugin development, like what is necessary to know to make plugins

dusky harness
#

Intellij 😌

hoary scarab
#

Well just like anything if its unoptimized you're gonna notice it.

dusky harness
edgy pelican
dusky harness
edgy pelican
#

Java seems easy so far, does it increase in difficulty?

dusky harness
#

Oh that's very good lol

#

But if you are just learning methods, there's still a bit more to learn

#

I'd also recommend learning gradle
Its an unofficial build tool used to manage projects (ex if you want to add spigot to your project, you'd tell gradle that) and to actually create the jar file
Another build tool is maven, but gradle is preferred

#

But depending on your stage, it might be too early to learn gradle (since it won't be necessary)

worldly grotto
river solstice
dusky harness
worldly grotto
#

what command ?

worldly grotto
worldly grotto
edgy pelican
worldly grotto
#

bro how can i create dm ?
what command ?

edgy pelican
#

this is what I use

dusky harness
# edgy pelican this is what I use

Oh ok
Yeah you want to learn methods (you can skip recursion) and look at classes
Then after that, just Google like "spigot gradle" and probably follow spigot tutorials from there

There's no set path to follow so don't take my words or anyone's too seriously for how to progress

ripe gull
#
            TextComponent textComponent = Component.text(PlaceholderAPI.setPlaceholders(player, line));
            Component component = MiniMessage.miniMessage().deserialize(textComponent.content());;
            lore.add(ChatColor.translateAlternateColorCodes('&',LegacyComponentSerializer.legacyAmpersand().serialize(component)));```
#

i want to implement minimessage support in my config, is it the right way? im going insane

prisma vault
#

What's the best way to handle open-ended text as variables within placeholders?

For example, example_<text>_var1_var2 where <text> could potentially include underscores, what's the best way to handle that? Quotes?

I haven't used PlaceholderAPI before, so I don't know how other developers tend to do that, but I'd like to keep the syntax consistent

ripe gull
#

i think you do

atomic trail
#

Can someone explain how this only prints 1 and nothing else?

        PickaxeType type = getPickaxeType(firstJoinPickaxe);
        System.out.println("1");
        ItemStack pickaxeItem = type.build(prisonPlayer);
        System.out.println("2");
        PrisonPickaxe pickaxe = new PrisonPickaxe(pickaxeItem, prisonPlayer);
        System.out.println("3");

code of build method: https://paste.helpch.at/edatetaton.java

prisma vault
dusky harness
edgy pelican
dusky harness
#

oh okay that's good

edgy pelican
#

can someone explain encapsulation ?

proud pebble
#

a class that exists for variables and methods, like the player class for example is encapsulation

edgy pelican
#

i dont understand the concept behind get and set

#

and this too

proud pebble
#

if you had your variables a public then one piece of code could modify it at any time with any value, getters and setters exist so you can put limits on what that value can be and to exit before its changed

edgy pelican
#

oh

#

are getters and setters located in the private class?

#

or outside of it

proud pebble
#

inside the class

edgy pelican
#

and are private classes read only? or no read

proud pebble
#

the class is public, the getter and setter methods are public, but the variables are private

edgy pelican
proud pebble
#

private classes cannot be accessed afaik from anywhere, its unlikely you would make a class private unless its an inner class

edgy pelican
#
public class Main {
  public static void main(String[] args) {
    Person myObj = new Person();
    myObj.name = "John";
    System.out.println(myObj.name);
  }
}
   private String name;

   // Getter
   public String getName() {
     return name;
   }

   // Setter
   public void setName(String newName) {
     this.name = newName;
   }
}
#

code i find confusing

#

the get and set are inside of the private class, so what are they doing?

#

are they moving data (to the main class)? or

proud pebble
brazen elm
#

^

#

you can't get the values that are private

#

you can ONLY get the private value from the parent class itself

#

minus reflection but that's too advanced rn

edgy pelican
#
  public static void main(String[] args) {
    Person myObj = new Person();
    myObj.setName("John");
    System.out.println(myObj.getName());
  }
}```

```public class Person {
   private String name;

   // Getter
   public String getName() {
     return name;
   }

   // Setter
   public void setName(String newName) {
     this.name = newName;
   }
}
#

what about this?

brazen elm
#

that would work

#

since the method is public

proud pebble
#

that wouldnt error, because those functions/methods are public

edgy pelican
#

so things can be public in a private class

proud pebble
#

public, private and protected are all access modifiers

#

thats not a private class

edgy pelican
#

oh

#

was reading the wrong thing

brazen elm
#

private = only the parent class can access it
protected = only the classes inside the parent PACKAGE can access it
public = every class can access it (theoretically)

proud pebble
#

nearly all classes you have inside of a project will be public

edgy pelican
#

oh this makes sense, the name variable is private, but since it's in the same class it can access it, so the getter get's the variable and stores it, and sets it to newName which can be accessed by another class

brazen elm
#

yeah

#

the method is public therefore that would work. But if the method was private that would throw an error since the main method doesn't have access to it

edgy pelican
#

so you would make another public methodd in the class getting and setting the private method so it can be used by the main class

brazen elm
#

yeah

#

basically

edgy pelican
#

oh, rad

brazen elm
#

and non-static variables are stored inside the object whenever you create a class object

#

static variables are stored inside the class which isn't created everytime you create an object of the class

#

to my understanding, idk how it works under the hood but ik when to use them 💀

proud pebble
#

static variables are created when it registers that the class exists

#

you dont even have to call new for those variables to register

edgy pelican
#

anything i should know about any of this going forward?

proud pebble
#

if you want to call static variables, then you have to do ClassName.variable

edgy pelican
#

i think i'm gonna call it a day, currently im using w3schools https://www.w3schools.com/java/, i finished the tutorial yesterday, now i'm moving onto Packages / API

proud pebble
#

or if you are using a getter/setter, they have to be declared as static aswell

edgy pelican
#

i need to familiarise myself more with keywords

#

hopefully after time my memory an understanding will increase

brazen elm
edgy pelican
#

what's instance?

dusky harness
# edgy pelican i dont understand the concept behind` get` and` set`

not sure if you figured it out already but basically, getters and setters allow you to control the data being set and get as Lunaiskey mentioned
But even if you're not doing anything with the data (other than setting and getting), if you didn't have getters/setters but wanted to add them later, you'd have to change all of the code from person.name -> person.getName()/person.setName()
So having getters/setters from the start avoids that

proud pebble
#

its basically just a copy

edgy pelican
brazen elm
#

and looks way better sometimes

edgy pelican
#

   public static int x = 5;

 }

Test t1 = new Test();   
Test t2 = new Test();```

would it turn into 

public class Test{

public instance int x = 5;

}

Test t1 = new Test();
Test t2 = new Test();

dusky harness
edgy pelican
#

oh, just get and set it

#

yeah that seems cool

brazen elm
#

bruh i cant send images in here

neat pierBOT
brazen elm
#

ugfhhh

dusky harness
#

lol

edgy pelican
#

hehehehe

brazen elm
dusky harness
brazen elm
#

(I am using kotlin but same thing)

dusky harness
#

kotlin 😌

brazen elm
#

kotlin is actually awesome

dusky harness
#

indeed

brazen elm
#

literally how you make a leaderboard

edgy pelican
#

anyways, @dusky harness , @brazen elm and @proud pebble , nice discussion we've had lol. I'll be going offline now. Thanks for all of your help to broaden my understanding about Java.

brazen elm
#

lmao

proud pebble
brazen elm
#

nope

#

that's a char

#

single quotes

#

🙂

dusky harness
#

mixing java and yaml 🥲

brazen elm
#

xD

#

it happens!

proud pebble
#

well in yaml you can just do 'easports'

#

i think its the same in json aswell

dusky harness
#

no json is strictly "

#

😌

proud pebble
#

then how i fucked that up idk

#

im too used to ide telling me im shit change that

prisma vault
#

If it doesn't matter what type of player I need to use, should I use the onRequest(OfflinePlayer, String) method or the onPlaceholderRequest(Player, String) method?

brazen elm
dusky harness
#

just note that because of that, the second one won't work if you use the first one

forest jay
#

ok github copilot, I didnt need to be reminded

merry knoll
cyan spear
#

or you can connect it to the menu by clicking, after which the item will be enchanted?

royal hedge
worn jasper
#

who is outspending?

#

lol

royal hedge
#

literally more than half the servers im in hes in

brazen elm
#

Huh??

royal hedge
edgy flume
#

Hello there, I am trying to hide player x name tag from player y, by sending a armor stand spawn packet to player y, that is attached to player x. I'm stuck on attaching the armor stand as a passenger. I noticed the Mount packet only takes one argument and that confuses me, couldn't really find anything online.

hoary scarab
edgy flume
hoary scarab
#

Ah

cloud panther
#

just want some advice, currently working on a plugin and every friday at 00:00:00, i want the plugin to run a certain method, is there an event i can use ?

dusky harness
# cloud panther just want some advice, currently working on a plugin and every friday at 00:00:0...

I would just run a bukkit scheduler for every second or something and check the time using https://stackoverflow.com/a/26097080/14105665 and https://www.geeksforgeeks.org/localdate-getdayofweek-method-in-java/ (both use LocalDate)

dark garnet
dusky harness
#

tbh that's probably the best solution for Walter as well, but I didn't feel like doing research 🥲

dark garnet
dusky harness
#

uhh

dense drift
#

Quartz is a lib for cronjobs iirc

atomic trail
#

Anyone got a class that basically makes an item undropable in any way? Like inserted into chest, dropped, everything

broken elbow
#

Question regarding GitHub and Verified Domains. I've followed the steps to verify a domain and it did verify it but after a while it sent me an email to reverify. This has happened twice now. I can't see this specified anywhere but I've removed the TXT Record after verification. Anyone know if this might be the issue or if this is just normal?

broken elbow
#

I went ahead and reverified and didn't remove the TXT Record. We'll see if it happens again or not.

light pendant
#

Can I somehow get rid of this unchecked cast warning? I know that in java I can't check the generic type, I guess in kotlin I cannot do it either, right?

dusky harness
light pendant
#

stupid compiler, doesn't see that I check isSUperclassOf 🥲

sterile hinge
#

use asSubclass

#

don't know if that works with Kotlin

river solstice
#

@Suppress("UNCHECKED_CAST")

#

😇

willow willow
#

Can DeluxeMenus open a menu with a specific color? I'm not exactly sure how, but vanilla core shaders can take a color argument, and that color is specified on the server somehow

edgy pelican
#

hey, how do i differentiate between if something is an inner class, or an outer class

#

indentation?

uneven gyro
#

Hello, im having troubles accessing the roles in my discord. it says im the server owner but when i click server setting the roles tab does now show up. can anyone help me?

edgy pelican
pulsar ferry
#

This server is not for discord help though

#

Specially not this channel

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

uneven gyro
neat pierBOT
worn jasper
uneven gyro
#

like i said i added him as a friend and took it offline 🙂 ty

iron crow
#

who can help me setup plot system i have all the code i js need help setting it up will pay LMKK

proud pebble
#

basically an example

sterile hinge
#

an inner class is always non-static, otherwise it would be a nested class

river solstice
#

true

sonic nebula
#

is this possible to do path finder class like this ```java
//not actual code don judge just concpet
if(health > 20) {
if(enemydistance > 5){
Shoot(entity);
} else {
StabInTheHead(entity)
}
} else {
RunAway
}

#

something like that can i do with custom entity pathfinder goal

#

like writing on pathfindergoal ofc

#

and also cast abilites how would u do it by a task or there some sort of priority in entity goals?

#

like there is i know i have checked the net.minecraft default mobs

#

i mean vanilla but yeah

#

it has like goal(intger,jerk around); and etc etc

keen cipher
#

I have an error in my code from protocollib, and at the bottom of the error, it gives these paramaters:

[17:55:31] [Server thread/ERROR]: Parameters:
  net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment@452d894f[
    b=99
    c=[(MAINHAND, 1 netherite_pickaxe)]
  ]
ripe gull
#

hello, i want to store simple integer to acces it throught placeholderapi

#

What's the best way to handle it? and prevent losing the data on server crash and make it optimized so it doesnt read and lookup every second the data.yml file?

tame jungle
#

Just load from file on startup and save periodically. @ripe gull

merry knoll
#

or save on change and keep a cache for papi

ripe gull
edgy pelican
#

ok, i did the w3schools guide, now what do i do to make my java skills the best/learn how to develop in spigot

edgy pelican
#

alr, msg when your here

dusky harness
#

piggy is an admin in this server btw

#

i dont think hes really active recently tho

edgy pelican
#

how do i even create the plugin thing in intelij?

dusky harness
#

oh wait oops yeah I forgot to mention that lol

edgy pelican
#

thx

#

found this

dusky harness
#

spigot should have a wiki tho

edgy pelican
#

couldn't see it

dusky harness
#

hold on kinda busy atm ill link more soon

dusky harness
#

oh and this

dusky harness
edgy pelican
#

any difference between making it in paper? or in spigot

#

@dusky harness

dusky harness
#

or actually tbh

#

yeah just stick to spigot for now

edgy pelican
dusky harness
#

paper has a lot of additions

#

but also "removes"/unrecommends/deprecates some spigot stuff that you should probably know

dusky harness
#

I originally wrote "many" but edited it 🥲 because idk how to english that

dark garnet
#

it deprecates anything that doesnt use adventure 😭

dusky harness
#

🥲
adventure better tho

edgy pelican
#

such a cool lib

dusky harness
#

oh if you know adventure already

#

then

#

you know this would be a great time to advertise galaxy gradle

edgy pelican
#

ill learn the developmental side too

dusky harness
#

but for the sake of knowing the behind the scenes

edgy pelican
#

spigot?

#

sure

dark garnet
dusky harness
#

😮

dark garnet
dusky harness
#

hey that was stolen inspired by DkimGradle

dark garnet
#

sorry i had something stuck in my throat

dark garnet
dark garnet
#

as it just widens userbase, but if u need paper-specific stuff then use paper

edgy pelican
#

paper is much more efficient

#

but sure ill develop in spigot

#

which build system?

dusky harness
#

GRAdle

#

Gradle

#

Gradle

#

GraADle

dark garnet
dark garnet
edgy pelican
#

paper-plugin.yml

#

ill start with paper i guess

dark garnet
#

yeah paper (sorta) recently made its entirely own plugin registration/loader thingy

dusky harness
#

uh

#

i would advise using spigot first

edgy pelican
#

oh

dusky harness
#

paper server

dark garnet
#

oh right this is first-time sorry

dark garnet
edgy pelican
dark garnet
edgy pelican
dusky harness
#

ur domain

#

if u have one

dark garnet
#

ex: xyz.srnyx or com.srnyx

edgy pelican
#

does it have to be?

dusky harness
#

i do me.dkim19375

#

¯_(ツ)_/¯

#

it doesn't have to be official

dark garnet
#

u can just make it up

dusky harness
#

i used me.dkim19375 then like 2 years later bought dkim19375.me

dark garnet
#

💀

dusky harness
#

¯_(ツ)_/¯

dark garnet
#

yeah thats the only thing u gotta keep in mind

#

its used to identify ur code

#

so its best to use something u can acquire later yknow (or already have)

edgy pelican
#

ye true

dark garnet
dusky harness
#

tbh i like xyz more

edgy pelican
#

fr

#

xyz good

#

artifact id?

dusky harness
#

project name lowercase no space no underscore no dash

#

no symbol

#

actually are there supposed to be dashes?

#

idk i dont use dashes tho

dark garnet
#

yeah i dont either

edgy pelican
#

what??

dusky harness
#

like coolplugin

#

for example

#

or bedwars

edgy pelican
#

just named it first

#

version?

dusky harness
#

¯_(ツ)_/¯

dark garnet
dusky harness
#

oh uh

dark garnet
dusky harness
#

:)

dark garnet
dark garnet
#

(and not lowercase, ex: LaserTag)

dusky harness
#

thats supposed to be in settings.gradle.kts

#

well thats what intellij does so

#

¯_(ツ)_/¯

dark garnet
#

:)

dusky harness
#

SMh

dark garnet
#

so what the heck is artifact id

dusky harness
#

like in maven dependencies

#

you know

#

theres the groupid:artifactid:version

ripe gull
#
    public static void loadData() {
        FileConfiguration config = YamlConfiguration.loadConfiguration(new File(PlayerGreetRewards.plugin.getDataFolder(), "data.yml"));
        for (String key : config.getKeys(false)) {
            UUID uuid = UUID.fromString(key);
            int greetings = config.getInt(key);
            greetData.put(uuid, greetings);
        }
    }

    public static void saveData() {
        FileConfiguration config = YamlConfiguration.loadConfiguration(new File(PlayerGreetRewards.plugin.getDataFolder(), "data.yml"));
        for (UUID uuid : greetData.keySet()) {
            config.set(uuid.toString(), greetData.get(uuid));
        }
        try {
            config.save(new File(PlayerGreetRewards.plugin.getDataFolder(), "data.yml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }```
#

is this the correct way of caching my data?

dark garnet
dusky harness
#

ig not but intellij auto adds it so i just have it 🤷

dark garnet
#

oh lmao

dusky harness
#

although i don't use intellij project maker for java anymore 😌

#

should make ur own project generator

dark garnet
#

i just have a template lmao

#

how would project generator even work

dark garnet
#

if so, it looks good, but i usually store/cache the YamlConfiguration too (or whatever YamlConfiguration#loadConfiguration(File) outputs i forget)

ripe gull
dark garnet
#

yeye

ripe gull
#

So now, every 5 minutes i saveData() and loadData()?

#

or what

dark garnet
dusky harness
#

tried finding a video but couldn't find :(

dusky harness
#

kotlin

dark garnet
#

so is it like a script/program?

#

separate? or is a gradle plugin

dusky harness
#

whole program

#

then i do java -jar

ripe gull
dark garnet
#

(and/or in ur plugin's reload cmd if u have one)

dusky harness
#

and i have a bunch of templates that it uses

dark garnet
dusky harness
#

um

#

well you see

#

its kinda personalized 🥲

#

so its closed source

#

BUT

#

it could be a fun project to code

dark garnet
dark garnet
dusky harness
#

also its kinda broken rn

#

the placeholder system isn't working

dark garnet
dusky harness
#

uh

ripe gull
dark garnet
dusky harness
ripe gull
#

i want my data to be stored to use it in PlaceholderAPI

dark garnet
ripe gull
#

and i dont want the PlaceholderAPI to look for the user every second in data.yml file, i want it to be cached in map

dark garnet
ripe gull
#

okay thanks

ripe gull
#

this approach is okay?

dark garnet
ripe gull
#

so maximally can be lost data from up to 5 minutes

#

awesome

merry knoll
#

or you can do a file save every x amount of changes if these change constantly

ripe gull
#

so i save to file every time i change the value?

ripe gull
# merry knoll ``` public class CacheExample { private final HashMap<UUID, Integer> cache...
    public static void saveData() {
        FileConfiguration config = YamlConfiguration.loadConfiguration(new File(PlayerGreetRewards.plugin.getDataFolder(), "data.yml"));
        for (UUID uuid : greetData.keySet()) {
            config.set(uuid.toString(), greetData.get(uuid));
        }
        try {
            config.save(new File(PlayerGreetRewards.plugin.getDataFolder(), "data.yml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }```
#

im using a file data.yml

merry knoll
ripe gull
#

rarily

#

i wrote a plugin to reward players on greeting a new player on chat

#

and i want to store how many players you have greeted

merry knoll
#

on change should be fine then, also if you are using ymlconfiguration

#

cache the instance and use that

ripe gull
#

what does that mean

merry knoll
#

one sec

ripe gull
#

i had an idea of storing it in PDC

#

but what about offline players?

merry knoll
#
public class CacheExample {


    private final HashMap<UUID, Integer> cache = new HashMap<>();
    private final Set<UUID> changes = new HashSet<>();
    private final FileConfiguration config;
    private final int saveDelay;


    public CacheExample(YamlConfiguration config, int saveDelay) {
        this.config = config;
        this.saveDelay = saveDelay;
    }

    public void setGreeting(UUID uuid, int greeting) {
        cache.put(uuid, greeting);
        changes.add(uuid);

        if(changes.size() >= saveDelay) saveToFile();
    }

    public int getGreeting(UUID uuid) {
        return cache.get(uuid);
    }

    private void saveToFile() {
        try {
            for (UUID changed : changes) {
                config.set(changed.toString(), cache.get(changed));
            }

            config.save();
            changes.clear();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


#

something like this

merry knoll
#

ideally you would just store there

ripe gull
#

maybe then sqlite?

merry knoll
#

if you use it already would work fine

#

just a basic table

#

with uuid - smallint

#

uuid as primary key

ripe gull
#

which is easier to implement

merry knoll
#

both are simple but the issue with yml is that

#

you load all of the file

#

whenever you do yamlconfiguration

brazen elm
#

sqlite

merry knoll
#

so its not exactly scalable if your player count that greet increase

brazen elm
#

its faster

#

and ain't that hard to code a complete database

merry knoll
#

its not like you code anything

#

just gotta add sqlite jdbc driver

#

so jar size goes up

brazen elm
#

uh no?

#

java has the jdbc driver for one

#

and two, you still need to add a connection and sql strings

merry knoll
#

since when jvm has jdbc driver by default

brazen elm
merry knoll
#

huh lemme try

brazen elm
#
import java.io.File
import java.sql.Connection
import java.sql.DriverManager
import java.sql.SQLException```
#

prob not the BEST way to do it but idc

#

and its kotlin so

merry knoll
#

ya but you need the driver itself no?

brazen elm
#

for mysql you do

#

and you dont need to close the connection in sqlite which is nice

merry knoll
#

ah, i probably just assumed its not in there

#

and just added through maven

#

never tried honestly

brazen elm
#

all the other databases you need to close the connection everytime

#

idk i like sqlite but people like other things

merry knoll
brazen elm
#

mongodb, mysql, ect

merry knoll
#

you would probably do postgres

#

instead of mysql regardless

brazen elm
#

fair enough

#

i've honestly never touched postgres yet

#

wanting too

#

or surrealdb

#

i wanna try both of them

#

cuz sqlite doesn't support arrays 😦

merry knoll
#

if you can use mysql you can use postgres

brazen elm
#

gotta make your own serialization with it

#

you need to edit the params as needed

merry knoll
brazen elm
merry knoll
#

what you can do instead is have another table

brazen elm
#

yeah that is true but i'd still personally perfer arrays but its whatever

#

i usually just use another table cuz im lazy to setup another database

#

since sqlite is automatically setup for ya

merry knoll
#

what do you need exactly?

#

just uuid to int?

brazen elm
#

mehh

#

not rlly

#

yml is slowest of all of them

#

json MAYBE, but i'd still recommend a database

merry knoll
#

it really doesnt matter at 50 - 100 total players

#

barely any data

brazen elm
#

i mean as long as you aren't writing to the file constantly you should be fine ig

merry knoll
#

write every 5 - 10 changes

#

and do it async and you good

#

on another thread

brazen elm
#

running on a different thread

#

use a BukkitRunnable or CompletableFuture imo

#

although a CompletableFuture is a thread pool so

#

i'd do every 5 minutes and everytime they join / leave

#

i usually set it up like that

merry knoll
#

saving every x time is wasteful

brazen elm
#

could also do a little bonus thing and make it so it doesn't unload from memory until like 5 minutes after the player leaves incase they relog

brazen elm
#

i wouldn't do every minute but

#

but i get what you're saying

#

dont write to the file everytime a value changes

#

do it like every 5 minutes and when they leave / join then you should be fine

merry knoll
#

here

brazen elm
#

i wonder if you could write a batch system for yaml

#

never tried

merry knoll
#

unless you do your own yaml handler from scratch

#

with mutable state

brazen elm
#

i mean when i started learning java i used simplexstorage

#

it has a batch system and everything you really need

#

i use it sometimes cuz spigot's api for yaml configuration is actually doodoo

merry knoll
#

i barely do yml anyway

brazen elm
#

i mean i only use it when i make a public plugin with a config ofc

#

that's it

merry knoll
#

altho i stopped writing anything minecraft for couple of years now

brazen elm
#

oh that's fair

#

mc development has really gotten boring recently

#

ik other languages just idk what to make in them so i just stuck with java

#

and decided to learn kotlin like a week ago

merry knoll
#

kotlin is fun

#

especially coroutines

brazen elm
#

kotlin is epic

#

it has nice syntax imo and has an expanded stdlib from java

#

kotlin's methods in collections are great, really saves some time. And their kt extentions are epic too

merry knoll
#

it just doesnt force oop down your throat

#

and allow you to write functionally if needed

brazen elm
#

fr

#

simple leaderboard system in kotlin

#

would be a bit more complex in java

merry knoll
#

with streams it should be similar

brazen elm
#

i mean prob i was looking at the sortedByDescending and its just a comparable so

merry knoll
#

later java versions are really not that bad anymore

#

unless you are forced to work with j8

brazen elm
#

yeah

#

java has improved, especially in 21 with new collections and such

#

but most of the good things that were announced are in preview

merry knoll
#

@ripe gull you good now?

brazen elm
#

and honestly, idk who tf decided to do string templates like they did in java but i really dont like how they did it

merry knoll
#

honestly

brazen elm
#

its like swift and meh

#
STR."\{firstName} \{lastName}"``` this looks dogwater imo
#

i'd much rather ${}

brazen elm
merry knoll
#

is the way to go

#

my only issue with java atm is null safety

#

Optionals are way too verbose

#

dont forget to call the saveData() method on server shutdown if you are using the code i sent

brazen elm
#

erm

#

trying to rotate a vector depending on the living entities yaw

#

that works just wondering how i could improve it

royal hedge
#

Id vector ur own type

#

Cuz if it is make it a data class and u can destructure it woth val (vx, ...) = vector or smth lile that

sterile hinge
#

And "I don’t like the syntax" is like the weakest form of complaint, and it was also discussed and considered, and the decision was made because the facts are in favor of it

brazen elm
#

i moved to kotlin recently anyways so it doesn't really impact me that much

sterile hinge
#

Yeah Kotlin only has basic string interpolation anyway, so that’s not comparable at all

turbid hornet
#

how fix getMaximumAge?

   @EventHandler
    public void Farm(BlockBreakEvent event) {

        World world = Bukkit.getWorld("world");

        if (event.getBlock().getWorld() == world) {

           Block block = event.getBlock();
           Player player = event.getPlayer();

           Material cropBlockType = null;

           if (block.getType() == Material.WHEAT) {

            Inventory inv = player.getInventory();
            cropBlockType = Material.WHEAT;

            Ageable age = (Ageable) block.getBlockData();
            int getMaximumAge = age.getMaximumAge();


           }
        }
    }
#
age.getMaximumAge

don`t worlk

dusky harness
#

like what's the issue with getMaximumAge?

terse osprey
proud pebble
#

cropBlockType seems redundant

#

you could get hte world and just check if the name is equal to "world" instead of using getworld and checking if they are equal since afaik its possible that both world objects might not be

turbid hornet
turbid hornet
turbid hornet
terse osprey
# turbid hornet didn`t work

Can we see your imports as well. And “didn’t work” isn’t all that descriptive, is it producing an error?

turbid hornet
turbid hornet
terse osprey
merry knoll
#

you can only do thread safe stuff async

sonic nebula
#

helllo

#

dears

#

i cant do trial and error from diff reasons

#

but scoreboard packets once sent it stays till new update? same Tab list?

#

or u need to update schedulerly or everytick

#

thanks to the answers.

pulsar ferry
#

It stays

sonic nebula
#

so for performance for player side , i would need to send packet only on update correct?

#

ill think about how to manange performance better thanks Matt.

pulsar ferry
#

Sounds like premature optimization, but yes it makes more sense to only send when it needs to update

quartz briar
#

I've generated jars for this project with BuildTools with the --remapped flag, then loaded them in the individual version directories with mvn install:install-file, but still face an error along the lines of what is below for every NMS version. I have no idea what do, help please.

[ERROR]   symbol:   class ItemStack
[ERROR]   location: class su.nightexpress.ama.nms.v1_20_R3.mob.HoglinMob
[ERROR] /home/shakytimon/IdeaProjects/AdvancedMobArena7.14/V1_20_R3/src/main/java/su/nightexpress/ama/nms/v1_20_R3/mob/HoglinMob.java:[167,37] cannot find symbol
[ERROR]   symbol:   class Player
[ERROR]   location: class su.nightexpress.ama.nms.v1_20_R3.mob.HoglinMob
[ERROR] -> [Help 1]```
quartz briar
#

found the right ones under Spigot-API

#

nevermind, that did not help

stuck canopy
#

Is there a way to implement a class on CraftingRecipe or RecipeChoice and have that recipe registered.
I tried implementing upon RecipeChoice but that did not work. There are two RecipeChoice. ExactChoice which allows you to add multiple ItemStacks for detection (assuming it uses ItemStack#isSimilar or ItemStack#equals to detect). MaterialChoice which allows you to add multiple Materials for detection.
I am trying to add a Custom ItemStack detecting system (e.g if I only want to check for the ItemStack's (in the matrix) name or persistentdata, etc). Do I have to create my own recipe manager to check for recipes and their results using PrepareItemCraftEvent
OR is there any better way to do this?

dusky harness
#

edit: below, plus you can just buy the plugin too :))

light pendant
# dusky harness edit: below, plus you can just buy the plugin too \:))

when using maven + spigot I'd highly suggest to use mojang maps + the specialsource plugin for remapping https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/

If you need to access NMS classes from inside your Spigot plugin, it is a very good idea to use the so called Mojang mappings. Disclaimer: This post is obviously written for 1.18.2. If you use another version, you of course have to replace every occurance of “1.18.2” with the version you actually use. What...

#

gradle question: I have declared a libs versioncatalog in settings.gradle.kts like this:

dependencyResolutionManagement {
    versionCatalogs {
        create("libs") {
            plugin("shadow", "com.github.johnrengelman.shadow").version("8.1.1")
        }
    }
}

However I cannot access that in my buildSrc/build.gradle.kts - anyone got any idea?

#

I however can access "libs" in all other build.gradle.kts files, just not in buildSrc - am I doing sth wrong or sth?

pulsar ferry
#

buildSrc is a separate project and currently it doesn't have access to anything from the root project, not even the gradle.properties
You need to declare the version catalog in the buildSrc's gradle.settings.kts
Also you can't make it a plugin if you want it to be accessible in the buildSrc's build.gradle.kts's dependencies block, you'd need to make it a library

light pendant
#

oh ok that's sad. I thought I could avoid having to declare things twice using the version catalog, but then it won't work. Well I'll just keep the version hardcoded then, thanks

pulsar ferry
#

If you have a version catalog file, then you can get away from declaring it twice then on the buildSrc's settings you can do

 versionCatalogs {
    register("libs") {
        from(files("../gradle/libs.versions.toml"))
    }
}

To import the catalog from the file

flint kernel
#

why register the catalog manually? gradle recognises that one by default

minor summit
#

read up

flint kernel
#

i see

#

yeah i ran into that issue too

#

when trying that

#

really annoying

light pendant
light pendant
#

alrighty that works fine except for in actual scripts in buildSrc/.../kotlin/bla.gradle.kts files. It still cannot find the "libs" thing there, so I currently use this:

dependencies {
    api(project.versionCatalogs.named("libs").findLibrary("acf-paper").get())
}

that can't be the correct way I guess?

#

as you can see, it works in my buildSrc/build.gradle.kts file, but not in actual buildSrc scripts

royal hedge
light pendant
#

oh alright, thanks! Then I'll just use my workaround from above, but good to know that there's an issue for it open 👍

queen plank
#

I'm adding SQL support for one of my plugins and have found a problem I can't find a good solution to. My plugin allows users to, among other things, edit custom items. I want these items to be saved in the SQL db.
So, say I start my server and it loads all items from the db and I then proceed to edit the item. When the item is edited it of course has to be saved so the changes are pushed to the SQL db. However, right as my changes were saved to the db another server auto-saved all items to the db, and so my work was overwritten? What would be the best way of solving this? I've thought about adding like an "updates" column to the row and compare those, would this be a good way of doing it?
Also, how would I do for other players editing the item? Should I just not update the SQL db if someone else has updated it while I was editing it? That will again ruin my work. Should I just don't care and let it be a problem for the servers owners or should I "lock" the items, and if so what would be the best way of doing so?

#

Please ping me if you respond :)

hoary scarab
#

Could also save the time it was saved and if it was edited in the last 30 seconds or so take both items and merge the edits from the original.

quartz briar
dusky harness
quartz briar
light pendant
#

np!

light pendant
#

buildtools simply runs mvn install on the spigot-api and spigot project

dusty frost
queen plank
flint kernel
queen plank
dusty frost
#

then once you do update the rows later it removes the lock

flint kernel
#

hmm, cool

dusty frost
queen plank
#

Yeah that’s the problem I keep coming back to lol. My current best idea is having a ”updates” column, then telling a player wanting to save data that ”the item has been updated x amount of times since you started editing, do you really want to undo the previous changes?” or smth?

#

How’d I do the timeout as well lol? If the server is offline it can’t do it it self. Do I make a new column or table for it?

dusty frost
#

Could do something like a cache table, then when you're done editing it can check the timestamp of when you started and see if it has been updated since, then give players a "This item has been updated since you started editing, would you like to overwrite?", and if they say yes, you flush the changes to the table

queen plank
#

Yeah exactly. That’s where I’m at rn, just think an updates field to show ”it has been updated x amount of times” instead of ”it has been updated” seems nicer

dusty frost
#

I mean, what's the timeframe on this kind of stuff?

#

are people editing items for like, hours? how many times is a single item going to be updated while you're editing?

hoary scarab
#

Is this per server? Maybe update the item to the player live.

queen plank
#

Not very often I’d imagine. Very rarely I think. Though I will probably get some angry users complaining abt it. Though the major thing is other servers backing up data and replaceing new data. Maybe I can flag the items or compare update timestamps etc?

queen plank
#

Like fetch the new data with each update?

dusty frost
#

Surely you just touch it once and then that's how it is until the next time someone updates it

queen plank
#

I currently have the servers auto saving data. But now that I think abt it I really don’t need that lmao. If I just saves the changes when they are made all is fine lol. Smort

#

Ig I’ll just compare timestaps and ask users if they wanna make the changes. Seems like the best idea so far?

dusty frost
#

yea

queen plank
#

Oki then, thanks for your help :)

pulsar ferry
light pendant
light pendant
pulsar ferry
#

It's a gradle function

light pendant
#

oh wow you're right lol

#

yay! thanks

pulsar ferry
#

Yw ;p

light pendant
#

only downside is I gotta use the<...> in every script right? I cannot move this into an extension function or sth?

pulsar ferry
#

Yeah you have to use it on every script
There might be something you can do about it though, give me a sec let me try something

light pendant
#
// Libs.kt
fun Project.libs(): LibrariesForLibs {
    return the<LibrariesForLibs>()
}

// Any other buildSrc script
dependencies {
    api(libs().acf.paper)
}

Got it to work like this now! Thanks for the idea, works great :3

pulsar ferry
#

Yeah, or

val Project.libs: LibrariesForLibs
    get() = the<LibrariesForLibs>()

If you want it to stay a property instead of function

hollow rune
#

yo so

#

im on deluxemenu

#
  • '[console] give player dirt 1'
#

this doesnt owrk

#

and %player% tho

#

and %player_name% doesnt owrk either

river solstice
#

Well 'player' will obv not work

hollow rune
#

doesnt owrk

river solstice
#

Do you have placeholderapi installed

#

Not sure if thats a requirement tho

hollow rune
river solstice
#

Idk @marble heart will know fr

marble heart
#

yes

neat pierBOT
#
FAQ Answer:

Player placeholder not working? If you are using a plugin which supports PlaceholderAPI, and the %player% placeholder doesn't work, then change it to %player_name% and download the player expansion.
Commands:
/papi ecloud download player
/papi reload

hollow rune
#

still doesnt owrk

#

ohh i need to download it ty

#

a alr

#

and yk how to make a heart shop from that?

#

a heartshop. Like u buy things from ur hearts in that

#

bro what?

#

yh?

#

many servers have it

#

from lifesteal core

dense drift
#

#general-plugins

⚙️ Development Support - Stay on topic! - Not configuration help - No favourite IDE arguments.

marble heart
#

OKK oof didnt notice where we were

hollow rune
#

alr???

river solstice
#

my favorite ide is intellij idea, far better than everything out there

tight junco
#

i like notepad++

terse osprey
#

Big fan of ms paint

graceful hedge
#

punch cards is my personal favorite

forest jay
#

I saw this somewhere I am curious how they did it. Supposedly by manipulating a TextDisplay you can move the text up and down. This was used so that if the entity had a name already, the plugin could shift the text display upwards. the only way I can see this working would be by setting a line width and having an empty character wrap over to the next line, shifting the previous line up, just not sure how to achieve that as the documentation on TextDisplays is terrible.

Does anyone know how to achieve this?

minor summit
#

translation transform

#

something like

display.setTransformationMatrix(new Matrix4f().translation(new Vector3f(xOffset, yOffset, zOffset)));
dense drift
#

Mhm, math

minor summit
#

yes

#

math requires math

wicked flicker
#

There a already compiled a jar for the folia branch? I tried compiling it last night but I didn't have any luck. Trying to get my plug in updated for folia

dense drift
#

Folia branch of what

wicked flicker
#

papi

terse osprey
#

Is it possible to change the name above a players head without using GameProfiles or ProtocolLib? I don't have a problem with using NMS but want to avoid using external libraries if possible.

terse osprey
minor summit
#

no, when an entity (even players) has a passenger, their name tag is hidden

terse osprey
#

🤯

#

Did not know that thank you lol

minor summit
dark garnet
#

is it possible to remove an entity's ai but still allow them to experience gravity?

#

i saw fundy do it in his latest video: https://www.youtube.com/watch?v=99Hd5Lh69T4&t=1095s
but i assume he didnt use a plugin to do it, so im not sure if its possible with a plugin

🕹 Get a browser that’s literally better at everything: https://operagx.gg/Fundy4 Sponsored by Opera GX!

I Added ACTUAL Human Intelligence to Minecraft...

Heya guys! Fundy here, I just want to take a second and say that this video is some of my proudest work. I am so happy with how it turned out, and I am even more happy that it worked... It's ...

▶ Play video
dark garnet
river solstice
#

how dare you lobotomize them

dark garnet
dark garnet
#

anyways new question :D
how do i disable the right-click edit thing for specific signs?

#

just cancel the interact event if its a sign?

dark garnet
ocean crow
late wyvern
#

Whats the best way to show countdown timers inside lore of an item that's sat inside a inventory? can't be move etc. Loop the inventory while open?

#

best way being most efficient and realiable

worn jasper
#

triump gui clears

royal hedge
#

nah

#

they both got their advantages and disadvantages

#

but for stuff that needs updates it's easier with mine

dense drift
#

looks nice, good work sparky thumbsupparrot

worn jasper
#

interesting

royal hedge
worn jasper
royal hedge
#

typical lol player

#

jk afonso ily

worn jasper
worn jasper
worn jasper
forest jay
#

How would I go about adding a entity as a passenger to a horse and not letting the horse immediately eject it? I couldnt find an event for it, would I have to do it through packets?

dense drift
dense galleon
#

Why doesn't Java like me using Optional<Integer> as a parameter

minor summit
#

taking an Optional as method parameter in Java can be a questionable design decision

#

but, eh, idrc

sterile hinge
#

there also is OptionalInt

minor summit
#

bleh

sterile hinge
#

this Brian Goetz guy has no clue what he's talking about!

dense galleon
#

I mean

#

It's Minecraft's source code I am copying haha

minor summit
sterile hinge
forest jay
river solstice
#

optional should be mainly used for returns and ternary operator avoidance lol

#

(mainly imo)

dense drift
#

Poor man's Object?

river solstice
river solstice
#

Optional is a monad but not a monad

#

by definition it is, by behaviour, eh, sometimes

grand island
#

Do method overloading instead

tight junco
#

for no reason at all but

royal hedge
#

um why did my message get deleted for having links

#

theres no links

#

oh

royal hedge
river solstice
#

Optional is entirely different use case

royal hedge
river solstice
#
@Nullable
private List<MyObj> getObj(...) {
  List<MyObj> objects;
  ...
  return objects;
}

private void b(...) {
  var obj = getObj(...);

  return Struc.builder()
      .a(...)
      .b(Optional.ofNullable(obj)
               .map(List::stream)
               .map(stream -> stream.filter(Objects::nonNull))
      ...
}

idk I prefer using something like this

royal hedge
#

huh? you prefer that instead of

return Struc.builder()
     .a(...)
    .b(obj
        .stream()
        .filter(Objects::nonNull))
    ...

?

#

oh wait nvm

#

but why u got a nullable list

#

thats an anti pattern

#

i mean i get when doing nested chaining stuff itll look kinda ugly so i get that, but if its like just Optional.ofNullable(foo.bar()).orElse("") then its a little unnecessary

river solstice
#

shit happens

random gate
#

I have a message that runs when the player leaves the server but the placeholders in the message just get replaced with nothing. I assume the player needs to be online for them. specifically with luckperms placeholder. wasnt sure if its something with the plugin i made or placeholderapi

#
@EventHandler(priority = EventPriority.LOWEST)
    public void quitEvent(PlayerQuitEvent event) {
        // other code

        player.sendMessage(PlaceholderAPI.setPlaceholders(player, message));
}
topaz gust
#

As them being offline will likely be the issue depends on the placeholder though

random gate
#

thought so, thanks

queen plank
#

I have a bunch of ”Component” classes that include multiple ”Parameter” fields each. I need to show this data (component name and description + parameter name and description) on my GitBook wiki. Is there a good way of converting this automatically? If not it will be a nightmare to do by hand, and near impossible to keep up to date and maintain.

#

Please ping me if you respond :)

sterile hinge
#

there are many ways I guess

#

one would be annotation processing directly

#

another would be using a library that understands java and can extract the data you want

#

@queen plank

queen plank
#

The data itself isn’t too hard to extract. The problem I can’t solve is how to get said data to the gitbook wiki. I need to create tables, bold text etc..

sterile hinge
#

you could probably make use of some sort of templating framework

queen plank
sterile hinge