#development

1 messages · Page 108 of 1

wheat carbon
#

first step

#

what os are you on

wise steeple
#

Windows 11 😔

wheat carbon
#

do you know how to open environment variables on windows 11?

wise steeple
#

yessir

wheat carbon
#

do you know how to add stuff to path?

wise steeple
#

yes

wheat carbon
#

k, I recommend making a gradle folder somewhere

#

preferably on c

#

in that folder, make another folder called 7.3.2

wise steeple
#

alright

wheat carbon
#

directory structure should look like this

#

then add the gradle bin folder to ur path

#

e.g. C:\gradle\gradle-6.5\bin

wise steeple
#

alright, one sec

#

@wheat carbon Just curious, whats the differnce between the User Variables path, and the system variables path

wheat carbon
#

presumably the user variables only affects the current user

#

I'd just put it on system

wise steeple
#

yea

#

alright

#

done

wheat carbon
#

open a terminal of your choice

#

and type gradle -v

wise steeple
#

welcome to gradle 7.3.2

wheat carbon
#

great

#

u using ij?

wise steeple
#

yep

wheat carbon
#

make a backup of the project folder

#

just incase it goes wrong

wise steeple
#

alright

wheat carbon
#

then go file -> close project

#

and delete the project from ij (click 3 dots when u hover over project and click remove from recent)

wise steeple
#

alright

#

then open it up again i assume

wheat carbon
#

no

#

navigate to the project dir

wise steeple
#

alright

wheat carbon
#

delete pom.xml, out, target, .idea, *.iml

wise steeple
#

so leave src

wheat carbon
#

yes

wise steeple
#

alright

wheat carbon
#

create 2 files, build.gradle & settings.gradle

#

what's ur project name

wise steeple
wheat carbon
#
rootProject.name = "BetterSpawners"```
#

paste that in settings.gradle

wise steeple
#

outside of src?

wheat carbon
#

in the project dir

#

yes

#

same place pom.xml was

wise steeple
#

alright

#

done

wheat carbon
#

navigate to the folder in ur terminal

#

and type gradle wrapper

#

this step isn't strictly necessary but I recommend it

#

the gradle wrapper allows you to build the project anywhere even if gradle isn't installed

#

it's useful if the project is open source

wise steeple
#

i think it failed

wheat carbon
#

what did it say

wise steeple
#

it crashed really quicjk

#

but i caught a glance of the word failed

wheat carbon
#

are you able to show me the error

wise steeple
#

it clsoes too fast

wheat carbon
#

what terminal are you using

wise steeple
#

got it

#

cmd

wheat carbon
#

in build.gradle change 7.2.0 to 7.1.1

#

7.2.0 doesn't exist

#

my mistake

wise steeple
#

build successful

wheat carbon
#

type dir

#

and show result

wise steeple
#

where

wheat carbon
#

in cmd

#

same folder

wise steeple
wheat carbon
#

looks good

#

go back to ij

#

click open in top right

#

navigate to the project folder

#

select the build.gradle file

wise steeple
#

open as file or project

wheat carbon
#

project

wise steeple
#

ok

wheat carbon
#

once the project is fully loaded go to the right side of ij and open the gradle tab

wise steeple
#

wait

wheat carbon
#

it's still loading

wise steeple
#

not fully loaded yet

wheat carbon
#

shadow

#

shadowJar

#

jar is in build/libs

wise steeple
#

awesome

#

quick question

#

how do i use dependencys now

wheat carbon
#

like how do u add new dependencies?

wise steeple
#

like if its a pom.xml example how do i convert to build.gradle

wise steeple
wheat carbon
#

u can actually just paste the pom.xml dependency into ur build.gradle

#

ij will convert it to gradle

wise steeple
#

oh

#

sick

#

AAAAAAAAA

wheat carbon
#
<dependency>
    <groupId>org.spigotmc</groupId>
    <artifactId>spigot-api</artifactId>
    <version>1.16.5-R0.1-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>```
#

like try pasting that in

wise steeple
#

alright

#

oh thats cool

wise steeple
wheat carbon
#

I think it'll convert repositories too

#

file -> project structure

#

click project

#

make sure project sdk is java 17

wise steeple
#

ok, yea

#

it changed itself bbacxk to 16

wheat carbon
#

yeah ij's 17 support is a bit funky

#

especially with gradle

#

will probably be fixed next ij update

lyric gyro
#

works fine for me tho

wheat carbon
#

it's an issue when creating new projects because the gradle ij bundles is outdated

wise steeple
#

i do not undertsnad

#
[20:41:07] [Server thread/ERROR]: Could not load 'plugins\BetterSpawners-1.0-SNAPSHOT-all.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/silentprogram/betterspawners/BetterSpawners has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 60.0
wheat carbon
#

u need to run ur server with java 17

wise steeple
#

lol

#

i just checked

#

im using 16

wise steeple
#

😳

wheat carbon
#

@wise steeple also recommend changing the relocation in build.gradle to be ur proper package

#

I copied the relocation you had from maven which was silent_program

#

but your package is silentprogram

wise steeple
#

oof

#

im running minecraft 1.16

#

it doesnt support java 17

#

what do?

wheat carbon
#

go back to 16

wise steeple
#

but then the plugin doesnt compile

wheat carbon
#

change the VERSION_17 in build.gradle to VERSION_16

wise steeple
#

ah

#

@wheat carbon thank you so much

wheat carbon
#

np

#

now remember

#

don't be stupid and gradle will treat you nice

rugged bane
rugged bane
#

Wow you have guides for everything lmao

broken elbow
#

yes he does. they're cool

#

he's cool

#

and he's 121 years old

lyric gyro
#

rEpOrTeD

wheat carbon
#

😮

broken elbow
#

yes

lyric gyro
#

Bro I actually said this in this discord. And my shit got banned

#

Emily probably did report you too like a snake. So you’re done for.

wheat carbon
#

emily didn’t report me but have deleted it because i’m now scared

broken elbow
#

:kek;

lyric gyro
#

I didn’t report you so you should be good. I just thought it was funny cause I got banned for that exact sentence lmao. Just tedious to get it back

mortal timber
#

Does anyone have an idea how I can paste a schematic with Worldedit 6.0.0 (Minecraft version 1.8.8) with a self-made command?

cinder forum
#

there are youtube tutorials how to paste schematic using we api

mortal timber
#

Worldedit version 6.0.0 is missing classes that are used in tutorials (Apart from 7.0.0 and higher, but intended for higher Minecraft versions)

#

And maven does not find higher versions

lyric gyro
#

it works fine for aany other clolour but when its white or something similar it does it

rare gale
#

anyone know if MessageAnnouncer will be updated to 1.18 ?

hushed badge
lyric gyro
slim vortex
#

store them in region files, not worlds. then load them into memory

slim vortex
#

for the sake of modularity between islands. what if you eventually wanted to expand the island size to infinite? peoples islands would start to meet each other. if you spread them out you’d reach the actual physical world boarder quickly if you had a large number of players

#

It’s similar to giving each player their own world without the colossal size of each world folder

slim vortex
#

👍🏻

patent zephyr
#

Hi, I have question about working with config.yml.

You can often see in plugin something like:

items:
  '1':
    name: "my item"
    lore: 
      - "my lore"
      - "my lore"
  '2':
    name: "my item 2"
    lore: 
      - "my lore 2"
      - "my lore 2"

and my question is, how can I target the parameters of the item?

icy shadow
#

is that... all the code you've got?

#

loading != pasting

broken elbow
#

tru

icy shadow
#

uhh

#

no it didnt

#

that looks very different to the code you sent

broken elbow
#

you need to load then paste

icy shadow
#

^

hushed badge
mortal timber
#

Does anyone have an idea how I can paste a Schematic with the Worldedit API? I use Worldedit API version 6 because I need it for Minecraft version 1.8.8

dusty frost
#

yikes lol

dusky harness
#

How do i teleport a player after they die? I'm doing ```kt
Bukkit.getScheduler().runTask(plugin, Runnable {
Bukkit.getPlayer(player.uniqueId)?.let player@{ player ->
player.teleport(spawn)
println("Teleported ${player.name} to ${spawn.format()} 2")
}
})

broken elbow
#

don't you have to respawn them first?

dusky harness
#

hm

#

using Player#spigot().respawn()?

broken elbow
#

yes

dusky harness
#

I'll try ```kt
player.spigot().respawn()
Bukkit.getScheduler().runTask(plugin, Runnable {
Bukkit.getPlayer(player.uniqueId)?.let player@{ player ->
player.teleport(spawn)
println("Teleported ${player.name} to ${spawn.format()} 2")
}
})

lyric gyro
#

ok

icy shadow
#

ok

dusky harness
#

oh wait

#

that code isn't running

icy shadow
#

good

dusky harness
#

nvm

#

it is

icy shadow
#

I disagree

lyric gyro
dusky harness
#

does it update the player or smth?

lyric gyro
#

Yea

#

At least back in the days

dusky harness
#

interesting 🤔

#

ty 👍

lyric gyro
#

You should try and lmk. I want to see what happens with newer versions

toxic roost
#

Any idea on what would cause this?

#

I was thinking custom blocks maybe. But they're only mining stone

lyric gyro
#

what version is that?

toxic roost
#

Server version is 1.16.5, the player is also on 1.16.5

#

Via Version was 4.0.1, since been updated to the latest, 4.1.1. Still get this issue:

lyric gyro
dense galleon
#

https://paste.helpch.at/udalamiwit.json I tried making this loot table where it should be dropping both redstone dust and gold nuggets, but instead it just drops either one of the two. what am I doing wrong?

graceful hedge
#

Add another entry

#

Under pool entries

#

So like another json object in the json array

dense galleon
#

Ah I see

#

Say that it is an ore though

#

I'd have to have something like

#
  • If silk touch: drop ore
  • if not, drops these two items
#

How would I do that

#

Drops the ore with silk touch, but drops only either one of two items without silk touch

#

I thought it would work as alternatives should drop only either the ore, or the group of items

#

But instead it only drops one of the items in the group

molten wagon
#

Strange but I have to add ,"text":"" in the end to get it work like this ({"extra":[{"color":"yellow","text":" this is only"},{"text":" one color"}],"text":""})

slim vortex
#
Minecraft Wiki

The Region file format is a storage format for Minecraft chunks introduced in Beta 1.3, in which groups of 32×32 chunks (512×256×512 blocks, 67,108,864 total) are stored in a region file. This file format took the place of the Alpha level format, which had been in use since the Infdev development phase, in which chunks were stored in individual ...

#

You’re probably going to need an NBT api implementation as well

lethal plaza
#

who knows about matt's framework

icy shadow
#

matt probably does

slim vortex
#

Well you can always use javas file api to just read and write data like you would a text file

#

first load the contents into memory and process them using an nbt api or your own system, then make changes and write the new changes to the file

lethal plaza
icy shadow
#

i wasnt joking lol

shell moon
#

When using mysql, should the PreparedStatement created be close?

shell moon
#

in all cases? i mean using hikaricp too?

lyric gyro
#

yes

#

Connections, ResultSets and Statements

dusky harness
lyric gyro
#

and all the other things too

#

just use a try-with-resources for everything lol

shrewd geode
#
echo To continue, press any key.
pause >nul
cls
echo We are now configuring the network... Please wait...
ping localhost -n 3 >nul
cls
echo Copying profile file...
copy HVVC-Profile.xml C:\Users\Documents\%username%\HVVC-Profile.xml
ping localhost -n 3 >nul
cls
echo Applying Wifi Profile....
sc config dot3svc start=auto
sc start dot3svc
netsh lan add profile filename=C:\Users\Documents\%username%\HVVC-Profile.xml
ping localhost -n 3 >nul
cls
echo Profile complete, now attempting to connect to network....
ping www.google.com -n 1 -w 1000
cls
if errorlevel 1 (set internet=Looks like there was a problem connecting... Try to put in your login information...| set connected=False)
if errorlevel 0 (set internet=Looks like you are connected. | set connected=True)
echo %internet%
echo.
ping localhost -n 3 >nul
cls
if %connected%=='True' goto nextwifi
if %connected%=='False' goto retry

Would this work for batch?

lyric gyro
shrewd geode
#

wut

lyric gyro
#

Open link

grim oasis
#

did you click the link

shrewd geode
#

that's no help

#

and yes

lyric gyro
#

this link will help you a lot

grim oasis
#

Okay, what problems are you having with it?

lyric gyro
#

if you open and see what's there

shrewd geode
#

I did

grim oasis
#

it doesn't autoplay for me anymore @lyric gyro

#

weird

shrewd geode
#

I was just wondering if that code would work or not

#

for batch

grim oasis
#

how would we know

#

try it

#

you've given a pretty long piece of code

#

that seems pretty complex

lyric gyro
#

¯\_(ツ)_/¯

shrewd geode
#

It's fairly simple, i just wanna make sure I'm not missing anything

#

I'm creating this little program for my work to automate download and install profiles when needed

#

I also need to make a sh version of this script

#

so no one else knows dos

shell moon
# lyric gyro just use a try-with-resources for everything lol

i make it like

try (Connection con = getConnection();PreparedStatement ps = con.preparedStatement("etc etc")){
  ps.setString blah blah
  ps.executeUpdate(); or ResultSet resultSet = preparedStatement.executeQuery();
  then if(resultSet.next()) etc etc
  //SOMETHING
}catch(SQLException e){
}
```is is necessary to close the result set too?
#

or it's necessary to have a

try{resultSet.close();}catch(SQLException ignored){}``` in the //SOMETHING line
lyric gyro
#

put it in a twr

orchid otter
#

Is there a way to cancel the entity sound effect when its damaged

slim vortex
#

PacketPlayOutNamedSoundEffect

#

intercept that and If it contains the name of an entity cancel it

gritty sleet
#

I found a bug, basically it consists in crashing to recover several times some thing.
Example: You have a store in deluxemenu to pay a pickaxe is 100$, you have the money, you crash and you can recover several times the pickaxe while you have just 100$.
It's a pity because some players make duplication bugs via store or other menu that ask for a payment with a reward

fading fiber
#

Anyone know how to fix this with mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)```
gritty sleet
#

crash connection

dense drift
#

I've never had this issue, idk what you are talking about

gritty sleet
#

A player in my server use this to have so many item

dense drift
#

Things are done on the server's end, once the tranzaction is done, the client can disconnect and it shouldnt affect the data that's on the server

dusky harness
#

What is the difference between Bukkit.setWhitelist and Bukkit.setWhitelistEnforced?

atomic echo
#

If the whitelist is enforced, non-whitelisted players will be disconnected when the server whitelist is reloaded.

dusky harness
#

what about setWhitelist?

atomic echo
#

That just sets if the server is whitelisted

dusky harness
#

but isn't that what enforced does?

lyric gyro
#

if enforce-whitelist is set to false, you can turn the whitelist on in-game and non-whitelisted players will still be in-game

dusky harness
#

oh

lyric gyro
#

if it's set to true, anytime it's reloaded (and turned on) they'll be kicked

dusky harness
#

ty

lyric gyro
#

WorldCreator#createWorld() should load the world if it already exists

#

unless you're unloading it without saving it or deleting it in-between reloads everything should be there

gritty sleet
slow meteor
#

is there a way in DeluxeChat that i can use "tracks" in LuckPerms? if so how

tight junco
slow meteor
#

ah, gotta register

#

let me get the owner of the jar to do it, im just a configurator for him

dense drift
gritty sleet
dusky harness
#

this should be named #coding-help 🥴

lyric gyro
#

coding configs?

dusky harness
#

:smiling_face_with_3_tears:

robust crow
#

People complain about this channel name no matter what it is

dusky harness
#

funnycube 👀

dusky harness
robust crow
#

Don't actually remember, but I put it to a vote at one stage

lyric gyro
#

people also post things when they need help in other channels in #showcase because they have image perms lol

robust crow
#

Yeah we limited it to tier 1 and above which has stopped most of that

marble nimbus
#

Hey how could I make a circular Worldborder? maybe with clientsided Particles? (I am bad with Math and stuff

queen plank
lyric gyro
#

you're gonna have to share a fair bit more code than that

queen plank
lyric gyro
#

is this in an event, in a command, on a timer?

queen plank
#

Event

#

It is a massive switch

#

I cut out a lot to make it possible to read

lyric gyro
#

what event?

queen plank
#

Ugh, it is a function. Activated by multiple events

marble nimbus
# slim vortex have you taken trig

not really, I live in germany we don't really have classes for that. we have a class called "math" in which we just learn 3000 things at once

slim vortex
#

well to make a circle use sin and cos

#

rotate theta from 0 to 2pi and the X coord is cos(theta)*radius and Y is sin(theta)*radius

vapid shuttle
#

It's been a long time since I've done Spigot programming, but I'm a pro software dev.

What's the most straightforward way of matching a block to a partial blockstate.

e.g. if I want to test a block being placed in an event, against a matching mojang blockstring like minecraft:petrified_oak_slab[type=bottom] or minecraft:petrified_oak_slab[type=top] whilst ignoring waterlogging (because it's not in the block state written).

How would I go about doing that?

vapid shuttle
#

blockdata.matches

molten wagon
#

Is it way to include jar for jitpack shall not give errors (is one dependency i have locally)?

lyric gyro
#

hy, My other account has been banned for viral spam! I'd like to get it back. I deleted the virus from my computer!

robust crow
#

Banned from Helpchat or discord?

mortal timber
#

Does anyone have a tested method for Minecraft version 1.8.8 (Worldedit 6) to paste schematics?

amber storm
#

Is there any way to get a block's "facing" property?

lyric gyro
robust crow
#

this is a minecraft chat

lyric gyro
#

this is development room

robust crow
#

for minecraft

lyric gyro
#

i m say 5 admin and no react..

robust crow
#

hm?

dusty frost
#

no react!

orchid otter
#

what method should i be using to print stuff to the console

dusty frost
#

as in like, logging?

#

JavaPlugin#getLogger().info("blah blah");

icy shadow
#

log4j 2.15.0 is probably what you want to use :)

dusty frost
#

hey even log4j 2.16.0 is still vulnerable to a DoS ;)

icy shadow
#

😌

dusty frost
#

and this, kids, is why we use Logback 😌

sleek wedge
#

I need an idea for start an plugin for fun xd

graceful hedge
void orchid
wheat carbon
#

"affected"

#

logback vulnerability was way less severe than log4j

#

you need to be able to modify the logback config for the logback vulnerability

#

and if you have access to that... that's a much bigger issue

dusty frost
#

^

#

Logback is significantly simpler than log4j, and has 99.9% of what 99.9% of people need from a logging framework

void orchid
dusty frost
#

the things a single google search can solve 😌

wheat carbon
#

honestly I'm not even sure it's fair to call it a vulnerability

#

cuz if u have access to the logback config file, then you can straight up put whatever code in there u want

#

why would you even change the config file if you could change the entire program lol

icy shadow
#

holy shit guys, there's a critical vulnerability in linux! if someone is in the sudo group they can run ANY command on your system!

dusty frost
#

oh no! our kernel! it's broken!

wheat carbon
#

need regex halp

#

got this pattern
@.+?(?(?=\()\)|\s)

#

this sample:

@Deprecated test
test@Contract("null -> null; !null -> !null")
@Nullable test```
#

should select

  • @Deprecated
  • @Contract("null -> null; !null -> !null")
  • @Nullable
#

tried using a conditional to only end with whitespace if a ( isn't found, but it doesn't work

high edge
#

if you find a (, just include everything till you find a )

#

What I'm saying is, loopty loop

wheat carbon
#

yes that worked

#

next question

#

any idea how to make it not match the space

wheat carbon
#

current pattern is this @.+?(?(?=\().*\)|(\s|$))

dense drift
#

The problem is that .+

#

replace it with \w+ and other characters accepted by java for class name

#

@\w+(\([^)]+\))?

wheat carbon
#

replacing the .+? with \w+ still selects the space

#

your edited pattern seems to work

#

thx

dense drift
#

Np pig

wheat carbon
#

@dense drift found another issue

dense drift
#

nested annotations?

wheat carbon
#

do you know how to make it count the parentheses?

dense drift
#

thonk

#

nope, sorry 🤣 I only know like basic regex

wheat carbon
#

damn

dense drift
#

how does it handle annotations that are split on multiple lines btw?

#
@Something(
  a = 1,
  b = 2
)```
#

or they are folded

wheat carbon
#

believe they're folded, your pattern matches that fine though

dense drift
#

True

#

Do you get these from the javadoc jar or source code?

wheat carbon
#

jar

#

javadoc jar

dense drift
#

And are annotations on the same element as params?

wheat carbon
#

sometimes

#

^ on old javadocs they are

#

that's what this is for

#

this isn't an issue on newer java versions

dense drift
#

Shit

dusky harness
wheat carbon
#

how do you propose I check this manually

dusky harness
#

loop

#

and stuff

broken elbow
#

🥲

dusky harness
#

go character by character 🙃

#

i mean.. regex can do it, so you can too fingerguns

wheat carbon
#

might have to

broken elbow
#

how come you use a tool that's suppose to help you not have to do things manually instead of doing things manually

dense drift
#

Hf pig

pulsar ferry
#

Hmm actually that might break on other things

robust flower
#

does PluginMessageListener (spigot) run on threads other than Main thread by default?

wheat carbon
#

it merges some annotations

#

but that's definitely getting closer

lyric gyro
#

wait until you find out recursive patterns aren't regular

#

god this salmon color is weird

hard wigeon
#

Is there a way to load a config that's still inside a plugin's jar as a YamlConfig?

#

since I'd like to load it without letting people edit it

wheat carbon
#

probably not using spigot's yaml config api

lyric gyro
#

surely you can

wheat carbon
#

d;spigot yamlconfiguration#loadfromstring

uneven lanternBOT
#
public abstract void loadFromString(@NotNull String contents)
throws InvalidConfigurationException, IllegalArgumentException```
Description:

Loads this FileConfiguration from the specified string, as opposed to from file.

All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given string.

If the string is invalid in any way, an exception will be thrown.

Parameters:

contents - Contents of a Configuration to load.

Throws:

InvalidConfigurationException - Thrown if the specified string is invalid.
IllegalArgumentException - Thrown if contents is null.

wheat carbon
#

to get the content, Resources.toString(MainClass.class.getResource("/config.yml"), StandardCharsets.UTF_8);

hard wigeon
#

cool thanks

broken elbow
#

but they will still be able to edit it by opening the jar and putting the file the plugin folder right?

hard wigeon
#

it's okay if they can edit it by unziping the jar

#

and editing it

#

and putting it back in

#

I don't care enough for that

lyric gyro
#

how may people actually do that tho

hard wigeon
#

if people cared they could decompile the plugin for god sakes

#

I'm just trying to add some configs for patreon members on mine, but for people who just download the public one they just get the default settings

wheat carbon
#

ended up doing it manually

#

seems to work

robust flower
#

why check for the chinese character? 🤔

wheat carbon
#

that signals the start of the parameters

#

the method/field name + ( is replaced with that char

#

the char is arbitrary, I just chose a char that should ideally never appear elsewhere

lyric gyro
#

that.. doesn't work with annotations without parenths?

wheat carbon
#

ur right

#

need to add more code

dense drift
#

I see you are having fun pig

lyric gyro
#

parsers are fun

wheat carbon
#

new code that might work

dense drift
#

Btw doesnt StringBuilder#setLength(0) reset the buffer?

#

Yes, it does

wheat carbon
#

will do that

dense galleon
#

How do I send a Java "error" message?

#

So that when I send it in the console it's not [INFO]

#

but [ERROR]

broken elbow
#

use a logger library

dense galleon
#

is doing System.err.println() wrong?

tranquil hamlet
#

Can someone help me with adding my plugin to the PAPI wiki?
I don't really understand how it works. I've tried creating a pull request but it got labelled as invalid.

pulsar ferry
#

The Github actions message explained it for you, you need to target the docs/wiki branch, you targeted master

robust flower
#

In a bungee network with Bungeecord online mode on, and all other spigot servers with online mode off, will Player#getUniqueId (on spigot servers) and ProxiedPlayer#getUniqueId (on bungeecord) return different results?

tranquil hamlet
dense drift
#

I dont think so, SecretX

tranquil hamlet
#

Oh, forgot it. But everything else is fine?

warm steppe
#

send code mby?

broken elbow
warm steppe
#

ah oky

hard wigeon
#

How do I make anvils do damage when I drop them on someone?

#

just making a falling entity doesn't do damage

leaden sinew
#

How do I create a world generator that I can use in other plugins by using its name?

mortal timber
#

Does anyone have an idea how to copy a world?

leaden sinew
#

You can copy the folder

lyric gyro
#

god this color is so weird

hard wigeon
#

yeah I agree

#

can we get @ cube in here to remove like 20k xp from emily

tranquil hamlet
hard wigeon
#

My color's wierd too, I just don't need to look at it :p

hushed badge
#

so if its an internal change u would add [x]

tranquil hamlet
leaden sinew
#

I want to put the name in Multiverse and have it be generated through Multiverse, or is that not possible?

mortal timber
leaden sinew
mortal timber
#

Sure?

leaden sinew
#

What does sure mean lol

mortal timber
#

Of course I have already made plugins

leaden sinew
#

Do you know how to copy files with Java?

hoary scarab
leaden sinew
#

I'm asking them if they do

hoary scarab
#

Ah just read the question not the convo xD

mortal timber
#

I copy the folder, but you also have to load the world, and this creates a completely different world for me and not the one that is copied

leaden sinew
#

You can do new WorldCreator(name).copyWorld(world)

hushed badge
tranquil hamlet
lyric gyro
tranquil hamlet
#

Sorry but its the first pull request I ever made

mortal timber
leaden sinew
#

Could you show your code?

mortal timber
#
        worldCreator.copy(Bukkit.getWorld("void"));
        worldCreator.createWorld();```
leaden sinew
#

What happens?

mortal timber
#

A world is created, but the wanted world is not copied

lyric gyro
#

that doesn't copy the actual world, it just copies the generation properties

mortal timber
#

And how do I copy the world?

lyric gyro
mortal timber
#

When I copy the folder I also have to load the world, how do I do that?

lyric gyro
orchid otter
#

Im looking to check if a player has sent a specific string in any kind of message, like a message or a command anything like that

#

what event would let me achieve this

mortal timber
lyric gyro
#

how are you checking?

lyric gyro
hoary scarab
lyric gyro
#

the vomit spigot is

#

paper leaves it squeaky clean

hoary scarab
#

Paper has too many tears in it LMFAO

lyric gyro
#

what is that supposed to mean

hoary scarab
lyric gyro
#

okay you're definitely smarter than me, what's so bad about Paper over a decade-old stagnant software with legacy API with no improvements withheld by a single person?

hoary scarab
#

Whats wrong with it? List is to long. I can tell you the only thing good about it. It stops when you run /stop unlike spigot that takes for ever sometimes.

lyric gyro
#

Please enumerate the things that are wrong

leaden sinew
#

List a couple things

lyric gyro
#

Better API? That is soooo wrong

#

Performance improvements all over the place? Oh please no disgusting

hoary scarab
#

Errors, lag, entity modifications, api is lacking, the list goes on.

lyric gyro
#

Bug fixes for both Minecraft and Spigot? Oh ew, that's hideous

#

API is lacking you've got to be kidding me

#

This has got to be satire

leaden sinew
#

You can do the same things as you can with Spigot lol, how is API lacking?

lyric gyro
#

Paper API extends Spigot API, if anything Spigot's is more lacking

hoary scarab
leaden sinew
#

No its not

leaden sinew
#

As Emily said, it extends the Spigot API

#

So you can use all the same Spigot methods

lyric gyro
#

it literally rebases on top of spigot

leaden sinew
#

Aren't they going to stop depending on Spigot soon?

lyric gyro
#

"soon"

#

been hinting that since 1.15/.16

#

but it's a long and tedious process for them

hoary scarab
# lyric gyro name them

Don't have the code anymore.

I can give an example of an errors and other the api gives.
When you set the players velocity paper errors.
When you use System.out paper gives a dumb message. (I know it can be disabled now but Its still there.)
Paper modifies entities on chunk loading causing issues. (Use to, IDK if thats ever been fixed.)

lyric gyro
#

When you set the players velocity paper errors
no it doesn't?? wtf

leaden sinew
#

Someone had a NPE

lyric gyro
#

When you use System.out
yeah... because you shouldn't use it 🙃 use a proper logger

lyric gyro
#

JUL, SLF4J

#

pick your poison

hoary scarab
#

🤦 They make you do a form to download below 1.17 xD

lyric gyro
#

of course

#

no sane person supports old shit

hoary scarab
slim vortex
#

how are they going to stop depending on spigot

#

are they going to magically swap out all of the mojang code

leaden sinew
#

What?

lyric gyro
#

Spigot and paper suck

#

Idk what this argument about lmao

#

Nothing can ever fix that dog shit especially with the more ass added every version

broken elbow
#

we should all switch to using Krypton :kek:

lyric gyro
#

Not even :3

#

Well maybe for others personally not me

#

Krypton is still single threaded using netty iirc?

leaden sinew
dense galleon
#

Alright

#

I have been seeing this Predicate thing around the Fabric API and I don't understand what it means when it wants a predicate

#

Is it a Java thing or a Fabric thing

lyric gyro
leaden sinew
#

Wdym took larger steps?

hushed badge
graceful hedge
marble nimbus
#

when I have a class that has a constructor which loads stuff from a config. Is it possible to make it return null if something went wrong.

so lets say I have MyObject myObject = new MyObject();

is it possible to make myObject be null if something in the Constructor goes wrong?

#

fyi its just something I have thought about nothing I need

graceful hedge
#

Static Factory

#

class MyObject {
static MyObject create() {
if(something) {
return null;
}
return new MyObject();
}
}

#

Then use
MyObject myObject = MyObject.create();

lyric gyro
#

factory pattern good

leaden sinew
#

Or just throw an error

lyric gyro
#

god no that's horrible

leaden sinew
#

Either way I think its pretty bad, loading values from a config in a constructor

graceful hedge
#

Yeah probably is

lyric gyro
#

that's why it will be in a factory method and not in the constructor itself fingerguns

wise steeple
#

In intellij, whenever i share a project to github it shares my entire intellij folder, and other projects.

#

Like not only the project i am viewing

#

I hit share

#

and then this happens

#

But theres nothing in the other folders

#

except a .iml

#

I am using gradle

dusty frost
#

I have never clicked that button before ngl

#

Just use normal git commands

hard wigeon
#

What's the best library for dealing with audio & discord bots in java?

#

Maybe even real-time speech to text it possible

pulsar ferry
#

I think google has something for text to speech
There's probably some open source ones too though

#

But "best" is very hard to find

hard wigeon
#

Just specifically in java

#

Since I want to make a discord bot in a spigot plugin with voice recognition

leaden sinew
#

Voice recognition?

hard wigeon
#

So real time speech to text

#

Then parsing

leaden sinew
#

Just hire a permanent person to always listen

#

I’ll do it for $57.86/hr

hard wigeon
#

The issue is I want to publish it

#

Otherwise I'd make some janky NodeJS bot

wise steeple
#
            event.setCancelled(true);
            if (event.getAction() != InventoryAction.PICKUP_ALL) return;
            if(event.getCurrentItem() == null || event.getCurrentItem().getType() != Material.SPAWNER) return;
            ItemStack itemStack = event.getCurrentItem();
            if(itemStack.getItemMeta() == null || (!itemStack.hasItemMeta())) return;
            PersistentDataContainer itemData = itemStack.getItemMeta().getPersistentDataContainer();
            if(!itemData.has(plugin.ENTITY_TYPE_KEY, PersistentDataType.STRING)) return;
            Player plr = (Player) event.getWhoClicked();
            String group = "gui.groups.default-group";
            for(String i : config.getConfigurationSection("gui.groups.custom-groups").getKeys(false)){
                if(plr.hasPermission("betterspawners.group." + i)){
                    group = "gui.groups.custom-groups." + i;
                    break;
                }
            }
            int itemAmount = pages.getItems().size() + 1;
            
            if(itemAmount > config.getInt(group +".spawner-amount")) return;
            List<ItemStack> itemList = new ArrayList<>();
            if (config.contains(plr.getUniqueId() + ".spawners")) {
                itemList = (List<ItemStack>) config.getList(plr.getUniqueId() + ".spawners");
            }
            ItemStack itemClone = itemStack.clone();
            itemClone.setAmount(1);
            itemList.add(itemClone);
            itemStack.setAmount(itemStack.getAmount()-1);
            dataConfig.set(plr.getUniqueId() + ".spawners", itemList);
            createGui(plr).show(plr);

Basically that itemList is taken from the config, then an item is added to it. Then the itemList is set back in the config to be used later.
My problem is that if an item is identical to another item in the list it just kinda doesnt work
Leme get the part where it populates a gui with the itemStacks`

#
        List<ItemStack> inventoryItemList = new ArrayList<>();
        if (dataConfig.contains(guiPlr.getUniqueId() + ".spawners")) {
            inventoryItemList = (List<ItemStack>) dataConfig.getList(guiPlr.getUniqueId() + ".spawners");
        }
```
That list is then used here
```java
        int itemsPerPage = this.height * this.length;
        int pagesNeeded = (int) Math.max(Math.ceil(items.size() / (double) itemsPerPage), 1);

        for (int i = 0; i < pagesNeeded; i++) {
            OutlinePane page = new OutlinePane(0, 0, this.length, this.height);

            for (int j = 0; j < itemsPerPage; j++) {
                //Check if the loop reached the end of the list
                int index = i * itemsPerPage + j;

                if (index >= items.size()) {
                    break;
                }

                page.addItem(new GuiItem(items.get(index)));
            }

            this.addPane(i, page);
        }


```
#

It causes one item to show up rather than them to show up as different stacks

wise steeple
#

io fixed it

brittle thunder
#

For a second, I thought this was another one of bm's multiple personalities coz of the dp

warm steppe
#

use this bruv

hard wigeon
#

what's a good config API that keeps comments, and is simple to add / change config values

slim vortex
#

Uhh that’s going to be hard to find

#

Keeping comments while writing to a file is pretty difficult and I’ve yet to find one that can do it after searching for years

broken elbow
#

yeah. configme, spigot's, configurate, matt's lib, they all can't do this

#

I have not tested SilentX's lib but I doubt it does support that.

#

who the fuck is SilentX?

#

I meant SecretX

slim vortex
#

Configurate is good though

wheat carbon
#

I am secretx

broken elbow
#

ok

#

didn't ask

wheat carbon
#

oh

broken elbow
#

asked who SilentX is

#

:)))

wheat carbon
#

I am silentx

broken elbow
#

cool

cinder forum
#

Is using static for accessing ArrayLists/HashMaps ok?

wheat carbon
#

elaborate

#

there's ambiguity within the question

cinder forum
#

Well
I want to use same ArrayList in multiple classes (in one add items to it, in second check if arraylist contains something)
Can I just make static getter for the list to access it in both classes?

wheat carbon
#

no

#

that would be static abuse

broken elbow
#

smh

#

how dare you abuse static?

wheat carbon
#

honestly might just ban you

cinder forum
#

So this is the right way?

wheat carbon
#

I love it when people who don't know java answer questions for java

broken elbow
#

:kek:

#

me and dkim

wheat carbon
#

and it's actually an accepted answer!

dense drift
#

for real

wheat carbon
#

@cinder forum that probably wouldn't work for your situation

#

let's say class a has the array list, you need to access it in class a & class b

#

you've got your instance of class a that you instantiated somewhere

#

where is irrelevant

#

to access class a's arraylist in class b, you'll need 2 things

#

a state-bound getter in class a to retrieve that arraylist (or ideally, add/remove methods)

broken elbow
#

you'll need the first thing and the second thing

wheat carbon
#

and you'll need to accept an instance of class a in class b's constructor, to then be able to access your instance of class a in class b

#

^ dependency injection

#

when you then instantiate class b, you can pass in your instance of class a

#

to ensure the arraylist's contents are preserved, you'll need to consistently use the same instance of class a

broken elbow
#

its not as hard as you make it sound

#

please delete that now

cinder forum
#

alr Piggy, thank you for explanation theotherpig

broken elbow
#

it hurts my brain

#

or at least make it spoilers

#

jesus

wheat carbon
#

feel free to ask for more assistance on anything in my explanation that you didn't understand

#

ik you may not understand "instantiate" and "instances" seeing as you were asking about static in the first place

#

and I'm more than happy to help - if you actually need it

broken elbow
#

xdd. sorry. really had to delete that. my head hurts from it

wheat carbon
#

I imagine you hate these gifs blitz (=pig, =funnycube, etc)

broken elbow
#

but for some reason that one was really messing with my brain

wheat carbon
#

you allergic to pepe or something?'

broken elbow
#

no. I Love pepe

#

smh. fred

wheat carbon
#

think glare does have one

#

can't remember the command

broken elbow
#

one of the admins doesn't have one

#

=clip

#

is it clip?

#

I swear I used glare's before which is literally just the text glare

#

but don't remember the command

wheat carbon
#

glare does have one

#

just not working for whatever reason

#

checked the code

broken elbow
#

ah

#

lol

#

imagine having access to barry

hard wigeon
#

=glare

broken elbow
#

kek

hard wigeon
#

=official_clip

#

=extended_clip

#

=paperclip

#

@UncookedBacon why doesn't it work smh

wheat carbon
#

yes

void gyro
#

Could someone help with this problem? So im using nms and i want to edit a book and quils nbt and so there is a tag list "pages" and then inside the pages there are individual strings aka a page, and so ive created the tag list with

NBTTagList pages = new NBTTagList();
``` but how can i add the string(page) to that list? I suppose it will be a NBTTagString although i cant find a way to add it
cinder forum
#

How to make plugin that don't break when server is reloaded? Is that possible?

broken elbow
#

maybe. you shouldn't worry about that tho. people should not use reload

cinder forum
#

I'm just curious what stuff breaks it etc

#

also is this good way to check if clicked block is X

pulsar ferry
#

EnumSet

broken elbow
#

yeah. I'd personally use a set instead of a list

#

matt too fast

cinder forum
#

Thanks

pulsar ferry
lyric gyro
#

which is a good thing

#

enums suck, registries should be used for all this really

#

a great example is the "CUSTOM" dimension/"environment"

#

like what the fuck is that supposed to mean how am i supposed to integrate with that

#

spoiler alert: you're not

#

Oh fuck that also means switch will be no longer valid for a lot of things

#

Damn

#

This is actually huge lol

sudden sand
#

[19:39:01 WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''username' VARCHAR(16),PRIMARY KEY(username),'kill' INT(200000),'death' INT(2000' at line 1 Do someone see any syntax error ?

cinder forum
#

INT(2000
is ) there?

#

btw

sudden sand
#

it is it's just the print that doesn't show it

cinder forum
#

isnt int limit 255?

sudden sand
#

wait

#

how is that that short ?

cinder forum
#

i think its

#

2^255

#

not 255

#

but im not sure

sudden sand
#

2147483647

somber seal
#

though I will miss my beloved switch statements 😢

lyric gyro
#

This might actually be the one time forwards compatibility is broken on a large scale

#

Unless of course they pull some class loading fucky hackery to preserve old behavior like they did from 1.12 -> 1.13

#

Though I doubt so

cinder forum
pulsar ferry
#

Why are those static?

pulsar ferry
cinder forum
#

Its in custom config tutorial

#

🤔

wise steeple
cinder forum
lyric gyro
#

Matt knows

warm steppe
cinder forum
#

pog, thx

glacial yacht
#

Add support for java 8, And the plugin does not work on 1.12.2 please plugin DeluxeMenus

hard wigeon
neat pierBOT
#
Deluxemenus - Version List
Spigot:

1.8.8
1.12.2
1.16.5
1.17.1

Version:

v1.10.5
v1.13.3 - Latest
v1.13.4 - Dev Builds
v1.13.4 - Dev Builds

neat pierBOT
#
Vault - Version List
Spigot:

1.8.8
1.12.2
1.13.2
1.14.4
1.15.2
1.16.5
1.17.1
1.18.1

Version:

v1.6.7
v1.6.7
v1.7.3 - Latest
v1.7.3 -Latest
v1.7.3 - Latest
v1.7.3 - Latest
v1.7.3 - Latest
v1.7.3 - Latest

glacial yacht
#

I just downloaded the latest version of the plugin and offers java 11 and I have java 8

formal crane
#

Is it better to save data in .json files for players?

#

or yml

fiery pollen
#

What about mysql database?

formal crane
#

sounds harder

fiery pollen
#

You'll have to learn it eventually, why not sooner?

formal crane
#

i cant find good tutorials on sqlite

#

does sqlite still require anyone to make a database?

pulsar ferry
#

The SQLite file itself is the database

cinder forum
#

Hello, I have this issue: Call to 'super()' must be first statement in constructor body
But the problem is when it's first this.plugin is null in functions, how to avoid that? 🤔

lyric gyro
#

what are you trying to do

lyric gyro
#

i.e. show code

#

please please please please don't handle IO/logic in constructors, either have a separate init/load/etc method that do that (initialize/load things) or pass the relevant values through the constructor

cinder forum
#

confusion
what line do IO in constructor?

lyric gyro
#

for all means and purposes, this is effectively in the constructor (since it happens when the object is constructed)

protected ItemStack FILLER_GLASS = new ItemBuilder(Material.valueOf(getFillerMaterial()), 1, getFillerID())
    .name(ColorHelper.translate(getFillerName()))
    .build();

and you're calling getFillerMaterial and getFillerName

cinder forum
#

alr, thank you 🙂 👍

lyric gyro
#

yeah i suggest moving that logic to a separate method you call after construction

#

or

#

initialize it in the subclass constructor

lyric gyro
#

Its minecraft

formal crane
#

redis?

trail hedge
#

I'm trying to figure out how to edit the Ender dragon skills and bossbar but can't find any useful information, I've been searching for hours. Can anyone guide me? Thank you very much !!

cinder forum
dusky harness
#

I updated some packet stuff from 1.8 -> 1.17 but it doesn't work anymore, the armorstand is just a regular armorstand with no extra data :/
https://paste.helpch.at/iwaduqefec
Before I just set the metadata when spawning the armor stand but that isn't in the spawn packet anymore 🙃
The code that I'm running when spawning the armor stand is setName(lastName.get())

Expected:

  • armor stand with a custom name and always showing
  • armor stand invisible

teleporting the armor stand works fine

Helpful pages: https://wiki.vg/Protocol#Entity_Metadata
https://wiki.vg/Entity_metadata
https://wiki.vg/Entity_metadata#Entity
https://wiki.vg/Entity_metadata#Armor_Stand
Things I changed (that I remember, since I changed it a while ago before noticing that the holograms don't work anymore):

  • using WrappedDataWatcher.WrappedDataWatcherObject instead of just putting the objects in for the metadata
  • applied the metadata in a separate packet instead of in the spawn packet
#

packets are fun when i get it to work but horrible when i don't get it to work ☹️

lyric gyro
#

ok

dusky harness
#

:(

icy shadow
#

ok

lyric gyro
cinder forum
#

wdym by init method?

lyric gyro
#

have a separate init/load/etc method that do that (initialize/load things)

cinder forum
lyric gyro
#

Hey i want to make a plugin that only allows Totems to go into a Hopper. What kind of event do i use there. Like there is no InventoryChangeEvent or smth

#

I didnt found an event that lets you check for a new item in an inventory (from other input source than Player for exmaple Dispenser or another Hopper)

grim oasis
#

?

lyric gyro
#

uhh that kinda hurt rn

grim oasis
#

I clicked on event then inventoryevent

#

then saw the rest

lyric gyro
#

how do i get the name of the inventory?

grim oasis
#

well there isn't a "name" till you open it

#

so you'd wanter to get the Hopper block and get the name from that i believe

lyric gyro
#

Thank you very much i'll try it

#

found a way

#

Container cont = (Container) event.getInventory().getHolder(); and then get the name of the Container

#

Thank you very much ❤️

lyric gyro
atomic echo
lyric gyro
#

Thanks :3

wise steeple
#

to save a data file should i save every 5 mins with a runnable, as well as on disable?

lyric gyro
#

depends what it is man

#

up to you

dusky harness
#

i personally just save on every time i modify it 🙃

#

but if you modify a lot maybe a runnable is better

cinder forum
#

Is for Duels plugin better SQL (PostgreSQL) or no SQL (Mongo) database?
Practice means saving

  • players stats for every kit
  • players settings
  • players kit inventories
  • very probably smth more but I forgot
graceful hedge
#

Sounds like structured data to me so the former

dense drift
#

@orchid nymph @noble grotto #bot-commands

lyric gyro
#

Most the shit you save for duels are primitive values anyways

rugged bane
sudden sand
#

CREATE TABLE IF NOT EXISTS esplayerdata (username VARCHAR(16),PRIMARY KEY(username),kill INT(200000),death INT(200000),killstreak INT(200000),level INT(200000),xp INT(200000)) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci Is there a syntax error ?

#

it's giving me this error:

#

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'kill INT(200000),death INT(200000),killstreak INT(200000),level INT(200000),xp I' at line 1

cinder forum
rugged bane
cinder forum
#

Well what is easier for implementing data on web? (leaderboards, match inventories, ...)

#

Mongo?

sudden sand
#

SQL and mongo both are fine for this

#

But I prefer SQL for implementing data on web or discord whatever

rugged bane
#

Because SQL alone is fast

cinder forum
#

well idk I worked w SQL in Java, w Mongo never but working w JSON files is really easy in Go 🤔 Using SQL would be kinda pain

sudden sand
#

yes with golang but who uses golang for web lol

cinder forum
#

me

cinder forum
rugged bane
#

You can practically insta query like 80mil rows with SQL

cinder forum
#

😳

rugged bane
#

That’s the best I ever got to anyway 😂 haven’t tried higher

cinder forum
#

Also what is best way to count playtime? I know some plugins that show playtime w seconds but ig making repeating task that update db every second isnt best way xd

#

(without using statistic if possible)

lyric gyro
#

getAndAdd

cinder forum
#

oh yeah that makes sense ty xd

hot ruin
#

Please help, how do I reformat the player join message on paper 1.18.1 ? event.setJoinMessage is deprecated and is now event.joinMessage wich now takes a Component and not a String but I want to replace %player by the player's name but it wont accept it because it becomes a String and not a Component
sUtils is where are all my messages

@EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Player p = event.getPlayer();
        event.joinMessage(sUtils.chat_player_join.replace("%player", p.displayName()));
    }```
dense drift
#

d;spigot Bukkit#getOfflinePlayer(UUID)

uneven lanternBOT
#
@NotNull
public static OfflinePlayer getOfflinePlayer(@NotNull UUID id)```
Description:

Gets the player by the given UUID, regardless if they are offline or online.

This will return an object even if the player does not exist. To this method, all players will exist.

Parameters:

id - the UUID of the player to retrieve

Returns:

an offline player

dense drift
#

does this method by any chance first check if there's an online player with that uuid? xD

rugged bane
#

I think you have to null check it yourself

dense drift
#

it is NotNull

rugged bane
#

oh wow

dense drift
#

I was just wondering if I would first use Bukkit#getPlayer and then Bukkit#getOfflinePlayer

rugged bane
#

I thought you had to do

if(Bukkit.getPlayer(x) != null) {
// online
} else {
// get offline
}
#

Yeah you're right

#

iirc its been agesss since I did plugins

dense drift
#

nice, it does check first through online players

rugged bane
#

Oh it does :o

#

d;spigot Bukkit#getPlayer(UUID)

uneven lanternBOT
#
@Nullable
public static Player getPlayer(@NotNull UUID id)```
Description:

Gets the player with the given UUID.

Parameters:

id - UUID of the player to retrieve

Returns:

a player object if one was found, null otherwise

rugged bane
#

i wish this had a param for returning offline if they aren't online

dense drift
#

well a Player is different from an OfflinePlayer

#

You can pass a Player to a method that requires an OfflinePlayer but not the other way around from obvious reasons

rugged bane
#

Ah I see that makes sense yeah

cinder forum
#

What is best format to store time of last connection to get number of seconds from the last connection to time that method is executed?

rugged bane
#

Store in a map perhaps, then check if the map exists, get the value and calculate against current time

cinder forum
rugged bane
#

It's an optimised version of MySQL, of course, you can still optimise it further for best performance, but a solid solution

dusty frost
#

mmm and open source

#

Postgres is cool too, though

lyric gyro
graceful hedge
#

Yeah which returns the player if the player is online or null

graceful hedge
#

Same, bomp :3

shell moon
#

Plugins using mysql connector in spigot 1.8.8 have issues with MySQL 8+, can that be solved if the plugin shades and updated mysql connector? (If so, latest one?)

robust flower
#

if I made a plugin to be run in 1.8, I would definitively shade EVERYTHING related to databases (latest version), except HikariCP (because version 5+ is compiled against Java 11, so you need to use version 4.0.3)

robust flower
shell moon
#

So it worked fine when you shaded it? I use one jar for all versions, no issues when using it in 1.18 for example?

robust flower
#

it should work just fine, unless you don't relocate

#

but don't quote me on that

shell moon
#

SecretX told me to

spring nebula
#

how can I make a check if there is a magic format &k?

    /**
     * Check in a input name for the guild is proper
     *
     * @param name            the name input
     * @param settingsManager setting manager
     * @return valid or not
     */
    public boolean nameCheck(String name, SettingsManager settingsManager) {
        String regex = settingsManager.getProperty(GuildSettings.NAME_REQUIREMENTS);
        if (!settingsManager.getProperty(GuildSettings.INCLUDE_COLOR_CODES)) {
            String tmp = StringUtils.color(name);
            return ChatColor.stripColor(tmp).matches(regex);
        }
        return name.matches(regex);
    }
shell moon
#

String#contains("&k") ? xd

dense drift
#

cache the regex 🥲

warm steppe
#

father check

spring nebula
# shell moon String#contains("&k") ? xd

yes, I wanted to do this at first, but then I thought that there would be problems with the RGB, but now it has dawned on me that everything will be fine. thank you 🙂

shell moon
#

why? xd

#

hex dont use k

spring nebula
#

I just realized that xd

formal locust
#

org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml

at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:154) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at java.lang.Thread.run(Thread.java:823) [?:1.8.0_272]

Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml

... 6 more```
#

what does this mean

#

can anyone please help

#

i have a plugin.yml

dusty frost
#

Are you shading it?

#

Open your jar file with like winrar or 7zip and look at it

formal locust
#

i didnt understand

dusty frost
#

Are you using Maven or Gradle?

formal locust
#

yes

dusty frost
#

which one

formal locust
#

Maven

#

i want to remove it

dusty frost
#

you want to remove Maven?

formal locust
#

yes

dusty frost
#

in favor of Gradle?

formal locust
#

no

#

i dont want any framework

dusty frost
#

uh well

#

Hate to break it to ya, but you have to build your jar with dependencies somehow

dusty frost
#

Sure

#

or the Spigot API

formal locust
#

like in plugin.yml

#

i have to add

#

it

#

?

dusty frost
#

No?

formal locust
#

then

dusty frost
#

Is your plugin.yml file in the resources folder?

formal locust
#

its in src

dusty frost
#

It isn't src

#

It should go in resources

formal locust
#

so config.yml

#

also?

dusty frost
#

Yes, as that is a resource, not a source file

formal locust
#

ok :)

#

thank you for help

carmine crow
#
@EventHandler
    public void onPickup(EntityPickupItemEvent e) {
        if (e.getEntity() instanceof Player player) {
            if (e.getItem().getItemStack().getType().equals(Material.ENCHANTED_GOLDEN_APPLE)) {
                int i = 0;
                for (ItemStack is : player.getInventory().getContents()) {
                    if (!(is == null) && is.getType() == Material.ENCHANTED_GOLDEN_APPLE) {
                        i += is.getAmount();
                    }
                }
                System.out.println("I had before picking up " + i);
                System.out.println("I picked up " + e.getItem().getItemStack().getAmount());
                if (i + e.getItem().getItemStack().getAmount() > 2) {
                    int amount = i + e.getItem().getItemStack().getAmount() - 2;
                    System.out.println("Should delete " + amount);
                    ItemStack itemStack = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE);
                    itemStack.setAmount(amount);
                    player.getInventory().removeItem(itemStack);
                }
            }
        }
    }
#

its not removing item
from inventory
every print is printing good info but at the end its not removing item

tight junco
#

what are you trying to do there

carmine crow
#

i want to remove items from player inventory

#

player.getInventory().removeItem(itemStack);

#

this line is not working for me

#

its doing nothing

tight junco
#

probably because that itemstack isnt in the player's inventory

#

i assume you're just trying to remove any enchanted golden apples that a player picks up

carmine crow
#

i want to make like enchanted golden apples limit

#

i want limit it to 2

high edge
#

I mean yea you're creating a new item stack

#

That's not how it works

carmine crow
#

oh ok

tight junco
#

off the top of my head, frosty might say to do this better but just check if the amount of golden apples a player has in their inventory is > 2, if so cancel the event

carmine crow
high edge
#

loop through the players inv, find which slot is the golden apples, then reduce the amount with setAmount

cinder forum
#

Hello, this

#

is better practice than this when I just need to access config, right?

high edge
#

Yes

lyric gyro
#

that's not reliable if you call Plugin#reloadConfig sometime, you'd need to get it again

broken elbow
#

who the fuck is this ^

lyric gyro
#

ur mum

broken elbow
#

hi mom

#

👋

broken elbow
#

because yes

lyric gyro
#

because reloadConfig will use/set a new FileConfiguration object

#

it doesn't use the existing one you already have

high edge
#

Shut mortal

lyric gyro
#

you ain't telling me what to do

cinder forum
#

im confused so

#

if i just want to get config values i should use 1st option

#

if i want to use reloadConfig method option 2 is better

#

right

lyric gyro
#

if you ever use the reloadConfig method, you'll have to go with the second option to ensure the command has access to the reloaded config

#

if you never ever reload the config because you don't care about your users reloading the config then you can use the first option

cinder forum
#

wait so w first option can happen that config will not be reloaded for 1st try but in 2nd yes? Because thats exactly what happens in one plugin which I use

lyric gyro
#

what

night ice
#

But the 2nd option is far more better right? in all sense..

cinder forum
# lyric gyro what

"Sucessfully reloaded PluginName! (You may have to run this command twice to take effect)"

lyric gyro
#

that's probably because that plugin is horribly designed

cinder forum
#

:-(

#

premium plugin xd
config have 4k lines

night ice
#

is it vulcan?

cinder forum
#

y

lyric gyro
#

again, if you ever plan on reloading the config, use the second method, if not then you can use the first though personally i wouldn't

cinder forum
night ice
cinder forum
#

🤷‍♂️

lyric gyro
#

clearly you don't own an air fryer

cinder forum
#

most of lines is just configuration for each check

night ice
cinder forum
#

and commands you can just replace

night ice
#

hmm..didn't felt like that, I wished to configure it for each game mode...most gamemode never requires everycheck

icy shadow
sudden sand
#

Do someone has a good hikariCP configuration ?

dusty frost
#

the default one? lmao