#help-development

1 messages · Page 2230 of 1

strange patrol
#

same error

#

the /public/ one should have the latest versions as well though

#

dumb gradle just doesn't grab them

quaint mantle
#

try reimporting? you can look, it's there

ivory sleet
#

yes

#

if you use lambda meta factory

#

you ll get the speed of invoke dynamic

strange patrol
#

Yep all new ones are there, just 20220615 isn't, and gradle is looking for that for some reason. What do you mean with reimporting, how to do that?

ivory sleet
#

as opposed to invoke virtual

#

or iirc invoke interface

#

altho invoke static might still be faster, but you dont gain any abstraction

#

so not really a good comparison

quaint mantle
#

this button in intelliJ, if you open the gradle menu on the side

tardy delta
#

smh have to present a website

river oracle
quaint mantle
#

you should remove the old repo too if you still have it there

tardy delta
#

looks ugly af

#

i made it lol

strange patrol
river oracle
# tardy delta looks ugly af

your website is the exact reason I'm not a web developer my websites would look 3000x worse than that on a good day

tardy delta
#

we just got a book html and css and they told us to learn it :/

river oracle
#

you poor soul

tardy delta
#

im not a web developer im a pprogrammer lol

#

yesj

river oracle
#

is that why your working in C sharp

tardy delta
#

nah but its for the same project

river oracle
#

gross

#

C# and HTML+CSS

tardy delta
#

i have to talk about the code implementation

#

i mean wtf

river oracle
#

of HTML and CSS?

#

thats not even code

tardy delta
#

c#

#

and database stuff

river oracle
#

oh

#

how do you hook that into a website

tardy delta
#

its not hooked smh

#

i will hook you

river oracle
#

😉 alright

tardy delta
#

have fun

#

i tried to do a class diagram in paint.net but that program hates me lol

mortal hare
tardy delta
#

hmm

#

how do i start that shit

mortal hare
#

i did something like this

#

in like 10 mins

#

first draw the shape

#

then use the connect button

#

to connect shapes

#

on your right there will the be the properties

#

in what style do you want to your shapes to appear

tardy delta
#

wheres the text thing

mortal hare
mortal hare
#

then double click

tardy delta
#

oh i see

mortal hare
#

and it will act as a text box

#

I love libre office suite

#

its underappreciated

winged birch
#

does anyone know where did setCustomNameVisible go in 1.19?

mortal hare
#

i finally did it! I made a working container in trading

river oracle
mortal hare
#

which is fully synced

#

and acts like virtual chest

winged birch
#

NMS

river oracle
#

oh no clue just look around the same classes

#

for similar implementation

tardy delta
#

doesnt look like a big achievement lol

mortal hare
#

you need to make your own NMS class

tardy delta
#

pain

river oracle
#

you do?

mortal hare
#

since Bukkit API doesnt allow you to open merchant inventories

#

and if it does

twilit roost
#

@mortal hare heeyy agaain .. 😄
This throws me this when leaving chunks or placing blocks in it :

mortal hare
#

all the items which were previously put in

#

will go back to your inventory

#

in this case it does not

tardy delta
#

im wondering why bukkit has a conversation api

mortal hare
#

I asked the same couple months ago

mortal hare
twilit roost
#

damn
theres litterally nothing on BiomeSpecialEffects out there

mortal hare
#

new BiomeSpecialEffects.builder() allows you to construct BiomeSpecialEffects

#

it does everything

#

that's color related

tardy delta
#

ok im loosing my last braincells

twilit roost
#

yeee but on implementing it into game
aka applying

mortal hare
#

yea its just an a.k.a record class

#

which holds data

#

you can apply it to the biome by constructing new biome via new Biome.builder()

#

but how to apply the biome to specified region im really not sure

twilit roost
#

btw where did you got that photos?
u send them very very earlier , they contained custom leafes color,water color

mortal hare
#

or you can use reflections to modify existing biome

#

to replace the colors of existing biomes

#

that seems hacky

#

but it would work

twilit roost
#

ye thats what I want to do
but im scared of reflections

mortal hare
#

there's nothing scary there

#

you just ask for a field

#

in runtime from JVM

#

instead of asking it on compile time (well you ask it on runtime, since its interpreted but still)

mortal hare
#

here's the plugin

#

which does exactly this

#

but its premium resource

#

iirc

#

that's where I got the photos from

twilit roost
#

frick its premium
I would have "borrowed" some code out of it

mortal hare
#

it seems it uses protocollib

#

so we can make presumptions that it uses packet technique

#

which I mentioned previously

#

but its hacky

#

and needs to be managed

#

everytime player enters chunks

#

basically the same thing what the NMS does

twilit roost
#

oh noo
is there some other way for custom fog?

mortal hare
#

custom fog and sky color should be easier to do

#

i think

#

but im sorry cant help

twilit roost
twilit roost
winged birch
#

can you mess up your IDE method suggestions if you decompile source code?

here npc should have the method setCustomNameVisible, but it isn't there https://i.imgur.com/YA802j3.png

        var npc = new EntityPlayer(server, world, profile);
sterile token
#

Hi i need some recomendations for my block protection plugin. Im trying to add multi protection per user support. And im a bit messed trying to do that. At the momment i have this structure.

  1. The claim manager (holds every claim from the db and used for caching)

  2. The protection manager (holds every protection from the yaml file and caching them)

  3. The claim object (holds each region data, the claim uuid, owner uuid, claim type, protection block location, home location, flags list and members uuid list)

  4. The protection object (holds each protection data, for example the name, item, displayname, lore and radius)

So im stucked thinking how to to implement the multi claim part. I really apreciate help. THanks

winged birch
hushed spindle
#

im trying to get nms to work on my server but im getting a NoSuchMethodError every time, implying the specialsource maven plugin didnt work entirely well, am i missing something? do i have to build my project a specific way?

grim oak
hushed spindle
#

yeah i thought that was what the plugin was supposed to do

tardy delta
river oracle
#

maven should create ~3 jars depending on your setup

hushed spindle
#

uh where do i check that real quick

#

i admittedly dont care too much for maven

river oracle
#

do you use gradle?

hushed spindle
#

no

river oracle
#

your jars should be in your target directory

hushed spindle
#

there seems to be not much of note in my target directory aside from the my own project file structure

river oracle
#

you do have the md5 maven plugin correct?

sterile token
river oracle
#

because your probably putting the wrong jar in your server

#

oddly enough for me it was my shaded jar and not the remapped jar

tardy delta
sterile token
#

Oh

#

More than i expected

#

I will try to figure myself

#

I just having logic troubles

hushed spindle
#

the specialsource md5 plugin right?

#

its in my pom xml yes

tardy delta
#

just put it on github and maybe i got some time tmrw

#

i dont get anywhere with random code

sterile token
#

Allr

river oracle
#

its a build plugin

sterile token
#

Cant you help me now?

hushed spindle
#

do i need to do it a specific way because ive just been using build artifacts the whole time

brave sparrow
sterile token
mortal hare
#

did you guys know that you can make villagers leashed

tardy delta
#

with code maybe

mortal hare
#

you can modify the canBeLeashed() method inside abstractvillager

#

and in villagers can be leashed with lead by default

quasi patrol
#

Yall know how to send a message to discord in a bot after a spigot event is ran without having to start a new session every time the event is ran cuz ofc it kinda delays the event.

hushed spindle
#

i would probably just cancel an interact event towards villagers if a leash is held and leash them

mortal hare
#

yea but that requires handling leashing by yourself

#

server already does this

tardy delta
#

oh

mortal hare
#

why bother 😄

#

i mean

mortal hare
#

in order to not use NMS

#

i would handle by myself

quasi patrol
tardy delta
#

just send a message to the desired channel thro the jda

hushed spindle
tardy delta
#

dunno what session but normally your bot connects when your plugins starts

left swift
#

can entity metadata packet be sent before the spawn entity packet?

tardy delta
#

and stays alive

quasi patrol
tardy delta
#

oh discord4j not even jda

#

just get the server and the textchannel and send a message

quasi patrol
# tardy delta just get the server and the textchannel and send a message
                .builder(plugin.getConfig().getString("BotToken"))
                .build()
                .login()
                .block();
        gatewayDiscordClient.getChannelById(Snowflake.of(987876078624325682L))
                .ofType(MessageChannel.class)
                .flatMap(channel -> channel.createMessage("``" + event.getPlayer().getName() + "``: " + event.getMessage()).withAllowedMentions(AllowedMentions.suppressAll()))
                .subscribe();``` it works, but it creates a new connection each time and so it kinda delays the message and the actual action in game.
tardy delta
#

lol store the client you silly

quasi patrol
#

My brain just went brr.

#

Thinking of a possible solution.

sterile token
hushed spindle
#

i think i found it already, i just did ctrl shift a, entered maven, and i could find the menu that way

#

there maven package was one of the "goals" i could create

sterile token
#

yeah

#

Maven package will generate the jar

hushed spindle
#

and i gotta use that as plugin to actually put on the server?

#

right then

sterile token
#

Yeah, you can also use the maven shade plugin

hushed spindle
#

taking a bit longer to compile but its to be expected

quasi patrol
sterile token
tardy delta
#

?di

undone axleBOT
hushed spindle
#

thanks for helping out btw and being patient

#

ive been developing plugins with just spigot for too long so nms takes some getting used to

twilit roost
#

does anyone know how to make custom fog?

tardy delta
#

burn weed plants

sterile token
#

Lmao what a shity

#

I supouse something like that was comming soon

#

😡

tardy delta
#

never used that

hushed spindle
#

yeah im confused, i used the plugin but im still getting nosuchmethoderrors

#

specifically on CraftPlayer#getHandle()

sterile token
#

Maybe because the class you are importing doesnt contain that method

#

check if you have the correct import

hushed spindle
#

i mean just org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer right

next stratus
#

man, intellij truly is shit as of lately for me lol

grim oak
#

I have this error when trying executing the following line of code InputStream in = getClassLoader().getResourceAsStream("dbsetup.sql")
java.lang.IllegalAccessError: class me.vaindev.simprewards.Database (in unnamed module @0x4df62f75) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x4df62f75Anyone have any suggestions on what it could be

#

Im trying to use a db with my plugin

quasi patrol
tender shard
#

there is a reason why it has "internal" in the package name

grim oak
#

in that line im not accessing internal right?

tender shard
#

in what line? i didnt see any code you sent

grim oak
#

its saying the error is caused by the following line: InputStream in = getClassLoader().getResourceAsStream("dbsetup.sql")

tardy delta
#

i mean there is a plugin.getResource method

tender shard
#

send the full stacktrace

#

?paste

undone axleBOT
grim oak
#

^

tender shard
#

are you trying to get "dbsetup.sql" from your jar file?

grim oak
#

yeah

tender shard
#

just do getResource("dbsetup.sql")

grim oak
#

ty

smoky oak
#

if i have two zombie textures for head and body each can i say 'this zombie has head a and body b' or do i need to save all possible permutations along the lines of 'a_a.png, a_b.png, b_a.png, b_b.png'?

tardy delta
#

what kind of server? mysql?

#

i guess the database either doesnt exist or the credentials are wrong

#

for me a h2 database is the eaasiest option as its just a local file and it doesnt require login credentials

#

could you show code

#

?paste

undone axleBOT
tardy delta
#

is it connecting?

#

errors?

#

or did you forget to create the db with the mysql workbench

#

lets try to execute a query like SELECT 3 and check the return value

#

well thro code i mean

humble tulip
#
public enum ArrowType {
    
    FISH(){
        ItemStack itemStack = new ItemStack(Material.ARROW);
        {
            ItemMeta meta = itemStack.getItemMeta();
            meta.setDisplayName("Fish Arrow");
            itemStack.setItemMeta(meta);
        }
        @Override
        public ItemStack getItemStack() {
            return itemStack;
        }
    };

    ArrowType() {}
    
    public abstract ItemStack getItemStack();
}
#

better way to do this?

mortal hare
tardy delta
#

enums dont like static fields but they accept static methods :/

#
try (Connection conn = getConn(); PreparedStatement ps =
conn.prepareStatement("SELCT 3;")) {
  ResultSet rs = ps.executeQuery();
  System.out.println(rs.next());
} catch (SQLException e) {
  e.printStackTrace();
}```
@quaint mantle
#

execute that somewhere

tardy delta
#

My pc screen got black lol

#

Stupid school pc

#

ok back lol

humble tulip
#

Let me see getConn

tardy delta
#

lets just get a connection which is opened

#

whats on line 44

humble tulip
#

Let's see getConn

tardy delta
#

conn is null then

kind hatch
#

Isn’t that invalid SQL? Or does it just grab the first three from the first table in use?

humble tulip
#

It just returns 3

tardy delta
#

it return 3

humble tulip
#

The number 3

kind hatch
#

Oh. I did not know that.

tardy delta
#

3 | 3 |

humble tulip
#

What is in ur getConn method?

tardy delta
#

i guess you didnt call connect()

humble tulip
#

Did it say databse connecter or not connecter or anything likr that?

#

Print the stacktrace

tardy delta
#

well theres a null value someone add some sysouts to see what is null

humble tulip
#

When u cath the sql exception print it

tall dragon
#

why does none use intellij's debugger

#

its so nice

kind hatch
#

Oh is this MySQL and not SQLite?

humble tulip
#

Put e.printStackTrqce when u catch all exceptions

#

It's gives useful onfo

tardy delta
#

enable your database

kind hatch
#

You sometimes need to call the MySQL class directly before it can load. I forget the proper syntax, but it’s smth like Class.forName(“org.java.mysql.MySqlDriver”)

tardy delta
#

is it on localhost?

#

"it should be" doesnt say anything, what did you do to enable it?

#

in my opinion mysql workbench is just the easiest way

#

uhh

kind hatch
#

No systemctl?

#

I thought it was sudo systemctl mysql start

tardy delta
#

havent tried mysql on linux myself

tall dragon
#

imagine not using windows and just using xampp 😄

humble tulip
#

Try connecting to it on ur windows pc

#

With heidisql or something

kind hatch
#

Well it’s just a daemon so it should be started and stopped with systemctl

smoky oak
#

im on windows and i do use xampp

tardy delta
#

i always use embedded databases

kind hatch
#

Guess I need to brush up on the syntax for that command.

#

Maybe it’s systemctl start mysql

chrome beacon
#

^

river oracle
#

idk try it

humble tulip
#

Can u connect to it from another device?

kind hatch
tardy delta
#

i think you want to check if the name equals what you are looking for, not just starts with it

#

actually since when Stream#toList a thing?

humble tulip
#

Are u testing the plugin on the same device that hosts the db?

ocean lion
#

?paste

undone axleBOT
ocean lion
#

what is this? how do I prevent it

tardy delta
#

sounds like tabcompleting the player names

humble tulip
#

Do u have a username as password set in tje cinfig+

#

Config*

#

3306 is the defult

#

Think u can do lsof - i:3306

#

To see if it's mysql

tardy delta
#

if you're using it for tabcompletion, just let TabCompletor#onTabComplete return null and it will automatically do the player names stuff

#

also thats just default impl

winged birch
#

how can you know the equivalent of a packet if you're using mojang mappings? i.e. what would be the equivalent of PacketPlayOutNamedEntitySpawn?

tardy delta
#

i was doing my tabcomplete light this

winged birch
#

is there a list somewhere?

smoky oak
#

does -> do the same as parenthesis in java?

ocean lion
#

Hello friends can someone tell me why this is happening?

kind hatch
smoky oak
#

wait

#

double colons

tardy delta
ocean lion
#

Yes but its not tho.. or maybe ive done something wrong

kind hatch
#

I believe that there is a method that can do that. Bukkit#getPlayerExact() and Bukkit#getPlayer()

#

No a single player

smoky oak
#

eh im asking cuz my switch looks more like 'case 1 : ... break;' so i assume the lambda works like a normal switch just with break included?

tardy delta
#

you never told us what you were trying to do

tardy delta
kind hatch
ocean lion
humble tulip
#

Player with that exact name else a player who's name starts with the string

tardy delta
#

as ye that -> is the same as { something(); break; }

ocean lion
#

that is the error line

tardy delta
ocean lion
#

It is

humble tulip
#

Are you sure it's not global-prefix

kind hatch
#

Are you sure?

ocean lion
#

global_prefix: '&7&l[&b&lHub&7&l] '

humble tulip
#

I make that mistake alot

ocean lion
#

right here

humble tulip
#

Can we see your code

kind hatch
#

Check your config in your ide and then check what the config on your test server says.

tardy delta
#

is it set in the actual file and not in the file within the resources folder?

kind hatch
#

They may not be the same

ocean lion
#

Right now it doesnt give me any config folder since the error

kind hatch
#

Do you ever call #saveDefaultConfig()?

ocean lion
#

i have

#

getConfig().options().copyDefaults(true);

#

saveConfig();

tardy delta
#

also you should replace & but use ChatColor.translateAlternateColors('&', text)

kind hatch
#

That’s why

#

Use #saveDefaultConfig()

ocean lion
#

Okay so remove both and use saveDefaultConfig()

kind hatch
#

Remove getconfig.options…

humble tulip
#

Heidisql

kind hatch
humble tulip
#

To view a db

#

Or to host

#

?

#

Oh to create

#

Well @tall dragon said xampp

kind hatch
ocean lion
#

at same line

#

even when changed to saveDefaultConfig();

kind hatch
#

Show updated code.

ocean lion
#
    public void loadConfig() {
        saveDefaultConfig();
    }
kind hatch
#

Where do you call loadConfig()?

humble tulip
#

If u wanna save config from the jar file do saveResource("config.yml", true)
Then do reload Config

ocean lion
#

onEnable

kind hatch
#

And how often?

humble tulip
#

Shadowmaster

#

I think ur wrong

kind hatch
humble tulip
kind hatch
#

True

#

Forgot about that

ocean lion
#

Ok but

humble tulip
#

@ocean lion let's the the config in ur plugins folder

#

Not in your ide

ocean lion
#

I changed to saveResource

#

still same error

kind hatch
#

Share your code

#

?paste

undone axleBOT
tardy delta
#

just use saveDefaultConfig in onEnable

humble tulip
#

Let me see the config in ur plugins folder

#

That'll be the most useful in helping u rn

ocean lion
#

that is not the config in my plugins folder tho

humble tulip
ocean lion
#

since the folder wont load

#

since the plugin dont load

humble tulip
#

Ohhh

#

LOL

kind hatch
#

You are calling #getConfig() in a global context.

mortal hare
#

can you set merchant recipe to slot 0

kind hatch
#

Which won’t work.

humble tulip
#

Don't get the config values outside onEnable

mortal hare
#

and then to index 3

#

can you skip merchant recipe indexes

ocean lion
#

ok so where to put it then

mortal hare
#

can you do something like this

#

instead of this

kind hatch
#

Declare your classes and variables in a global context. Initialize them in a method. Or declare and initialize all inside one method.

mortal hare
humble tulip
#

public String PREFIX;

then in onEnable after saveDefualtConfig PREFIX=getConfig().getString("global_prefix").replaceAll("&", "§");

sterile token
#

Im looking into a plugin api, but im wondering to know how the heck it works, because all the methods throw exception. Looks weird

eternal night
#

some class extends that

#

and overrides the methods

sterile token
#

OHh ok

mortal hare
sterile token
#

Thank because i was looking and i was like shit how does that work

mortal hare
#

but im not sure about eclipse

sterile token
#

Eclipe sucks

lost matrix
humble tulip
#

It's also possible that they do that to hide the internals of their plugin

#

And the actual plugin has methods that work

mortal hare
sterile token
#

Also the plugin itself its obfuscated only their api its not obfuscated*

#

Im not trying to steal nothing just trying to find a good example of external api for a design

mortal hare
#

that's not really good example

sterile token
#

Allright, a good example would be with an api with interfaces right?

#

and the core, having the api integrations right?

mortal hare
#

you should have an interface which should be implemented

#

by your code

#

which gets provided either by static getter

sterile token
#

Allright really thanks

mortal hare
#

or by bukkit api providing api

#

i forgot its name

#

vault uses it

sterile token
#

And how do i protect people using my methods from the main class?

#

Like, i just want them to access to api getter

#

Nothing else

mortal hare
#

just return an interface

humble tulip
mortal hare
#

instead of class

mortal hare
mortal hare
sterile token
#

Even using private methods, i go another class that uses DI ith main class and do: plugin.getBla() and appear everything

#

Instead of just public methods

ocean lion
humble tulip
#

You need to update them when u reload config

kind hatch
ocean lion
#

wtf

#

the prefix is not like in the config

#

it says

#

Hub v1.0 in white

#

Nvm

mortal hare
#

how many trade offers can villager hold?

#

exactly how many can it fit inside its gui

tender shard
#

the GUI is scrollable

sterile token
#

so any example about an api?

mortal hare
sterile token
mortal hare
#

why map?

tardy delta
#

same thing as an arraylist lol

sterile token
mortal hare
#

with arraylist you can do the same

#

its called indexes

sterile token
#

oh lol

#

i never used

tender shard
#

you have never used a list?

sterile token
#

list yes

#

But not indexes

mortal hare
#

you're saying you never done this list.get(i)?

lost matrix
#

There is only a single use for array lists... access by indicies

smoky oak
echo basalt
#

if the key is an incremental integer, then just use a list

smoky oak
#

ur thniking about c++ arrays

echo basalt
#

if it's a task id or something, use a map

sterile token
#

In messed up

echo basalt
#

There are multiple types of maps in java

#

Or dictionaries as programming teachers call them

#

In java, the most common variant is HashMap

sterile token
#

lol really?

smoky oak
#

yup

sterile token
#

I use Map<> bla = new HashMap<>()

echo basalt
#

Yeah

sterile token
echo basalt
#

you're defining it as a hashmap

sterile token
#

I really aprreciate

humble tulip
#

I use a Map<Integer, Inventory> im my plugin

#

Sue me

mortal hare
#

i wonder why #Inventory.all(#ItemStack) returns Map<Integer, ItemStack> instead of List<Map.Entry<Integer, ItemStack>>. Wouldnt a LinkedList better suite for this job?

sterile token
smoky oak
echo basalt
#

probably due to the hashing

mortal hare
#

maybe because of O(1) .get()

smoky oak
#

only inventory i ever saved was extra ender chests tho

mortal hare
echo basalt
#

what the fuck

lost matrix
humble tulip
#

Pages but not all exist at once

echo basalt
#

Honestly the list would mostly be empty or null

echo basalt
#

to preserve indexes

#

Map.Entry belongs to map anyway

tardy delta
mortal hare
echo basalt
#

also it's bukkit so

#

¯_(ツ)_/¯

#

don't have high expectations

mortal hare
smoky oak
#

not really. I recommend looking up PDC - i stored it in pdc then loaded it into a <uuid, inventory> map while the player was online

tender shard
mortal hare
#

hash load factor matters

smoky oak
#

initializes two hundred and point seven five

#

once a map reaches seventy five percent capacity

hybrid spoke
#

if you wanna be that petty just use arrays for everything

smoky oak
#

it increases in capacity

#

which eats up some millis

echo basalt
#

those extra 20 clock cycles are really gonna hurt us

sterile token
sterile token
#

dovidas*

smoky oak
#

😛

mortal hare
#

Hashmaps use loading coefficient to determine array size, and im pretty sure its memory footprint would be bigger

#

but i bet its because the .get() is O(1)

#

and linked list is O(n)

tender shard
#

yes, that's soooo important when using inventories which can never be bigger than 54 anyway

echo basalt
#

pretty sure iteration speeds are still the same as it ends up getting converted to an entryset

lost matrix
smoky oak
#

yea but that three bytes more space eaten by a hash map in this day and age really isnt important

mortal hare
echo basalt
tender shard
#

yeah 7smile7, CHILL! DONT SHOUT AT HIM

lost matrix
mortal hare
#

Im not complaining i was just thinking

echo basalt
#

we're talking about linkedlists not arraylists

#

class overhead and calling getters might end up slightly slower at an assembly level

#

run JMH and test

lost matrix
#

Linkedlists are really bad. If you would use a list for this, then it would be an arraylist.

mortal hare
#

I started to regret that I asked this. I was just curious, that's all.

smoky oak
#

its the two way pointer thing isnt it

echo basalt
#

you aren't the only one spending hours doing meaningless optimization

hybrid spoke
mortal hare
#

this is getting into StackOverflow vibe

smoky oak
#

no

#

nobody is throwing insults yet

tender shard
#

people who worry about whether a List<Entry<Integer,ItemStack>> is "better" because it uses 62 bytes less then a HashMap should also put all their code into one class, and call their methods "a", "b" etc. Because proper class names will take up sooooo many bytes too

echo basalt
#

I've rewritten Math.abs to not use any if statements and just return the value with the flag bit set to 0

#

¯_(ツ)_/¯

#

something the jvm probably does by itself

smoky oak
#

oh right i remember something like that

#

if you can replace an if with math

#

its almost always faster

echo basalt
mortal hare
echo basalt
echo basalt
tender shard
smoky oak
#

the three element spaghetti code i write cant be optimized further

echo basalt
#

idc I'm the only person that's ever gonna use it

tender shard
echo basalt
#

if it's above 100kb I double the rate lol

tender shard
#

yeah totally fair

smoky oak
#

two times zero is still zero

echo basalt
#

then I decompile that shit and they shaded commonlangs3 or something

hybrid spoke
#

but 0² is 1

mortal hare
#

:DDdd

sterile token
#

Hey, so is there any api good example or not??

tender shard
smoky oak
#

he said double not square

mortal hare
smoky oak
#

important difference

tender shard
lost matrix
echo basalt
#

those 17MB plugins that have 53kb of actual content

echo basalt
#

compiled on that pentium 1 just to be sure

hybrid spoke
tender shard
sterile token
echo basalt
#

classic

mortal hare
smoky oak
#

bleugh

tender shard
smoky oak
#

you guys managed to make me think of four dimensional numbers now

echo basalt
#

I've downloaded more spigot jars bundled in plugins than actual spigot jars

smoky oak
#

you can download spigot?

sterile token
smoky oak
#

i thought you have to build it

tender shard
#

that's wrong

sterile token
#

Okay that why

#

😂

tender shard
#

you use filters and/or the scope to tell it what to shade

lost matrix
#

I once uploaded a plugin on an alt that only removed join messages. It was 1.7mb because it contained a txt of the bible and some cat images.
Bstats showed a bit over 100 concurrent installations before it got shut down.

echo basalt
#

lol

hybrid spoke
echo basalt
#

I once made a website for my work

smoky oak
#

stay back satan

tender shard
#

I once went to the supermarket and bought butter

echo basalt
#

took a month before someone sent the history of fishing wikipedia page translated to chinese

lost matrix
tall dragon
crisp steeple
#

is there any library someones made to get the end result of an inventory event? right now the only real ways of doing it is with bukkitrunnables, which can cause a lot of issues and bugs, or manually doing checking the data of the event and and doing things yourself, which can get very long and tedious

smoky oak
#

cant you just chain all inventory events into the same class

#

java is the language with too many method parameters anyways

echo basalt
#

with some fancy if statements

crisp steeple
#

getting what the items in an inventory after a click event takes place

crisp steeple
echo basalt
#

if it's a shiftleft, oppositeInventory.firstEmpty

smoky oak
#

why not just vomit out the inventory on click event

#

just dont edit the event

tender shard
lost matrix
smoky oak
#

looks like normal gui code

#

you havent seen java yet unless you saw someone overload the same method twelve times

echo basalt
#

:)

#

or my shitty minigame code

#

that's true java

#

just pulling numbers out of my ass and doing bitshifts

lost matrix
mortal hare
#

do it in C form

smoky oak
#

idk

#

was some german data analysis company

#

dont ask me how i got that code

lost matrix
tender shard
#

wrong quote

#

why do I always quote the wrong people

#

I know why

smoky oak
#

wait so

tender shard
#

because people write a new message at the same time when I click on reply

#

and then it moves up

echo basalt
#

idiots made that with copilot most likely

smoky oak
#

map of has a limit of sixteen?

tender shard
echo basalt
#

I know but still

smoky oak
#

*ten

tender shard
#

java.util.Map#of

echo basalt
#

those early copilot builds that would just make a christmas tree

sterile token
smoky oak
#

iseven copilot is an abonimation too

humble tulip
#

I got kicked out of copilot

echo basalt
#

suggesting stuff like

numberOne
numberTwo
numberOneOne
numberOneTwo
numberTwoOne
numberTwoTwo
numberOneOneOne

...

sterile token
tender shard
smoky oak
#

hello darkness my old friend

humble tulip
#

Why?

quaint mantle
humble tulip
#

It helped me so much tho

sterile token
echo basalt
#

copilot gave me an extension until august yeah

#

it's only 10$/mo

#

so I'm signing up

humble tulip
#

Wtf so i teach it how to work then they make money off me

sterile token
#

Its a lot if you dont work it

sterile token
#

It really shity

#

😂

tall dragon
#

im not sure how i feel of github making money from the work of other devs bassically

#

since it learns from github

mortal hare
echo basalt
#

I achieve part-time hours with copilot

#

it's more of a therapy type thing

#

avoids mental breakdowns

smoky oak
#

one thing that almost made me stop coding was understanding delta time

wild reef
#

Hey guys quick question.
So I want to do the following:

  • when a player dies, I want his body to fall down (like the sleep animation)

  • I would do this with nms right?

  • Basically making an npc with the same skin and name and putting him to bed somehow?

compact haven
#

that nonsense is a result of not using kotlin

echo basalt
#

packe

#

nms is fun

wild reef
#

alright, thanks guys

tender shard
#

yeah this calls for DHL or UPS

mortal hare
#

np

tender shard
#

or FedEx

lost matrix
mortal hare
#

MyEx

smoky oak
#

its fun until you realize it breaks even on minor version updates

sterile token
#

wait someone send a link for doing that

smoky oak
#

then you realize that using remapped is a very good idea

compact haven
#

could be rewritten as fun mapOf(vararg Pair<K, V> values): Map<K, V> and mapOf("test" to 23, "hello" to 54, "no weay man" to 12);

#

😏

echo basalt
#

thing is

#

after 16 entries

#

it goes vararg

sterile token
# wild reef Hey guys quick question. So I want to do the following: - when a player dies, I ...

In this episode of the Spigot MC Plugin series, I start a new plugin called Bodied. This plugin makes it so when a player dies, an NPC is spawned using NMS and is made to lay down and have no nametag. In the next parts of this plugin's development, I will show you how to put items in the body once the player dies, and if no one claims it after a...

▶ Play video
#

There you have sir, have a lovely day

wild reef
echo basalt
#

prettys ure

sterile token
#

Your welcome

humble tulip
compact haven
#

I know Java has vararg xd

lost matrix
mortal hare
#

no more static blocks for me i guess

sterile token
#

why do they use:

List<CustomObj> getCustomObjs() {
    return new ArrayList<>(this.objects);
}```
lost matrix
sterile token
#

Is there a reason?

tardy delta
#

to not exposing access to the internal list?

smoky oak
#

how the hell do you have methods with an unknown number of arguments???

sterile token
#

allr

sterile token
#

i didnt know

mortal hare
#

varargs

#

... operator

tender shard
#

varargs is basically just an implicit array creation

compact haven
#

well in truth varargs is just an array

smoky oak
#

ah ok

tardy delta
compact haven
#

just in the language, it's unknown the number

mortal hare
#

varargs in Java are ok

sterile token
#

dovidas so do you have a good eample for an api or not? you never anwered me tho :/

mortal hare
#

wait till you see C varlists

tender shard
sterile token
mortal hare
#

those dont even have implicit type

#

or size

#

you need to specify the type and the size

#

of var list

compact haven
mortal hare
#

by yourself
in C

compact haven
#

what attribute is that in? the field map table?

tender shard
#

oh wait of course I know what the varargs flag is for

#

it's there so you can pass as many parameters as you want lol instead of having to create an array yourself lmao

#

so yeah the flag is there to make it work lmao

tardy delta
#

yes lol

compact haven
#

nah that doesn't make sense

smoky oak
#

so a third weird flag urgh... ? and T was confusing enough lol

compact haven
#

Java compiles varargs to creating an array, the bytecode is dealing with arrays directly, no?

#

I don't think that the JVM implements varargs, that's a bit silly

tender shard
compact haven
#

javac can know, because that's part of the Java language

#

the JVM bytecode spec is abstracted from Java

tender shard
#

it couldnt know it without the flag

compact haven
#

the hell are you talking about

tender shard
#

if you have a dependency that declares a varargs method and the bytecode only sees the array, then how would javac supposed to know that it's avarargs method

#

maybe I'm explaining it badly

compact haven
#

I had thought about that as well but I thought you meant javac with just one source, because then it wouldn't need a flag as it already knows that it is varargs

#

nah I get you now, just needed you to specify for dependencies

#

well I guess even with one source it wouldn't know

#

as the class is turned into bytecode first and then actual Java sourcecode is completely ignored kekw

tender shard
#

imagine you have two methods

public void stuff(String... args);
public void stuff2(String[]args);

both have String[] as parameter in their signature. If stuff wouldnt have the varargs flag, then javac wouldn't let you use this

stuff("asd","asd2");

because there is obviously no method called stuff(String,String)

And that's why the varargs flag is needed. That's what I wanted to say

compact haven
#

nope I get you alex

#

yep okay

#

you're right

#

it's considered an access flag by the JVM

tender shard
#

oh yeah I tried to find that link but somehow I was too stupid to google it properly lmao

compact haven
#

lol, I just went through the document directly

#

I had gone through this document a few times because I was trying to write a custom JVM language

#

it's true that it's not very well SEO'd

tender shard
#

It also looks like the site was made in the early 90‘s 😄

compact haven
#

😏 that's because it was

tender shard
#

Yeah lol

quasi patrol
#

Are online players included in Bukkit.getOfflinePlayers();?

dire marsh
#

it's every player that has ever joined

quasi patrol
#

Dang. I would have expected it to just be people who have joined the server before but aren't on.

ivory sleet
#

if a player is online then it will be an instance of Player

dire marsh
#

you can use isOnline

quasi patrol
#

Ik.

sterile token
#

In conclusion, apis are a set of interfaces and abstract methods right? And the core contains the impl of that api right?

short gulch
#

Hello
I need to check if a player is in the air or on a block.
Player#isOnGround is deprecated, and is based off the on-ground flag set by the player.
Is there a way to get the height of a block type without creating a manual mapping? (Since not all blocks are a full block tall)
If anyone has any ideas, feel free to ping me. Thanks!

waxen plinth
#

Block#getBoundingBox

last swift
#

Hello! I am quite stumped as I'm trying to set the block data given a string. I store an entire map in a text file with the block's state as a string (via block.getData().toString()), but now I'm trying to set that data. An example of the text data is this:

{ x: -3.0, y: -3.0, z: -3.0, type: STAINED_CLAY, world: Urban, state: STAINED_CLAY(9) }
{ x: -3.0, y: 1.0, z: -1.0, type: BRICK_STAIRS, world: Urban, state: BRICK_STAIRS(5) facing EAST inverted }

However, the function for setting the data of the block is deprecated and doesn't set the data properly (ex. clay isn't set to the correct color, stairs aren't updated properly, etc.). Is there a better way to do this?

Location newLoc = blockLoc.add(loc);
world.getBlockAt(newLoc).setType(block.getType());
MaterialData data = new MaterialData(block.getType());
for (byte byt : block.getBlockDataAsString().getBytes()) {
  data.setData(byt);
}
world.getBlockAt(newLoc).getState().setData(data);
waxen plinth
#

I have a library that does that

#

It also compresses the data

#

Would you like to use it?

last swift
#

Sure. I'm using 1.8 however which is why this sort of problem is a bit more difficult since I think 1.13+ is better for this sort of thing

waxen plinth
#

1.13 is better

#

But my library still works on 1.8

#

It just loses the ability to rotate block data

last swift
#

Oh awesome. Yea that's fine

waxen plinth
last swift
#

Thank you! i'll try it out

waxen plinth
#

Feel free to DM or @ me if you need help

last swift
#

👍

waxen plinth
#

Installation instructions are in the readme

minor otter
#

is it possible for me to make a block have a blockphysics event fire

waxen plinth
#

elaborate?

last swift
#

The library uses structures though. Is it possible to just utilize the block data part? I only want to load block data that I store initially. Removing a lot of the code for creating/saving maps would be annoying haha

minor otter
#

I made a block array and want all the blocks in the array to run blockphysics event

waxen plinth
waxen plinth
minor otter
waxen plinth
#

I guess you might be able to with block.getState().update(true, true);

#

Not sure though

minor otter
#

I did that and it didnt look like it worked

last swift
waxen plinth
#

If you can already save the cube of blocks then what's the problem?

last swift
waxen plinth
#

oh

#

yeah my library does that

last swift
#

sorry im pretty terrible at explaining things but hopefully that makes sense

waxen plinth
#

you can convert it to a string and back

ocean lion
#

Any idea why this isnt working? They have values in config, no error in console but does not do anyhting

last swift
ocean lion
#

have registered the event too

waxen plinth
#

MultiBlockStructure.stringify

#

MultiBlockStructure.create

#

Those are the methods to convert to a string and load from a string respectively

last swift
#

okay. tysm for the help

waxen plinth
#

Some debug output

#

To ensure that your event handler is actually being run

ocean lion
#

but the title still wont work

waxen plinth
#

Print out each individual value

#

The values loaded from config

#

Make sure they are what you think they are

tall dragon
#

btw @waxen plinth wanted to thank u for making Crunch

#

that shit is so nice

waxen plinth
#

👌

ocean lion
#

it does print every value as I've put it

waxen plinth
#

What do you use it for?

waxen plinth
last swift
waxen plinth
#

Hold onto that return value

short gulch
#

I am aware of this, and for my application that would not work. I ended up using Block#getBoundingBox as suggested by Redempt. Thank you though.

ocean lion
waxen plinth
#

And you can call .build on it

tall dragon
waxen plinth
#

Not seconds

#

That's gonna fade in for 1/20th of a second

#

Stay for 1/10th of a second

#

And fade out for 1/20th of a second

tall dragon
#

yea its also really awesome i can define my own funtions

#

i love that

#

and the speed ofc

ocean lion
#

...

waxen plinth
#

What about the strings

ocean lion
#

both Title and subtitle is being printed

#

no errors in console

last swift
waxen plinth
last swift
waxen plinth
#

You can save the string returned by that

#

Load it later, create the structure from it, and build it somewhere

last swift
#

oh okay. i think i understand now. ty

waxen plinth
#

what was it?

ocean lion
#

the world uses some time to load on my pc, so I had to increase the values to ensure that I was there in time to get the actual message

tall dragon
#

;D

last swift
waxen plinth
#

Like I said

#

You just pass in the string

#

It returns a MultiBlockStructure object

#

You hold onto that return value

#

And then you can call build on it to build the structure at a given location

last swift
#

MultiBlockStructure#create takes two string parameters though. Would it just be 1x1x1 and STAINED_CLAY:9?

waxen plinth
#

no

#

one is a name

#

it can be literally anything

#

it's only there to make comparison easier

#

you can even set it null if you want

last swift
#

ah ic

#

mb i shouldve known abt that. tysm it worked haha

lost matrix
#

Prevent the PlayerInteractEvent all together when they leftclick blocks

#

Hm might not work like that

humble tulip
#

If the block isn't breakable maybe that can work?

#

As in marked unbreakable

undone axleBOT
humble tulip
#

Send bqck the stacktraces

kind hatch
#

This has been a long standing issue with servers. I doubt there is an easy way to fix it since it depends on the game tick.

#

The simplest solution is to prevent them from breaking blocks, but I can understand how that wouldn't be a perfect solution.

humble tulip
#

Print the url before u connect

#

I wanna see what it looks like

kind hatch
#

Yes

humble tulip
#

What

#

LOL

#

U updated in ide but not plugins folder

#

Happens

#

Print everything when ur confused

#

That's what i do

#

Pretty much solves everything

waxen plinth
#

yes

#

it is not particularly simple

humble tulip
#

Should

#

Send me error

#

Read first line

lost matrix
#

Are you using an old jdbc driver?

kind hatch
lost matrix
#

*Or wall glitching

kind hatch
#

Well I haven't had a need to check for that yet. Could you give some more details?

#

I'm assuming Player#isOnGround() isn't enough?

humble tulip
#

Google that error

#

Should be easy to find a fix

ocean lion
#

I have a /relore command which takes the item in players hand and relores it! However it is only one long line.. how would I do /relore 1 <lore>

tall dragon
lost matrix
lost matrix
#

You will have to at some point.

lost matrix
tall dragon
#

ah i thought it did

#

must be mistaken

humble tulip
#

Cuz it's much better than conventional artifact building

lost matrix
#

Because if you want to use other dependencies then maven will save you huge amount of time and headaches.

tall dragon
#

unless ur name is 2hex aperantly PES_Angel

humble tulip
#

Don't think he sorted that as yet

#

I'd have already reintalled intellij

tall dragon
#

rumor goes his resources still dont get included

tall dragon
crisp steeple
#

So I'm in a situation where I need to remove final on a field, however, for some reason java 17, the "Field" class seems to have 0 fields, which includes the one that needs to be changed to remove final. On java 8 however, all the fields are still there. Tested this on a brand new project and got this as well:

quaint mantle
#

getDeclaredFields

crisp steeple
#

using that

quaint mantle
#

show code

crisp steeple
quaint mantle
#

done

crisp steeple
quaint mantle
#

show

#

Full

#

code

#

bro

crisp steeple
#

i cant right now since its someone else working with me and they went afk a few minutes ago lol

quaint mantle
#

literally

#
field.setAccesible(true);
field.set(instance, value);
crisp steeple
#

tried that already

#

get the error i sent above

quaint mantle
#

thats the solution

#

no

#

what you sent above

#

says you're tying to assign "java.lang.Reflect" to that field

#

so one of your variables are mixed up or you're passing the wrong one

crisp steeple
#

ok lmao i think they might have just used the wrong parameter

#

ill check once theyre back

#

still confused as to why the field class doesnt have any fields on it at runtime but doesnt really matter

quaint mantle
#

probably

#

java weird

humble tulip
#

no ur weird

modest garnet
#

is there a way to get the entity that hit a entity, but didnt use there fist

#

as EntityDamageByEntityEvent i can use getDamager but that only does fist

humble tulip
#

so what else will they use?

pastel juniper
#

How can I change item durability, I don't want to add more than the max, I want to set it to 50% and 100%???

humble tulip
#

can someone convert that lambda to a java 7 level

#

i dont understand what's going on there

worldly ingot
#
return new Consumer<>() {
    @Override
    public void accept(T value) {
        this.accept(value);
        after.accept(value);
    }
};```
#

Basically returns a new Consumer that calls this consumer and the consumer that was passed as an argument

humble tulip
#

that's what i thought but this refers to the scope ourside of the consume that is being returned?

worldly ingot
#

Yes

#

So I guess technically my example wouldn't necessarily work lol

quaint mantle
worldly ingot
#

I mean I guess so lol

#

That's very likely what it compiles down to

raw sky
#
        PlayerConfig.getPlayerFileConfiguration(player).set("Deaths", PlayerConfig.getPlayerFileConfiguration(player).getInt("Deaths") + 1);
        PlayerConfig.savePlayerDataFile(player);

``` Anyone know why player deaths wont increase?
dusk flicker
#

holy static abuse

raw sky
#

:( dont talk about it

dusk flicker
#

oh I am talking about it

#

holy shit

raw sky
#

no please

#

just let me be static PLEASE

dusk flicker
#

god no

raw sky
#

I am going to fix all the code up after it works

dusk flicker
#

you dont even have public or private or any other modifier on your global VARIABLES

raw sky
#

OK

#

THATS NOT

#

IMPORTANT

dusk flicker
#

YES IT IS

raw sky
#

oh my god wait

#

that is bad

dusk flicker
#

okay it really wont change anything but like