#help-development

1 messages · Page 2273 of 1

chrome beacon
#

What IDE are you using?

dry forum
#

intellij

chrome beacon
#

Could you show me a screenshot of how the window looks right now

#

DM me or verify for screenshots

#

I'm curious if your setup is correct since 1.18 pom isn't a module

opal wedge
#

Is the GameProfile no longer available in 1.19?

chrome beacon
#

No

#

Well what you need it for

#

It was changed a bit

#

If it's for skulls just use the api

opal wedge
chrome beacon
#

I really should write this down... this is the 5th time I help someone with this lmao

#

1 sec

coral oyster
#

hi, I want to print the names of each configuration section of my config.yml like this:
minigame1
minigame2
minigame3
and my config.yml might look something like this:

minigames:
  minigame1:
    key: value
  minigame2:
    key: value
  minigame3:
    key: value

so I used the following code:

for (String configSection : getConfig().getConfigurationSection("minigames").getKeys(false)) {
   player.sendMessage(configSection);
}

but it only prints the first section (minigame1) when I want it to list through all of them. Any ideas?

chrome beacon
#

Since that code doesn't match the one you provided

coral oyster
coral oyster
modest garnet
#

anyone able to direct me a forum how to use NMS

chrome beacon
#

Be more specific

#

Just importing it to the project or?

#

Also what version. NMS is very version dependent

modest garnet
#

1.8.8 importing it

#

mb

chrome beacon
chrome beacon
#

?bt

undone axleBOT
modest garnet
#

just run it normally or in my project file?

chrome beacon
#

BuildTools can be run anywhere on your system

#

I'd create a new folder for it

#

Run it and delete it after

modest garnet
chrome beacon
#

Yes

modest garnet
chrome beacon
#

Are you on windows?

modest garnet
chrome beacon
#

Start by downloading Java 8 if you haven't already

#

?java16

undone axleBOT
chrome beacon
#

^ same link just select 8 on top

modest garnet
#

i have and i need java 8 but its set to java 17 atm

buoyant viper
#

change ur JAVA_HOME and update PATH envvars

modest garnet
#

didnt work

chrome beacon
#

Did you restart cmd

modest garnet
#

ye

chrome beacon
#

Could you show how you set your path

modest garnet
#

welp nvm, the java 8 instal i had was saying it was already on my pc but using the link u sent it worked

crisp steeple
#

is there a way to dynamically get a value from a configurationsection? if i had something like this, it either throws a classcastexception when its a string int bool etc, or returns null if it is actually configurationserializable

private static <T extends ConfigurationSerializable> T getValue(String path, Class<T> clazz) {
    return config.getSerializable(path, clazz);
}
crisp steeple
echo basalt
#

you'd need to handle enums and all

chrome beacon
#

You would need to add a way for it to convert a string to material

echo basalt
#

Material is not ConfigurationSerializable iirc

coral oyster
crisp steeple
chrome beacon
crisp steeple
#

ok ive been struggling for the past hour for nothing

#

thanks

dry forum
#
    public void spawnArmorstand(Player p, int x, int y, int z) {

        Level level = ((CraftWorld)p.getWorld()).getHandle();
        ArmorStand stand = new ArmorStand(EntityType.ARMOR_STAND, level);
        stand.setInvisible(true);

        ClientboundMoveEntityPacket Velocitypacket = new ClientboundMoveEntityPacket(stand.getId(), x, y, z, true);

        ClientboundAddMobPacket Standpacket = new ClientboundAddMobPacket(stand);
        ((CraftPlayer)p).getHandle().connection.getConnection().send(Standpacket);
    }```  from ```ClientboundMoveEntityPacket Velocitypacket = new ClientboundMoveEntityPacket(stand.getId(), x, y, z, true);```  ```'ClientboundMoveEntityPacket' is abstract; cannot be instantiated``` yes i understand what that means i just dont know how else it would be done (1.18) im trying to apply a velocity to the armorstand
paper viper
#

Use your tools and try to find implementations for the abstract class

chrome beacon
#

^

paper viper
#

Ctrl + Right Click goes into source code

#

Right click and click view implementations for the class header if you want to see implementations

dry forum
#

right click what

paper viper
#

The class header like the name

chrome beacon
#

It appears to be a static class

paper viper
#

Or you could do it for a method idk anything works

#

Oh

chrome beacon
#

ClientboundMoveEntityPacket.Pos

#

Or .Rot

#

Or PosRot

modest garnet
#

why is it telling me the first =
is redundant?

chrome beacon
#

You're not using the value

modest garnet
#

what do you mean

paper viper
#

You aren’t using the variable for anything after

modest garnet
#

ahh i see so just like set the meta after or something

chrome beacon
#

No you just need to use first for something

dry forum
echo basalt
#

I did it with ProtocolLib

#

Lacks a lot of methods but I only need these to make a mystery box

#

¯_(ツ)_/¯

modern prairie
#

what is the easyest way to start

static ingot
#

to start what

#

lol

#

assuming you mean plugin development altogether, then go learn basic java if you haven't already, then consult the spigot wiki on how to make your first plugin
https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-intellij-idea/
or
https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-eclipse/
(there's ones for netbeans and vs code too, but I rarely hear of them actually being used for plugin development)

#

there's several other resources on just the wiki about how to use the basics as well, like commands and event listeners

modest garnet
vocal cloud
#

1.8 gag

modest garnet
#

its so i can multiversion

vocal cloud
#

Become based, only 1.16+ kek

west scarab
#

hi, i tried debugging this, and just everything else. I can't figure it out, please help.

        if(!p.getItemInUse().equals(new ItemStack(Material.AIR, 0))) {```
#

i tried debugging

#

it said that the thing was

#

ItemStack{AIR x 0}

vocal cloud
#

So generally, it's considered best practice to compare materials and not itemstacks, especially when trying to figure out if something is Material.AIR or not.

tranquil viper
#

Oops wrong channel

round mural
#

What's best practice when writing the onCommand() and you have a bunch (20+) of commands? Case switch?

crisp steeple
#

you could either use one of the thousand different command frameworks there are, or just make an abstract class that you trigger depending on the subcommand. switch case works but it’ll get messy after a bit

wet breach
#

this is how I do it most of the time

round mural
#

Thanks both! I have a second, broader question - I'm mainly a front-end developer so my Java is rusty and I'm totally new to Spigot, but where can I learn best practices? A lot of YouTube tutorials are made by very young (albeit helpful and capable) developers, and I feel like I'm picking up a few bad habits sometimes by following them. Aside from looking at the docs directly, is there a resource most devs stick to?

kind hatch
#

Other than that, it's just java. You can also find tons of help on StackOverflow.

round mural
#

For sure. Somewhat related, is it a Java thing to use single character variables for things? That's probably my biggest grief with the code I see from tutorials, which imo just makes code less readable. Ty for the suggestions btw!

kind hatch
#

Do you have an example of what you are talking about?

round mural
#

It's totally nitpicky but something like Player p = (Player) sender; instead of Player player = (Player) sender;

#

Could also just be a personal preference thing

kind hatch
#

Yea, it's a thing. Usually, we try to recommend the latter approach as code readability goes a long way. It can be seen as a preference, but most people here use descriptive variable names.

round mural
#

That's good to hear lol

lost matrix
round mural
#

I'm saying I would see people in tutorials with lots of variables in this style: Player p = (Player) sender; which I agree is worse than a descriptive variable name.

#

I worded it weird haha.

wet breach
#

?learnjava

undone axleBOT
lost matrix
lime moat
#

Hello, I have this code: https://paste.gg/p/anonymous/8e556102be3e4d57b2bc1a11ccd76e14

Right now, I'm trying to do something like: java Map<BlockData, Double> ores = new HashMap<>(); ores.put(Bukkit.createBlockData(Material.SPRUCE_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.BIRCH_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.JUNGLE_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.ACACIA_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.DARK_OAK_LOG), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.CRIMSON_STEM), 0.125); // 12.5% ores.put(Bukkit.createBlockData(Material.WARPED_STEM), 0.125); // 12.5% Mines.fillCuboid(loc1, loc2, Bukkit.createBlockData(Material.OAK_LOG), ores);

... and it looks like this in game: https://fwoostyhub.com/🔊🍾🤣🐲

#

In theory, it should all be 12.5%, but it's just... not

#

If there's an easier way to do this without math as they're all the same percentages, I would really prefer that. Just not sure how :P

echo basalt
#

instead of 12.5% chance of per log

lime moat
#

Ah, I see

#

How shall I fix it?

echo basalt
#

mm you have a funny structure here

lime moat
#

Yeah... it's quite weird, but it works for my ores system 😂

wet breach
#

the fix is you need a delta

echo basalt
#
private <T> T getRandomElement(Map<T, Double> entries) {
  double sum = 0;
  
  for(double value : entries.values())
    sum += value;

  Random random = ThreadLocalRandom.current();
  double choice = random.nextDouble() * sum;

  T result = null;
  for(Map.Entry<T, Double> entry : entries.entrySet()) {
    T key = entry.getKey();
    double value = entry.getValue();
  
    result = key;
    choice -= value;

    if(choice < 0)
      break;
  }

  return result;
}
#

You can make something like this and apply your current system

lime moat
#

Huh, could you guide me through how I could apply it? I've really never done two systems at once :P

echo basalt
#

and just add the oak log to your drop table

#
for(...)
  BlockData data = getRandomElement(ores);
  ...
wet breach
#

imllusion has got you covered on it 🙂

echo basalt
#

You can also do some pre-validation to your map

#

like setting an upper bound to 100%

#

normalizing every value if we go above that value

#

or if we're below that value, adding the missing percentage as the base item

wet breach
#

even setting lower bounds too like if you never want it to be 0%

echo basalt
#

Should make the system a lot more robust

quaint mantle
#

hey, so im making a custom invsee plugin, and need to access to inventory objects i made in a different class file, how do i do this?

echo basalt
#

?di

undone axleBOT
lime moat
#

Just so I'm on the right trade, should it look something like this? java int x1 = -114, y1 = 62, z1 = -55; Location loc1 = new Location(Bukkit.getWorld("world"), x1, y1, z1); int x2 = -102, y2 = 52, z2 = -67; Location loc2 = new Location(Bukkit.getWorld("world"), x2, y2, z2); Map<BlockData, Double> ores = new HashMap<>(); ores.put(Bukkit.createBlockData(Material.COAL_BLOCK), 0.15); // 15% ores.put(Bukkit.createBlockData(Material.IRON_ORE), 0.15); // 15% ores.put(Bukkit.createBlockData(Material.GOLD_ORE), 0.05); // 5% ores.put(Bukkit.createBlockData(Material.REDSTONE_ORE), 0.04); // 5% ores.put(Bukkit.createBlockData(Material.DIAMOND_ORE), 0.03); // 3% for(something) { BlockData data = Mines.getRandomElement(ores); } Mines.fillCuboid(loc1, loc2, Bukkit.createBlockData(Material.STONE), ores);

echo basalt
#

you do the getRandomElement within the fullcuboid method

#

but hmm

#

we can skip the lower bound check if we do something like

#
double totalChance = sum... // the first sum loop;
Random random = ThreadLocalRandom.current();

// inside loop
BlockData data;
if(random.nextDouble() < totalChance)
  data = getRandomElement(...)
else
  data = baseData;

set...
shadow zinc
#

I'm making a lag notifier that needs to run every minute, would I create a separate class and put a bukkit runnable in that, or a method inside my lag notifier class to initialize a runnable?

lime moat
#

Uhmmm, I'm so lost I'm sorry 😅

crisp steeple
#

what would be the best way to add multi version support to a plugin that uses a decent amount of nms? rn im just going the approach of making a different NMS class for every version, but i think that could get a bit difficult and i would also have to run buildtools a ton of times to get the names of fields

tall dragon
lost matrix
lost matrix
crisp steeple
#

yeah, think im probably going to go that route

#

is there a list out there of obfuscated fields/methods for nms? or do i just need to install all the different versions and see for myself

crisp steeple
#

neat

summer scroll
#

How can I enable outer layer of skin on NPC?

dim palm
#

someone can help me fix my staff mode plugin

#

it is just nullpointerexception

vocal cloud
#

?ask

undone axleBOT
#

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

undone axleBOT
somber hull
#

How do i shadow with gradle on a multiproject build?

noble lantern
#

IIRC bungeecord needs an online player on the target server to work doesnt it, or else it just flat out doesnt work?

#

Remember a lot of talk around that in here before

#

@tawdry lava use dependency injection or a static getter

#

?di

undone axleBOT
tawdry lava
#

ok ty

#

how to create a workspace in intellij that has multiple project modules?

noble lantern
#

That im not sure how to do sadly

#

Maybe someone else lurking in here does

tawdry lava
#

np

hybrid spoke
tawdry lava
#

is maven better or gradle in terms of simplicity?

hybrid spoke
#

gradle is shit

noble lantern
#

gradle is defo simpler for a lot of things

#

Its some weird limitation the plugin messaging system has

#

If no ones online plugin messaging just yeets itself (From what i heard)

hybrid spoke
#

it only sends the message to servers which has players on it

tawdry lava
#

i mean

#

i can share my screen gui me then

lost matrix
#

The communication happens through the connection of a player. So the spigot server basically sends a packet to the player
but it gets intercepted by bungeecord.

#

Why do you send a message to a spigot server?

#

The spigot server does not decide when to connect a player.

#

Oh this is from a command framework. Ok let me look at that again.

#

Ok why do you want to use the "bungeecord:main" namespace if "BungeeCord" works?

#

That would be news to me

tawdry lava
#

@scarlet swallow @lost matrix how to create a workspace in intellij that has multiple project modules?

#

any idea?

#

like we do in eclipse

lost matrix
#

Just create a maven project and add modules...

tawdry lava
#

can u help me

#

i mean ill be screen sharing

#

hmmm?

#

@lost matrix

#

?

#

what shld i select

lost matrix
tawdry lava
#

then

#

i gave the name

#

the archetype shld be

#

?

#

bruh

lost matrix
#

You can as well just create a minecraft project if you are using the mc dev plugin.
And then you just add modules like GodCipher told you

tawdry lava
#

bro

#

lemme try

#

this one right?

#

what do i do next

summer scroll
#

Right click the tab and New -> Module

tawdry lava
#

its stays inside the main folder

summer scroll
#

yeah like that

tawdry lava
#

what next

#

u see i hv already created a project

#

i want to add another in same list

summer scroll
#

I use the top button (generators)

#

Which is New Module

tawdry lava
#

ok

#

still it is inside my main project folder

#

wth am i supposed to do

summer scroll
#

it should be

#

it will be inside of your main project folder

tawdry lava
#

so i sld create an emty project

#

right

#

?

summer scroll
#

you can also delete the existing folders

#

such as src

#

but keep the pom

tawdry lava
#

now

summer scroll
#

you need maven project

#

you're trying to create multi-module maven project right?

tawdry lava
#

yes

#

this one

#

?

#

hmm

#

@summer scroll

summer scroll
#

You can use the previous project

#

The Minecraft Development project, and just delete the src folder

tawdry lava
#

what shld i do

summer scroll
#

Use the previous project

#

And create the module there

tawdry lava
#

i did delete

#

src folder

summer scroll
#

And then create the module

tawdry lava
#

ok

#

what do i hv to select

#

can i use the mc dev plugin

#

?

summer scroll
#

I'm not sure but I use the "New Module".

#

Just put the name of the module and click Create.

tawdry lava
#

parent stuff

#

right?

summer scroll
#

yes

#

Workspace should be the parent

tawdry lava
#

do i have to make any changes to pom like adding parent and stuff

summer scroll
#

The parent automatically will be added.

#

And on the parent pom you will have a list of modules too

tawdry lava
#

so i just need to add the dependency of spigot or whatever api im using

#

?

quaint mantle
#

hey earlier i asked a question about accessing objects in different classes and was directed to dependency injection. idk if its just me not being as experienced, but I can't figure it out and how to apply it to my plugin, can someone help?

tawdry lava
#

how can i create an instance of my main class

hybrid spoke
hybrid spoke
undone axleBOT
tawdry lava
summer scroll
tawdry lava
#

i want to know how to

summer scroll
quaint mantle
hybrid spoke
quaint mantle
#

okay hold on

tawdry lava
#

umm can anyone say why my maven run button is grayed out

#

?java

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

hybrid spoke
tawdry lava
#

i want to know what shld be the type

#

i want to know what to select

hybrid spoke
#

maven obv

hardy swan
#

hear me out

hybrid spoke
#

no

hardy swan
#

mvn clean install

quaint mantle
# hybrid spoke #verify yourself

Okay, so I am trying to access targetInventory and my player object in a seperate class, I cant bring them out of the method because they rely on the args parameter

tawdry lava
lost matrix
quaint mantle
quaint mantle
hardy swan
#

Dependency injection isnt the thing you need rn

quaint mantle
quaint mantle
hardy swan
#

First of all, that question is somewhat vague. Object references are passed around everywhere in Java, and the how is based on what you are trying to achieve.

quaint mantle
#

Im trying to be able to pass the objects into my listener class

summer scroll
hardy swan
#

Passing to Listener from a CommandExecutor?

#

Doesnt sound right to me

quaint mantle
hybrid spoke
#

looks like you are trying to learn java

#

the InventoryClickEvent already provides an inventory

quaint mantle
#

i worded that poorly, i need to be able to use those specific inventories in the event

hybrid spoke
#

which will be provided once a player clicks their inventory

#

what you want is to identify if the inventory belongs to your target player

#

means, that you will have to keep track of what player specs whos inventory

#

i would go the OO way, but for your needs a Map of uuids would do the magic

quaint mantle
#

okay, i think i see what you mean n how i would go about that, thank you

hardy swan
#

I wonder if you can go about it without Listeners

quaint mantle
summer scroll
#

Absolutely not xd

hybrid spoke
#

probably

#

i mean for what do you need a listener in an invsee plugin

#

oh well

#

to not take out the items

quaint mantle
#

yeah

#

seeing the inventory is super easy

#

its chaning it thats hard

hybrid spoke
#

just let them steal it

quaint mantle
#

easy dupe

hardy swan
#

Ohhhh

hybrid spoke
#

what a nice game concept. every hour you can steal an item from a player

hardy swan
#

I just assumed invsee includes potentially stealing

quaint mantle
#

it wouldnt be stealing though, cause without the event you coudlnt modify the targets inventory right?

#

itd just be duping

summer scroll
#

it will directly modify the player's inventory

hardy swan
#

Sounds wrong to me tbh

hybrid spoke
#

if you open the same instance the changes should be applied or no?

summer scroll
#

yeah it should be applied

hybrid spoke
#

depends if bukkit clones the inventory internally or not

quaint mantle
#

im not just getting the target players inventory and opening it, im taking it and copying the items into a custom inventory that has extra buttons to open the ec / clear inventory

hardy swan
#

Correct

hybrid spoke
#

make a page system and every page is an inventory of another player

summer scroll
quaint mantle
#

i was gonna do /invsee and it would open a menu w playerheads n then you click to open their inventories

#

cant remember why i went a different way with it

hybrid spoke
#

nah thats lame

#

just make 2 arrow buttons, left and right

#

then you go to the next/previous player with it

quaint mantle
#

oo smart thinking

hybrid spoke
#

but with fancy animations

quaint mantle
#

i wont even add names too, so its a guessing game of whos inventory im lookin at

#

a game within the game

hybrid spoke
#

and make a random button

#

which exchanges every item with a random one

#

and a swap button which just swaps the item slots

quaint mantle
#

what abt a swap button that swaps players whole inventories?

hybrid spoke
#

and add a roulette game where you can bet on if the inventory either gets cleared or remains

quaint mantle
#

make players pay to not have their inventory wiped every 24 hours

hybrid spoke
#

that would be p2w

quaint mantle
#

eula smhula

hybrid spoke
#

let players play for their inventory

#

roulette. if they win, double every itemstack. if they lose, clear the inventory

#

and if they win on green, make 3 chests with their inventories and give it to them

#

am i gambling addicted?

quaint mantle
#

noooo

#

ofc not

#

fun fact did you know that 90% of gamblers quit right before hitting it big?

hybrid spoke
#

lemme open csgo gambling sites rq

hardy swan
#

Technically, roulette means you have a better chance of winning than losing if you keep going

quaint mantle
hybrid spoke
#

$20 on black, red or green?

quaint mantle
#

green

hybrid spoke
#

going risky i see

quaint mantle
#

i have never played roulette

#

im underage

#

dont even know how the game works

hardy swan
#

Then what isnt underage for roulette

#

You can only do it once per lifetime anyways

hybrid spoke
#

fuck it

#

close enough to green

#

another round

quaint mantle
#

you should defintely go in a vc and screenshare this

hybrid spoke
#

nah i just lost $30

#

and ofc now its green

quaint mantle
#

fun fact did you know that 90% of gamblers quit right before hitting it big?

fiery prairie
#

hey, so I have import org.bukkit.attribute.Attribute which allows me to use things like p.getAttribute(), but it doesn't exist in older versions like 1.8-1.12.2 (didn't check all versions), but i want to make it work on 1.8-1.19, does anyone know how I can do that? or at least how can I replace getAttribute("GENERIC_MAX_HEALTH") with something else?

#

or is p.getMaxHealth not locked in older versions?

quaint mantle
#

but @hybrid spoke how would i actually go about modifying the target players inventory when the player moves things in the custom inventory

noble lantern
fiery prairie
#

Yea I'm kinda new to spigot, what exactly is reflection?

agile anvil
fiery prairie
#

Alright thanks, I'll figure something out

agile anvil
#

When programming for mc, we mainly use it to access the NMS (net.minecraft.server) which is the mojang root of the server

tardy delta
noble lantern
#

thats when i ctrl click that bullshit method and scream "Wtf are you even doing"

#

Idk about yall, but i argue with every method i write

opal juniper
tardy delta
#

i have no idea lmao

opal juniper
#

you ok?

#

or you need help

tardy delta
#

have no idea why it doesnt know what method to choose

#

lemme show

opal juniper
#

pls

tardy delta
#

wait lemme edit with da fuction interfaces

opal juniper
#

where are you calling it?

tardy delta
#

when i remove the ,owner it seems to find the right one

#

well here

opal juniper
#

u know you put Objects right?

#

not Object

tardy delta
#

BRUH

#

intellij showing me stupid imports again..

#

well ye thank joe

tardy delta
#

that scares me

mortal hare
#

*cough* *cough*

noble lantern
#

forever

#

sec

#

its literally just chains of captures....

tardy delta
#

reference or optional?

noble lantern
#

sometimes both

#

googles api is shit

tardy delta
#

oh no

noble lantern
#

check this

tardy delta
#

optional.orElse(null) kekw

noble lantern
#

notice something?

noble lantern
tardy delta
#

what the

noble lantern
tardy delta
#

not putting the return in the try :bonk:

noble lantern
#

optional.empty()

#

ez

#

discord lag smh

#

bro discord come on

#

this is ridiculous

#

fucking hell SEND

hybrid spoke
noble lantern
#

and i was like ill change it soon

noble lantern
#

sorry im not chaining class captures to a optional completable future

#

fuck that

tardy delta
#

tbh didnt know this was possible

#

not instantiating it

noble lantern
#

idek wtf going on there

tardy delta
#

try with resources but usually u"d put try (Connection conn = getConn())

noble lantern
#

yes why not do that

#

thats what im trying to figure out

#

that try looking funky

tardy delta
#

cuz i already got a connection via parameter

#

its pain i know

noble lantern
#

isnt the conn; kinda like

#

not needed?

tardy delta
#

it will close it when the scope finished

noble lantern
#

hm

tardy delta
#

same for ps

noble lantern
#

well yeah ps would but idk how ide feel about the method yeeting my connection xD

#

what if i wanna chain it and do a few different statements

#

ide have to reopen another connection unless your using a connection pool

tardy delta
#

wdym chain? like try (conn; PreparedStatement ps = ...; prep.. ps1 = ...)?

noble lantern
#

like

#

if i wanna do multiple withConnection's

#

withConnection();
thenDoThisWithConnection();
thenThis();

tardy delta
#

ah i get it

noble lantern
#

idk tho im not good with mysql

#

i heard your supposed to open and reclose the connection almost every statement from a lot of people

#

i just always kept the one connection with a keepalive ping, or the connection pool

#

never know if that ever is an issue or not tbh

ivory sleet
#

Well connections are supposed to be long lived

#

But they might timeout or other things might happen

tardy delta
#

in my current impl that would be

#

smh

noble lantern
#

yeah thats what i figured and people always told me that and i never got that

ivory sleet
#

Which is why a connection pool is the most optimal solution

noble lantern
#

I know MySQL connections naturally time out after like 5 mins

tardy delta
#

actually didnt need it

noble lantern
ivory sleet
#

The connection pool won’t necessarily close the connection when you use close(), it will lend the connection back to the pool simply

noble lantern
#

but if you dont need it dont need

#

Yeah thats what i normally use when i did mysql but

#

i cba writing statements

tardy delta
#

conn will be closed at this point

ivory sleet
#

Fourteen brush you use a connection pool?

tardy delta
#

well actually

#

yes

ivory sleet
#

If you do then it’s fine

noble lantern
#

fucking discord

#

send my message

#

^

ivory sleet
#

Altho that’ll technically always consume 2 connections

tardy delta
#

whats wrong with ya internet smh

noble lantern
#

my internets fine im watching wt and connected to my vps rn

#

but discord doesnt like me and grays my msgs out but i can receive msgs totally fine

hybrid spoke
#

ctrl+r

tardy delta
#

my internet was doing weird stuff yesterday

noble lantern
#

doesnt help

#

this is a long running issue

#

years now

tardy delta
#

i tried to ping google.com and that worked but discord and webpages kept loading

noble lantern
#

even got a new router

tardy delta
#

it kinda annoys me that we never learned at school how to create a good database table structure

#

we learnt like half of it

noble lantern
#

i just make my own

ivory sleet
#

Well your abstraction is extremely coupled

tardy delta
#

and then we had to implement it for our final school project and mine sucked so hard

#

uhh

ivory sleet
#

Which is a slight issue

noble lantern
ivory sleet
#

As you see in your own example you’re bound to use 2 connections there

tardy delta
#

ye that method doesnt make sense either but ill see when i write new impl what i actually need

ivory sleet
#

Sure

noble lantern
#

mongodb > mysql

ong

tardy delta
#

some things are indeed cursed

hybrid spoke
#

store everything in txt files > db

ivory sleet
#

Well they’re suited for different things

tardy delta
#

storing json in db 😎

noble lantern
#

I mainly just like working with mongo and java together ngl

ivory sleet
#

Mysql becomes extremely overpowered when you need it’s relational advantage in terms of scalability

noble lantern
#

so easy to shove java objects into a db

ivory sleet
#

Much more scalable than Mongo actually at that point

tardy delta
#

does this look good now tho?

#

7smile told me to not use a combination of owner and name as primary key

ivory sleet
#

Yes

tardy delta
#

like we always learnt it at school ¯_(ツ)_/¯

ivory sleet
#

I mean probably depends

#

In some rare cases name + owner might end up being a self checking key

eternal oxide
#

No need for a kay pair there as the homes own UUID must be unique

ivory sleet
#

In which it could be fine

tardy delta
eternal oxide
#

The owner doesn;t define if the Home is unique. Its own ID does

tardy delta
#

school learnt me weird stuff then

ivory sleet
#

Not necessarily

eternal oxide
#

Just not needed in this case

ivory sleet
#

Yep

tardy delta
#

can you think of a case where it would be needed to use a double pk?

#

instead of adding another field

eternal oxide
#

off the top of my head no. But I have recommended it in here a few times

ivory sleet
#

No not a double one, but you’d probably have an algorithm of a binary operation that takes both owner and name

lost matrix
tardy delta
#

whats that supposed to mean ¯_(ツ)_/¯

#

aggregation thing what does that mean?

lost matrix
#

ill explain later

fiery prairie
#
    public boolean onCommand(CommandSender sender, Command command, String label , String[] args){
        if(sender instanceof Player){
            Player p = (Player) sender;
            if(p.hasPermission("evanishplus.vanish")){
                if(invisible_list.contains(p)){
                    invisible_list.remove(p);
                    p.sendMessage("you are no more vanished");
                }else if(!invisible_list.contains(p)){
                    for (Player people : Bukkit.getOnlinePlayers()){
                        people.hidePlayer(plugin, p);
                    }
                    invisible_list.add(p);
                    p.sendMessage("you are now vanished");
                }
            }
        }

'hidePlayer(org.bukkit.entity.Player)' in 'org.bukkit.entity.Player' cannot be applied to '(net.d1axowy.evanish.EVanishPlus, org.bukkit.entity.Player)'

#

how can I fix that?

tardy delta
#

what version ur on?

fiery prairie
#

1.8

tardy delta
#

makes sense then, i guess use the hidePlayer(Player)

#

also use a Set<UUID> instead of a arraylist

fiery prairie
#

thx though I am not really the best at java and spigot, so I'd like it to remain how it is, which version should i set for what i have now to work?

noble lantern
#

Anyone here experiences in deploying things to a linux server

I want to have my java program where i have it installed like a linux service, but also being able to go in and out of the console to view the logs, anyone have a good guide by chance?

tardy delta
#

ugh atleast not 1.8 unless you want that weird pvp stuff

fiery prairie
#

i mean 1.12

#

my brain didnt work while typing this msg

noble lantern
tardy delta
#

uhh people would say to use latest version but im on 1.17

chrome beacon
tardy delta
noble lantern
chrome beacon
#

Yeah

noble lantern
#

the service im running is quite heavy

fiery prairie
tardy delta
#

why are you even on 1.8

noble lantern
#

its bad

fiery prairie
fiery prairie
#

yea

tardy delta
#

i guess a daemon is the best way to run multiple non mc related things

noble lantern
#

i just dont know if pterodactyl opens lots of threads

#

my program is fully async, it needs as much cpu as possible

#

and memory too

tardy delta
#

i bought the cpu so im gonna use the whole cpu lmfao

noble lantern
#

startup

tardy delta
#

classic

noble lantern
#

then idle

#

handles requests sooo fast doe

twilit roost
#

If I want to do tips above blocks like "Right Click to Reload" only when player is near
Should I do it every tick? or every second

tardy delta
#

why am i always solving my own coding problems when laying in ma bed :/

noble lantern
twilit roost
noble lantern
#

Invisible armor stand

#

and setCustomNameVisible(false)

twilit roost
#

ye but if it would kill server if I would update every tick

noble lantern
#

nametag will show on hover

twilit roost
#

oooh

#

well thats great therefore

noble lantern
#

but they gotta hover close to it, so if you want them to be farther youll need a checker

twilit roost
#

wdym by closer
2blocks?

tardy delta
#

¯_(ツ)_/¯

hybrid spoke
twilit roost
#

oh therefore its great

noble lantern
#

god so fast

#

gonna scream yell run and shit

iron glade
#

What do you think is better for users when choosing a color, decimal or rgb values? I want them to input the color through chat

noble lantern
#

rgb

#

ppl arent smart enough for decimals

#

you can do 3 stage questions for it

iron glade
#

I guess that's kinda true

noble lantern
#

like enter numeric value for red, then green then blue

#

and then the alpha if mc supports it

iron glade
#

yeah or I was thinking about something like r[int]; g[int}; b[int]

tardy delta
#

rgb(0, 0, 255)

noble lantern
iron glade
#

yeah sure

noble lantern
#

that way if users dont like one way they can do it another

noble lantern
tardy delta
#

people are idiots

hybrid spoke
twilit roost
noble lantern
twilit roost
#
as.setCustomName(ChatColor.DARK_GRAY + "Right click on box to refill Ammo");
as.setCustomNameVisible(false);
dawn plover
#

how would i make sure some methods will run every X ticks or every X seconds

noble lantern
#

is the armor stand actually spawned in too?

hybrid spoke
#

?scheduling

undone axleBOT
twilit roost
#

also my armor stand is invisible

short raptor
#

How can I tell if a block is solid or not? E.g. I want to filter out something like dirt, stone, logs, but ignore flowers or tallgrass or those non-solid blocks

dire marsh
#

Material class has util methods for that like isSolid and occluding etc

short raptor
#

Ok thanks

iron glade
#

Is there something simpler to remove whitespaces at the beginning and end of a message than this?

            if (Character.isWhitespace(message.charAt(0))) {

                message = message.substring(1);

            }
            else if(Character.isWhitespace(message.charAt(message.length() - 1))) {

                message = message.substring(0, message.length() - 2);
                
            }```
iron glade
shadow zinc
#

why isn't it being removed?

#
    private boolean isConfirmed(String playerName) {
        if (toBeConfirmed.contains(playerName)) {
            toBeConfirmed.remove(playerName);
            return true;
        }
        toBeConfirmed.add(playerName);
        new BukkitRunnable() {
            @Override
            public void run() {
                SmartClearCommand.this.toBeConfirmed.remove(playerName);
                Bukkit.broadcastMessage(""+SmartClearCommand.this.toBeConfirmed);
            }
        }.runTaskLater(NeoPerformance.getInstance(), 20*10L);
        return false;
    }```
iron glade
#

what is toBeConfirmed?

shadow zinc
#

in the list

#

for a command

#

you need to run it twice

#

but in the runnable it doesnt remove it from the list

iron glade
#

you don't need to check if it contains the playerName, just call #remove(), it already takes care of that

shadow zinc
#

?

#

im not

#

oh that

iron glade
#
        if (toBeConfirmed.contains(playerName)) {
            toBeConfirmed.remove(playerName);
            return true;
        }```
shadow zinc
#

irrelevant

#

and i actually do need to do thoat

iron glade
#

ah I see since you want to return

chrome beacon
#

return toBeConfirmed.remove(playerName)

iron glade
#

yea

#

Also this is bothering me
20*10L

chrome beacon
#

Ah wait you only want to return if removed

iron glade
#

please change that to 10 * 20L

chrome beacon
#

So if(toBeConfirmed.remove()) return true;

iron glade
#

Is there a nice way to simplify this?

            String input = "120 49 244";
            String[] rgb = input.split(" ");

            if(getPlugin().isInt(rgb[0]) && getPlugin().isInt(rgb[1]) && getPlugin().isInt(rgb[2])) {

            }```
smoky oak
#

int[] rgb = new int[]{120,49,244};

#

and then you can skip the if

#

or do you mean that as input example

iron glade
#

yeah that was just an example

#

if the user messes up and does something like 40 toast banana i wanna tell him he messed up

flint coyote
#

if the numbers are small enough you can remove the whitespace and

try catch with Integer.parseInt

#

if they get larger then it might overflow

smoky oak
#

it should be possible to make it so your command has to contain numbers

#

dont ask me how tho

iron glade
#

it's not even a command it's just a raw chat message

iron glade
#

would this also work if the first number is a 0?

smoky oak
#

you need a separator

flint coyote
#

I mean since it's just for the validation and you dont use the validated number it would also work with 0

#

If you need to use the 9 digits directly and you only get 8 digits after conversion you would know that it has to be 0xxxxxxxx

iron glade
#

Could be 25580255 tho for example

#

also only 8 digits

flint coyote
#

but if you parseint the full 9 numbers it will only remove zeros at the beginning

#

So any missing digit after that is a 0 at the beginning

iron glade
#

Hm okay, I actually need to store all 3 values afterwards

flint coyote
#

You can either cast them to integers after or you do it by dividing/bitshifting which might be a bit of a hustle unless you really need that little extra performance

iron glade
#

Alright, I'll try my luck

noble lantern
#

poooog i figured it out

#

my logging all fucked doe

smoky oak
#

that doesnt look like minecraft logs

noble lantern
#

wtf is minecraft

smoky oak
#

on not this again

#

i had three different people quote me that just with different titles

#

im so done

#

*in the last 12 hous

tardy delta
#

if (tmBeConfirmed.remove(playerName)) return true

#

ah what happened here

dry forum
#

why doesnt ``` public void spawnArmorstand(Player p, Vector v) {

    Level level = ((CraftWorld)p.getWorld()).getHandle();
    ArmorStand stand = new ArmorStand(EntityType.ARMOR_STAND, level);
    stand.getBukkitEntity().setVelocity(v);

    ClientboundAddMobPacket Standpacket = new ClientboundAddMobPacket(stand);
    ((CraftPlayer)p).getHandle().connection.getConnection().send(Standpacket);
}``` do anything? i want to spawn an armorstand at the player and give it a velocity but with this nothing happens, no armor stand spawning or velocity, 1.18 and no console errors
smoky oak
#

huh

#

never seen a hq screenshot of a console before

#

*HD

#

oh on that topic

tardy delta
#

lets google that error

smoky oak
#

did you know that a C++ success message has an ERROR CODE

tardy delta
#

fun

#

need to compile my fking project lmao

noble lantern
dry forum
#

1.18

noble lantern
#

if so just use normal bukkit code and youll be fine

#

yeah

#

you dont need nms for that haha

dry forum
#

no but i need it for 1 player

noble lantern
#

ahh

#

in that case it just complicated things 10 fold

dry forum
#

wdym

noble lantern
#

Just in debugging wise

tardy delta
#
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message find class on InstrumentationImpl failed at ./open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 494
*** java.lang.instrument ASSERTION FAILED ***: "result" with message instrumentation instance creation failed at ./open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 402```🤡
hybrid spoke
#

doesnt 1.18 provide a #hideEntity method

noble lantern
#

You know what i think it does but does it have a LivingEntity argument?

dry forum
#

when i package the plugin it creates like 6 different jars would me using the wrong jar be the issue?

smoky oak
#

you need the one that has remapped in the name and doesnt have obf behind the remapped

noble lantern
dry forum
noble lantern
#

ohhh its a player method

#

thought it was a Entity method haha

#

yep that would work tho 100%

dry forum
#

.showEntity is deprecated

hybrid spoke
#

why would you hide an entity for an enitty

#

just like #hideEntity

smoky oak
#

pathfinding?

#

aggression?

noble lantern
#

Hence why i thought like Entity#hideEntity(player)

#

and that entity is hidden for player

hybrid spoke
noble lantern
#

but it was other way around

tardy delta
#

ah nice i know atleast where the error comes from smh

#

always fun when c code crashes

green prism
#

It doesn't already shade into the jar.. That's the problem I think

tardy delta
#

lets try another jdk

chrome beacon
#

Stop doing that

#

If you're using maven send your pom and I'll check

tardy delta
#

lmao eclipse jdk doesnt have the problem

green prism
#

?paste

undone axleBOT
dry forum
#

why doesnt ``` public void

green prism
tardy delta
#

why am i such an idiot that removed the whole buildtools folder

#

?bt

undone axleBOT
green prism
#

whats buildtools

chrome beacon
green prism
#

wat

#

wdym

chrome beacon
#

It's how you get the spigot jar

green prism
#

ohhh, it's a jar with every version

#

am I right?

chrome beacon
#

No just the regular spigot jar

green prism
#

ah

tardy delta
#

ah and tf is this

chrome beacon
#

PortableGit

tardy delta
#

ah fun now it complains bout my java version smh

green prism
#

viruz installing, please wait...

tardy delta
#

how do i run it with java 17?

buoyant viper
quiet ice
#

Just use a J17 Install bro

tardy delta
#

i did the bat thing

green prism
chrome beacon
green prism
paper swift
#

guys can anyone help me with imageonmap plugin? Its not working on 1.19*

quiet ice
#

(though paper is fine)

buoyant viper
tardy delta
#

i did this thing lol and clicked it

buoyant viper
#

just change the "java" text to the path to the jre u want to use

tardy delta
#

hmm

vocal cloud
#

Yeah, either update your PATH var or change the java path on the bat

buoyant viper
#

like "C:\Program Files\Java\jdk-17\bin\java.exe" -jar

ivory sleet
#
(isContained,exc) -> {
  if (exc instanceof Exception exception) {
    return new ContextImpl<>(Result.no(exception), user);
  }
  
  if (exc == null) {
    return new ContextImpl<>(Result.yes(isContained), user);
  }
  
  SneakyThrow.sneakyThrow(exc);
  throw new AssertionError("Unreachable code");
}

So I'd need a second opinion, should I handle all exception (even Throwables), or do I just handle Exception instances (which I do as of now)? I know many of Throwable instances are Errors and not suppose to generally be caught but still thonking

sullen marlin
#

cant you do throw SneakyThrow.sneakyThrow(exc); btw

ivory sleet
#

yeah thats what Im doing as of now, but well I could make it so that I always return the exception instance (with a result object) rather than rethrowing it

buoyant viper
#

rare md sighting

tardy delta
#

this one ig

eternal oxide
quiet ice
#

Generally anything but ThreadDeath is okay to xatch

green prism
ivory sleet
#

but ye

quiet ice
#

Yeah that one too

chrome beacon
quiet ice
#

But some Errors are fine to Catch auch as ClassDefNotFoundError

ivory sleet
#

true

ivory sleet
#

but Itd be a hassle to check individual error types just to sort out those that arent supposed to be caught

#

or well

#

so I think at least

quiet ice
#

Though arguably you can Just decide to rethrow anything that extends error

#

Catch throwabke, rethrow error

ivory sleet
#

Ah thats smart

#

hmm

#

yeah Ill do that

chrome beacon
#

Also it says that's a library plugin

#

So try placing it in the plugins folder

green prism
# chrome beacon So try placing it in the plugins folder

I thought about it but then I went to see better... says that it is used by Spartan, then I went on the spigot page of Spartan Anticheat and it doesnt ask for dependencies, I think a shade should do the job... But how can I shade the jar inside the project?

chrome beacon
green prism
#

3000 IQ

green prism
chrome beacon
#

Ok so don't shade it

green prism
#

thank you olivo

twilit roost
#

How can I give any entity animations?

for example wardens when he climb up from ground

crude charm
#

Havent touched an ide in forever so might just be stupid and this was a project from abit ago
https://paste.md-5.net/uzijososuy.bash

Line 68 is

            List<Punishment> bans = data.getPunishments().stream().filter(punishment -> punishment.getType() == PunishmentType.BAN).collect(Collectors.toList());

severe turret
#

.

crude charm
#

I have literally no clue how it could be null;

I tried filling bans, mutes and everything I check for here with atleast one

            item.addLoreLine("&aBans: &f" + bans.size());
            item.addLoreLine("&aBlacklists: &f" + blacklists.size());
            item.addLoreLine("&aMutes: &f" + mutes.size());
            item.addLoreLine("&aKicks: &f" + kick.size());
            item.addLoreLine("&aWarns: &f" + warns.size());

and I use this exact same code here (totally different purpose) and it works;

        @Override
        public ItemStack getItem(Player player) {
            ItemBuilder item = new ItemBuilder(AMaterial.retrieveWoolFromData(3));
            item.setName("&bBans");
            item.addLoreLine("");
            List<Punishment> bans = punishData.getPunishments().stream().filter(punishment -> punishment.getType() == PunishmentType.BAN).collect(Collectors.toList());
            item.addLoreLine(PunishmentUtil.MAIN_COLOR + "Currently banned&7: " + (punishData.isBanned() ? "&aYes" : "&cNo"));
            item.addLoreLine(PunishmentUtil.MAIN_COLOR + "User was banned " + PunishmentUtil.SECONDARY_COLOR + bans.size() + PunishmentUtil.MAIN_COLOR + " times.");
            item.addLoreLine("");

            return item.toItemStack();
        }
severe turret
#

are you using ide?

crude charm
#

ofc lmfao...?

lost matrix
#

"data" could be null

#

And if you use the exact same code twice then why dont you make a method for that?

crude charm
#

wdym by "it", the actual punishment isn't null as it not only goes through and writes into the db but I can get it in other ways, it's just for some reason here where it doesn't work

dry forum
#

how can i apply velocity to a packet armorstnad? ``` public void spawnArmorstand(Player p, Vector v, double x, double y, double z) {

    Level level = ((CraftWorld)p.getWorld()).getHandle();
    ArmorStand stand = new ArmorStand(EntityType.ARMOR_STAND, level);
    stand.setPos(x, y, z);
    stand.getBukkitEntity().setVelocity(v);

    ClientboundAddMobPacket Standpacket = new ClientboundAddMobPacket(stand);
    ((CraftPlayer)p).getHandle().connection.getConnection().send(Standpacket);
}``` doesnt work, nothing happens but the armorstand does spawn and no errors in console (1.18)
crude charm
#

but the idea of getting the number stays the same

lost matrix
lost matrix
#
long bans = punishData.getPunishments().stream().filter(punishment -> punishment.getType() == PunishmentType.BAN).count();
crude charm
#

I do /punish "username" and get a null pointer. The command SHOULD open the "main menu" which only gets the number of bans / kicks ect from the db

#

everything else is just taking to another menu which has it's only pulls in a seperate class, I have commands to open these separately and it works fine so that has nothing to do with it

lost matrix
#

Show the npe and the method that causes it

crude charm
#

I do

lost matrix
#

Well either "data" or a "punishment" is null. Check which one it is

crude charm
#

hold on...

#

I might have been very, very stupid

tardy delta
#

enabled my plugin for the first time and got so many exceptions lmao

#

huh whats wrong here?

noble lantern
#

Space vs tab

#

Idk if thats still an issue with yaml or not

tardy delta
#

replaced it but doesnt work

noble lantern
#

I think that parser is tweaking

tardy delta
#

multiline lol

eternal oxide
#

try using " instead of ' around yoru string in that line

tardy delta
#

nop

#

when i remove the whole block its good```yaml

home:
limit-reached: "&cYou have reached the maximum amount of homes!"
already-exists: '&cYou already have a home with that name!'
no-homes-created: '&cYou haven't created any homes!'
created: '#83c916You have created a new home, %s'```

#

ohhhhh

#

i thought that was replaced automatically

dry forum
#

nms velocity

tardy delta
#

still seems to give errors

eternal oxide
#

if not wrapping the whole string with ".." use a double ' like haven''t

tardy delta
#

nothing seems to work only removing the '

lost matrix
#

"" should allow '' inside

eternal oxide
#

It does. Even allows numbers for keys

tardy delta
#

seems to work now

marble copper
#

DM me if anyone wants to hire developers

tardy delta
#

?services

undone axleBOT
lost matrix
#

?services

undone axleBOT
tardy delta
#

ha

lost matrix
frozen cedar
#

how to forceload chunk?

formal bear
#

Could someone guide me if I'm doing it right, i want to set servers names as tabcomplete arguments and then get the address to display the address
https://hastepaste.com/view/CAJTLA353

iron glade
#

I just ran into the good old problem that comments are not being saved when saving the config file.


        getConfig().set("Setup-Plugin", setup);
        saveConfig();
}```
#

Anything I'm doing wrong?

#

1.19 btw

tardy delta
eternal oxide
#

pretty sure you have to config#options().copyDefaults(true) to preserve comments

lost matrix
eternal oxide
iron glade
#

defaults to true

#

so it should parse them even without me setting it to true huh?

eternal oxide
#

it should

#

did copyDefaults(true) work?

iron glade
#

nope comments are still gone after saving something :(

lost matrix
#

minecraft already has that

eternal oxide
lost matrix
#

And the list goes on. Just take those statistics and display them in a gui.

iron glade
eternal oxide
iron glade
eternal oxide
#

test it on spigot

iron glade
#

okay

lost matrix
#

Well... You can listen to the StatisticsChangeEvent and create one Map<Statistic, Long> which is shared.

tardy delta
#

isnt there api code to get global statistics?

lost matrix
tardy delta
#

hmm idk i was thinking about the singleplayer thing

lost matrix
tardy delta
#

dunno if multiplayer has that too

lost matrix
tardy delta
#

ah

lost matrix
iron glade
eternal oxide
#

I just tested it

iron glade
#

Then IDK what is going on here

eternal oxide
#

let me test one more thing

#

yes

iron glade
#

@eternal oxide you mind if I send you a PM?

eternal oxide
#

I just did java saveDefaultConfig(); getConfig().set("test", true); saveConfig();And comments were preserved.

iron glade
#

alr let me try that real quick

#

Nop, comments still gone

#

frustrating

eternal oxide
#

Sorry I can't help. Works perfectly on Spigot

iron glade
#

How did you set up the comment?

#

just in your config.yml?

eternal oxide
#

comment is in my default config.yml in the jar

iron glade
#

same here

eternal oxide
#
# Delay (in Seconds) before a regeneration starts.
# (The time between the explosion and regeneration)

delay: 10

# Frequency of regeneration (in server ticks).
# (How fast the regeneration runs)

frequency: 5```
#

Spigot 1.19 and compiled for java 16

iron glade
#

Do free lines work? I thought comments have to be right above the setting

eternal oxide
#

I canb try it without

iron glade
eternal oxide
#

works with and without an extra line

#

your config is fine

iron glade
#

I'm doing it the exact same way I'm doing it in one of my other plugins where it's working

#

so weird

eternal oxide
#

are you sure you are not doing something silly, like you already have a config saved with no comments so you are just loading and saving a broken config?

iron glade
#

well getting all the values works fine

vast sapphire
#

i'm trying to set spawned items to 2x their amount with this but i don't want dropped items to multiply, I tried to set the metadata of the dropped item then check for the metadata in the itemspawn event but that doesn't seem to work.

    @EventHandler
    public void dropEvent(PlayerDropItemEvent event){
        Bukkit.getServer().broadcastMessage("dropped");
        event.getItemDrop().setMetadata("dropped",new FixedMetadataValue(Lootsmp.instance, true));
    }
    @EventHandler
    public void onItemSpawn(ItemSpawnEvent e) {
        if (!e.getEntity().hasMetadata("dropped")) {
            e.getEntity().getItemStack().setAmount(2);
        } else {
            Bukkit.getServer().broadcastMessage("dropped item");
        }
    }```
eternal oxide
#

broken as in no comments not broken no data

iron glade
#

How would I check if it does not find any comments in the file?

eternal oxide
#

what?

#

delete teh file and let it create a new file. if it has comments its fine

iron glade
#

yep the new file has all its comments just like in the config.yml from the jar

vast sapphire
#

huh i forgot about that event, that is probably what i'm looking for thanks

iron glade
#

How it looks like when it's just created

tardy delta
#

my eyes

eternal oxide
#

at what point does it lose comments?

iron glade
#

Directly after setting the first value and saving it

eternal oxide
#

show some code that caused that

iron glade
#
    public void set(String path, Object o) {

        plugin.saveDefaultConfig();
        plugin.getConfig().set(path, o);
        plugin.saveConfig();

    }```
This is literally all I'm using
eternal oxide
#

Yep I see no reason for it.

#

works flawlessly here on Spigot

iron glade
#

works fine on my other plugin using the exact same paper version too

eternal oxide
#

You must be doing something differently then. config.yml file encoding is UTF-8?

iron glade
eternal oxide
#

No clue then. I can't replicate your issue on Spigot

iron glade
#

:( Thanks for trying to help tho

marble copper
#

which one is better i7 or amd 5950x

tardy delta
#

depends on what generation ig

marble copper
#

both 10th gen

eternal oxide
#

which i7 is the question

modest garnet
#

anyone know whey this is happenening

#

wait nvm

eternal oxide
#

null at FactoryManager.java:65

tardy delta
#

didnt know List#replaceall was a thing

dire marsh
#

1.19.1 is the chat report update

#

1.19 cannot support 1.19.1

#

not even with via

#

i tested it a few days ago

#

"[22:04:43 WARN] [viaversion]: Due to technical limitations, ViaVersion does not support 1.19.1+ clients on 1.19.0 servers. Please update your server to a newer version."

eternal oxide
#

There is nothign above 1.19 on Spigot yet

dire marsh
#

Well once 1.19.1 releases I will probably update the server to that, but I already have a patch to strip the new signing from everything.

#

probably not, but who cares about those?

#

isn't it off by default anyway

#

there's already an option to disable the chat entirely, not much you can do except tell them to turn chat on

#

their loss

#

I haven't really checked out how the secure chat option works, it might just be a setting to ignore invalid signing on player chat messages, but "system" messages will still get through

#

I strip out uuids and signatures associated with the messages

river oracle
#

System messages will look the best 👌

dire marsh
#

I believe that way it just appears as a system message

river oracle
#

And they got the red little exclamation point

dire marsh
#

well I'll test it once 1.19.1 is out

#

if they do, I'll just fix that.

river oracle
#

Poor md5 has to redo the entire chat api ahaha

dire marsh
#

Mojang forcing API changes in all the wrong ways.

river oracle
#

1.19.1 might have a decent delay

dire marsh
#

since mojang decided to be stupid and add grey bars??

#

i wont even use 1.19.1 on my client because of the chat padding and grey bar stuff

#

ugly ugly

#

not sure what you mean

#

sounds like you're overcomplicating it though

river oracle
#

Hot take

dire marsh
#

oh yeah that's what i thought it was at first