#help-development

1 messages · Page 1214 of 1

proven kite
#

?gui

smoky oak
#

that sign cant stop me because i cant read

proven kite
#

I bought a course when it was really cheap on udemy

surreal wadi
#

do u know any dev who will make it for me if they need owo i will because there is a event in my friends hosting

proven kite
#

and they dont explain guis well

echo basalt
#

?services

undone axleBOT
echo basalt
#

Getting someone to make stuff for you costs cash money

smoky oak
#

^

proven kite
#

if you want it fast and want it working decently use skript

#

skript is free option

echo basalt
#

that's not great advice thumbsup

proven kite
#

it is he if he doesnt wanna pay

echo basalt
#

he's gonna think skript is a sg plugin

proven kite
#

I will take a wild guess and I will say he is indian

#

or like an individual

#

that wants it for free and just working

#

@surreal wadi I have a dev friend that could prob do it if u want if its a small project he makes it for free if its a bit bigger it costs to like 3euro max

surreal wadi
#

ok

#

it is small project

proven kite
#

inv as friend

smoky oak
#

well crap ive been bid out :V

#

back to despairing about SQL i guess

blazing ocean
#

A large squid game event will not be 3€ 😭😭

proven kite
#

its a skript dev XD

#

it will prob take him like an hour max

#

like its NOT that hard to code red light green light in skript

smoky oak
#

well red light green light is a scheduler, a area scan and a kill line

#

but if you want the other events things get more difficult

echo basalt
#

id be the kind of guy to make a whole 3d shape system for the area scan

#

a phase system for the scheduler

#

and an ECS to track who's dead

smoky oak
#

aint there a find entities in this area already?

#

like the collision box thing or whatever it was?

blazing ocean
echo basalt
#

what if I decide the area is a cylinder

blazing ocean
#

and stop fucking advocating for skript

#

it sucks

smoky oak
#

i mean suuuuure but circles? in square game?

proven kite
echo basalt
proven kite
smoky oak
#

im pretty sure red light green light tends to be played on one

blazing ocean
rough drift
surreal wadi
echo basalt
#

Instead of doing graphics you'd be optimizing the algorithm while reaching the same end goal

#

It's more efficient both in engineering and operating costs

rough drift
proven kite
rough drift
#

Like tall grass

blazing ocean
smoky oak
surreal wadi
#

map is already builded

smoky oak
#

doable with volume scans then ig

robust helm
#

Im using a PerkManager which i use to retrieve the default perk object by class in my PlayerJoinEvent class' constructor. Now I need to watch out for the right order so that the perks get registered before registering the events. Is there any elegant solution? BukkitRunnables maybe?

proven kite
#

?gui

robust helm
#

but this doesnt work as the order is wrong

smoky oak
#

why do you need to register the listener at a specific time compared to the perks?

#

like, if all this happens at startup, by the time players can connect all the data the event could need shoudl exist

robust helm
#

just thought it was kinda weird/bad

smoky oak
#

i cant explain why but i think you might want to use ?di here

undone axleBOT
robust helm
#

So like a DefaultPerkSupplier interface?

smoky oak
#

i have no idea if its correct, i just dont like the .class thing there

robust helm
#

now that i think about it it doesnt rly matter as i only need the perkManager for testing there

smoky oak
#

like i said gut feeling

robust helm
smoky oak
#

you need to instantiate them so they work, and having them at hand might prove useful i guess

#

i tend to have classes keep a reference to my plugin instance for example

robust helm
#

ig it also depends on how i want to change the default perk later on, should i make a varaible in the plugin main class?

smoky oak
#

make the default perk one that doesnt do anything imo

robust helm
#

oh nvm

robust helm
smoky oak
#

nulltends to cause problems lol

robust helm
#

hm

#

how would i call a nothingPerk?

#

NullPerk?

robust helm
glad prawn
#

No s

robust helm
smoky oak
#

i thought along the lines of EmptyPerk

robust helm
#

what permission should i use for that?

#

like i have permissions for each perk to use

buoyant viper
#

PerklessPerk fr

smoky oak
#

permissions can have default: (true | false | OP) so just set it to true

robust helm
#

nah then id have to static abuse

blazing ocean
#

singleton isn't really static abuse

proven kite
#
package com.sealpvp.sealMc.listeners;

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;

public class guiListener implements Listener {


    @EventHandler
    public void onClick(PlayerInteractEvent e) {

        Player p = e.getPlayer();

        if (p.getOpenInventory() != null && p.getOpenInventory().getTitle() != null) {
            String title = ChatColor.translateAlternateColorCodes('&', p.getOpenInventory().getTitle());

            if (title.equals(ChatColor.AQUA + "Select Kit")) {




            }
        }
    }
}

how can I cheak now if a specific slot was clicked on or a specific item in the gui???

#

?gui is kinda gay

robust helm
smoky oak
#

?di

undone axleBOT
blazing ocean
proven kite
#

what hte skib is ?di

smoky oak
#

not you, kento

blazing ocean
#

it's [the gui post] the best way to do guis on spigot

desert aspen
#

how can i modify the cooldown time of a shield?

proven kite
#

thank you.

smoky oak
#

i think its in item somewhere rafi

blazing ocean
smoky oak
#

ah no its in humanEntity

desert aspen
proven kite
blazing ocean
#

pretty sure that's not it

blazing ocean
#

shield breakage is seperate from item cooldowns afaik

#

but it's worth a shot

proven kite
#

whoever

#

said

#

?di

undone axleBOT
proven kite
#

should rethink what I asked for...

blazing ocean
#

have you considered that there are other people in this chat too

proven kite
#

like what the skib is fancylogger

blazing ocean
#

they even said that it wasn't directed at you

proven kite
proven kite
blazing ocean
proven kite
#

tilted text

#

wow

blazing ocean
#

the dependency injection post was directed at kento

#

not you

proven kite
#

awh :(

robust helm
smoky oak
#

2nd

robust helm
#

english is weird

smoky oak
#

tell me about it

robust helm
#

but DI doesnt work with singletons does it?

smoky oak
#

why wouldnt it

#

you pass the reference

robust helm
#

to the constructor?...

smoky oak
#

yeeesss?

proven kite
#

fuck guis Im gonna make player sel kit and round in the command

buoyant viper
#

reject guis

#

return to the command line

smoky oak
#
class example{
  Object reference;

  public example(Object reference){
    this.reference = reference;
  }  
}

robust helm
#

singletons are these

class Singleton {
    private static final instance = new Singleton();
   public static Singleton getInstance() {
      return instance;
   }
}```
thingies right?
blazing ocean
#

that's di yes

#

yep

robust helm
#

so constructor is kinda difficult

blazing ocean
robust helm
#

where would i specify the plugin's instance then?

desert aspen
smoky oak
#

you dont, it gets instantiated for you
its the class that's extending JavaPlugin and can be referred to in the onEnable as this

#

you can just shove that into a static variable and write a getter, which can be quite useful at times

robust helm
#

so i write the instance variable and getter for it in the plugin class?

smoky oak
#

you can, or you can since the only code that gets ran for you is the three methods in JavaPlugin, just pass the reference via injection

worthy yarrow
#

Main main = Main.getPlugin(Main.class)

#

You already get a default static reference

robust helm
worthy yarrow
#

no

smoky oak
#

part of the api apparantly

#

i knew you could grab plugins over bukkit but i wasnt aware its implemented like this

worthy yarrow
#

It depends how you use it

worthy yarrow
#

Just use DI

smoky oak
#

you have different options how to get a referencew to your plugin, i outlined two there

robust helm
#

or idk what i want

worthy yarrow
#

Main main;

SomeClassConstructor(Main main) {
this.main = main;
}

#

that's di

robust helm
#

i want kotlin's Object keyword

robust helm
worthy yarrow
#

public static NDGManager getInstance() {
if (instance == null) {
instance = new NDGManager();
}
return instance;
}

#

That's a singleton

#

Where there is only ever supposed to be a single instance of said object throughout the entire project (for the most part)

robust helm
#

and DI with singletons doesnt work AFAIK

worthy yarrow
#

It does

robust helm
#

how?

smoky oak
#

again, unless you copy an object (or its a primitive, think numbers), it's a reference

passing along the object in a constructor and caching it or grabbing the object from a static method in a singleton both result in the same reference

worthy yarrow
# robust helm how?

Because you're only getting a reference with DI, whereas a singleton will be constructed once and used everywhere, that being said you can still use DI to get an instance of that object but there's no point because you already give yourself a static reference to the class so

worthy yarrow
slender elbow
robust helm
#

wait i mean like DI for the plugin instance and singleton for the perk instance

like the only thing i can imagine is
class EmptyPerk {
private final EmptyPerk instance = new EmptyPerk(LobbyPlugin.getInstance();
//...
}

#

i meant for the perk, but thatd also have the same problem as i have with singletons as ive realized

worthy yarrow
#

Well that's not singleton syntax

#

technically

robust helm
#

i didnt write the getter cuz yup

worthy yarrow
robust helm
#

wait when do static variables get intialized?

worthy yarrow
#

when the class is initialized / loaded

robust helm
#

and if its never initialized than its just like lazy?

worthy yarrow
#

I believe that's what it's considered

#

Lazy instantiation

worthy yarrow
robust helm
#

java is confusing

#
public class ElytraPerk implements Perk, Listener {

    private static ElytraPerk instance;

    public static ElytraPerk getInstance() {
        if (instance == null)
            instance = new ElytraPerk(TottoriLobby.getPlugin(TottoriLobby.class));
        return instance:
    }
// ...
}

anyway, is this an alright approach?

worthy yarrow
#

Well like in order to get an instance of an object (in another class anyway) that object has to be initialized and not null (unless you're expecting a null value ig)

gentle nexus
#

Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
the line that the error is showing is
public static NamespacedKey getKey(String key) { return new NamespacedKey(instance, key);}
(at the return part)
and the instance variable is
private static Pluginname instance;

worthy yarrow
#

I'd try to only use DI where possible

robust helm
#

i would

worthy yarrow
#

Save static calls for util class and stick to pub/private access modifiers until you understand a bit more about java and those related semantics

#

It's not really a bad thing that you have static objects/method calls per se, it just depends what should be considered rather internal because static shouldn't hold onto state also for those static method calls, this can occur anywhere in your project so I guess you can consider it a global access modifier if you will

worthy yarrow
#

?paste

undone axleBOT
remote swallow
#

also send the whole class thats in

worthy yarrow
robust helm
#

well ig ill sip some tea first. thanks tho!

worthy yarrow
#

Sure!

pure dagger
#

how do you make nicknames invisible ?

worthy yarrow
#

Wdym by nicknames?

remote swallow
#

you never assign instance

worthy yarrow
#

You never assign

#

Man spigot must be hosted wherever you live ebic smh

#

Latency issue fr

remote swallow
#

nah i just read it quicker

worthy yarrow
#

pffffft

gentle nexus
#

private static final Pluginname instance = new Pluginname (); ig ?

worthy yarrow
#

It extends java plugin, so this already occurs. Instead just use the "this" keyword and remove the static from the method call

#

Just make it public

#

NamespacedKey(this, key)

blazing ocean
#

Hi Kat

worthy yarrow
#

Hi rad

worthy yarrow
gentle nexus
worthy yarrow
#

?di

undone axleBOT
pure dagger
#

i guess they are called tags

worthy yarrow
#

The regular player name you mean?

pure dagger
#

i guess

worthy yarrow
#

Try putting an empty textDisplay as a passenger on the player

#

I've seen that the regular name gets removed when there is an overlapping textDisplay so

pure dagger
#

armor stand withut a name?

robust helm
#

theres also some scoreboars option

worthy yarrow
pure dagger
#

1.8 ???

#

wdym

worthy yarrow
#

What version of spigot are you using

pure dagger
#

depends but like 1.16 +

worthy yarrow
#

1.19.4+ you get display entities

#

way easier to work with

robust helm
#

why not scoreboard with nametagVisibility never?

worthy yarrow
#

🤷 I've never done scoreboards

pure dagger
#

oh

#

okay

worthy yarrow
#

I did however accidently get the player name removed by doing the text display thing so

misty ingot
#

wheres the page where i can see the placeholders that work for when the plugin is downloaded from spigotmc

worthy yarrow
#

what placeholders and what plugin?

misty ingot
#

like

#

%%RESOURCE_ID%%

#

that kinda stuff

#

that i can put in my code

#

and spigot puts the resource id there when the jar is downloaded

worthy yarrow
#

I would figure you just put that in your plugin desc manually?

misty ingot
#

no i remember theres a thing for that

#

spigot has placeholders

worthy yarrow
#

Hmm I'm not sure then

misty ingot
#

i just forgot where to find the list

worthy yarrow
#

btw kek

gentle nexus
# worthy yarrow ?di

uhh so like
i did this.getKey(stat) the issue is that the method that the pdc setter is in is static so it doesnt work

misty ingot
#

i remember jeff told me about it

#

i mean mfnalex

misty ingot
#

yes thats the one

worthy yarrow
#

❤️

misty ingot
#

its only for premium resources tho? sad

worthy yarrow
#

I wouldn't know lol I've never used those before

#

seem pretty cool tho

worthy yarrow
#

Just don't make that method static

#

Feels like you're abusing static a bit

gentle nexus
worthy yarrow
#

I'm sure but would not recommend

#

I need more context tho, send me all the code you're having issues with

gentle nexus
worthy yarrow
#

Yeah so then stop abusing static lol

#

?di

undone axleBOT
gentle nexus
#

ok i understand why it would work if i dont use static
but it would still baisically be super annoying cause i need to make an object of "StaticMethods" to do the setting / getting

worthy yarrow
#

Not really

#

You can still use DI in that regard, then just use the instance of that class to make a call to a public method

gentle nexus
#

ah so like
call static method
static method makes object which then calls method which actually does everything ?

worthy yarrow
#

uh no

#

You pass an instance of a class, use that instance to call a public method

tidal kettle
#

im a mc plugin developer dm me

rough drift
worthy yarrow
echo basalt
#

imagine having public constructors lmao

robust helm
#

[sql] read directly after write but from different server reliably

worthy yarrow
blazing ocean
#

imagine not allocating with unsafe

echo basalt
#

interface-factory-impl-provider pattern go brr

rough drift
quaint mantle
#

Imagine computing

gentle nexus
worthy yarrow
#

Correct

gentle nexus
#

is there any way to like put it all in 1 class (Pluginname /Main class)

#

so like ima try and summerise my issue cause even im getting kinda lost
so like to store stuff in my pdc i need a NamespacedKey which to create i need Pluginname object and a string
and if i put this into a method to create NamespacedKey and make it not static i would need a Pluginname instance to call it since the method is in the Pluginname class
and after this im kinda lost on what im doing

gusty bough
gentle nexus
robust helm
#

you use constructor parameters to pass the plugin instance(Pluginname) to your class where you need the namespaced key. then you save the plugin instance to a variable(this is dependency injection).
Now you can simply use the local variable with your plugin instance to create the NamespacedKey

#

and because you create the instance for the class where u need the plugins instance in ur Pluginname class, you dont need static

robust helm
gentle nexus
worthy yarrow
#

Scroll up a bit I described static abuse sorts

#

It’s a bit far up

misty ingot
#

I am using tchristofferson's config updater and its not updating the actual file in the directory

    private void checkLangUpdate() {
        try {
            log("l "+ getLangDouble("lang-version"));
            if (getLangDouble("lang-version") != PLUGIN_VERSION) {
                log("2");
                ConfigUpdater.update(this, "lang.yml", langFile);
                lang.set("lang-version", PLUGIN_VERSION);
            }
        } catch (IOException e) {
            logError("Failed to check lang file update.");
            e.printStackTrace();
        }
    }

it prints lang version was previously 1.0 (taken from lang)
then it prints new lang version is 1.2 (taken from lang)

this change in lang-version does not reflect in the directory file
and when i grab any of the newly added keys from lang they dont exist (a server restart fixes this, since they are added to the physical file)

gentle nexus
#

and i would somin like
public NamespacedKey getKey(String key) { return new NamespacedKey(this.plugin, key); }

#

also i realised that the class name is StaticMethods when im trynna not use statics
ill change it eventually

gentle nexus
robust helm
#

and the StaticMethods class doesnthave any static methods

#

but now you see, you can use the plugins instance without static in a different class, so at least DI(dependency injection) is direct

proven kite
#

Could someone help me with this stupid gui please 😭

    public void onInventoryClick(InventoryClickEvent e) {
        Player p = (Player) e.getWhoClicked();
        Inventory inv = e.getInventory();
        String guiname = e.getView().getTitle();
        int clickedSlot = e.getRawSlot();
        //gui mechanics
        if (guiname.equals("kitGui")) {
            e.setCancelled(true);
            ItemStack clicked = e.getCurrentItem();

            if (guiname.equals("roundGui")) {
                e.setCancelled(true);

                if (guiname.equals("kitGui")) {
                    e.setCancelled(true);


                    if (clicked != null && !clicked.getType().isAir()) {
                        if (clickedSlot == 10) {
                            p.sendMessage("G FUCKING G");



                        }
                    }
                }
            }
        }
    }```
#

like when I use the command

#

it just says "invalid usage"

fossil ridge
#

wtf is this code

proven kite
proven kite
remote swallow
#

show the command then

proven kite
remote swallow
#

i mean the code

proven kite
remote swallow
#

does your gui open

proven kite
#

ye

#

wait wanna vc? so I can screenshare?

remote swallow
#

and it still sends the message?

proven kite
#

it could be easier for you to help

remote swallow
proven kite
#

and it just gives me the correct usage or smth

remote swallow
#

so it opens the gui, but still sends incorrect usage?

#

so show the command code

proven kite
#

and this is my only class in the main class I got this

    public void onEnable() {
        getCommand("duel").setExecutor(new duelCMD());
    }```
remote swallow
#

go and learn java, your event isnt registered and that class shouldnt be a command and an event, and you return false which causes sending the usage

proven kite
#

it implements command executor and listeners

worthy yarrow
#

Holy hell

remote swallow
#

you do not register the listener, and you shouldnt import event listener

proven kite
#

this is what Im trying to do

remote swallow
#

your command should not be an event too

worthy yarrow
proven kite
#

fine

nova notch
proven kite
#

this is what u wanted me to do?

remote swallow
#

yes

robust helm
#

holy triangle

remote swallow
#

dont forget to register it

remote swallow
#

you also should not be using inv name to detect what inventory

proven kite
#

wdym register?

#

Im sorry if Im annoying by asking stupid questions I dont know java very well

#

Im still trying to learn

remote swallow
#

you have to register the event with Bukkit.getPluginManager().registerEvents

gentle nexus
#

wait i think i got it to work
or am i still doing static abuse

robust helm
#

u shouldnt even need static here

#

so if ur code contains static then yes

blazing ocean
#

that is horrible advice

#

you often need static in places where DI would just not make sense

robust helm
#

well for this case i mean

gentle nexus
#

is this how it would look like ?

robust helm
#

kinda

#

but setIntStat needs to be public

#

and u cant create an instance of Pluginname

gentle nexus
robust helm
#

you can get the pluginname instance using "this" within the pluginname class

gentle nexus
#

ye but like
im calling the setIntStat method from another class

robust helm
gentle nexus
#

hm?

#

i feel like this is getting more complex than it needs to ?

robust helm
#

private Plugin plugin;

public ClasName(Plugin plugin) {
this.plugin = plugin;
}

robust helm
gentle nexus
#

i knew java was boilerplate hell but this seems over the top

robust helm
#

eeh its just 2 lines in the end

#

like declaring variable and setting the value in the construczor

gentle nexus
gentle nexus
robust helm
#

e.g if u have a command that needs Plugin instance to call the setIntStat method:

public class Pluginname extends JavaPlugin {
    
    @Override
    public void onEnable() {
        getCommand("setintstatcommand").setExecutor(new SetIntStatCommand(this));
    }
    
    @Override
    public void onDisable() {
    }

}
blazing ocean
smoky oak
#

are data bans still a thing in modern versions of the game? i recall hearing that something about the maximum amount of data sent to the player got changed?

robust helm
#

yes, in that example SetIntStatCommand has a constructor that takes in the Plugin instance

gentle nexus
#

ye ye i got it

#

tho like i still didnt understand the issue with static
ig it makes it less "oop" but still

worthy yarrow
#

It’s not that it’s less oop, it’s that there are access modifiers for a reason. Static is basically a global object being accessible throughout your entire project which unless done correctly can lead to a lot of issues. It’s also not a good idea to mix state with static fields. Really will just make your testing harder unless you’re using it correctly

gentle nexus
paper viper
#

Yes

misty ingot
#

whats the best library/api to use if i need the user to select a region (like the worledit wand does) and then have the plugin do whatever i want with said selected regionww

paper viper
#

I don’t know if there is a library for that, but it isn’t that hard to code

smoky oak
#

aint that just region select + iterator

#

like, for x = x_small, x < x_large, x++ ... block block = world.getblockat(x,y,z)

misty ingot
#

because basically like id be selecting a play area that players cant get outside of either, so i would need easy checks for stuff like that

smoky oak
#

scheduler iterating player list and positions if player x < minx player x = min x, if player x > maxx player x = maxx... then?

paper viper
#

Or use PlayerMoveEvent

#

That’s what WorldGuard uses

misty ingot
#

hm.

pliant topaz
tight compass
#

Can methods with @EventHandler be static?

#

I don't feel like testing it right now

earnest girder
#

how do I use meta.setCustomModelDataComponent? I need to set it to a string case for this resource pack config ("CUSTOMSTRING1") The method takes a CustomModelDataComponent but I dont know how to make one

{
  "model": {
    "type": "minecraft:select",
    "property": "minecraft:custom_model_data",
    "cases": [
      {
        "when": "CUSTOMSTRING1",
        "model": {
          "type": "minecraft:model",
          "model": "minecraft:model1"
        }
      }
    ],
    "fallback": {
      "type": "minecraft:model",
      "model": "minecraft:nether_brick"
    }
  }
}
sullen marlin
#

.GetCustomModelDataComponent will make one

#

Or you can just use the old string method for < 1.21 style

eternal night
#

old string method? raised_eyebrow

earnest girder
#
        List<String> customStrings = new ArrayList<>();
        customStrings.add("CUSTOMSTRING1");

        meta.setCustomModelDataComponent(meta.getCustomModelDataComponent().setStrings(customStrings));

this isn't compiling
Required type: CustomModelDataComponent, Provided: void

eternal night
#

save the getter return

#

call setStrings

#

then pass the instance to the setter

earnest girder
#

👍

remote swallow
#

i love CustomModelDataComponent

eternal night
#

parasocial relations like this aren't it

remote swallow
#

oh lynx while ur here

#

do you want miles to make a new pr

eternal night
#

depends on the PR sweating

remote swallow
#

totally not the poi one

eternal night
#

if its not the POI one all good

blazing ocean
#

lynx can i make a pr that has the buildscript of paper explode your pc

#

only for you tho

eternal night
#

I'll accept it

dry hazel
#

approved

remote swallow
river oracle
#

-# as a draft 🤫

floral pond
#

Initialising the plugin before the world generation solved my spawning issue thanks. Unfortunately vault will not be loaded so i need to take that into account and load it afterward

#

Using ServerLoadEvent should fix that

#

Thanks for the help !

sullen marlin
#

Even better or PluginEnableEvent if Vault is optional

#

Or even even better, ServiceRegisterEvent if you're using Vault services and they're optional

floral pond
#

In my case I only need the "Economy" part of vault so ServiceRegisterEvent should be even better

#

thanks !

smoky oak
#

ok so i have a -#teensy tiny ###problem
is there a way to, somehow, make this generic without using (Object key, Object value) and a ton of if(Object instanceof Class)?

#

if not, is that the better solution in this case?

hybrid spoke
smoky oak
#

ok the only thing in my head hearing that is github lol

hybrid spoke
#

especially if you have essentially the same method all over again you could just have an interface giving the methods

#

and different impls

smoky oak
#

ah, but i still would need to implement the methods just in different files

#

i was asking if there is a way to make this easier to tack additional types of keys and values onto

#

instead of having to make n*m methods lol

hybrid spoke
#
public interface Repository<T> {
  public void storePDC(T, PersistentDataContainer); 
}

or whatever

#

that would be the generic way

smoky oak
#

the problem is that those T still need to be translated into keys

#

hm

#

can you constrain T to a Set of classes?

#

like, T instanceof (Block, World, UUID) ?

blazing ocean
#

not without all of them implementing a common interface

smoky oak
#

!

#

ok ideeeea :V

remote swallow
#

persistent data holder might work

#

depends what stores it

blazing ocean
#

and since you're not bukkit you can't make an interface they implement without mixins and interface injection (my beloved)

smoky oak
#

no i think i got it
this class is already having a constraint in itself so that its only valid for one combination at once

#

so i can just have it store the PreparedStatement strings and call 'setKey', 'setValue', 'executeUpdate' and 'executeQuery'

#

like

#
private void storeString(int x, int y, int z, byte[] world, String value){
        String statement = "INSERT INTO "+table_name+" (x, y, z, world, data) VALUES (?, ?, ?, ?, ?)";
        try {
            PreparedStatement preparedStatement = connection.prepareStatement(statement);
            preparedStatement.setInt(1, x);
            preparedStatement.setInt(2, y);
            preparedStatement.setInt(3, z);
            preparedStatement.setBytes(4, world);
            preparedStatement.setString(5, value);
            preparedStatement.executeUpdate();
        } catch (SQLException e){
            throw new VDBException("FAILED TO EXECUTE STATEMENT: "+e.getMessage());
        }
    }
#

and just split this into the key assignment and the data assignment, since because all tables store exactly one value, the preparedString depends only on the key type

remote swallow
#

for the love of god use the prepared statement for the table too

smoky oak
#

?

remote swallow
#

you can put ? anywhere

#

then set it

#

dont concat the table name in

smoky oak
#

ah. well, the instances of this class are supposed to represent a specific table

#

is it an issue?

#

or just 'please dont do that' lol

remote swallow
#

you already use the prepared statement, so use it and sanitize the data

blazing ocean
#

me when the table name is void; drop all tables; -- or something, idk sql

smoky oak
#

the table name is generated from the key/value type and final after instanziation

#

i dont see how it could cause an issue here but i can tell that its good practice in general i guess

smoky oak
#

though my code yelling at me all the time is a bit annoying

#

:V

blazing ocean
smoky oak
#

thats not mysql

#

is it?

blazing ocean
#

maria

smoky oak
#

yea i think the direct mysql thing yells at you for not writing keywords in caps

blazing ocean
#

it does not

#

never has

smoky oak
#

aaaaalright then

earnest girder
#

my code for adding a custom model data component (string) is this:

        List<String> customStrings = new ArrayList<>();
        customStrings.add("ak47");
        CustomModelDataComponent component = meta.getCustomModelDataComponent();
        component.setStrings(customStrings);
        meta.setCustomModelDataComponent(component);

Here is the data on the item when I get it via command: https://cdn.discordapp.com/attachments/1332849118762242079/1332859931505725595/Minecraft_1.21.4_-_Multiplayer_3rd-party_Server_1_25_2025_3_49_07_PM.png?ex=6796ca0b&is=6795788b&hm=36ee12a50d7e3f9979c08f2fbe4535174b67143d0409d52b5b50160b61afbfcd&
so it seems that it has an empty custom model data component. is there anything wrong with my code?

sullen marlin
#

make sure your spigot is up to date

#

what does /version say

earnest girder
#

whats the newest version?

#

this just means I need to get a new spigot jar from buildtools?

chrome beacon
#

yes

sullen marlin
#

yep, this bug was fixed a week or twoago

earnest girder
#

so I currently have an old 1.21.4 and need the newest 1.21.4? or experimental?

sullen marlin
#

newest 1.21.4

mortal vortex
chrome beacon
#

As far as I'm aware that's not enforced

#

It's just good practice

sullen marlin
#

Yeah it's so you can tell what's a keyword

buoyant viper
#

same goes for windows Batch scripts

#

(for the most part, i think older windows and some cmds do poop on U if its not cap)

young knoll
#

You have to scream at the database

#

INSERT INTO table

worldly ingot
#

That way SQL knows you're SERIOUS >:(

blazing ocean
smoky oak
#

where's the code looking for a safe spawn? i need to steal it

quaint mantle
#

?paste

undone axleBOT
surreal wadi
#

anyone know to remove actionbar from our screen but i didn'y know where is the command block

rough ibex
#

Reset title?

surreal wadi
#

yes

#

i want to off the action bar

#

how to

#

tell me

rough ibex
#

I just told you...

surreal wadi
#

what ?

quaint mantle
smoky oak
#

cm'on guys its been half a bloody day lol

wet breach
#

for what?

smoky oak
#

since this topic started

wet breach
#

oh right

#

thought you were still waiting on safe spawn code and saying its been half a day

smoky oak
#

ah well i do need that too

#

i want to mimic overworld spawning in the nether

wet breach
#

for entities?

#

or players?

smoky oak
#

for players

#

i want to soft ban someone into the nether

#

coz its hell

wet breach
#

safe spawn detection isn't all that difficult

smoky oak
#

oh ik i can just search for solid block with 2 air above, but i want it to mimic overworld if possible, thats why im asking in the first place

wet breach
#

basically the code just looks at the initial place, and then surrounding locations. And if that doesn't work then it looks higher until it finds a 2 block high spot

quaint mantle
#

Anyone? khajiit

mortal vortex
pearl pewter
#

Where do I download the SpigotMC API?

sullen marlin
#

?maven

undone axleBOT
mortal vortex
#

ohh. When he said "download" I assumed he was doing it external to a build system like Maven.

misty ingot
#

which command frameworks do you guys prefer? i have been using ACF for a while but since its basically abandoned i was thinking about switching to something that might be more frequently updated or more feature-rich

blazing ocean
#

cloud, acf and commandapi are the popular ones

mortal vortex
#

Can permissions be dynamic, or must they be inferred from a plugin.yml? For instance, can you have a plugin, say a "homes" plugin, have the quantity of homes per group dependent on a dynamic permission node. Assume we have a plugin, RizzHomes.

Would it be possible to have a node rizzhomes.limit.X, and assign rizzhomes.limit.1 to your default group, and perhaps have the limit be 3 (rizzhomes.limit.3) for VIP.

I know you could probably just do this in your config.yml like:

groups: 
  default:
    limit: 1
  vip: 
    limit: 3

but the prospect of it being permission nodes sounds cool. But if this is the case, would you have to statically define every single potential permission node, such as:

permissions:
  rizzhomes.limit.1
  rizzhomes.limit.2
  ...
blazing ocean
#

rizzhomes

#

gtfo

#

but you can just create a Permission object

mortal vortex
#

Like is there a way for your plugin to check, "Does this person have the integer permission", and if so allow them to create more than X amount of homes.

wet breach
mortal vortex
wet breach
#

wouldn't be hard to modify that to handle integers instead

eternal oxide
#

filter on getEffectivePermissions works well

#
String perm = "homes.total.";
int total = player.getEffectivePermissions().stream().filter(homes -> homes.getPermission().startsWith(perm)).mapToInt(homes -> Integer.parseInt(homes.getPermission().substring(perm.length))).max().orElse(0);```
smoky oak
#

What is a IntFunction<T>?

mortal vortex
#

Interface

#

its a function that takes an int as an input and produces a result of type T.

smoky oak
#

im not passing this an int tho

#

oh its passed automatically aint it

#

huh

#

why is my ide markingn the parameter as R instead of T?

mortal vortex
#

This might be a little confusing, but IntFunction looks like:

@FunctionalInterface
public interface IntFunction<R> {
    R apply(int value);
}

R stands for Result. As relative to the inteface, it is the result, to you its the type.

smoky oak
#

fair enough

mortal vortex
smoky oak
#

ye

mortal vortex
#

Yeah it do

smoky oak
#

i saw it in the autocomplete for set -> array cast

mortal vortex
#

ohh alrighty

smoky oak
#

hmm unrelated question but i just got an idea
is this valid sql? cant really test atm

"INSERT INTO table (id, data) VALUES (?, ?,)"

eternal oxide
#

no

smoky oak
#

damn

#

i mean as prepared statement

#

but i guess you answered to that?

eternal oxide
#

extra comma will throw an error

smoky oak
#

alr ty

#

was hoping i could just count the args and go repeat("?, ",n)

glacial narwhal
#

Hey, how can i update a scoreboard, i saw that you need to reopen it, but just doing player.setScoreboard(scoreboard) doesn't seem to work, i tried to remove the scoreboard with player.setScoreboard(null) gave an error. (I do not use teams)

chrome beacon
#

I've already sent you the wiki link that explains how

eternal oxide
#

Hes been answered a couple of times over teh past two days

chrome beacon
#

Yeah I've answered at least twice

eternal oxide
smoky oak
#

i have two sets / arrays (doesnt matter which; currently writing the class) for which i need to figure out if they overlap at all
does java have set manipulation that allows me to calculate the crossection and check if its non-empty?

#

coz otherwise this is just n² comparisons

chrome beacon
#

Should be a retain method you can use

smoky oak
#

'retain' ?

chrome beacon
#

Not sure about the complexity of it though

smoky oak
#

n * O(insert) i guess

#
set.stream().anyMatch(set2::contains)
#

only found this tho

young knoll
#

retainAll

chrome beacon
#

^^

upper hazel
#

guys here idea

#

what you think about create safe async task

chrome beacon
#

???

upper hazel
#

if task will interact with sync methods he will synchronizes them

#

automaticly

chrome beacon
#

How do you plan on detecting that

upper hazel
#

hm

#

good question

#

need to think

smoky oak
#
Set<String> keySet = new HashSet<>();
for(TypesAccess keyType : keyTypes){
  for(String key : keyType.keySet){
    if(keySet.contains(key)) throw new RuntimeException("OVERLAPPING KEYS");
    else keySet.add(key);}}

im going with this right now

chrome beacon
#

Use retainAll 🙏

upper hazel
chrome beacon
#

Also checking contains is redundant

smoky oak
#

i need to see if the overlap is empty and then grab the merged set if it is, so i figured this would be less operations total

#

for each iteration

upper hazel
chrome beacon
#

💀 Please don't

young knoll
#

Couldn’t you just add all from
Set A to B

#

And then check if the size increased

upper hazel
#

why

#

this be funny

chrome beacon
#

Do not mess with the code during compile time from a Intellij plugin

#

That will create a dependency on Intellij being used to compile

smoky oak
chrome beacon
#

list a, b
copy a to c
c addAll b
is c size a + b

upper hazel
#

just warnings

#

where i should sync

smoky oak
upper hazel
#

i need create smth like black list

#

bukkit methods💀

#

or

#

not

chrome beacon
upper hazel
#

idk need think

chrome beacon
#

but if you're making the pdc thing still I don't think it matters that much

smoky oak
#

this isnt for pdc, im making a framework for databases to spare myself headaches later on once i forgot how sql works in 3 weeks

chrome beacon
#

I see

#

Yeah I did already tell you that was a bad idea

#

Since there's no generic way of handling relationships between objects

#

You'd still need to define them

young knoll
#

Hibernate!

smoky oak
#

well this isnt meant for complex database relation nonsense lol

#

this is so i can go 'hey, i want this table: (Keytype, Valuetype)' and get a instance that has 'put(key, value)' and 'query(key)'

hazy parrot
#

Why use relational database then

smoky oak
#

wym

young knoll
#

MongoDB moment

smoky oak
#

is it possible to assign final variables outside the constructor? i have a method thats supposed to be called from the constructor so that i can organize my code better, and it does some string manipulation

chrome beacon
#

You can return that value from the method

#

and then assign it

smoky oak
#

yeeeah i feared

#

bleh it builds three strings. set? return the partial strings?

smoky oak
#

ah. i split the method into multiple parts and am now realizing a small issue. if i iterate the same set, with no changes, using for(T t : Set<T>), does it always iterate in the same order?

#

ah fuck it says 'subject to change' here

hazy parrot
#

if order is important dont use set 👍

smoky oak
#

i stg the longer i am working on this the dumber my code becomes

smoky oak
#

how do i do a sql statement that overwrites if data is currently present?
im getting 'primary key constraint failed'

my current sql is INSERT INTO table_name (name, data) VALUES (?, ?)

amber fjord
#

idk how to write sql 🤷‍♂️

pseudo hazel
#

how about INSERT OR UPDATE?

smoky oak
#

huh its that simple

#

imma try that brb

#

[SQLITE_ERROR] SQL error or missing database (near "UPDATE": syntax error)

#

nope

eternal oxide
#

depends on which sql

smoky oak
#

a

#

im on mysql

eternal oxide
#

then just REPLACE INTO

pseudo hazel
#

or insert into ... on duplicate key update

smoky oak
#

wait

eternal oxide
#

yeah I just used replace into for simplicity

smoky oak
#

dont you need to state which keys on that?
as for elgar, you can use different placeholders on that?

#

[SQLITE_BUSY] The database file is locked (database is locked) what the

#

imma hit restart on that rq

#

hm no that still happens if i use REPLACE

wet breach
#

that is sqlite which is not mysql

smoky oak
#

ngl those are kinda swapping around in my head rn

eternal oxide
smoky oak
#

noted

worthy garden
#

how to create an umbreakable sword in spigot 1.8.8

smoky oak
#

there should be item flags for that i think?

worthy garden
#

i dont foud it

smoky oak
eternal oxide
#

are you even connected?

smoky oak
#

i mean, yea. it wouldnt complain about duplicate values if i exclude everything after (?, ?) otherwise

#

unless changing my insert string SOMEHOW disconnects me

eternal oxide
#

your first entry shoudl be your table name

smoky oak
#

isn't that set to the table name?

eternal oxide
#

a database can have many tables. You specify which table as teh first arg of your INSERT statement

smoky oak
#

ye

eternal oxide
#

or NAME_STRING

worthy garden
#

thx

eternal oxide
#

thats your table?

smoky oak
#

in this instance yes

#

testing yknow 🤷‍♀️

eternal oxide
#

then why is it also in your on conflict?

#

on conflick shoudl be on name or data as those are the keys you are using

smoky oak
#

bc it says so in the thing you linked

eternal oxide
#

ah no, you are mis-reading

#

I store a table name as a reference in some tables

smoky oak
#

ah so it is a column

eternal oxide
#

%s is my table name for the insert

smoky oak
#

or does that have to be the entire key?

#

my primary key can be coordinates

eternal oxide
#

I guess mine can be confusing as I have TABLE_NAME as a column in one table

#

that one with TABLE_NAME is just a table of timestamps of last update

#

keeps track of table change timestamps for syncing across servers

smoky oak
#

this error keeps getting weirder and weirder

[SQLITE_ERROR] SQL error or missing database (no such column: excluded.UPDATED)

#

i switched the table name with the primary key and that seemed to do something?

eternal oxide
#

Your columns are name and data

smoky oak
#

oooh

#

caps strikes again lol

#

im Deeply Suspicious of the fact its not throwing errors anymore

#

more testing required

#

ah no

#

database is locked agian

eternal oxide
#

are you getting new connections without releasing the old?

#

its a file so suffers from file locks

smoky oak
#

ah

#

could potentially happen?

#

depends on how erroring works

eternal oxide
#

if you try to open a new connection while one is alreasdy open

smoky oak
#

lemme verify something

#

hm no that shouldn't be an issue atm - i make a connection, pass a reference to it to the class interacting with the table, and the only thing i ever do with it is calling prepareStatement

robust helm
#

is there any good async/sync taskchain api?

smoky oak
#

ok this is decidedly odd. it causes an exception the FIRST time (something something result set), and THEN it goes 'Database Locked' on subsequent queries. Only fix to that is restarting the server

#

god damn it

#

statement.close has to be added bleh

eternal oxide
#

if you use a try with resources it auto closes

smoky oak
#

ye but i am using a builder pattern (that the right name?) for composite keys

#

wot

#

its saying the statement is null

#

i dont unset that ever tho???

#

so a sql exception unlinks a reference. great

quaint mantle
misty ingot
#

how can i set a custom no permission message in acf?

remote swallow
#

Show code

misty ingot
#

uhh

    @Subcommand("info")
    @Syntax("<guild>")
    @CommandCompletion("@AllGuilds")
    @CommandPermission("guilds.info.other")
    public static void guildInfoOther(Player player, String guildName) {
#

acf by aikar

#

spigot 1.21.4

eternal oxide
#

Spigot no longer gives no permission messages, just unkown command

misty ingot
#

sure but acf does right

chrome beacon
remote swallow
#

My discord didn't load ur messages kekw meant for @smoky oak to show code

misty ingot
#

yeah i was a bit confused

#

why show code

smoky oak
#

specifically, after the error it stops executing, and the first call after that is to this method

public SQLTable prepareInsertStatement(){
        try {
            statement = connection.prepareStatement(insertString);
        } catch (SQLException e) {
            try {statement.close();
            } catch (SQLException ex) {throw new RuntimeException(ex);}
            throw new VDBException("FAILED TO SETUP INSERT: " + e.getMessage());
        }
        return this;
    }
#

in which the debugger showed statement as null before that first line executed

chrome beacon
#

Why no try with resources smh

remote swallow
#

Use t-w-r and you don't need to close

quaint mantle
blazing ocean
#

that is cursed try usage

smoky oak
#

bc i need a preparedstatement field to do chains a la this

chrome beacon
#

You can set the variable in the try with resources

#

not that it's a good idea since it already will be closed

#

(but that's also the case in your code above)

smoky oak
#

not too sure what exactly youre saying here tbh

chrome beacon
#

What you should be doing is creating the prepared statement in the execute method

#

or if you really want to do it that way you close it in the execute method

#

wait nvm I missed that your second try was in the catch block 🤦‍♂️

smoky oak
#

btw i am doing that there since i can use twr there and closing the reference closes the statement

#

the issue was that after an sqlexception it for some reason unliked the statement reference from the field

#

which is like ?????

#

thats not how it works 😂

eternal oxide
#

the code you showed would always have a null statatement if it errors in creation

smoky oak
#

ah thats not what i stated that method was

#

ah

#

hold up i see the problem now

#

i requested a new table but the connection was tied up in the error from the old instance

#

im a dumbass

#

of course two different objects dont have the same references

smoky oak
# chrome beacon What you should be doing is creating the prepared statement in the execute metho...
private void insertKeys(PreparedStatement statement) throws SQLException {
  for(Map.Entry<KeyType, Object> entry : keyMap.entrySet()){
    KeyType type = entry.getKey();
      switch (type) {
        case UUID -> statement.setBytes(keyOffsetMap.get(type), Serializer.serializeUUID((UUID) entry.getValue()));
        case NAME -> statement.setString(keyOffsetMap.get(type), (String) entry.getValue());
            }
        }
    }

public ResultSet executeQuery(){
  try(PreparedStatement statement = connection.prepareStatement(queryString)) {
    insertKeys(statement);
    return statement.executeQuery();
    } catch (SQLException e) {
      throw new VDBException("FAILED TO EXECUTE QUERY: " + e.getMessage());
        }
    }
#

like this?

chrome beacon
#

Not a fan of hardcoding the switch like that

#

but other than that yes

smoky oak
#

forces me to update it when i add different key types

quasi gulch
#

is there a way to make a skeleton shot an arrow with the animation?

proven kite
#

can

#

someone help me with gui

#

like I cant make it so it does anything on open

#

nor click

quasi gulch
#

send your code

misty ingot
#
    @Subcommand("accept")
    @Syntax("<player>")
    @CommandPermission("guilds.request.accept")
    public static void acceptGuildJoinRequest(Player player, Player target) {
        log(player.getName());
        log(target.getName());

using acf
i am running the command with one account
and putting the name of a diff online account

but both player and target refer to the same player (the sender)
whats up with this?

echo basalt
#

Uh

#

Try @Flags("other")

#

on the target

misty ingot
#

alright

#

well that seems to have worked perfectly

#

what sort of witchcraft-

echo basalt
#

¯_(ツ)_/¯

#

I just see it being done on this one plugin I've worked on that uses ACF

#

we use cloud at work but I've been preferring command-api a lot more tbf

#

it's the closest to the one I made while still supporting brig

robust helm
#
.thenAsync((Task<Double, Object>) ignored -> {
                    System.out.println("hi");
                    return Math.sqrt(Math.PI);
                })

is there any plans for java to allow simplifying this to

.thenAsync( ignored -> {
                    System.out.println("hi");
                    return Math.sqrt(Math.PI);
                })
```?
kinda like kotlin does
#

or any way to make this not require casting/be simpler?

chrome beacon
#

Is that your thenAsync method?

robust helm
#

yea

chrome beacon
#

Could you show us how you made it

#

?paste

undone axleBOT
sullen marlin
#

Java already allows lambdas without explicit types?????

robust helm
#

its incomplete but i commented what doesnt work

#
/**
 * @param <S> return type of self task
 * @param <T> return type of prev task
 */
public interface Task<S, T> {

    /**
     * Runs the task
     */
    S run(T prevResult);
}

interessting part is propably this

chrome beacon
#

Why not use Aikars taskchain?

robust helm
#

uh i was too stupid to include it using gradle

blazing ocean
#

what?

chrome beacon
#

?? it's just a maven dep

robust helm
#

and it didnt have any new commits so i was kinda concerend if its maintained

chrome beacon
#
  • shading
robust helm
#

i got it included but the methods in TaskChain and all the classes didnt show up

blazing ocean
#

this uses horrible gradle stuff but yea

chrome beacon
#

Ancient shadow in that example so do make sure to update it

blazing ocean
#
plugins {
    id("com.gradleup.shadow") version "9.0.0-beta6"
}

repositories {
    maven("https://repo.aikar.co/content/groups/aikar")
}

dependencies {
    implementation("co.aikar:taskchain-bukkit:<version>")
}

tasks {
    assemble {
        dependsOn(shadowJar)
    }

    shadowJar {
        relocate("co.aikar.taskchain", "my.shaded.taskchain")
    }
}
#

modern gradle

robust helm
#

did u just copy paste it or is there some updater tool?

blazing ocean
#

no i wrote that by hand

robust helm
#

shame. thanks tho

blazing ocean
#

ohmagawd shadow 9 beta 6 is out now

#

gonna have to update all my projects from beta 4

chrome beacon
#

Should have stayed on stable

blazing ocean
#

nah 👍

#

i just always stay updated

#

(most of the time)

chrome beacon
#

Livin' on the edge

blazing ocean
#

listen i use arch (btw)

robust helm
#

systemd 🤮

blazing ocean
#

don't see the issue with systemd

robust helm
blazing ocean
#

i tried artix but i had issues

robust helm
blazing ocean
#

your shaded package

robust helm
#

and bloated asf

#

so security wise kinda bad

blazing ocean
robust helm
blazing ocean
#

it's just a package

blazing ocean
#

windows used 6 gigs soooo

#

i just have lots of stuff running that i need

robust helm
#

but mostly doesnt matter tbh

blazing ocean
#

eh i honestly do not care about systemd

#

i'm used to systemctl too

robust helm
#

sadly i care so i hate like every linux distro xD

quaint mantle
#

Whats the max bandwidth you guys have hit?

blazing ocean
#

what about gentoo or lfs?

quaint mantle
robust helm
blazing ocean
#

i haven't tried void much yet

robust helm
quasi gulch
#

Why does an IronGolem change its yaw rotation when i aply a vector in the direction he is running?

                    Bukkit.broadcastMessage(vector.toString());
                    vector.setY(0.8);
                    Bukkit.broadcastMessage(vector.toString());
                    ironGolem.setVelocity(vector);```
robust helm
blazing ocean
#

aur my beloved

robust helm
#

xbps is a bit better than pacman in my opinion but maybe its js the packages being more stable

robust helm
blazing ocean
#

eh not really for me

#

i have to manage an alma server, rhel and dnf is such a pain sometimes

robust helm
#

lucky me is js a 15 yo kid with no responsibilities but school

proud obsidian
#

What to use instead of "EnumChatFormat" on 1.21 for ProtocolLib? (it says doesn't exists)

teamPacket.getOptionalStructures().read(0).map((structure) ->
                structure.getEnumModifier(ChatColor.class,
                                MinecraftReflection.getMinecraftClass("EnumChatFormat"))
                        .write(0, ChatColor.RED));
blazing ocean
robust helm
#

-y is your friend

#

or does dnf not have that?

blazing ocean
#

dunno, don't use it too much

robust helm
#

oh or yes | dnf install ...

blazing ocean
#

god i hate doing that

robust helm
#

any chance u know how to fix "Unsupported class file major version 65
"?

blazing ocean
#

huh i just noticed the memory usage on this srever is only 12 gigs for three minecraft servers, two proxies, a maven repo, three databases, four github actions runners and docker

#

what java version are you using

robust helm
#

21

blazing ocean
#

show the full exception

robust helm
chrome beacon
#

also do cache that class somewhere so you don't call getMinecraftClass every time

#

for future reference use

#

?mappings

undone axleBOT
robust helm
#

how tf do i copy gradle errors without internal lines

#
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:199)
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:287)
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
    at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.remapClass(ShadowCopyAction.groovy:339)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.remapClass(ShadowCopyAction.groovy:325)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.visitFile(ShadowCopyAction.groovy:239)
    ... 151 more

so theres this

#
org.gradle.api.GradleException: Could not add file '/home/k/Documents/IdeaProjects/TottoriUtils/build/classes/java/main/me/xkento/tottoriutils/TottoriUtils.class' to ZIP '/home/k/Documents/IdeaProjects/TottoriUtils/build/libs/TottoriUtils-1.0-all.jar'.
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
    at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.visitFile(ShadowCopyAction.groovy:243)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)

this + some yapping

chrome beacon
#

Are you using the shadow version rad sent

robust helm
#

uh no

chrome beacon
#

Do so

#

yours is probably outdated and doesn't support Java 21 then

robust helm
#

oh works :)

#

tyy

buoyant viper
#

ive used dnf all of like twice but

proud obsidian
#

Trying to set Block Display as invisible, for shulker boxes it worked, but for Block Display it doesn't
(glowing effect works, but still not invisible)

WrappedDataWatcher watcher = new WrappedDataWatcher();
//...
watcher.setObject(0, WrappedDataWatcher.Registry.get(Byte.class), (byte) (0x40 | 0x20));
//...
sullen marlin
#

Why are you using packets for this

blazing ocean
#

Player#hideEntity in shambles rn

proud obsidian
#

To spawn glowing invisible display block

#

It will highlight selected block for player

blazing ocean
#

you can do that with the api

proud obsidian
#

I know but it should be only client side and don't spawn decoration entities in world

blazing ocean
#

Entity#setVisibleByDefault + Player#showEntity

buoyant viper
#

just remember to clean them up if u dont want them lingering ig

proud obsidian
#

Okay, but can block display be invisible? Like shulker box, like falling block

smoky oak
#

... why would you want a display entity to be invisible

#

just remove and respawn it

proud obsidian
#

Hightlight only glowing borders

smoky oak
#

ah

proud obsidian
#

Glowing works but invisible doesn't by some reason

smoky oak
#

you might get away with what rad posted

summer scroll
#

does #setInvisible works?

smoky oak
#

i seem to recall some nonsense with armor stands with arms, but i dont think thats what you need here

summer scroll
#

with rad answer that still will not achieve what nosatlev wants

#

have you tried giving invisibility potion or something?

proud obsidian
#

The reason why client side is because worlds have limits of entities and entity spawn event will be cancelled

#

Maybe i should try with potions something

rough drift
#

worlds don't have entity limits for display entities lol

summer scroll
#

maybe he has his own plugin handles that

proud obsidian
#

Not vanilla one

#

Worlds controlled by plugins

rough drift
#

ah

buoyant viper
#

why not change the plugin to allow a higher limit on display entities

#

🤨

summer scroll
#

it must be a livingentity

proud obsidian
#

And what about setInvisible does it works with block display? (combined with setGlowing)

summer scroll
#

well, setInvisible is from LivingEntity

#

and BlockDisplay is not a LivingEntity

proud obsidian
#

Oh then probably I should use Falling block instead

#

Thanks

summer scroll
#

best of luck mate

smoky oak
#

can i ask for code reviews here? :v

buoyant viper
#

i think theres a dedicated thread

smoky oak
#

ah ur right

vital ridge
#

https://paste.md-5.net/imikomenab.cs
I have this code, it gets some player statistics and applies it to an item lore, the thing is I'm getting the statistics on a seperate thread since it caused too much lag (a long delay when opening a menu). But now the problem is that the function returns before the seperate thread can calculate the values, which results in all the values being 0. How could I fix this?

smoky oak
#

a scheduler called from async on sync thread will jump back onto main next tick

#

you can either give the item when that scheduler jumps onto main, or edit it

vital ridge
smoky oak
#

like, 'technical explanation' or 'gimme code'

vital ridge
#

Like technical but kinda like how should I do it

#

Ik you meant that I should runtask on main thread from the async

smoky oak
#

yep

#

minecraft does most stuff on one central thread

#

this includes world and item changes

#

so you need to re-join the main thread

vital ridge
#

Yeah but like

#

I'm returning a value

#

How should I access that returned value

#

from the async thread

smoky oak
#

you dont?

vital ridge
#

Like i'd need to set the lore's placeholders again

smoky oak
#

you have the rejoin runTask pass on the data

#

call the method to update the lore from the sync task

vital ridge
#

Aight, I'd just set the lore from the async thread then

#

It would be pointless to return it from the main thread

#

Since everything would be 0

smoky oak
#

you cant do that
async is limited in its interactions with the main thread
thats why you need to rejoin it via a sync task

desert aspen
#

when i rename an arrow, and i shoot it, the arrow entities still have the name that i renamed with?

smoky oak
#

dont think so but not 100% sure

vital ridge
# smoky oak you cant do that async is limited in its interactions with the main thread thats...
public List<String> getLore() {

        List<Object> objects = (List<Object>) MAIN.getMenusFile().getFeatureAttribute(getFeatureType(), "lore");

        if (objects == null)
            return new ArrayList<>();

        AtomicInteger coursesCompleted = new AtomicInteger();
        AtomicInteger coursesUploaded = new AtomicInteger();
        AtomicInteger coursesPlayed = new AtomicInteger();
        AtomicInteger totalPlaysOfMyCourses = new AtomicInteger();

        if (player != null) {

            PlayerStatisticsFile playerStatisticsFile = MAIN.getPlayerStatisticsFile();
            PlayersCoursesFile playersCoursesFile = MAIN.getPlayersCoursesFile();

            Bukkit.getScheduler().runTaskAsynchronously(MAIN, () -> {

                coursesCompleted.set(playerStatisticsFile.getCompletedCourses(player).size());
                coursesUploaded.set(playersCoursesFile.getPlayerUploadedCoursesAmount(player.getUniqueId()));
                coursesPlayed.set(playerStatisticsFile.getPlayedCourses(Bukkit.getOfflinePlayer(player.getUniqueId())).size());
                totalPlaysOfMyCourses.set(playerStatisticsFile.getTotalPlaysOfCourses(player.getUniqueId()));

            });

        }

        return objects.stream()
                .map(obj -> String.valueOf(obj))
                .map(str -> player != null ? str.replace("%PLAYERNAME%", player.getName()) : str)
                .map(str -> coursesCompleted.get() == -1 ? str : str.replace("%COURSESCOMPLETED%", coursesCompleted.get()+""))
                .map(str -> str.replace("%COURSESUPLOADED%", coursesUploaded.get()+""))
                .map(str -> str.replace("%COURSESPLAYED%", coursesPlayed.get()+""))
                .map(str -> str.replace("%TOTALPLAYS%", totalPlaysOfMyCourses.get()+""))
                .collect(Collectors.toList());

    }
#

So I'd need to just getScheduler().runTask() from the a sync thread, but what would be the code? like how can I pass the data to the main thread? I'd need a global variable, the current function wouldn't make sense since I could not use "return"

smoky oak
#

tasks can accept arguments

vital ridge
#

Just read about them

smoky oak
#

dunno how they interact with bukkit

#

good luck 👋

#

💨

earnest girder
#

does anyone with nms experience know if its possible to spoof an item meta update packet? specifically, updating an item's persistent data container? I need to update it without causing the item to "bob" in the player's hand while they are holding it.

slender elbow
#

you'd need to cancel the item packet altogether, or use that new fancy resource pack option thingu

#

didn't you ask this before already?

earnest girder
#

oh shit I forgot

#

thanks lol

robust helm
#

chat i need help with gradle, once again.
I need to expose the taskchain api to consumers of my Api plugin while also shading it into a fatjar.
I tried this but im still getting NoSuchMethodException


    // https://mvnrepository.com/artifact/co.aikar/taskchain-core
    implementation("co.aikar:taskchain-core:3.7.2")
    api("co.aikar:taskchain-core:3.7.2")
    // https://mvnrepository.com/artifact/co.aikar/taskchain-bukkit
    implementation("co.aikar:taskchain-bukkit:3.7.2")
    api("co.aikar:taskchain-bukkit:3.7.2")
#

also pls ping ill go to sleep now, 2 am already and got school tomorrow 🪿