#development

1 messages · Page 2 of 1

worn jasper
#

wut

broken elbow
#

the problem is that paper users are not dumb. we need the spigot users because they're the dumb people that pay for our trash plugins /s

lyric gyro
#

feather uses server internals from Spigot, can you send your build.gradle?

worn jasper
lyric gyro
#

uh to start with, this is not gonna work

sourceCompatibility = '1.17'
targetCompatibility = '1.17'
#

thanks discord

dense drift
#

yes, use 1.19 wtf kek

icy shadow
#

rofl

dense drift
#

waiting for em to send the actual answer xD

lyric gyro
#

try changing this

compileOnly 'ca.tweetzy:feather:3.1.0'

to

compileOnly('ca.tweetzy:feather:3.1.0') {
  exclude('org.spigotmc')
}
worn jasper
#

oh wait yes

#

don't

#

uhm

#

answer that

lyric gyro
#

RIP

worn jasper
#

ye

dense drift
sterile hinge
twilit delta
#

What event is called when Water and Lava come together to make obsidian/cobblestone?
1.8.9

odd prawn
twilit delta
#

Does that work on 1.8.8? I heard that the BlockFormEvent is broken on 1.8.8

proud pebble
#

¯_(ツ)_/¯

#

i dont develope for 1.8.8 so no idea

twilit delta
#

🤔

dense drift
#

d;1.8.8 BlockFromToEvennt

uneven lanternBOT
#
public class BlockFromToEvent
extends BlockEvent
implements Cancellable```
BlockFromToEvent has 1 extensions, 1 implementations, 1 all implementations, 7 methods, and  3 fields.
Description:

Represents events with a source block and a destination block, currently only applies to liquid (lava and water) and teleporting dragon eggs.

If a Block From To event is cancelled, the block will not move (the liquid will not flow).

proud pebble
#

try it and see

orchid wyvern
#

Making a plugin with kotlin and using kotlin reflect for something. The correct versions of kotlin and kotlin reflect are given in the libraries section of plugin.yml. Getting this error when my plugin tries to use kotlin reflect

org.bukkit.plugin.InvalidPluginException: java.lang.LinkageError: loader constraint violation: when resolving method 'java.util.Collection kotlin.reflect.full.KClasses.getDeclaredMemberProperties(kotlin.reflect.KClass)' the class loader 'cordify-1.0.jar' @9ea769b of the current class, com/jackchapman/cordify/utils/Messages, and the class loader java.net.URLClassLoader @4e38616a for the method's defining class, kotlin/reflect/full/KClasses, have different Class objects for the type kotlin/reflect/KClass used in the signature (com.jackchapman.cordify.utils.Messages is in unnamed module of loader 'cordify-1.0.jar' @9ea769b, parent loader java.net.URLClassLoader @5ba3f27a; kotlin.reflect.full.KClasses is in unnamed module of loader java.net.URLClassLoader @4e38616a, parent loader java.net.URLClassLoader @5ba3f27a)
orchid wyvern
#

The server logs show the correct version of kotlin and kotlin-reflect are being downloaded by spigot

#
libraries:
  - org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}
  - org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}```
dense drift
#

Why do you use jdk8 with jdk16 or whatever

orchid wyvern
#

No other kotlin stdlib afaik

#

I haven't checked in a while, maybe I'm wrong

#

I think also using kotlin-stdlib might be okay, but I don't think that is the issue here

sterile hinge
#

are you additionally shading something?

orchid wyvern
#

I didn't think you need to if you used the libraries attribute in the plugin.yml

merry knoll
orchid wyvern
#

Yeah, I just never liked shading kotlin because it makes the JARs huge even for small plugins

#

I guess if that's the only option then that's what I'll have to go with

#

This approach has worked in the past with kotlin-reflect though, so not sure what's changed

#

Oh wow, restarting the server and it seems to work fine

#

That's odd?

#

That probably should have been one of the first things I tried. I don't like that fact that I know it's a possibility though

wet dragon
#

yo anyone devs looking to make a server to co own i have a few custom gamemode ideas and wanna make a server but i need a dev to make it

wet dragon
proud pebble
#

tho developing for a server usually includes getting paid real money, co owning a server isnt really payment or really that valuable

wet dragon
proud pebble
wet dragon
#

gotcha

merry knoll
#

game modes etc will usually cost 100+ $ usually

proud pebble
#

tho ive never done that so im not entirely sure.

merry knoll
#

medium size stuff is around 50 - 100 range

wet dragon
wet dragon
merry knoll
#

i personally would not take a request like that

wet dragon
#

how come?

merry knoll
#

you need to provide exactly what you want

#

otherwise it drags on

wet dragon
#

oh no i mean like

#

say i want a prision server

#

i wanna buy a server setup from them

merry knoll
#

all custom coded plugins?

wet dragon
#

but the plugins custom most of them like the prision core

#

most not all

merry knoll
#

around 1k probably

#

prison has a lot of stuff in it that needs to be done

#

but if you are fine with using external stuff when available

#

cost should drop a lot

wet dragon
#

alright cause u usally want a fewq custom fetures

merry knoll
#

if i were you, i would set up the server as much as you can

#

then buy the features one by one

#

rather than pay someone to do all

wet dragon
#

hmm

merry knoll
#

like, if you need a mining plugin

#

just buy that specifically

wet dragon
#

smarth alright

#

do u know what jailbreakmc is

merry knoll
wet dragon
#

yea but its not like op prision

#

its like

merry knoll
wet dragon
#

more simple

merry knoll
#

since its quite common to get the "hey can you add this too" as a major feature

wet dragon
#

do you know anythin g abt dev

merry knoll
#

about developing?

#

yes

wet dragon
#

yea

#

ok i have a qustion

#

is it possible to do a plugin for prision where its like ur own cell like an island for skyblock but its a prision sell and u can upgrade the size and stuff and all the blocks will change

#

for like an upgrade

merry knoll
#

yeah quite possible

broken elbow
#

it definitely is possible

wet dragon
#

hmm alright

#

thank you

#

one more qustion

merry knoll
#

if you want it properly done with instancing though, you would need an experienced dev

wet dragon
#

alright

merry knoll
#

otherwise player count scaling is a gonna be an issue over 100+ people

broken elbow
#

if done very badly it might take less than 100 players :)))

wet dragon
#

do you think a good game mode would be kinda like prision but the mines are like a sand and insted of a pick axe its a shovel that you upgrade

merry knoll
#

anything can be a game mode

#

but you need to think about it way more than just

#

"yeah you just want a cell with sand in it"

wet dragon
#

oh no i have

#

thats just a small explination

merry knoll
#

its basically skyblock

#

with that

wet dragon
#

where is the best place to find devs

#

like good ones

merry knoll
#

here is okay

#

ask for their portfolio

wet dragon
#

ok what do i look for

merry knoll
#

big projects

#

skyblock etc type plugins

wet dragon
#

what about like a free lancer?

merry knoll
#

i would go with someone familiar with mc landscape personally

wet dragon
#

hmmm alright

#

thank you

dusky harness
#

Fiverr 💀

wet dragon
#

ewww

#

i dont like fiverr

merry knoll
#

post a request here and get quotas from developers

wet dragon
#

its too easy to get scammed

orchid wyvern
#

definitely a lot easier to get scammed over discord than fiverr so be careful

wet dragon
#

wow really

broken elbow
#

that's why you usually want to ask for portofolio and maybe even look them up and see maybe reviews, or posts about them

wet dragon
#

ohh good ida

#

wow yall are alot of help

merry knoll
#

and do a percentage up front

#

and total once its finished

#

and they show it working

wet dragon
#

how should i pay them like half first then half after?

#

or all after the work is done

merry knoll
#

depends on size of project usually

#

i always take some upfront personally

wet dragon
#

what abt like a 100$- 200$ game mode

merry knoll
#

unless its a small one

broken elbow
#

you can decide with them this, but you don't want to give full pay at the start, and NEVER use F&F (family and friends) payment methods. Even if other methods take a cut, at least you have a way to get your money back if they scam you

wet dragon
#

ohh

#

alright\

merry knoll
#

yes, business payment is king

wet dragon
#

should i alway use paypal

broken elbow
#

not necesarely

#

I personaly use Stripe

merry knoll
#

doesnt matter much as long as payment method is credible

#

just dont use crypto

broken elbow
wet dragon
#

why not crypto

broken elbow
#

bcz you can't get it back

merry knoll
#

no way to charge back

broken elbow
#

when its gone, its gone forever

merry knoll
#

or do anything

wet dragon
#

ohhh

#

gotcha

merry knoll
#

also make sure to discuss source code etc

#

as in if you will receive full source code once done and if the plugin is exclusive to you

wet dragon
#

oh yea shouldthey give me the sorcecode too?

merry knoll
#

yes normally

#

but i have seen people get scammed with that in the past

#

where their plugin gets released to public after

#

or gets sold to others

orchid wyvern
wet dragon
#

so just go to a very trusted dev

merry knoll
#

a basic script can do wonders

wet dragon
#

have yall heard condor services?

merry knoll
wet dragon
#

they do free lancing to make servers

#

they have worked with servers like vipermc

merry knoll
#

big service groups are hit and miss

#

some are great some are just meh at best

#

worst case you get scammed

wet dragon
#

yea

merry knoll
#

i think for you, i would go with a singular dev and maybe someone to configure your stuff

wintry grove
#

if you are willing to go that way I would recommend senior studios

merry knoll
#

then you can comission the same dev again in the future as well

wintry grove
#

havent commissioned them yet but from what I have seen they are good

wet dragon
wintry grove
#

but also yeah

#

If you want to make a small server or so a single dev should be enough

#

just make sure its one you can trust

wet dragon
#

not like a dev team one person can do it prolly?

merry knoll
#

the advantage is usually

#

is that if you commission the same guy

wintry grove
wet dragon
#

so i should hire someone to dev and to config u say?

merry knoll
#

you can probably hire them in the future

#

if your server grows

wet dragon
#

i mean like hire them for the project

wintry grove
#

the problem is that you have to manage them and make sure they do the work

#

you can also hire a team of devs

merry knoll
#

yes ^

wintry grove
#

one by one

wet dragon
#

ok

wintry grove
#

but again the same problem

#

but bigger

merry knoll
#

what we do currently is to hire people per mode

#

and they maintain the gamemode as needed

#

add features / bugfixes etc

#

but for your case where you want to make a prison server of sorts

#

a dev and one guy to configure the rest

#

is enough i feel like

#

if you can configure plugins yourself

#

even better

wet dragon
#

i config all my servers but im too lacy and out of ideas

#

tbh

wintry grove
#

I'd rather spend the time configuring it myself

wet dragon
#

ok

#

ill do that

wintry grove
#

so that you can know how does it work

wet dragon
#

one thin g that annoys me is crates

merry knoll
#

if you want a honest opinion

wintry grove
#

and how it is configured

wet dragon
#

i never know what to put in crates

merry knoll
#

i would make the server to the best of my ability

#

then hire a dev to fill the gaps as you need it

wintry grove
#

why even do crates

merry knoll
#

crates are great for income

wet dragon
#

well im working on a skyblock server rn

merry knoll
#

gotta get the gambling addiction going

wet dragon
#

^^^^^

#

what are sum fetures yall would like to see in a prision server or skyblock that isnt already a thing or else something changed

merry knoll
wet dragon
#

alright

merry knoll
#

this channel usually has programming questions

wet dragon
#

alright thanks everyone

bitter basin
#

whats the best way to take a player number input, sign or chat

lyric gyro
#

Get them to build a 7-segment display with redstone lamps and light up the number

#

Conversation API exists too

#

It's conversation between plugin and player.... I don't know why it's named "conversation" lol

icy shadow
#

to this day ive never actually seen anything use the conversation api

lyric gyro
#

Me neither

#

It's like java.util.Scanner, never seen anyone actually use it, but it's full of neat methods

brittle thunder
#

CoC

#

CodeChef

#

😩

pure crater
#

I love CoC

pulsar ferry
lyric gyro
#

Big black coke

high edge
#

I'm sure you do

edgy lintel
#

what the fockacola

warm steppe
#

Is it possible to store objects on item using PersistentDataContainer?

lyric gyro
rancid bronze
#

Any help as to this weird issue im getting?

I give a player full colored leather armor and its fine
they die and then I set it again to that color, its fine for 0.1 seconds but then it changes to red/dark blue for some reason

#

i tried clearing their armor as well and then setting it but it doesnt fix it

#


    public void setArmor(Player p) {
        p.getInventory().setHelmet(dyeArmor(new ItemStack(Material.LEATHER_HELMET), playerTeam.get(p.getUniqueId()).getColor()));
        p.getInventory().setChestplate(dyeArmor(new ItemStack(Material.LEATHER_CHESTPLATE), playerTeam.get(p.getUniqueId()).getColor()));
        p.getInventory().setLeggings(dyeArmor(new ItemStack(Material.LEATHER_LEGGINGS), playerTeam.get(p.getUniqueId()).getColor()));
        p.getInventory().setBoots(dyeArmor(new ItemStack(Material.LEATHER_BOOTS), playerTeam.get(p.getUniqueId()).getColor()));
    }

    public void clearArmor(Player p) {
        p.getInventory().setHelmet(new ItemStack(Material.AIR));
        p.getInventory().setChestplate(new ItemStack(Material.AIR));
        p.getInventory().setLeggings(new ItemStack(Material.AIR));
        p.getInventory().setBoots(new ItemStack(Material.AIR));
    }```
#

the methods im using

#

i also tried clearing the armor and then running a delayed task to set the new armor

#

still doesnt work

#

I printed out the getColor and its correct every time btw

wheat carbon
#

I use scanner too!

#

for console commands

edgy lintel
#

i use scanner for a scanner

pure crater
#

I like my BufferedReaders

edgy lintel
#

BufferedReaders my bae

lyric gyro
#

Readers

urban temple
#



    @Override
    public void onEnable() {
        // Plugin startup logic
        getServer().getPluginManager().registerEvents(this, this);
        getServer().getPluginManager().registerEvents(new JoinLeaveMessages(), this);
        getServer().getPluginManager().registerEvents(new WelcomeMessage(), this);
    }```
'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(net.d1axowy.drainstealcore.Misc.WelcomeMessage, net.d1axowy.drainstealcore.DrainStealCore)'
why?
icy shadow
#

do your listener classes implement Listener?

urban temple
#

Ohh yea right I forgot 'bout that one, thanks!

urban temple
#

error/exception in console: https://pastebin.com/TsA5Ss8p

code:

public class WelcomeMessage implements Listener {

    @EventHandler
    public void welcomeMessage(PlayerLoginEvent e){
        Player p = e.getPlayer();

        String wm = "&e&lWelcome %luckperms_prefix% %player_name% &e&lto &b&lDRAIN&f&lPVP &8&l- &e&lA great &b&lLifeSteal&f&lSMP &e&lserver";

        wm = PlaceholderAPI.setPlaceholders(p, wm);

        p.sendMessage(Utils.color(wm));
    }
}
    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>placeholderapi</id>
            <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.19-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>me.clip</groupId>
            <artifactId>placeholderapi</artifactId>
            <version>2.11.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>```
#

could anyone help?

stuck hearth
#

Is PAPI on the server?

urban temple
#

yea

#

/plugins output:
Plugins (4): DrainStealCore, CraftserveAgent, PlugmanX (Plugman), PlaceholderAPI

broken elbow
urban temple
#

it doesnt return the msg i wanted

broken elbow
#

try sending the message to console, see if its being sent there at least

urban temple
#

i should use getLogger to send it to console?

broken elbow
#

sure

urban temple
#

aight wait

#

it says this
[20:28:30] [Server thread/INFO]: ?e?lWelcome %luckperms_prefix% %player_name% ?e?lto ?b?lDRAIN?f?lPVP ?8?l- ?e?lA great ?b?lLifeSteal?f?lSMP ?e?lserver

broken elbow
#

when are you sending this? after parsing the placeholders or after?

urban temple
#

after

#

after or after makes sense

#

oops im late

urban temple
orchid otter
#

How can you get the directional value of a block?

tight junco
formal crane
#

What would be the best way to make a bossbar count down in a specific time of seconds (like from full to empty in 15seconds)?
I have tried some ways but nothing to hard. (i currently have a runnable for every 2ticks for 15seconds long but now it still needs to change the progress of the bar )

orchid otter
slim estuary
#

How do I set an armorstand into noclip mode in 1.19 NMS

stuck hearth
#

Noclip mode?

broken elbow
#

probably means no gravitation

#

actually

#

nvm

merry knoll
#

probably marker setting

karmic arch
#

Gday Lads!
I recently faced some big issues with my Plugin Code, and i hope that anyone here can help me.
The Idea is, that if a Player Clicks a Specific Item in the Inventory (Command Block in this Case), the Current inv closes and a new one opens up.
Any Help?
Here's the Code:
https://srcb.in/u9sVDhswz3

wintry grove
#

I have a string, like for example "<StarL0st> Hello" and I need to split the part thats the username and the actuall message, how can I do so?

broken elbow
#

you can split at first >?

#
var split = "<StarL0st> Hello".split(">", 2);``` or something like that
wintry grove
#

kotlin moment

broken elbow
#

no?

#

that's 100% java

wintry grove
#

my bad

#

forgot about the var thing

broken elbow
#

unless the ">" need to be a char

#

ah. the var. I See

wintry grove
#

yeah that works

#

ty

slim estuary
#

Rather than be stopped by them

#

I know you can do it with the 1.16 one but the 1.19 one doesn’t work the same

warm steppe
#

?mf

neat pierBOT
warm steppe
#

Also this^

vital pecan
#

a

lyric gyro
#

can we get this pinned?

vital pecan
#

[00:25:03 ERROR]: Could not pass event PlayerJoinEvent to Simpleplugin v1.0.0 java.lang.LinkageError: loader constraint violation: loader 'simpleplugin-1.0.0.jar' @5b0ffae wants to load class org.geysermc.floodgate.util.DeviceOs. A different class with the same name was previously loaded by 'Geyser-Spigot (3).jar' @4dc5ff2c. (org.geysermc.floodgate.util.DeviceOs is in unnamed module of loader 'Geyser-Spigot (3).jar' @4dc5ff2c, parent loader java.net.URLClassLoader @5c29bfd) at com.plugin.simpleplugin.util.ToolBoxChecker.hasToolbox(ToolBoxChecker.java:14) ~[simpleplugin-1.0.0.jar:?] at com.plugin.simpleplugin.Simpleplugin.onPlayerjoin(Simpleplugin.java:111) ~[simpleplugin-1.0.0.jar:?]

#

guy i got an error

#

how to fix that

#

help please

hoary scarab
lyric gyro
#
    private void hideBossBarAfter(BossBar bossBar, int timeInSecs) {
        if (timeInSecs == 0) {
            player.hideBossBar(bossBar);
            return;
        }
        double timeDecrease =  (double) 1 / timeInSecs;
        plugin.getServer().getScheduler().runTaskTimer(plugin, task -> {
            if (bossBar.progress() <= 0.0) {
                task.cancel();
                player.hideBossBar(bossBar);
                return;
            }
            bossBar.progress((float) Math.max(0.0, bossBar.progress() - timeDecrease));
        }, 0, 20L);
    }
#

Then you'd just make your bossbar with the adventure API, and pass it to the method

formal crane
#

I am gonna try it later, ty

karmic arch
vital pecan
lyric gyro
granite mountain
#

how can i use 1.19 nms?

vital pecan
granite mountain
high edge
#

No

granite mountain
#

ok how to i get 1.19

#

nms

hushed badge
#

run build tools for 1.19, or use the paper-user-dev gradle plugin (or whatever the spigot equivalent is if u use maven)

granite mountain
#

thanks!

errant kraken
#

How can I eval a String? I tried using the JavaScript and Nashorn engines, but they were removed since Java 15

sterile hinge
#

eval a string representing what?

errant kraken
#

a condition

#

like a comparison

sterile hinge
#

I mean there is no universal way to evaluate every expression, as that fully depends on the format of the expression

errant kraken
#

I don't need an "universal way", I just need something that can eval this %krownedlevels_level% >= 20

sterile hinge
#

string.split(">="), trim, parse both integers, do a >= b

errant kraken
#

so basically there's no engine that can do that?

sterile hinge
#

as I said, there is no universal way to evaluate expressions

dense drift
#

If you have basic conditions like that one, is easy to make your own system

errant kraken
#

I tried using the graal.js engine, but it bloats my jar and makes it MBs bigger

sterile hinge
#

graaljs can only evaluate js

errant kraken
#

that's good enough, idk why you're under the impression I need to be able to eval all languages known to man

broken elbow
#

well, you didn't specify that you need a javascript evaluator

errant kraken
#

I said I tried JavaScript and Nashorn which both eval JS, so I thought you got it

sterile hinge
#

conditional expressions can look different than js, so god knows what you really want

errant kraken
#

omg

broken elbow
#

pretty sure there's a wiki page with a long list of them

errant kraken
#

My issue is that JavaScript and Nashorn don't work, their script engine objects return null, so i looked the issue up and apparently they removed them in Java 15

broken elbow
#

yeah. you'll have to shade one

#

if you want to use it

dense drift
#

If your plugin is for 1.17+ you can use the library thing to download them at runtime

#

But again, for some simple conditions, is just easier to make your own system imo

errant kraken
#

it's configurable tho, who knows what conditions the admins will want to use

dense drift
#

They will use what conditions you allow them to, wdym

sterile hinge
#

that's why you need to know what you want

dense drift
#

By simple I mean != == > >= < =<

lyric gyro
#

I'll negate you

dense drift
#

No Emily..

#

Whats the use case for this? @errant kraken

errant kraken
#

I am making a portal that will only teleport those who meet 2 conditions: a JS condition and an item condition

karmic arch
#

Gday Lads!
I recently faced some big issues with my Plugin Code, and i hope that anyone here can help me.
The Idea is, that if a Player Clicks a Specific Item in the Inventory (Command Block in this Case), the current inv disappears and a the new one opens up.
Any Help?
Here's the Code:
https://srcb.in/KRh35LwcpH

hard wigeon
#

How does one check if a hit is a critical hit, or a normal one with spigot?

leaden sinew
#

Probably check their downward velocity

lyric gyro
#

I've been spending a lot of the day trying to reverse engineer EssentialsX's build project setup. Yes, I've failed to try and build it from scratch several times. I basically want the same setup they've got for their projects, the code-style checks, junit and the multi-project building and compiling with a runServer.

Is there any helpful guides or simpler (than Essentials) code to look at to help build a system like theirs?

lyric gyro
tight junco
#

i don't believe it has to be jumping to be critical

lyric gyro
#

Was that recently changed?

#

I know in 1.12, the player must be like falling/not on ground, cant be on like a ladder or in water and cant be sprinting/on a mount

tight junco
#

i might be delusional

lyric gyro
tight junco
hard wigeon
lyric gyro
#

I'm pretty sure you can look at the logic in Spigot and just copy it

hard wigeon
#

It should totally be exposed

lyric gyro
#

I'm looking at a thread from a few years ago

#

let me see if I can dive into the source to make sure its still accurate

lyric gyro
# hard wigeon It should totally be exposed
    @SuppressWarnings("deprecation")
    public boolean isCritical(Player player) {
        return player.getAttackCooldown() > 0.9F && player.getFallDistance() > 0.0F
            && !player.isOnGround() && !player.isInWater() && player.getActivePotionEffects().stream()
            .noneMatch(p -> p.getType().equals(PotionEffectType.BLINDNESS))
            && player.getVehicle() == null && !player.isSprinting();
    }
#

that should do you just fine.

hard wigeon
#

Is that 1.19 decompiled?

#

If so, thanks

lyric gyro
#

No, it's a custom method I built off of the requirements

hard wigeon
#

Ah

#

Well ty

lyric gyro
#

np

slim estuary
#

Does anyone know the 1.19 NMS name for noclip? I know it’s just .noclip for 1.16 but things have changed

worn jasper
#

Uhm, so rn, I was going to check for every single thing I get from the config and report and error in case it doesn't find it, the thing is, is there no other way of doing this? Seems like DRY to be doing this like 15 different times...

pulsar ferry
#

Sir you can use code blocks

dusky harness
#

🥲

ornate salmon
#

Hello, in Bungeecord API, does PreLoginEvent.getConnection().getUniqueId() returns the player's UUID? Is it the same as PostLoginEvent.getPlayer().getUniqueId()?

lyric gyro
#

Examples of attributes which are not available include their UUID.
thonk you sure that works?

worn jasper
#

Either way I just assume config verification are a bunch of checks and there is nothing we can do

ornate salmon
#

I want to perform database action based on the player UUID

lyric gyro
#

hm I believe LoginEvent is fine

#

90% sure

ornate salmon
lyric gyro
#

yes but the uuid should be populated by then

ornate salmon
#

Ok let me have a try

#

Also

#

I should perform the database action asynchronously from the async LoginEvent right?

#

Should I start a new asynchronous task per LoginEvent or have a single thread for all LoginEvents

lyric gyro
#
#

the idea behind the intent stuff is "oh i'll be doing some work async, let the event continue to other listeners but don't continue the login process until i'm done"

ornate salmon
#

Cool let me see

ornate salmon
#

Looks like LuckPerms uses JDBC instead of JPA

lyric gyro
#

yeah I mean how it does the query specifically isn't exactly relevant

#

What I was trying to point out was more of the usage of the intent

granite mountain
#

any api for custom entities not using nms for 1.19?

#

coz i hate nms

ornate salmon
#

Is creating a Connection expensive such that I should perform database action for multiple players in the same Connection?

lyric gyro
# ornate salmon Is it possible for two players to login simultaneously, and should I access the ...

eeh you should definitely use a connection pool library, it'll take care of all the nasty lifecycling, hikaricp is the go-to solution for jdbc, you can configure stuff like max pool size, max lifetime and whatevs, manually trying to take care of this stuff is hell
I am not familiar with jpa's ecosystem but surely there has got to be solutions as well 😅

Is it possible for two players to login simultaneously
possible? yeah, how likely that is depends on the size of the network

ornate salmon
#

Ok thanks!

fiery roost
#

if i add this

    String parsedColors = ChatColor.translateAlternateColorCodes('&', parsedPlaceholders);```
the plugin wont enable for some reason if i remove it itll enable why?
sterile hinge
#

look at your logs

merry plover
#

If you need it, then buy it, noone is gonna give it to you, also you would only end up with malware that way

tropic socket
#

well, thanks

sterile hinge
#

Or use a free alternative

high edge
#

Can we get a yeet?

robust crow
granite mountain
#

anyone got a api for making custom enites i hate nms, for 1.19 btw

lyric gyro
#

So i have my saved kit-items in my config, but how can i put the items back in the player's inventory? Its prob very simple but i can't find the answer..

inv:
  inv:
  - ==: org.bukkit.inventory.ItemStack
    type: DIAMOND_SWORD
  - ==: org.bukkit.inventory.ItemStack
    type: BOW
  - ==: org.bukkit.inventory.ItemStack
    type: ARROW
    amount: 64
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - null
  - ==: org.bukkit.inventory.ItemStack
    type: LEATHER_BOOTS
  - ==: org.bukkit.inventory.ItemStack
    type: GOLD_LEGGINGS
  - ==: org.bukkit.inventory.ItemStack
    type: DIAMOND_CHESTPLATE
  - ==: org.bukkit.inventory.ItemStack
    type: CHAINMAIL_HELMET
  - null
  armor:
  - ==: org.bukkit.inventory.ItemStack
    type: LEATHER_BOOTS
  - ==: org.bukkit.inventory.ItemStack
    type: GOLD_LEGGINGS
  - ==: org.bukkit.inventory.ItemStack
    type: DIAMOND_CHESTPLATE
  - ==: org.bukkit.inventory.ItemStack
    type: CHAINMAIL_HELMET
broken elbow
# lyric gyro So i have my saved kit-items in my config, but how can i put the items back in t...

I'd personally recommend you use the base64 serializer instead. It lets you serialize an entire inventory to a base64 string and then it also gives you a method to deserialize. Its much more compact and nicer. https://gist.github.com/graywolf336/8153678 but anyways if you want to continue with the YamlSerializer, you just get the item list, get the player's inventory using Player#getInventory, and then and then use a simple for loop that goes from 0 until list size, and use the PlayerInventory#setItem method to add set the item

#

d;spigot PlayerInventory#setItem

uneven lanternBOT
#
void setItem(int index, @Nullable ItemStack item)```
Description:

Stores the ItemStack at the given index of the inventory.

Parameters:

index - The index where to put the ItemStack
item - The ItemStack to set

lyric gyro
broken elbow
sharp hemlock
#

just a simple regex question, but based in java. how would i make it so you it doesnt match the ending : next to the }

lyric gyro
uneven lanternBOT
#
@NotNull
public @org.jetbrains.annotations.NotNull byte[] serializeAsBytes()```
Description:

Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will use the built in data converter instead of bukkits dangerous serialization system.

Returns:

bytes representing this item in NBT.

broken elbow
#

cool

wintry grove
#

to check the regex things

icy shadow
#

regex101

torpid raft
#

that's an online regex checker site

broken elbow
#

is it?

torpid raft
hushed badge
#

close ur tabs

pulsar ferry
#

Haha imagine having many tabs always

crude charm
#

How do i make so when players leave the server their inventory gets cleared

package knockbackffa.knockbackffa;

import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;

public class LeaveEvent implements Listener {
    public void onPlayerQuit(PlayerQuitEvent e) {
    Player player = e.getPlayer();



    }
}```
inner jolt
#

player.getInventory().clear();

#

Should work

torpid raft
crude charm
crude charm
inner jolt
#

What about clearing their inventory when they join instead?

crude charm
#

wiat

#

i can clear it

#

and then give them stuff

#

im dumb

#

thanks

#

lemme try thaty

inner jolt
#

👍

crude charm
#

Does not work

#

hm

#

@inner jolt

#

help me

inner jolt
#

You might have to update the inventory afterwards?

inner jolt
#

player.updateInventory(); to force update the inventory after changing it

crude charm
#

Should it update before

#

or after

#

they join

#

Like

#

Should it update before the player.getinventor

#

or after?

#

@inner jolt

inner jolt
#

after

crude charm
#

Lemme try

#

Did not work

#

nvm

#

it did work

#

Thanks @inner jolt

inner jolt
#

No problem 👍

crude charm
#

Love you

#

(No homo)

inner jolt
#

😳

#

Love you too

wintry grove
#

how can I make a regex to only match the first colon in a string

wintry grove
#

or I want to make a regex for separating this string:
" (Rank) StarL0stGaming: Hello"

#

the rank would be a string

#

the name another

#

and the message another

#

how would I do so?

dusty frost
#

string.split(" ");

#

Or you could match each part depending on like if there are always parentheses around the rank and a colon + space before the message

somber light
#

hello, let's say that I can't use Thread.currentThread().getContextClassLoader().getResource(".."); and as a parameter I get the main class of a plugin
since the plugin is supposed to work on spigot and bungeecord I decided to have the following structure:

 me/oreoezi/plugin:
   - spigot
   - bungeecord
   - universal

Therefore my main class is in me/oreoezi/plugin/spigot, which makes it impossible for me to just list the files of the directory using

URL url = main.getResource("resources/" + path);
File dir = new File(url.toURI());
dir.list();

main is a Class<?> and path is a string, this code would work if main was part of me/oreoezi/plugin but wouldn't work if the main class is in a subpackage
this is the structure of my code https://media.discordapp.net/attachments/898308178058559550/1003616988121276426/Screenshot_at_2022-08-01_13-48-50.png
so now the question remains; how would I write a function that when given the main class and "folder/" as a parameter it will return a string array with the names of all the files inside of that folder in the resources directory

sterile hinge
#

I don't see how this is related to the package of the class at all

somber light
#

that's what I thought too

#

but for some reason it makes all the difference in the world

sterile hinge
#

I doubt that

somber light
#
private String[] listResourceDirectory(String path) {
        URL url = main.getResource("resources/" + path);
        if (url == null)
            return new String[0];
        try {
            File dir = new File(url.toURI());
            return dir.list();
        } catch (URISyntaxException e) {
            e.printStackTrace();
            return null;
        }
    }

I tested this and it worked on my other plugin, the only difference in setup is the package structure
another thing worth mentioning is the function for copying a file from my resource directory still works despite listing the directory doesn't

private boolean writeFile(String path, String local_path) throws IOException {
        Path dest = Paths.get(folder + path);
        if (new File(folder + path).exists()) return false;
        Files.copy(main.getClassLoader().getResourceAsStream(local_path), dest, StandardCopyOption.REPLACE_EXISTING);
        return true;
    }
sterile hinge
#
  1. don't mix the old file api with the new file api everywhere
  2. the package structure has no effect on functionality unless you found a bug
  3. you can't represent an entry in your jar file using Fileafaik
somber light
#

You actually can do the third

#

It is worth mentioning that if i did the same thing but used the class loader to get the resource i would get an url to it but it would give me an error saying URI is not hierarchical

#

When loading the file

#

I also tried "../resources/" + path and "/../resources/" + path but to no avail

sterile hinge
#

not sure where that "resources" is even coming from

somber light
#

that is the folder in which i store the files

sterile hinge
somber light
#

correct

sterile hinge
#

well as I said, you can't create a File object from that URL, so you can't list the dir content

somber light
#

I again state that I could just fine on my other plugin

sterile hinge
#

well if you know the solution, just do the same again

somber light
#

I don't

#

my only assumption was that it was due to the package

#

but,as you stated earlier, it wouldn't make much sense

#

without using files, how can I get the names of the files inside that folder

sterile hinge
#

the content of a jar file aren't Files, you'll need to use something to open the jar file and go traverse its entries

somber light
#

is there not another way, I am just interested in knowing the names of those files

#

not reading them

somber light
sterile hinge
#

because it works on an InputStream, which means it reads the files

somber light
#

correct

sterile hinge
#

but if the resource is in a jar file, that means reading an entry from the jar file

somber light
#

if I try to use getResourceAsStream on a folder and it returns an InputStream can I use that inputstream to get the items inside of that folder?

sterile hinge
#

I don't think so

edgy lintel
#

why is lambda function async lol

sterile hinge
#

?

edgy lintel
# sterile hinge ?

when trigger a lambda function from an inventory event, the bukkit api responds with the fact that i cant trigger closeinventory(lambda function) from async
or i assume inventories are handled in an async way or sth?

#

too lazy to decompile the source code

sterile hinge
#

show your code

granite mountain
#

help i cant make health higher then 20 ```java
public class battle_bot extends Zombie {
public battle_bot(Location loc, BotData data) {
super(EntityType.ZOMBIE, ((CraftWorld) loc.getWorld()).getHandle());

    this.setHealth(data.health);

    this.setPos(loc.getX(), loc.getY(), loc.getZ());

    this.setCanPickUpLoot(false); // Can Pick up Loot
    this.setAggressive(true); // Aggressive
    this.setCustomNameVisible(true); // Custom Name Visible
}

@Override
public void registerGoals() {
    this.goalSelector.addGoal(2, new AvoidEntityGoal<>(this, Skeleton.class, 6f, 1d, 1.2d));
    this.goalSelector.addGoal(1, new NearestAttackableTargetGoal<battle_bot>(this, battle_bot.class, true));
    this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1, true));
}

}```

granite mountain
#

oh i dumb thanks

hoary citrus
#

is there a way I can play sounds in a bungeecord plugin?

shell moon
#

SlimeWorldManager is a good option for arena regeneration in minigames right?
What about ores regeneration? I mean, if a minigame where players mine resources is made, how to randomize (efficiently) the ores when regenerating the arena too (with SlimeWorldManager). Would it be by using a specific material in the arena and then looping arena to replace that material with random ores or there is a better way?

grand island
#

Hello, is there a way i could listen to /papi reload and re-register expansions from my plugin?

shell moon
#

why would you do that

broken elbow
grand island
#

because expansion i register disappears after placeholder api reload

shell moon
#

what i thoo

broken elbow
#

that's because you're not overriding the persist method

shell moon
#

persist true

broken elbow
#

override it, and make it return true

grand island
#

oh

#

didn't know, thanx

shell moon
merry knoll
#

you probably need to change the ores afterwards

shell moon
#

ik

#

question was whats the best way

merry knoll
#

all slime world manager does is to save and load from slime format

shell moon
#

ik

broken elbow
merry knoll
#

ah? depends though no?

#

if block locations are known simple randomization is good enough

#

but if not you probably need to implement some procedural generation logic using noise

rapid silo
#

who can register me

obsidian abyss
#

How can I play videos doesn't matter what file format on a 2d game based on Java Swing?

#

Maybe I could export the video as a list of images and a .wav file?

somber light
# somber light ```java private String[] listResourceDirectory(String path) { URL url = ...

I fixed the issue in case anyone else has it, and I learned a bit along the way.

  1. The package that your class is in does matter, if you want to use getClass().getResource("text.txt") and your class is in me.dev.plugin your text.txt file should be in resources/me/dev/plugin/
  2. You can prevent that by using getClass().getClassLoader().getResource()
  3. You cannot load directories as java.io.File inside a jar
  4. Unlike directories outside of a jar, using getResourceAsStream in order to get an InputStream won't actually get you a directory listing, as expected
    private String[] listResourceDirectory(String path) throws URISyntaxException, IOException {
        URL url = getClass().getClassLoader().getResource(path);
        if (url == null)
            return new String[0];
        FileSystem fileSystem;
        fileSystem = FileSystems.newFileSystem(url.toURI(), Collections.emptyMap());
            Path resourcePath = fileSystem.getPath(path);
            List<String> resourcesNames = Files.walk(resourcePath, 1)
            .skip(1) //the dir itself?
            .map(p -> {
                String name = p.getFileName().toString();
                if (name.endsWith("/")) 
                    name = name.substring(0, name.length() - 1);
                    return name;
                })
            .sorted().collect(Collectors.toList());
            fileSystem.close();
        return resourcesNames.toArray(new String[resourcesNames.size()]);
    }```
This code is a modified version of https://stackoverflow.com/a/49570879 
This worked like a charm, although I'm gonna be honest, I don't know exactly what each line does, I might experiment with it if I have time.
wintry grove
#

I assume it is possible right?

#

I have used simply split(":") for splitting the rank and message

dense drift
wintry grove
#

let me try

#

cool it works

dense drift
#

the \d is not need btw

wintry grove
#

now the parentesis in the ranks is not actually in the chat message

#

I just used it for the explanation

#

the rank is a font character with an image

#

should I just change it with the character?

dense drift
#

good luck with that

#

because you most likely use unicoded symbols and I personally dont know how to make a regex accept that xD

wintry grove
#

pain

dense drift
#

though a split(" ", 3) would do the job

#

and then just remove the colon from [1]

wintry grove
#

doesnt it accept the unicodes tho?

#

I mean this should work

#

if I put the unicodes

#

or am I wrong

dense drift
#

idk how regex works with unicoded symbols

dense drift
wintry grove
#

aight

#

used 2 instead of 3

#

it splits the rank

#

gonna try 3 now

broken elbow
#

well yes...

#

that is the max limit of splits

#

or whatever its called. so if you give it 2, it will split a maximum of once if it finds the char sequence you want to split at

#

so the resulting array will either have 1 or 2 elements

#

if its 3, it will split it a maximum of 3 times, so resulting array will have between 1 and 3 elements

wintry grove
#

ye

#

should probably use the second part

dusty frost
#

could also possibly look into using zero-width spaces if you're concerned about it, then you can set explicit break points wherever you want

vital pecan
#

constructor SimpleCommand in class com.plugin.simpleplugin.commands.SimpleCommand cannot be applied to given types;

#

i got this error

#

anyone know?

wintry grove
#

I'm extremely new to regexes

#

it works now

#

tysm

#

shouldnt be a problem for now

dusty frost
#

as the name implies, it has no width, therefore it is essentially not rendered

#

but it can be used to put breakpoints in where you want to split stuff, like in this case

#

you could put one after the rank and after the name if you ever swap away from using a colon

torpid raft
#

on one hand it seems very easy and convenient

#

but it also sounds extremely hacky and like you'd get yelled at for even trying to add it

late wyvern
#

spigot down for anyone else?

icy shadow
#

yes

#

@late wyvern what can i do for you

late wyvern
#

Was looking for a commission but just seen 'Not available for commissions'

#

my bad

warm steppe
#

I'm available

late wyvern
#

Gangs plugin with some extra features. I have a full write up. Lmk

dense drift
somber gale
late wyvern
proud pebble
#

post both class's to helpchat paste, the one where you are trying to use simplecommand and simplecommand's class

#

or just hover over where your trying ot instance it and look what it says it wants and then what it recieved

vital pecan
tacit quail
#

never touched build.gradle yet getting errors from it?

#

any help with this?

dusky harness
#

Use releases

tacit quail
#

not sure what u mean by that

dusky harness
#

Use version 1.7.10

#

Oops I meant don't use beta

tacit quail
#

oh that makes more sense

dusky harness
#

Also kotlin and Java pluigins

Interesting

#

Using both langs? 👀

tacit quail
#

that was a mistake

#

i wanted to make it in kotlin but it wasnt converting

#

im gonna tryu it with maven

#

so far its working with maven

#

i just make a new project lol

lyric gyro
dusky harness
#

Oh

#

¯\_(ツ)_/¯

#

Makes sense

tacit quail
#

my pc is exploding from 1.19

#

wtf

warm steppe
#

Why is pdc not applying to my item? (1.17.1)

public static void setEnchant(ItemStack pickaxe, Enchant enchant, Integer value) {
    ItemMeta itemMeta = pickaxe.getItemMeta();
    itemMeta.getPersistentDataContainer().set(enchant.getNamespacedKey(), PersistentDataType.INTEGER, value);
    pickaxe.setItemMeta(itemMeta);
}
icy shadow
#

how do you know it's not applying

stuck hearth
#

Because

warm steppe
#

I print item enchant list in chat on my event

lyric gyro
#

can you show that

warm steppe
broken elbow
#

ugh. what is the PickaxeUtils.getEnchants method?

lyric gyro
#

that sure does look fine

warm steppe
#
public static Map<Enchant, Integer> getEnchants(PersistentDataContainer persistentDataContainer) {
    return new HashMap<>(){{
        put(Enchant.EFFICIENCY, persistentDataContainer.getOrDefault(Enchant.EFFICIENCY.getNamespacedKey(), PersistentDataType.INTEGER, 0));
        put(Enchant.FORTUNE, persistentDataContainer.getOrDefault(Enchant.FORTUNE.getNamespacedKey(), PersistentDataType.INTEGER, 0));
        put(Enchant.MULTI_MINE, persistentDataContainer.getOrDefault(Enchant.MULTI_MINE.getNamespacedKey(), PersistentDataType.INTEGER, 0));
    }};
}
lyric gyro
#

and how/where are you using setEnchant

warm steppe
#

in a command

#
public void enchant(Player sender, Enchant enchant, Integer value) {
    ItemStack pickaxe = sender.getInventory().getItemInMainHand();
    ItemMeta itemMeta = pickaxe.getItemMeta();
    
    PickaxeUtils.setEnchant(pickaxe, enchant, value);
    
    itemMeta.addItemFlags(ItemFlag.values());
    itemMeta.setLore(PickaxeUtils.getPickaxeLore(pickaxe));
    
    pickaxe.setItemMeta(itemMeta);
}
lyric gyro
#

you are overriding the meta after calling setEnchant

#

make it take an ItemMeta instead of an ItemStack

warm steppe
nimble vale
#

so PlayerDeathEvent is just for handling death event it has nothing to do with actually killing player

#

when i call the event i also need to kill player i guess

merry knoll
#

so if you kill a player that event will also fire

nimble vale
#

what if i call that event in a plugin

#

Bukkit.getPluginManager().callEvent

#

with this

merry knoll
#

would fire the event without killing the player obviously

nimble vale
#

yeah

merry knoll
#

events are there to notify plugins not the other way around

nimble vale
#

and if i kill the player myself then again another event will be fired

merry knoll
#

ye it will fire two times

nimble vale
#

yeah then something wrong with my logic i guess thanks anyway

merry knoll
nimble vale
#

i just need to make a custom event or just create a method to use like events

#

idk if i need to create a event for this because i will be calling it from the same plugin

#

not gonna use for any other plugin

#

that event

merry knoll
#

if yes its probably an okay idea to use a listener pattern internally

#

if only once though, i personally would just use a function call and be done with it when your custom "event" fires

nimble vale
#

actually i just made a custom event which i think it's the best approach here

#

that didn't took a minute really

dusty meteor
#

can I install ecloud expansions using placeholderapi on my plugin, for exemple, can I install Player expansion using a method from my plugin

dusty meteor
#

ok thanks

nimble vale
#

i guess you can just run commands too

#

not the best but you have that

dusty meteor
torn heart
#

i'm using BoundingBox#raycast and it's detecting the player, which i don't want. any way to fix this?

sterile hinge
#

looks like custom logging?

hoary scarab
#

Thats just a debug when I run commands. Nothing to do with the command/plugin that I used.

hoary scarab
#

This is the client causing this right? Its not a bug but just looks bad. (When you have a long string)

tacit quail
#

I cant use .equals on getEnchtntmentLevel

#

am i misssing something

#

i can do it on .gettype()

icy shadow
#

it's an int so it doesnt have .equals

tacit quail
#

oh so what should i do instead for it?

broken elbow
#

usually, you can hover over it and it will tell you what's going on.

icy shadow
#

==

broken elbow
#

==

tacit quail
#

that really didsnt work

icy shadow
#

oh?

tacit quail
#

not a statement

broken elbow
#

no brackets

#

?

icy shadow
#

well you need to actually do something with the result

broken elbow
#

== 50

#

ohh

#

lmao. nvm yeah what bm said

tacit quail
icy shadow
#

so put it in the if

broken elbow
#

yeah. but you're closing the if statement.

#

with ;

tacit quail
#

omg

#

ur right

#

tysm

#

it worked

#

is there a more efficent way to write this?

stuck hearth
#

Store the inventory in a variable instead of calling it twice

broken elbow
#

d;spigot PlayerInventory#setItemInMainHand

uneven lanternBOT
#
void setItemInMainHand(@Nullable ItemStack item)```
Description:

Sets the item the player is holding in their main hand.

Parameters:

item - The item to put into the player's hand

stuck hearth
#

Or that

tacit quail
#

oh wow

broken elbow
#

set it to null

#

and it will remove it

tacit quail
#

ty very much

broken elbow
#

no problem

#

so, for FireworkEffectMeta, spigot's api mentions:

Represents a meta that can store a single FireworkEffect. An example includes Material.FIREWORK_STAR.
where do I Find a full list of this? Or is it just firework star and firework?

dense drift
#

just these two

#

Arrays.stream(Material.values()).filter(Material::isItem).map(ItemStack::new).filter(it -> it.getItemMeta() instanceof FireworkEffectMeta)

broken elbow
#

👍 don't need a list, was just curious. but thanks

fiery pollen
#

In the method World#createExplosion(), whats the biggest power you can pass in

#

or is there no max?

fading stag
#

Is there any doc about which mc version fits best with which java version? I can set sourceCompatibility
targetCompatibility from build.gradle.kts and IDK what should I set them to

smoky hound
#

did you figure this out? I've been having this issue with no stack trace on 1.19.1 and when I hover it just says java.lang.UnsupportedOperationException or whatever

broken elbow
fading stag
#

I believe I need all versions (1.8-1.18) but thanks 😄

lyric gyro
#

in your case, java 8 would be that

fading stag
#

I plan publishing multijar

lyric gyro
#

skull

#

good luck

merry knoll
#

java 8 PU_PeepoMadPuke

lyric gyro
#

Hey ho

torpid raft
#

hey is for horses

lyric gyro
#

I want to make a Skyblock Plugin. What is the Smartest way to generate the World? using WorldEdit to load a Schmetica or can i Just Copy a World?

lyric gyro
torpid raft
#

if it's skyblock just start with a void world and use either the worldedit api or just paste in the islands yourself (in code) as they are needed

lyric gyro
#

wym by paste the islands yourself

torpid raft
#

like instead of depending on worldedit place the blocks programmatically on your own

#

make your own worldedit to copy your island into each spot

lyric gyro
#

so hardcode block by block?

torpid raft
#

not necessarily hardcode

#

you can make a simplified island config and read from that

lyric gyro
#

can you load Schmeticas with my Plugin without depending on others

torpid raft
#

there might be a library out there for reading schematic files so that you dont need to depend on another plugin

#

but i've never looked into something like that so ymmv

fading stag
broken elbow
fading stag
#

Installed spigot 1.8 from get bukkit and opened it with java 17 temurin

broken elbow
#

interesting

#

guess I was lied to (never tested this myself)

proud pebble
#

btw dont use spigot, paper does have a 1.8.8 legacy build

broken elbow
#

yeah. but that wasn't their original question

proud pebble
#

i was just adding something extra, didnt even see what they originally asked

#

when it comes to minecraft versions, its probably recommended to compile using a version of java that its minimum can me

#

so for 1.8,1.12,etc its java 8

#

1.16 is java 11, 1.17 is java 16 and 1.18 is java 17

lyric gyro
#

Sooo
In my Main I have an Array that contains commands. Now I want to check on Chat event if the /.... is in the Array. How do I do that

#
            if (event.getMessage().contains("/") && !Main.commands.contains(event.getMessage()))
            {
                event.setCancelled(true);
                event.getPlayer().sendMessage(PREFIX + "§cCommand not found.");
            }
``` why doesnt this work
proud pebble
lyric gyro
#

BRUH

#

sorry

#

is there an event for commands

proud pebble
lyric gyro
#

can I somehow prevent commands from being executed

#

via plugin

broken elbow
#

yes. there is an event fired when a command is executed

#

what lunaiskey sent above

proud pebble
#

turns out theres an event for when a command is sent, i wasnt aware of this.

lyric gyro
#

oof

hoary scarab
lyric gyro
#

Hey,
So how can I get every row from my MySQL table and return all rows in a String Array?

tawny shore
#

I have a question, is it possible to modify the enchantment table options?
for example add diamond sword and netherite and possible enchantments are custom

lyric gyro
#

I dont think you can. Altho you could use a Custom Interface

#

Wait

#

Maybe there is o.o

tawny shore
warm steppe
#

?mf

neat pierBOT
warm steppe
#

@lyric gyro ^

edgy lintel
#

any good modern java decompiler that supports higher version of java apart from jd-gui?

sterile hinge
#

Quiltflower is pretty up to date

hoary scarab
nimble vale
#

do you think that simulating that new spyglass without holding the item is possible?

stuck canopy
#

im trying to give a potion effect to a player when holding a item and taking away the potion effect from the player when they switch the item in hand to smth else

#

I have been trying to do this for a long time and its working when Im swapping it from a item but it doesnt work when im swapping it from nothing

lyric gyro
icy shadow
#

Any idea how to do collision detection with a custom model data armorstand?

high edge
#

yikes

icy shadow
#

yeah lol

#

i guess i'll just require that the hitbox is configured manually with a boundingbox

#

because it's not like the server knows how big it is

dense drift
#

yea, most likely

icy shadow
#

or could read the blockbench format

#

and automatically configure it

dense drift
#

is probably easier to do it manually

#

unless it tells you the size

icy shadow
#

i think the resource pack format specifies it

#
            "from": [-13.3, 0, -1.23],
            "to": [29.3, 7.1, 3.03],
            "rotation": {"angle": 0, "axis": "y", "origin": [-3.36, 0, -3.36]},
            "faces": {
                "north": {"uv": [0, 0, 16, 8], "texture": "#0"},
                "east": {"uv": [0, 0, 4, 8], "texture": "#0"},
                "south": {"uv": [0, 0, 16, 8], "texture": "#0"},
                "west": {"uv": [0, 0, 4, 8], "texture": "#0"},
                "up": {"uv": [0, 0, 16, 4], "texture": "#0"},
                "down": {"uv": [0, 0, 16, 4], "texture": "#0"}
            }
#

looks like it anyway

warm steppe
#

You have to shade toml in to your project

dense drift
warm steppe
#

(for the guy that deleted his post here)

dense drift
#

yup, it is

icy shadow
#

wdym element

dense drift
#

a part of the model

#

a block

icy shadow
#

oh well yeah

#

but i could read all of the elements to calculate a BB

dense drift
#

yeah, have fun

broken elbow
#

lmao

errant kraken
dense drift
#

they come from a library, and that's how inner classes are saved

errant kraken
#

so it's normal for it to have 3 more copies of JsonArrayList?

edgy lintel
sterile hinge
void nebula
#

Would it be at all possible to listen for vault economy deposits from a specific plugin? (Specifically autosell) I'm fairly unknowledgeable about development

dull kayak
#

I have a quick question. How would I access the whitelist.json file from a server through a plugin? Like what would that files directory be?

dense drift
#

new File(Bukkit.getWorldContainer(), "whitelist.json") maybe?

lyric gyro
#

why not actually use the whitelist methods in the API?

dull kayak
#

thanks!

ocean raptor
#

does adventure's translatable components work on older versions than 1.12? (for items and blocks name) iirc thats when spigot added localized names

lyric gyro
#

adventure doesn't translate components, it sends the translatable component to the client to render

ocean raptor
#

that makes more sense

#

alright thanks

stuck canopy
#

how can I check for a item being hold and when the player switches the item in main hand to something else

rigid mountain
#

Hey guys, im trying to acheive something where if you are in a chunk a timer or counter goes up, but when you leave it it does down what should i use for this?

high edge
#

runnable, check the players standing chunk id, if it matches, decrement otherwise increment

dark garnet
#
java.lang.NullPointerException: null```*this is the entire error*

```java
@EventHandler
public void onInventoryMove(InventoryMoveItemEvent event) {
    final Location source = event.getSource().getLocation();
    final Inventory destination = event.getDestination();
    if (source == null || destination.getLocation() == null || destination.getType() != InventoryType.HOPPER) return;

    final UUID sourceOwner = new LockManager(source.getBlock(), null).getLocker();
    final UUID destinationOwner = new LockManager(destination.getLocation().getBlock(), null).getLocker();
    if ((sourceOwner == null || destinationOwner != null) && (sourceOwner == null || destinationOwner.equals(sourceOwner))) return;

    event.setCancelled(true);
}```
sterile hinge
#

are you having like a lot of NPEs in your log? Also try with -XX:-OmitStackTraceInFastThrow

dark garnet
sterile hinge
#

NullPointerException

dark garnet
#

not like a ton ton

#
java.lang.NullPointerException: null
[19:09:45 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:09:46 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:13:41 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:16:21 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:20:30 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null
[19:20:30 ERROR]: Could not pass event InventoryMoveItemEvent to Vanadium v0.5.0
java.lang.NullPointerException: null```
sterile hinge
#

yeah try with that jvm flag then

dark garnet
#

does it just hide the errors?

sterile hinge
#

the - after the : means the same as -XX:OmitStackTraceInFastThrow=false, and it's true by default. If it's set to true, stack traces will be omitted under certain circumstances

dark garnet
#

o

dark garnet
#

alright ty

dark garnet
#

was able to find out what was breaking and fixed it

#

ty

sterile hinge
#

nice

smoky hound
dark garnet
dull kayak
#

Alright, I am lost.

This is the code that I have ```Java

    Bukkit.reloadWhitelist();
    //People that are whitelisted in the server file
    Set<OfflinePlayer> alreadyWhiteListed = Bukkit.getWhitelistedPlayers();
    Bukkit.getLogger().info("there are " + alreadyWhiteListed.size() + " players whitelisted");
And this is what it prints out:```
[INFO] .... there are 0 players whitelisted

While the whitelist.json file looks like this

[
  {
    "uuid": "fac0a13c-91eb-43f7-894b-0d4483232af6"
  },
  {
    "uuid": "a2eb00e4-8183-4244-bfef-8626b6391d84"
  },
  {
    "uuid": "306a4cc3-5e29-4dbe-9540-a26c48c514ee"
  },
  {
    "uuid": "33b17c18-b436-48bb-97a4-4bb5548d273c"
  },
  {
    "uuid": "846e593b-a91f-4d4e-ad60-3a271da879d7"
  },
  ...

Why in the world does the getwhitelistedplayers method not work?

spiral prairie
#

when are you running the code

#

try to run it when a player joins

tacit quail
#

this if statement isnt working

#

whats wrong

#
    @EventHandler
    public void onEntityDamage(EntityDamageByEntityEvent e) {
        if ((e.getEntity() instanceof Animals && e.getDamager() instanceof Player) ||
                (e.getEntity() instanceof Monster && e.getDamager() instanceof Player) ||
                (e.getEntity() instanceof Player && e.getDamager() instanceof Player)) {
            Player damager = (Player) e.getDamager();
            if (damager.getInventory().getItemInMainHand().getType().equals(Material.STICK)
                    && (damager.getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.KNOCKBACK) == (50))) {
                damager.getInventory().setItemInMainHand(null);

            }

        }
    }
#

full code ^^^

#

i just realised that code is extremely slow

broken elbow
#

what about it isn't working? where does it stop? have you tried debugging stuff? aka printing to console

#

also that if statement, can be made a lot shorter

tacit quail
tacit quail
broken elbow
#

check if damager is player only once

tacit quail
broken elbow
#

and see what code it runs, and what code it doesn't

tacit quail
#

alright ill check

#

why cant i do getLogger() in this class?

#

its an event handler

#

why cant i do that

broken elbow
#

pass the logger in the constructor from your JavaPlugin class

tacit quail
#

like this?

#

never tried to do this before

broken elbow
#

no

#

please read up on dependency injection

neat pierBOT
tacit quail
#

ok

#

nevermind this worked

#

i just needed to do Bukkit. before it

icy shadow
#

aside from the redundant instanceof checks (which arent really gonna be slow) it looks fine

icy shadow
# tacit quail

using the bukkit logger is a bit of a bad practice, the best way is to either use your Plugin's logger with DI as blitz said, or make a logger for the specific class with Logger.getLogger / LoggerFactory.getLogger

icy shadow
#

how do you know it's unoptimized

tawny shore
#

Hi, I have a doubt Is it possible to change the texture of a block with nbt data? e.g. change the texture to the enchantment table with title state when the item it is in hand or placed

#

i want to create a custom enchantment table texture but i don't know if it is possible to load the texture from the plugin and link it with the block

rigid mountain
#

Anyone know what this error means?

stuck hearth
#

Yes, it means a class VaultClaims was searching for (com.mongodb.client.model.Filters) was not found during run-time.

rigid mountain
#

Its included int he jar i think

past ibex
#

NoClassDefFoundError means there’s a previous exception

#

Potentially from not shading and a different version of the class being loaded

river solstice
dull kayak
dense drift
#
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_17```
Does this mean it will be compatible with java 11? I can't remember which option is for that 😬
#

I need java 17 for paper 1.18.1 but the jar to be compiled with java 11

stuck hearth
#

source would be the JDK used to compile, so it would restrict certain language features.
eg: 1.6 couldn't contain any lambda expressions.

Target would be the version of the generated class files, and should denote the lowest Java version the program will run on.

dense drift
#

so I should just switch them?

#
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_11```
#

Could not resolve: io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT I guess not 😐

dusty frost
#

I don't think it can go that way around

#

I think it can only up-compile source -> target

#

doubt it's a polyfill like javascript or somethin

dense drift
#

uh, that sucks

#

fucking paper, they have to do things in the right way all the time! spigot 1.18.1 is just fine with java 11 kek

dusty frost
#

why do you need to target Java 11 anyways? You need Java 17 to run Paper 1.18.1

dense drift
#

1.13 compatibility, is for chatchat and we need some api from paper as an alternative for what spigot offers

dusty frost
#

oh I thought we were only supporting versions with hex colors

dense drift
#

nah, 1.13+

dusty frost
#

who the hell even runs anything besides 1.18 and 1.19

#

i will pull out bstats rn

dense drift
#

fc call

dusty frost
#

we would only be losing ~8%!

dense drift
#

idk man

dusty frost
#

And only ~17% if we only supported Java versions made in the last 7 years

dense drift
#

so.. is not possible to use paper 1.18.1 and java 11? 🥺

dusty frost
#

Oh no definitely not, they use Java 17 features in the code

dense drift
#

Time for some reflections🪞 then

dusty frost
#

what are you going to do for spigot servers?

stuck hearth
#

Reflect on your decision to support legacy debt 😌

dense drift
#

is not mine, ok ??

dense drift
stuck hearth
#

Things I didn't say

dense drift
#

spigot will just use something that works there kek

#
final var prefix = material.isBlock() ? "block.minecraft." : "item.minecraft.";
return Component.translatable(prefix + material.getKey().getKey());```
dusty frost
dense drift
#

Material#getTranslationKey

dense drift
dusty frost
#

I mean surely it's not worth using two systems that do the exact same thing

#

just use the one that works for all of em and call it a day until we bully fc into submission

dense drift
#

yup, will wait for a good reason

#

check problem solved

brittle thunder
#

Make a multi-version wrapping library 🙂

dusty frost
#

or just let legacy users use DeluxeChat!

#

ha, chumps!

dense drift
dusty frost
alpine lava
#

Hi ppl

#

I want to start making plugins

#

Is there any tutorials for paper spigot 1.16.5

outer fulcrum
#

Placeholder API Dependency not working pls help

orchid wyvern
orchid wyvern
#

It's all preference, some people learn better off purely text resources, some off youtube, some prefer to buy courses (although personally I'd stay away from them)

merry knoll
orchid wyvern
#

Like I said, haven't watched them in years, so I don't know what state they are in now

merry knoll
orchid wyvern
#

@outer fulcrum how are you adding the dependency, maven/grade?

merry knoll
#

you will end up learning as you get stuck if you know how to google properly

orchid wyvern
#

sending your config for that would be handy