#help-development

1 messages · Page 891 of 1

quiet ice
#

You can, but you should not

lost matrix
#

Just... go to releases and download this

mild cloak
#

i already downloaded

lost matrix
#

Then throw it into your project and build an artifact

mild cloak
#

but its only a library

#

Ok

quiet ice
#

ALTERNATIVELY, use spigot's libraries feature

#

Given that it is on mavenCentral, that should work if you are on an up-to-date version

mild cloak
#

I'm on version 1.20.4, how can I call the function

lost matrix
mild cloak
rare rover
#

erm, does anyone know why my compound interest ain't working correctly?

    private fun getEnchantCost(currentLevel: Int, increaseLevel: Int): Double {
        val increase: Double = enchant.getIncreaseProgression() / 100
        val initialCost: Double = enchant.getInitialCost()
        val totalLevel: Double = (currentLevel + increaseLevel).toDouble()

        return initialCost * (1 + increase).pow(totalLevel)
    }```
1 = 1.1K
5 = 1.1K
25 = 1.2K
50 = 1.4K
mild cloak
lost matrix
mild cloak
#

i make this

#

to install .jar

lost matrix
mild cloak
#

idk i see in internet

quiet ice
#

If you intend to build this plugin a year or two, I urgently recommend to not use system, it is deprecated for removal

mild cloak
#

what i use? provided?

quiet ice
#

provided and hunt down the repositories in which the dependencies are included in

mild cloak
#

you can send me a example?

quiet ice
lost matrix
mild cloak
rare rover
#

for 0.5%

quiet ice
#

EZRanksPro probably does not have a repository attached - in that case you need to use the classic mvn install:install-file [...] workaround most people here can tell you more about (I use another workaround but can't be bothered to explain that one)

rare rover
quiet ice
#

Vault is also available via maven, though only via the jitpack repo

grizzled cedar
#

Hi @eternal oxide ! I develop my plugin that changes player skins and use your code of PlayerSkins. All works perfectly on player join, but when I try to update player skin on another event it takes 30 secs to load and it loads first layer only. Can you please give me some advice what should I do next, I'll be so grateful

eternal oxide
#

First layer only means you didn;t se the correct flags.

#

Probably something up with your EntityDataPacket

lost matrix
#

Why do you think its not working?

mild cloak
rare rover
grizzled cedar
rare rover
#

1 and 5 shouldn't have the same value

rare rover
#

let me increase ig maybe

lost matrix
#

The exponential growth properly kicks in around lvl 220

rare rover
#

hmm let me increase it to like 1%

#

the problem is that the max value will be like 25K

#

should i use a different algorithm? Im calculating the enchant cost, without having to loop

#

and i came across compound interest

#

ig it would be fine since i kinda do want it kinda easy at the start then get harder the more you play

icy beacon
#

does it ever happen to anybody that your ssh connection just goes on a disconnection spree

#

like i connect, i do stuff for 20 seconds and it disconnects me

#

and that happens like 10 times

#

then it stabilizes again

#

happens at random points in time

#

i'm not too bothered by it and i'm not gonna try to fix it unless someone actually has encountered such a problem and knows what exactly why it is & a solution

quiet ice
# mild cloak i dont see any tutorial to use mvn install

Sometimes you have a certain .jar file that you need as dependency, but the author of that .jar was too lazy to properly upload it to a public repository. That’s bad, but not a problem. There are two ways to solve this, but only one proper way. The proper way: install the dependency The proper...

mild cloak
#

i already try but say .jar dont have pom.xml

#

@quiet ice

quiet ice
#

the pom is irrelevant, the maven artifact resolver still works with just the jar in place

#

(hence why this is still just categorised as an INFO)

mild cloak
#

give me the same error

#

Cannot invoke "java.io.File.mkdirs()" because the return value of "java.io.File.getParentFile()" is null

quiet ice
#

What is the full stacktrace?

#

And where exactly does this error occur?

#

Assuming this happens while executing maven's package goal - are you using IJ's built-in maven integration or are you using the system's maven installation? If latter, how did you install it - manually or via a package manager? Does the maven local repository exist under %userhome%/.m2/repository?

mild cloak
quiet ice
#

```<language>
<code>
```

But that is irrelevant for stacktraces. There generic code blocks or a plain paste suffices

grim hound
#

How can I have a plugin start with root permissions?

quiet ice
#

root permissions as in ?

hazy parrot
#

Run server with root perms

grim hound
#

root

#

system

#

perms

hazy parrot
#

Altrough there is probably no reason to do it

quiet ice
#

Why on earth would you want that

grim hound
#

I need it

hazy parrot
#

You most likely don't

grim hound
hazy parrot
#

It's aways better to give correct permissions then just toss in root

grim hound
#

what if somebody has a server on a hosting and doesn't have access to the server starting file?

quiet ice
#

Regardless, you can only start individual processes as the superuser - nothing else

hazy parrot
grim hound
#

ignorant

quiet ice
quiet ice
#

which you generally need multiple of

hazy parrot
rough ibex
#

I see absolutely 0 reason to need root permission.

quiet ice
#

Well that specific example is attempting to making use of a software vuln

grim hound
#

and I need root perms for that

#

but ofc, all of you are quick to judge

quiet ice
#

Well that is an appropriate use

grim hound
#

(or ignorant)

rough ibex
#

You should have opened with your purpose

kind hatch
#

^

grim hound
rough ibex
#

instead of just asking how to do something that is indeed, dangerous

#

inherently

grim hound
#

I was taught here to not state what I'm doing unless absolutely necessary

kind hatch
#

Well, you were taught wrong.

rough ibex
#

I feel that virtue was self-taught.

grim hound
#

so, how can I do it?

rough ibex
#

sudo

kind hatch
#

Compromising system security should always be a red flag.

rough ibex
#

sudo iptables ...

quiet ice
#

Won't work lol

grim hound
#

/\

rough ibex
#

because

quiet ice
rough ibex
#

They seem to want to ignore those

quiet ice
#

Of serious magnitude even

kind hatch
#

iptables sounds like you're trying to mess with a ban plugin of some sort, but we wouldn't know since you won't tell us what you need access to that command for.

rough ibex
#

serious XY problem here

kind hatch
#

wut?

grim hound
rough ibex
#

I did

quiet ice
#

I mean you could set the executable bit for the iptables wrapper script to allow non-root access (so something like 777, but I am not sure if that even works)

rough ibex
#

It likely wouldn't

grim hound
#

tells me I need root perms

rough ibex
#

and they are correct

grim hound
#

for any iptables interaction

kind hatch
#

I know a solution to his problem, but idk if I want to say it.

young knoll
#

Is it time for plugins with ring 0 level access

kind hatch
#

Depends on if he already has root access to begin with.

quiet ice
#

Apparently you can also modify the /etc/sudoers file to whitelist some wrapper script so it has superuser perms

grim hound
#

but lets say that yes

kind hatch
#

Depends....

grim hound
rough ibex
#

why exactly does this need to be a plugin

grim hound
#

I can always just tell the user to start this file for extra performance

quiet ice
#

If the JVM process is executed as root you can execute the iptables command with no problems

rough ibex
#

if this is like a fail2ban type thing

grim hound
#

but it would be an addon to the plugin

#

to have the firewall be extra fast

rough ibex
#

microoptimization

grim hound
#

(really necessary, like there's some great exploits)

grim hound
hazy parrot
#

Just run server as root

grim hound
#

you don't even know why I want to do it

kind hatch
#

But we do.

rough ibex
#

no, because you won't tell us

grim hound
#

if it were microoptimizations I wouldn't do it

kind hatch
#

Otherwise we can't give you a good solution.

rough ibex
#

You seem to like playing this game of "let's see how little info I can give and ask for also outrageously-dangerous solutions to these problems"

hazy parrot
grim hound
quiet ice
#

Right now https://serverfault.com/a/636449 is the best option you have.
Running the entire server as root is very dangerous.
Anything else is impossible unless you somehow find a way to run iptables without superuser perms

grim hound
rough ibex
#

Putting others down and insulting people for asking for more info or giving possible solutions is not a good idea

grim hound
rough ibex
#

You have been given the solution

#

(many)

#

and told the ramifications and side-effects

kind hatch
quiet ice
grim hound
rough ibex
#

And you got it

quiet ice
#

I guess you could change the path of the iptables installation to not be within root? But requires even more setup on the user's side of things

rough ibex
#

it interfaces with the kernel

#

modifying iptables is a privileged operation

quiet ice
#

But what about the underlying database?

rough ibex
#

that's owned by root:root

#

I'm pretty sure

quiet ice
#

Yes, but what if we were to change that? If not - well then modifying sudoers it is. It is basically a one-liner anyways in terms of effort so there is little to complain

hazy parrot
#

Aren't rules stored in ram?

kind hatch
quaint mantle
#

log(n) space complexity

kind hatch
quiet ice
#

At worst they are cached in ram

quiet ice
#

You just have to ask yourself when you are going to run the sudo

quaint mantle
quiet ice
#

that still incurs the overhead of netty

hazy parrot
quiet ice
#

Basically the idea is to move the firewall a layer down instead of keeping it on the application layer

quiet ice
rough ibex
#

also not sure what "great exploits" there are

quiet ice
#

since you can't store them in volatile RAM

grim hound
#

I'm already doing that

quiet ice
#

But I mean iptables probably loads them into volatile RAM on startup so there is little point in doing so

quaint mantle
kind hatch
quaint mantle
#

Or socket

quiet ice
#

well analysed people.

kind hatch
#

Not much we can do other than speculate without being told what the actual issue is. :p

hazy parrot
#

You are not gonna stop ddos with iptables

rough ibex
#

oh boy

#

iptables do not stop a DDOS

quiet ice
rough ibex
#

You want DDOS protection, look at cloudflare

grim hound
quaint mantle
#

Attacker have multiple ips

grim hound
quaint mantle
#

One of them can be your client

rough ibex
grim hound
#

for it to be iptables

quiet ice
#

Well the lower the firewall is the more bandwidth you have available for the upper layers

rough ibex
#

Okay well you've been given the solution to use iptables

#

What more exactly are you looking for?

quiet ice
#

They found the option out themselves

#

Now I assume they want to automate that via a plugin. Hence, running iptables from a plugin. Which requires root perms. So you need to give it root perms

grim hound
#

how can I gain access to them?

rough ibex
#

You've been told....

grim hound
rough ibex
#

I am not going to spoonfeed you

#

especially not after your hostility to help

grim hound
#

/\ bruh moment

quiet ice
grim hound
#

you were annoying

quiet ice
#

This is impossible within the constraints provided.

quaint mantle
#

Isnt it hosting's job?

quiet ice
#

Technically speaking, if you are running on a shared host it is not the responsibility of the server admin to avoid a DDoS

quaint mantle
#

Preventing ddos attacks

rough ibex
#

yes

grim hound
rotund ravine
#

Don’t host a server

#

No ddos attacks

#

Otherwise look at mitigation

wintry lynx
quaint mantle
#

I mean

rotund ravine
#

There won’t be a “fix”

quaint mantle
#

Provider

quiet ice
#

Even on hetzner's could infra you don't have access to iptables as-is afaik

shadow night
rotund ravine
#

Cloudflares “fix” is by just throwing more resources at the issue and outresource the ddos attack

grim hound
#

well yes

rough ibex
#

Kind of hard to do anything else

rotund ravine
#

True

quiet ice
#

But uh, in the case of hetzner the firewall is not built into the VPS but rather somewhere else in the datacenter

#

I expect most other big datacenters to behave similarly

#

Anyways, does anyone know any annotation built into the JRE (Java 8) that has the TYPE_USE target and is public API?

#

I'd say no - but perhaps there is some random annotation that actually fits (as said, it can be literally anything, it just needs to compile)

sage patio
#

@tender shard doing what you said, i hope it doesn't take forever again, also i created this heapdump while the server was set to 12GB ram

charred blaze
#

so i want to code a plugin that toggles seeing glowing effect on players (for the command executor). Do i need to use protocollib or something?

rough ibex
#

for all players?

charred blaze
#

no, for command executor

quiet ice
#

?jd-s

undone axleBOT
sage patio
#

its not working

#

i've a gen 3 ssd, why?

quiet ice
# sage patio i've a gen 3 ssd, why?

Nah, it's your RAM. Heapdumps are friggn massive and 8 gigs of memory is a lot less than needed unless you go with unconventional tools

Btw: You are killing your SSD right now as it is using your SSD as a replacement for the RAM.

sage patio
#

i know i'm damaging it

#

but i'm damaging my player count too with this memory leak on my survival server

#

mfnalex said 64gb swap may help you, but it doesn't

lost matrix
#

Swap is incredibly slow. You should benchmark and find the memory leak.

sage patio
#

benchmark?

lost matrix
#

*profile

sage patio
#

well i did, everything looks kinda normal except a huge PlayerMoveEvent and Location instances in memory

lost matrix
#

Spark has a pretty nice memory inspection tool
Would you mind sending what you found?

sage patio
#

sure. i'll send it in dms but before that i've to find it in activity log or creating another one

sage patio
#

takes over a decade

lost matrix
sage patio
#

aikars

lost matrix
#

1GB of Location seems like a lot

sage patio
#

you can see it in the link i sent

sage patio
rough ibex
#

woah 300mb

#

bro must be moving the whole universe

shadow night
#

The player moved and caused a reconstruction of the multiverse event

sage patio
lost matrix
sage patio
#

80 at the same time, at all? i don't know

lost matrix
#

Same time. Im trying to estimate how many move events you could expect on average each second

sage patio
#

it goes higher if you don't restart the server

#

we've a daily autorestart

slender elbow
#

would love to know what plugin is doing that xD

sage patio
#

me too

lost matrix
#

Well in that case there is a horribly coded plugin which keeps hard references to the PlayerMoveEvent

#

Transitively increasing the Location amount

lost matrix
#

22M WeakReferences are probably a result of the Locations holding references to their World as well

shadow night
#

oh gosh

sage patio
#

so the question is which fucking plugin

#

i guess i've to purchase a VDS with 256GB memory to figure out which one

sage patio
dry hazel
#

no lol?

#

visualvm or eclipse mat can do it on a 16 gig system

sage patio
rough ibex
#

that's enough then

sage patio
#

it loads the heapdump

shadow night
#

Is a heapdump just the whole ram dumped into a file?

sage patio
#

but it cannot compute the refrences or gc roots

sage patio
quaint mantle
#

Quick question cause idk a clear answer

Is naming your artifact ID supposed to be all lowercase followed by dashes?

quiet ice
dry hazel
#

spark's heapdump is hprof I think, that should work just fine in visualvm/eclipse mat

sage patio
#

well, no idea, anyone?

quaint mantle
#

Can you tell class path of 300mb event listener?

sage patio
#

well i have no idea how this visualvm and stuff work, but someone said to just calculate gc roots which it takes a decade, is there another faster way to find out?

#

lemme load the heapdump into visualvm

lost matrix
echo basalt
#

my yourkit profiler license expired like a month ago

lost matrix
#

F

sage patio
lost matrix
#

Ive seen the slimefun package which is already a gamble to put on your machine 🙂

sage patio
#

hmm

sage patio
#

what should i do exactly?

slender elbow
#

click on the lil +

echo basalt
#

AureliumSkills, Slimefun

#

fun

sage patio
shadow night
#

oh god

#

Looks simple

echo basalt
#

CraftMetaSkull is probably just slimefun having hard references to all its tile entities ok

shadow night
#

Is a hard reference one that causes memory leaks

echo basalt
#

No

tender shard
#

stupid git filter-repo --mailmap didnt change anything

upper hazel
#

how i can add prefix to nps in nms?

echo basalt
#

It's just a reference to a java object

upper hazel
#

what property i need

slender elbow
# sage patio

keep clicking lil +s until you find something interesting :^)

sage patio
lost matrix
sage patio
naive meadow
#

Hi, i am getting this error when i try to execute query on mariadb server and idk what causes this: [23:13:31 ERROR] [aauth]: java.sql.SQLException: No connection available within the specified time (option 'connectTimeout': 30,000 ms)

upper hazel
#

when i was try create nps with nms minecraft say "big nick size"

rough ibex
#

what query are you running

upper hazel
#

how i can add prefix

#

to nps

rough ibex
#

NPS?

upper hazel
#

yes

#

"fake player"

#

not like vilager

tender shard
#

NPCs you mean

upper hazel
#

?

rough ibex
#

an NPC

tender shard
#

Its called NPC. Not nps

upper hazel
#

ok

signal tree
#

Hello everyone, please help me, I can't add a placeholder with the privilege prefix "%luckperms_prefix%" to my plugin for the staff chat. Other placeholders also don't work. Help me how to add it to my plugin

quaint mantle
#

"Non Playable Character"

upper hazel
#

so how i can add prefix to NPS

#

with nms

tender shard
upper hazel
#

NMS

proud badge
#

Hi I just cloned a repository but I cant seem to find, wheres the build button gone?

quaint mantle
#

Wait till sync

naive meadow
# rough ibex what query are you running
public boolean usernameExists(String userName) {
    String sql = "SELECT COUNT(*) FROM Accounts WHERE userName = ?";
    
    try (Connection conn = getConnection();
         PreparedStatement stmt = conn.prepareStatement(sql)) {
        stmt.setString(1, userName);
        ResultSet resultSet = stmt.executeQuery();
        
        resultSet.next();
        int count = resultSet.getInt(1);
        return count > 0;
    } catch (SQLException e) {
        e.printStackTrace();
        return false;
    }
}
tender shard
proud badge
#

Idk I just cloned it like 5 seconds ago

rough ibex
#

yeah wait

tender shard
#

Make a coffee, come back in 20 minutes

proud badge
#

Ok its here yay

tender shard
#

Its probably still not done kek

proud badge
#

does anyone know if CoreProtect needs shadowJar or not?

tender shard
#

If its in their build file, its probably needed

mild cloak
#

how can i make string text chaging color like white A next blue A

quiet ice
#

ChatColor.X?

quaint mantle
#

Impossible when alr sent

proud badge
#

its in the Shadow folder

quiet ice
#

then probably necessary

rough ibex
#

does he mean like text that changes

#

or just

#

WHITE + "A" + BLUE + "A"

quiet ice
#

<red>A<blue>B<yellow>C (beware: the actual syntax is something like \u00A7<code> instead of <red>, <blue>, etc. - <code> is some character from 0 to f and a few other letters. Look it up or use the ChatColor constants which have the \u00A7 "magic" character already defined)

quaint mantle
#

&fA&bA

mild cloak
quiet ice
#

ah, in that case use adventure if using paper, or bungee's chat components if on spigot

#

Or use some more user-friendly API such as minimessage

mild cloak
#

i using spigot btw

quaint mantle
#

Shadow adventue library(Platform bukkit) and minimessage

quiet ice
#

I always use paper when doing funny things with chat, so I don't know any examples from the top of my head - sorry.

quaint mantle
#

Ye bros gonna wrap player object every time when need to send a message

tender shard
tender shard
#

fun Player.sendMessage(component: Component) …

naive meadow
kind hatch
#

What's wrong with it?

tender shard
#

Are you using Hikari? Is your mysql connection limit set too low? Shared hoster or self hosted mysql?

naive meadow
quaint mantle
#

Dont use mysql connector

#

Use jdbc class

tribal quarry
#

@sage patio eclipse memory analyzer has its own automated memory leak detection, I suggest you to use that instead of visualVM

tender shard
slender elbow
#

closing the statement closes the resultset

naive meadow
tender shard
slender elbow
#

what does that getConnection() do exactly :hmm:

naive meadow
tender shard
naive meadow
#

i am connecting with this

    private DataSource initMariaDbLDataSource() throws SQLException {
        try (MariaDbPoolDataSource dataSource = new MariaDbPoolDataSource()) {
            String url = "jdbc:mariadb://" + getAnnotatedConfig().getDbHostname() + ":" + getAnnotatedConfig().getDbPort() + "/" + getAnnotatedConfig().getDbDatabase() + "?user=" + getAnnotatedConfig().getDbUser() + "&password=" + getAnnotatedConfig().getDbPassword()+ "&maxPoolSize=8&allowPublicKeyRetrieval=true";

            dataSource.setUrl(url);
            testDataSource(dataSource);
            this.dataSource = dataSource; 
            return dataSource;
        } catch (SQLException e) {
            logger.error(e.toString());
            server.shutdown();
            throw e;
     }
    }
#

private DataSource dataSource; -> ```java
public boolean usernameExists(String userName) {
String sql = "SELECT COUNT(*) FROM Accounts WHERE username = ?";

    try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) {
        statement.setString(1, userName);
        ResultSet resultSet = statement.executeQuery();

        resultSet.next();
        int count = resultSet.getInt(1);
        return count > 0;
    } catch (SQLException exception) {
        logger.error(exception.toString());
        return false;
    }

}```
tender shard
naive meadow
tender shard
#

your datasource gets closed at the end

#

do not use try-with-resources for creating the datasource!

naive meadow
tender shard
#

I told you what the issue is. get rid of the try-w-resources

private DataSource initMariaDbDataSource() throws SQLException {
    MariaDbPoolDataSource dataSource = new MariaDbPoolDataSource();
    try {
        String url = "jdbc:mariadb://" + getAnnotatedConfig().getDbHostname() + ":"  ... ;

        dataSource.setUrl(url);
        testDataSource(dataSource); 
        this.dataSource = dataSource;
        return dataSource;
    } catch (SQLException e) {
        // ...
    }
}```
naive meadow
#

ok.

pallid oxide
naive meadow
tender shard
#

np!

tender shard
young knoll
#

Hey look it's C#

#

kek

eternal night
#

operator overwrite truely was the greatest invention known to mankind

tender shard
#

we get it, you hate kotlin and every single thing it adds

eternal night
#

I adore the delegate feature

rotund ravine
#

1,19,4 looks cursed

eternal night
#

I'd love it if java pulled that

tender shard
#

doesnt lombok have a similar thing?

slender elbow
#

lombok should introduce operator overloading

dry hazel
#

just use manifold

slender elbow
#

true ..

rotund ravine
#

Manifold dors **^

young knoll
#

I wouldn’t mind it ig

#

As long as people don’t be stupid with it

#

Player / Player

tender shard
#

does anyone know how to fix this? this has been bothering me for days (since I updated gradle to 8.6). idk why IJ doesn't understand that there's a setter

dry hazel
#

it returns T

#

so it's not really a property-like accessor

young knoll
#

Does Kotlin only recognize setters that return void?

dry hazel
#

yes

young knoll
#

Rip

tender shard
#

but why does it compile fine then?

#

it's only IJ complaining

#

when going back to gradle 8.5, it also returns T and IJ does NOT complain

rotund ravine
#

IJ

#

And gradle

#

Are not good friends

hasty prawn
#

gradle doesnt have friends

tender shard
#

I just wonder why it complains about it in gradle 8.6 but not in 8.5 when the method has not changed at all

#

and as said, it works fine, it's only IJ not understanding it 🥲

tender shard
hasty prawn
#

touche

kind hatch
#

Why does abstraction have to be so damn difficult?

rotund ravine
#

It’s not

kind hatch
#

I guess I'm just bad at it then. 😭

flint coyote
#

We've all been there. You'll grow with experience

glacial narwhal
#

?paste

undone axleBOT
glacial narwhal
tender shard
#

did you register the listener?

glacial narwhal
tender shard
#

then probably RoleUtils.getPlayerRole(deathPlayer) returns null

glacial narwhal
tender shard
#

np

#

btw if you use newer java versions, the error tells you what exactly is null

#

in java 14 and newer it looks like this

Cannot invoke "Role.getColor()" because the return value of "RoleUtils.getRole(player)" is null
glacial narwhal
#

so i don't have it

pallid oxide
#

time to upgrage:)

#

u can also do things like

if (object instanceof Player p) {
p.sendmessage()
}
instead of 
if (object instanceof Player ) {
Player p = (Player) obj
p.sendmessage()
}
#

and lots lots of cool stuff in newer versions

sand spire
#

Hey, I'm trying to make it so I can change the title of the GUI from outside, but for some reason no information can be passed into the createInventory method.
https://pastes.dev/h1VdnPGytc
Does anyone know what is blocking this information and what I can do to solve this issue?

tender shard
sand spire
slender elbow
#

an Inventory is not an InventoryView

#

an InventoryView is available to you when the player opens the inventory (or is made open via Player.openInventory)

tender shard
#

player.openInventory(yourInv) returns an InventoryView

glass flicker
# sand spire Like this? ```java InventoryView inventoryView = (InventoryView) getInventory()...

no like this public abstract class InventoryGUI implements InventoryHandler {

private final Inventory inventory;
private final Map<Integer, InventoryButton> buttonMap = new HashMap<>();

public InventoryGUI(String title) {
    this.inventory = this.createInventory(title);
}

public Inventory getInventory() {
    return this.inventory;
}

// 5 methods irrelevant to the problem

protected abstract Inventory createInventory(String title);

}

public class BuyItemGUI extends InventoryGUI {

public BuyItemGUI(String title) {
    super(title);
}

@Override
protected Inventory createInventory(String title) {
    System.out.println(title);
    return Bukkit.createInventory(null, 3 * 9, title);
}

}

when you next create an instince of buyitem gui example bud need further assistance lmk

glass flicker
sand spire
#

Thanks yall, I think this should work "player.getOpenInventory().setTitle(title);" and I will also try your solution jacob

glass flicker
#

no problems have a blast with it might need to change a lil bit but if you do shoot a question here and will pick it up if you do

wintry lynx
#

Anyone know datapack stuff?

#

If so

#

Does setting terrain adaptation in a structure to anything but 'none' just break it or am I somehow failing to spell

young knoll
#

Should work fine

#

As long as you have it set right

spare mason
#

How could I use block displays to draw a vector?

tender shard
#

A vector is just a line in 3D space

#

What do you want to do exactly

eternal night
#

every mathematician shivering

ivory sleet
#

weeeeell, it has a direction also

tender shard
#

Is line the English word for Gerade?

eternal night
#

I mean, it isn't a gerade either

tender shard
#

I thought a line has a start and end point

eternal night
#

which a vector doesn't

#

tEchNicAlly

tender shard
#

Its a line between start and end point

ivory sleet
#

well u have free and bounded vectors

#

as different mathematical object types

eternal night
#

🤓

mint nova
#

is there any event for clicking item (like not inventory but hotbar you know) i cant find

remote swallow
#

any githuh workflow nerds know how to improve speeds, mainly with like caching dependencies

tender shard
#

I assumed they meant a bukkit vector which is just 3 doubles or floats

wintry lynx
ivory sleet
tender shard
#

That already caches stuff reasonably

#

Default settings haha

remote swallow
#

well it has to download and do whatever to every single dep each time i run it instead of having a local m2 with them in or smth

tender shard
#

You can set „cache: gradle“

remote swallow
#

on setup java?

tender shard
#

On the same level where you do runs-on iirc - IJ has autocomplete for it

remote swallow
#

appears it is on setup java

tender shard
#

Oh ok might be

#

Oh yeah it should be in the „with“ part of setup java i think

#

you can also manually add directories to cache, sth like this

    - name: Cache Gradle packages
      uses: actions/cache@v3
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
        restore-keys: |
          ${{ runner.os }}-gradle-

not sure if this is correct

remote swallow
#

when testing in act it just says this

tender shard
#

hm mine says "cache saved successfully"

#

I only used this

    - name: Set up JDK 17
      uses: actions/setup-java@v4
      with:
        java-version: '17'
        distribution: 'temurin'
        cache: "gradle" # <- this

the rest is exactly like the repo I sent above

remote swallow
#

mines this

#

ill try it without m atrix

#

same thing, ig ill try it on actual github

tender shard
#

Huh where did you try it

remote swallow
#

act locally

#

seems like it caches as expected on workflows

young knoll
#

What kind of wizardry

orchid brook
#

Hi the FileConfiguration save methods remove all " " from my config.

before:

item-name: "TEST"
item-lore: "sdfgsdgf"

after

item-name: TEST
item-lore: sdfgsdgf

is there a way to prevent save methods to remove " ?

remote swallow
young knoll
#

You’d have to use a custom implementation of SnakeYaml

#

The spigot one is set to remove unnecessary quotes

rough ibex
#

I'm not sure why you want to force quotes

#

they aren't needed unlike JSON or such.

lost matrix
rough ibex
#

true

#

but for TEST and sdfgsdgf they aren't

#

and .save shouldn't be dangerously removing quotes.

lost matrix
#

yep

wintry lynx
#

So i figured it out... They just really like to hide the error in the log lol

young knoll
#

How big is this thing

#

O_O

wintry lynx
#

lol

#

Its like 80

#

so it shoukd work fine

#

I got it to work tho

wet breach
wintry lynx
rough ibex
#

woah nice

#

I'd love that in vanilla

young knoll
#

Making structure stuff is fun

#

Shame it’s not easily doable with just a plugin

next zinc
#

Is it possible currently to increase entity size and such yet (via code)?

zealous scroll
#

is there a way to allow arrows shot from a player to hit players who they can't see (are hidden using the vanish api)

young knoll
next zinc
#

damn

wintry lynx
echo basalt
#

It seems like this doesn't work

violet delta
#

what should my POM file look like for latest version spigot plugins? how do i change the default pom file, i keep having to manually change it to 1.8 from 1.7

mental moon
#

Could someone familiar with populating chest inventories help me out?
I'm intercepting a BlockPlaceEvent to populate a placed chest with an ItemStack[].
I want to use the Container.getInventory.setContents(ItemStack[]); but it's not working.
If I set up a for loop and use the Container.getInventory.setContents(int,ItemStack); it doesn't work either.
Only Container.getInventory.addItem(ItemStack) works, but then I lose the original placement of the items in the ItemStack[].

#

I have confirmed that my ItemStack[] is populated, it's just not filling the chest with the two functions I'd like to use.

#

Going to bed now, but if anyone has any advice please @ ping me
Thanks all

lost matrix
lost matrix
tender shard
#

Oh I thought it was about generated chests

#

mb

#

I only read „populate“ and „chest“

lost matrix
#

^^

lost matrix
upper hazel
topaz kestrel
#

how call a overridden method from children classes in parent class?

pallid oxide
#

u mean super.method()?

#

or u mean if u have
animal and dog which extends animal and dog overrides makesound()
and in animal u want to call that makesound of the dog?

topaz kestrel
#

but not "dog" specifically

#

it's like

tall dragon
#

that is not possible as far as i know

#

cuz how does animal know which one to use?

#

there might be 10 classed overriding it

#

i also cannot think of a use case where you would need this. maybe explain what you want to do?

topaz kestrel
#

I don't know how to explain this. can you join voice call and see my screen share?

tall dragon
#

sure

pallid oxide
#

yes u can do that

#

add me to call aswell

hazy parrot
#

How can u call child method from parent class?

#

Im not aware of it lol

sullen canyon
#

If I want to precreate config.yml I just add it to the same directory as plugin.yml and then in the onEnable method I do saveDafaultConfig()

But what if I want to have other configs premade? Is it possible? Or is it only for the config.yml? Because I do not really want to use addDefault method

hazy parrot
#

There is saveResource method inside of JavaPlugin class

#

You can use it to "extract" from resources to plugin folder

sullen canyon
#

thanks

rough drift
#

@sullen canyon you can use saveDefaultConfig();

#

calls saveResource on the config.yml

sullen canyon
#

Right?

rough drift
#

yep

#

just saying in case you only had one

pallid oxide
# hazy parrot How can u call child method from parent class?

lets say u have abstract class Animals with abstract method makeSound();
and with method
public void eat() {
makeSound();
}

And then you have
Dog extends Animal {
and implement here makeSound method
}

That will call the childs makesound in animal

pallid oxide
ivory depot
#

It is possile to get value of mined blocks from statistics in game menu? or i need to count it by BlockBreakEvent?

ivory depot
#

thx

tender shard
#

you didnt add mojang's repo

#
        <repository>
            <id>minecraft-repo</id>
            <url>https://libraries.minecraft.net/</url>
        </repository>
sleek estuary
#

Which mysql api outside of the main thread do you recommend? java

grizzled cedar
#

Guys can you help me please? Using nms for respawning player in order to update his skin, but it doesn't work properly. It takes 30 seconds to load and loads only first layer of skin. ( if I respawn self(player) manually by nether portal, it loads without any problems)

My respawnPacket code:

CommonPlayerSpawnInfo spawnInfo = new CommonPlayerSpawnInfo(
                nmsLevel.dimensionTypeId(),                                // dimensionType
                nmsLevel.dimension(),                                    // dimension
                nmsLevel.getSeed(),                                        // Seed
                serverPlayer.gameMode.getGameModeForPlayer(),            // playerGameType
                serverPlayer.gameMode.getPreviousGameModeForPlayer(),    // previousPlayerGameType
                nmsLevel.isDebug(),                                        // isDebug
                nmsLevel.isFlat(),                                        // isFlat
                serverPlayer.getLastDeathLocation(),                    // lastDeathLocation
                (byte) 1                                                // keepAllPlayerData
        );

        ClientboundRespawnPacket respawnPacket = new ClientboundRespawnPacket(spawnInfo, (byte) 0);```
hazy parrot
#

I would just wrap it in CompletableFuture if ur asking that

tender shard
#

oh nvm that only works if they're dead

grizzled cedar
#

Can I somehow update skin using packets by fake killing + respawning player or fake reconnecting?

agile edge
#

Guys, i have problem with my api.

public final class Plugin extends JavaPlugin {

    private static Plugin instance;
    private ColorfulGUI colorfulGUI;

    @Override
    public void onEnable() {
        instance = this;

        colorfulGUI = new ColorfulGUI(this);
    }

    public static Plugin getInstance() {
        return instance;
    }

    public ColorfulGUI getColorfulGUI() {
        return colorfulGUI;
    }
}
public class ColorfulGUI {

    private static JavaPlugin instance;

    public ColorfulGUI(JavaPlugin plugin) {
        instance = plugin;

        registerListeners();
    }

    private void registerListeners() {
        instance.getServer().getPluginManager().registerEvents(new GuiListener(), instance);
    }

    public StaticItemBuilder staticItem() {
        return new StaticItemBuilder();
    }

    public DynamicItemBuilder dynamicItem() {
        return new DynamicItemBuilder();
    }

    public StaticGuiBuilder gui() {
        return new StaticGuiBuilder();
    }

    public DynamicGuiBuilder paginated() {
        return new DynamicGuiBuilder();
    }

    public static JavaPlugin getInstance() {
        return instance;
    }

}
#

ColorfulGUI:14 is

    public ColorfulGUI(JavaPlugin plugin) {

Plugin:10

        colorfulGUI = new ColorfulGUI(this);
dire saffron
#

bungee Help!

Is there awau to change the /server command to something else?

Asking this because i want a custom gui to show when a user types /server or /servers

rotund ravine
#

Just register a command called serber

dire saffron
#

i have but its not over righting it

#

would editing one of these jars chnage the command?

ivory depot
#
long temp = offlinePlayer.getStatistic(Statistic.MINE_BLOCK); ```
What is the most efficient way to count all types of blocks, because this give me error about missing parameter Material. If i need to loop all blocks?
rotund ravine
#

Sure

ivory depot
#

oh, if this could lag server, when somebody have so much mined blocks?

rotund ravine
#

Probably doesn’t matter how many they mined

ivory depot
#

okay, thx

quaint mantle
#

Hey, idk if I remember it wrong but wasn't there an built in method to reload an custom yaml config? something like reloadConfig() but for custom config? I remember using something like this in older plugins of mine but now I cant find something like this.

eternal oxide
#

?configs

undone axleBOT
mental moon
# lost matrix Show how you are intercepting the event
@EventHandler
    public static void blockPlace(BlockPlaceEvent bpe){
        ItemStack itemInHand = bpe.getItemInHand();
        if (skullItemIsMobHead(itemInHand)){
            SkullBreakPlace.placeMobHeadSkull(bpe);
        }else if (CreatureEvents.chestedItemIsContainer(itemInHand)){
            CreatureEvents.chestedPlaceContainer(bpe.getPlayer(), bpe.getBlock());
        }

    }
public static void chestedPlaceContainer(Player chested, Block block){
        ItemStack containerItem = chested.getInventory().getItemInMainHand();
        if (!chestedWhitelist.contains(containerItem.getType()))return;
        if (!chestedWhitelist.contains(block.getType()))return;
        ItemMeta containerMeta = containerItem.getItemMeta();
        if (containerMeta == null)return;
        PersistentDataContainer data = containerMeta.getPersistentDataContainer();
        if (!chestedItemIsContainer(containerItem))return;
        Integer count = data.get(chestedKey, PersistentDataType.INTEGER);
        if (count == null)return;
        ItemStack[] items = new ItemStack[count];
        for (int i = 0; i < count; i++) {
            String itemString = data.get(new NamespacedKey(plugin, Key.chestedKeyString + i), PersistentDataType.STRING);
            if (itemString == null || itemString.matches("null")){
                items[i] = null;
            }else items[i] = Serializer.deserializeItemStack(itemString);
        }
        Container container = (Container) block.getState();
        Inventory inv = container.getInventory();
        for (ItemStack item:items){
            if (item == null) item = new ItemStack(Material.AIR);
            inv.addItem(item);
        }
        container.update(true);

//        containerItem.setAmount(containerItem.getAmount() - 1);
//        chested.getInventory().setItemInMainHand(containerItem);
    }

Not forcing the update doesn't work, and making a Bukkit.runnable() that delays it by a tick doesn't either.

grizzled cedar
tame wolf
grizzled cedar
tame wolf
#

An author of your code?

grizzled cedar
#

No, the part I have the problem with

eternal oxide
#

You don;t send the entity data there so of course you have a single layer skin

grizzled cedar
#

Or how can I do that

eternal oxide
#

no

#

?paste

undone axleBOT
eternal oxide
#

you need all those packets to correctly change a skin

grizzled cedar
eternal oxide
#

What exactly is taking 30 seconds?

grizzled cedar
#

Player respawn

eternal oxide
#

uh

#

You must have somethign messing with it then

#

Its just a packet

grizzled cedar
#

All other players see skin change immediately

eternal oxide
#

oh you just mean for yourself it takes 30 seconds to see the skin change?

grizzled cedar
#

yeah

#

and only one who changes skin can see only one layer

eternal oxide
#

what spigot version?

grizzled cedar
#

1.20.4

eternal oxide
#

I doubt that code even runs on 1.20

#

oh yes it will. silly me 🙂

#

I haven't tested it since 1.18

#

only that it builds and runs

#

It worked perfectly on 1.18 but since I have not looked, other than protocol changes

grizzled cedar
#

but it does work

#

it changes skin perfectly, only can't refresh it for player who changes it

#

with dimension change it refreshes and 2nd layer shows up, so it's problem with respawning

#

But I have no idea how to fix that

agile edge
#

i have another problem, my plugin building without dependencies

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

  <dependencies>
      <dependency>
          <groupId>com.destroystokyo.paper</groupId>
          <artifactId>paper-api</artifactId>
          <version>1.16.5-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>me.xflyiwnl</groupId>
          <artifactId>ColorfulGUI</artifactId>
          <version>3.0</version>
          <scope>system</scope>
          <systemPath>${project.basedir}/libs/ColorfulGUI-3.0-shaded.jar</systemPath>
      </dependency>
  </dependencies>
</project>
#

without colorfulgui

#

java.lang.NoClassDefFoundError: me/xflyiwnl/colorfulgui/ColorfulGUI

#

compiled with command

mvn clean package

mental moon
young knoll
#

Yeah

#

getInventory is the live inventory

fluid river
#

imagine ```csharp
private Dictionary<Type, List<object>> eventMatrix = new();

public void AddEventListener<T>(EventListener<T> listener) where T : AbstractEvent
{
var type = typeof(T);
if (!eventMatrix.ContainsKey(type)) eventMatrix[type] = new List<object>();
eventMatrix[type].Add(listener);
}

public void RouteEvent<T> (T eventData) where T : AbstractEvent
{
var type = eventData.GetType();
foreach (var listener in eventMatrix[type])
{
((EventListener<T>)listener).OnEvent(eventData);
}
if (eventData is ICancellable c)
{
if (c.isCancelled())
{
c.CancelAction();
return;
}
}
eventData.Action();
}```

#

and the best part

#
public void RemoveEventListener<T>(EventListener<T> listener) where T : AbstractEvent
{
    var type = typeof(T);
    if (!eventMatrix.ContainsKey(type))
    {
        Logger.GetLogger().Log("EventSystemWarning: " + (listener.GetProvider() is GameListenerProvider ? "Game" : "Mod " + listener.GetProvider().GetName()) + " tried to remove listener to non-existing event");
        return;
    }
    eventMatrix[type].Remove(listener);
}```
#

Since i don't really know how JavaPlugin.getProvidingPlugin(Class clazz) works and how to replicate it in c#, i stored provider as a field of every listener

sleek estuary
echo basalt
#

I need to rewrite mine a bit but generally just uh

#

split things up a lot

icy beacon
#

How do yall backup your vps

radiant aspen
#

greetings people

#

any advice on how to create worlds in code when your server is up

#

Got this code atm

                WorldCreator worldCreator = new WorldCreator(worldName)
                        .generator(IridiumSkyblock.getInstance().getDefaultWorldGenerator(world.getName(), null))
                        .environment(world.getEnvironment())
                        .seed(world.getSeed());

                worldCreator.createWorld();

but im wondering if this will cause lagg issues, since its creating a whole new world in a single tick

#

is there a way to create this async, or anything?

echo basalt
#

Async generation? good luck

eternal oxide
#

all world creation will cause lag. No you can;t do it async

echo basalt
#

^

eternal oxide
#

create it as teh server loads, before you need it

echo basalt
#

If you need multiple worlds you should like.. delay their generation n stuff

radiant aspen
#

Any way to spread it out over multiple ticks though?

eternal oxide
#

no

echo basalt
#

Nope

shadow night
#

why is async generation not possible

echo basalt
#

because minecraft is gimmicky

radiant aspen
#

probabbly same reason you cant set block states async

shadow night
#

asscraft

radiant aspen
#

idk mc is weird

echo basalt
#

For minigames and skyblock-like plugins I just use slimeworldmanager

#

but then again these are not public plugins

radiant aspen
#

nah

#

slime world manager sucks

quaint mantle
shadow night
#

Thread safe minecraft when

eternal oxide
#

If I need multiple worlds I create a template, then file copy and load as needed

#

as you can copy files async

shadow night
#

Kopieren of files

radiant aspen
#

basically we are trying to find a way to re-generate terrain in a minecraft world. the sollution we came up with is to create a new world with the same seed, and copy the blocks over

#

which is supper hacky, and from what I can tell will probabbly cause alot of lagg issues with creating the world

#

but idk any other methods which are less shit

eternal oxide
#

why not just load a set number of chunks over a few ticks?

radiant aspen
#

wdym?

eternal oxide
#

allow the natural world gen to create teh chunks

#

oh you want to REgenerate terrain

radiant aspen
#

yeah mb

narrow ledge
#

regenerate the terrain while using a custom generator

eternal oxide
#

in that case backup each chunk load if it's a new chunk

radiant aspen
#

its my skyblock plugin, we are looking into adding ocean world types aswell as void types

#

but then deleting/regenerating the islands is causing issues since we dont know how to regenerate the origional ocean terrain

radiant aspen
#

tbh, I guess we could just save the block states in json, serialize it to like base64 and shove that base64 in some db somewhere

narrow ledge
#

i did look into just replicating the math for that portion of the world, and it does work, but we're also using the decorate method flag thingymahbob and you cant really replicate that with just math

radiant aspen
#

well none of these are good ideas

#

its just which one is the least worst

echo basalt
#

If you are going to be storing chunk data you'd want to actually encode it in a nice way

#

not just toss it in a base64

tender shard
echo basalt
#

Remember, each chunk section has 4096 blocks

radiant aspen
#

I mean it wouldnt be exact chunks

narrow ledge
#

thats the worst part 😔

radiant aspen
#

we would probabbly just get the two corners of an island, get the materials inside each island, and just create like a list<BlockState> or some object containing Location and Material

echo basalt
#

Even then you want to compress that further

radiant aspen
#

since there shouldnt really be anything too fancy that we have to deal with specific orientation or any other data

echo basalt
#

Use some sort of pallette

valid basin
#

how to override a bungee command with spigot command? I use /hub on bungee but I'd like to use different /hub on certain spigot server. It's possible?

#

or do I need to use commandpreprocess event?

chrome beacon
#

The Bungeecord will always take priority

#

You'd have to make a Bungeecord plugin to get around that

valid basin
#

bungee will still take priority?

chrome beacon
#

yes

tardy delta
remote swallow
#

iirc its gradle 8.2.2 that has 21 support

tardy delta
#

ah right

alpine urchin
#

yea

tardy delta
#

how do i even update gradle from within intellij?

remote swallow
#

easiest way is change the url in gradle/wrapper then the properties file

violet delta
#

what should my POM file look like for latest version spigot plugins? how do i change the default pom file, i keep having to manually change it to 1.8 from 1.7

tender shard
#
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.8.1</version>
  <configuration>
    <source>17</source>
    <target>17</target>
  </configuration>
</plugin>
violet delta
tender shard
#

?paste

undone axleBOT
tender shard
#

in properties, change maven.compiler.target and maven.compiler.source to 17

tender shard
#

in your pom?

violet delta
#

im trying to change it before its generated so i dont have to manually change the pom file every time after creating new project

violet delta
#

idk how to update my mavens default pom

#

besides manually editing pom

tender shard
#

you can write your own archetype

violet delta
#

ohhhh crap

tender shard
#

it's much easier to just use IJ's new project wizard

#

just do New Project -> Maven and you can choose the JDK version

violet delta
#

your spigot archtype seems like just what i needed lol

tender shard
#

well that's for 1.15.1

#

latest is obv 1.20.4 :p

violet delta
#

gif fail

#

thanks lol

agile edge
#

can someone help me with maven shade plugin?

tender shard
#

?ask

undone axleBOT
#

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

tender shard
ivory depot
#

Is this will be working?

        int totalBlocks = 0;
        for (Statistic statistic : Statistic.values()) {
            if (statistic.getType().equals(Statistic.Type.BREAK_BLOCK)) {
                totalBlocks += Bukkit.getServer().getOfflinePlayers().stream()
                        .mapToInt(player -> player.getStatistic(statistic))
                        .sum();
            }
        }
        System.out.println("Total block count: " + totalBlocks);
    }``` I want to count all mined blocks
tender shard
#
        List<Material> blocks = Arrays.stream(Material.values())
                .filter(Material::isBlock)
                .collect(Collectors.toList());

        int allMinedBlocks = blocks.stream()
                .mapToInt(block -> player.getStatistic(Statistic.MINE_BLOCK, block))
                .sum();

sth like this should work. You wanna cache the list of blocks though. Also maybe you can also just directl use Statistic.MINE_BLOCK, i don't know

ivory depot
#

im making statistic plugin, and i dont want to count all block break events, because this is made ingame, so i want to summary all types of blocks, thank you i will check it

#

throws error: Must supply additional parameter for this statistic

tender shard
#

then you have to do it for each block specifically, as I said

ivory depot
#

okay, thanks

#
temp = offlinePlayer.getStatistic(Statistic.MINE_BLOCK, Material.COBBLESTONE);``` in this case is the same error
#

so idk what is wrong with this

tender shard
#

show the whole error message

ivory depot
tender shard
#

what's BlockCountUpdateEvent line 26?

ivory depot
remote swallow
#

looks like you need to pass a material to it

ivory depot
mental moon
#

(i was checking the wrong data sorry lmao)

teal venture
#

If I want to store an area to mark it and deny certain permissions in it temporarily is it best to use hash map? Or is there other efficient ways of doing something like this?
NEW

rotund ravine
#

What type of area?

spare crypt
#

DamageSource stuff got merged in, huh?

spare crypt
tender shard
torpid blaze
#

Hey,
does anyone know how I can create a explosion which is bigger than a tnt explosion and puts down fire, but where I can still change the block list so it only destroys certain block types in paper 1.8.8?
Vecause when using createExplosion() the EntityExplodeEvent doesn't get triggered.

rough ibex
#

Is there a reason you are using a 7+ year old version?

torpid blaze
# proud badge ?whereami

I just found out there is a BlockExplodeEvent. Before then Typing ExplodeEvent it didn't show up

green prism
#

Hello,

I'm currently working on implementing deserialization from a Bson Document to ConfigurationSerializable. The entityClass is properly configured, and when I print the map entry, it contains the same entries as those for the Card POJO. However, despite this, the #deserializeObject method still returns null.

    @Override // todo: add this in the service interface of mysql
    public ConfigurationSerializable fromDocument(Document document) {

        // Puts all the entries of the document into a new map
        Map<String, Object> map = new HashMap<>(document);
        map.remove("id"); // Remove the id from the map, otherwise, entityClass which doesn't contain id will throw an exception (?)

        for(Map.Entry<String, Object> entry : map.entrySet()) {
            System.out.println(entry.getKey() + " B: " + entry.getValue());
        }

        return ConfigurationSerialization.deserializeObject(map, this.entityClass);
    }

Printed result from the for-cycle:

test B: 6

Where the entityClass gets set


this.cardRepository.setType(Card.class); // This is from the Main class 

    @Override
    public void setType(Class<T> type) {
        this.type = type;
        this.service.setClass(type); // entityType == type
    }

Card.class POJO:

@Data
@Builder
public class Card implements ConfigurationSerializable {

    // Card type variables

    @BsonProperty("test") // Mongodb impl related
    private int test;

    @BsonCreator
    public Card(@BsonProperty("test") int test) {
        this.test = test;
    }

    @Override
    public Map<String, Object> serialize() {
        return Map.of("test", test);
    }


}


#

No worries, it's not that big 🤣

carmine mica
spare crypt
#

Last night, DamageSource stuff got merged, but there was no version bump to go with it?

carmine mica
#

The Java version the api is compiled with was bumped is what I meant. What other “breaking” change are you talking about?

remote swallow
#

rerun buildtools for the server jar + the full spigot dep if you need it or refresh maven

spare crypt
#

Ah. Yeah. The Java version bump is another aspect of that for sure. It's breaking because I have a plugin that extends EntityDamageEvent. With the new DamageSource added to the constructor, the plugin can't run on the new build until I make adjustments, but then I lose backwards compatibility for any version before this last build.

carmine mica
#

Event constructors are not API

#

So changing them isn’t considered a breaking change

#

That is made clear in the javadocs

#

Extending/Implementing API types that aren’t explicitly made for extending/implementing also isn’t considered API, so any changes regarding that isn’t “breaking” either

spare crypt
#

One could argue that if it wasn't intended to be extended, it should have been made final then. Either way, it puts an interesting kink in things

spare crypt
#

Thank you MD

sullen marlin
#

What are you calling the event for anyway, is there not an API method that does what you want?

slender elbow
spare crypt
sullen marlin
#

Maybe Damageable.damage should return a boolean

rotund ravine
spare crypt
#

That was my other thought

spare crypt
sullen marlin
#

Open a feature request, it'd be pretty easy to change the new method at least

#

?jira

undone axleBOT
torpid blaze
#

Hey,
anyone any idea, why I get false when checking for event.getInventory().getHolder() instanceof Chest in the InventoryOpenEvent and when logging the handler class, I get CraftChest, which doesn't exist?

sullen marlin
#

Check you're using the right Chest import

spare crypt
sullen marlin
#

There's several, you want the block state one

torpid blaze
sullen marlin
#

?paste

undone axleBOT
sullen marlin
#

Share code

torpid blaze
sullen marlin
#

Full file

torpid blaze
#

I already checked that it returns at this if

green prism
rotund ravine
#

Not chest and not doublechestie

torpid blaze
#

and I don't have another InventoryOpenEvent in my project

sullen marlin
#

Craft chest implements chest. make sure that's the code that's running

torpid blaze
#

it is

#

I already executed it 20 times

rotund ravine
#

Does the event get cancelled

torpid blaze
#

yes

rotund ravine
#

Then it works fine

sullen marlin
torpid blaze
#

I added sout s

torpid blaze
green prism
# sullen marlin I have no idea about bson, but if you're serialising complex types you need to r...

Well... The issue is not really about Bson:

    @Override // todo: add this in the service interface of mysql
    public ConfigurationSerializable fromDocument(Document document) {

        // Puts all the entries of the document into a new map
        Map<String, Object> map = new HashMap<>(document);
        map.remove("id"); // Remove the id from the map, otherwise, entityClass which doesn't contain id will throw an exception

        for(Map.Entry<String, Object> entry : map.entrySet()) {
            System.out.println(entry.getKey() + " B: " + entry.getValue());
        }

        return ConfigurationSerialization.deserializeObject(map, this.entityClass);
    }
remote swallow
#

not Chest implements CraftChest

green prism
#

it's just a simple map, correctly converted from Bson Document

torpid blaze
#

lost

#

sorry

late sonnet
#

pkl?

ivory sleet
#

Think they mean those programming language thingies that are specifically made for configuration

#

But like, it would be a real hassle to remove yaml all of a sudden

minor junco
ivory sleet
#

But yeah pkl is cool

minor junco
#

What might be a great idea is to use validation when loading the configuration and generating a schema off of it, kinda like Zod (typescript world)

#

If it's like really complex, maybe

#

But I don't think it's that great of an idea to give a pkl config to an end user who might not be familiar with this

inner mulch
#

Lets say I have a manager, which has a method that is supposed to add something to a list. Is it okay to also have it send a message to the player (feedback to the player) , or should i do that in the implementation (when i use the manager's method). Im asking this because Im not sure if this breaks the principle of a single responsibility?

ivory sleet
#

Usually you’ll see managers being some sort of composition of other patterns

inner mulch
#

i heard this a lot

minor junco
#

Again, I think it's the best idea for the end user and developer / zero error tolerance of a stable plugin to have a validation, ensuring constraints set on a configuration rather than defining those constraints publicly and putting them right into the configuration itself. Idk

inner mulch
#

and btw since when are message not highlighted that are responses to sent messages by the user (discord)?

ivory sleet
# inner mulch what does high or low level mean?

Its a notion we talk about, it doesn’t really exist in the language itself, but you know how like a system usually has a bunch of classes, some classes will never call other classes, some classes do specific things, other classes become generalizations, after such analysis, its almost always possible to derive some tree based structure of how classes depend on each other

#

high level abstraction usually refers to the classes on top of everything else, those that could be api to other modules/projects, and low level abstraction refers to more concrete and implementation specific classes

#

Ofc its all relative, I mean if you code a sql connection pool project, that’s gonna define one abstraction hierarchy, whereas coding an entire minecraft server will have its own abstraction hierarchy

#

but the point of this is that you to some extent are able to isolate, moduralize and define clear types of relationships between components

inner mulch
#

okay, so in terms of my manager, it basically just adding or removing stuff from a list, and those methods are mainly called in commands, therefore im not sure whether i should send user feedback in the command itselfs or just implement that into the manager's methods. But that would break the principle of a single responsibility, right?

ivory sleet
#

Single responsibility principle by definition says that a class must only be held one major reason for it to change

#

for instance, you wouldn’t wanna change the CommandParser class if you needed to migrate the database module

#

if the functionality of command parsing needs to be changed, improved or altered, then that’s the only reason you’d ideally wanna reason about in order to change CommandParser

#

This principle is vague, and there is no clear definition, but usually its good to only have one big reason why your command class should change

#

Its hard also, if you overdo it, there might be other design issues you face, such as defining one class per function, which also isn’t what you want (presumably in most cases)

inner mulch
#

okay, thank you :)

ivory sleet
#

from what I know usually people have some sort of command manager, or some class that stores all the data of all commands, then you have one class that is responsible for the querying of commands (like a command map), one class that does the parsing, one class that does the dispatching (which can be good if you want to execute a command async etc)

i just made up this on the spot, but reasoning like this can get u relatively far I reckon ^^

shadow night
#

I'm making a little whitelist plugin (just a private thing so I can customize it and stuff) and is there some way to identify who's sending a ping packet?

zenith bobcat
#

Why do most people store there Itemstacks in Base64 encoding and not directly in an File as an ByteArray has this any reson?

chrome beacon
#

People just don't know how

zenith bobcat
chrome beacon
#

Yeah

zenith bobcat
#

Then now my question is why use Base64 enconding?

ivory sleet
#

Olivo knows everything Julix ;)

chrome beacon
zenith bobcat
shadow night
zenith bobcat
#

ok i am not realy sure if you can do that but it would make sence

shadow night
#

Isn't it also as simple as new String(byte[])

quaint mantle
zenith bobcat
chrome beacon
#

You can but again many people don't know that

quaint mantle
#

nvm i put it on github

chrome beacon
#

They just copy paste the first thing they find online

quaint mantle
#


    public void saveInventory(Player p) throws IOException {
        File f = new File(plugin.getDataFolder().getAbsolutePath(), p.getName() + ".yml");
        if (!f.exists() && !f.createNewFile()) {
            throw new IOException("Failed to create inventory file for player: " + p.getName());
        }
        FileConfiguration c = YamlConfiguration.loadConfiguration(f);
        c.set("inventory.armor", p.getInventory().getArmorContents());
        c.set("inventory.content", p.getInventory().getContents());
        c.save(f);
    }

    @SuppressWarnings("unchecked")
    public void restoreInventory(Player p) throws IOException {
        File f = new File(plugin.getDataFolder().getAbsolutePath(), p.getName() + ".yml");
        if (!f.exists()) {
            throw new IOException("Inventory file not found for player: " + p.getName());
        }
        FileConfiguration c = YamlConfiguration.loadConfiguration(f);
        ItemStack[] content = ((List<ItemStack>) c.get("inventory.armor")).toArray(new ItemStack[0]);
        p.getInventory().setArmorContents(content);
        content = ((List<ItemStack>) c.get("inventory.content")).toArray(new ItemStack[0]);
        p.getInventory().setContents(content);
    }

#

dk if thats of any help

#

but thats the way i did it

#

and it works perfectly

shadow night
quaint mantle
#

i dont. chatgpt questions most of my code though :)

ivory sleet
zenith bobcat
quaint mantle
shadow night
#

No idea

shadow night
quaint mantle
#

omg i did

shadow night
quaint mantle
#

uhm i stopped paying for it because i ran out of money lol

shadow night
#

Lol

#

Well, time passes too fast

quaint mantle
#

yehp

#

especially when you play minecraft all day everyday, definitly doesn't help

shadow night
#

we a bit off topic now aren't we lol

quaint mantle
#

well technically we are on the topic of your profile picture, we had this discussion last time aswell.

shadow night
#

Well, this is help-dev

quaint mantle
#

but yes, in regards to the channels purpose, it could be coonsidered off topic

#

anyways. i need help coding a super advanced AI model and help puting it in to minecraft. any suggestions

tall dragon
#

ask chatgpt 😂

sage patio
proud badge
#

Which one is faster?

eternal oxide
#

should be the same a single op

ivory sleet
#

yea it should be negligible, the difference, if any

tardy delta
#

look at the jit compilation of if_icmpgt and if_icmpgte in the jvm if it interests you 😂

kindred sentinel
#

How to get the country of the player's ip?

tardy delta
#

you use an api for that

kindred sentinel
#

hm, do you know any api which could be useful for this?

tardy delta
kindred sentinel
#

ty

sudden raft
#

🤓

tardy delta
#

mye could be, i always take the wrong comparison in asm

#

you would think the compiler would do a gt or gte to then avoid a jump but no

kindred sentinel
#

Wanted to add unirest-java dependency, but got this error, do you know what could make this?

tardy delta
#

thats a vulnerability warning

#

update it if theres a newer version or ignore it

kindred sentinel
#

ok

violet delta
#

?paste

undone axleBOT
kindred sentinel
#

Is there any way to disconnect player while he joining the server?

#

Or only player.kickPlayer?

violet delta
#

"Unsupported API version 1.20.4"

remote swallow
#

use 1.20 as api version

young knoll
kindred sentinel
#

in LoginEvent

young knoll
#

Probably

#

Just later and not async

kindred sentinel
#

I used it cause I wanna get the player's ip first

young knoll
#

That’s available in the async one

kindred sentinel
#

oh, ok then I'll use the async one

#

thanks

frail sluice
#

How can I detach a villager from its bed and workstation?
Also, is it possible to give certain villagers a different texture (using a resource pack, of course)

violet delta
remote swallow
#

change it in plugin.yml

frail sluice
#

setProfession doesn't free the bed and workstation from my testing

#

Alright thanks

undone axleBOT
frail sluice
#

That's NMS right?

eternal oxide
#

no

#

Its Bukkit implementation

tender shard
#

has anyone ever seen such a tiny /give command?

frail sluice
rotund ravine
tender shard
frail sluice
#

@eternal oxide is it possible to access net.minecraft.world.entity.npc.EntityVillager

echo basalt
#

meanwhile I found a flaw with advancedslimepaper today