#help-development

1 messages · Page 2182 of 1

eternal oxide
#

No scoreboard code

quaint mantle
#

but egarl

#

said

#

SEE
THIS IS WHAT I MENT

#

?paste

undone axleBOT
eternal oxide
#

Thsi is the only code you have show which concats the name to anything java public String getDisplayName() { return getColorForTier(tier) + name + " " + SUtil.toRomanNumeral(tier); }

iron glade
#

So I found out that the reason the schematics get corrupted after I extract them is that they get uncompressed, usually they are compressed in GZIP format, can I tell intellij that it should export them "as they are"?

golden kelp
#

how do i get all the lines in a sign, they return component but i cant get a string from it

quaint mantle
#

the boss name health stuff

sacred mountain
#

HI MINION

#

IM BACK FROM HOLIDAY

humble tulip
#

hey

#

😮 nice

sacred mountain
#

was a bit boring i just revised the whole time lma

limber owl
#

how would I go about creating world border in my plugin

granite owl
#

in the meantime ive solved the hp displaying by adding a health goal to the scoreboard and adding every player to the board

quaint mantle
#

timinator

granite owl
#

🤣

golden kelp
#

how to get a lectern in 5 block radius of a block?

thorn isle
#

By looking at every block in the radius and seeing if it is a lectern

golden kelp
#

is there any method for it or i gotta loop?

granite owl
#

data

humble tulip
#

@limber owl World#getWorldBorder

sacred mountain
#

AI spigot plugins when :D

thorn isle
#

Alternatively, loop over the TEs of the chunk and check their distance

eternal oxide
granite owl
#

iterate the blocks with the 3d matrix @golden kelp

limber owl
golden kelp
#

okay done

#

now how does one get text from lecterns

crude cobalt
#

Why is there no getUniqueId when calling the command and how can this be solved?

thorn isle
#

Command senders aren't necessarily players

crimson terrace
#

do you mind elaborating a bit more?

granite owl
#

xD

#

getBook or so

#

idk

quaint mantle
thorn isle
#

The console is a command sender, but obviously doesn't have an uuid

humble tulip
golden kelp
granite owl
thorn isle
#

Check and cast to player, then invoke the method

quaint mantle
humble tulip
#

or wherever you format damage as a text

golden kelp
#

i got a better idea, can we check if theres a itemstack (dropped item) at X location? as ill just drop a book and quill and read from it

quaint mantle
#

no file like dat

granite owl
sacred mountain
granite owl
#

xD

quaint mantle
granite owl
#

either that or holograms to implement it in a better way

humble tulip
quaint mantle
#

^

humble tulip
#

he cant figure out where to put code we spoonfed him

sacred mountain
#

rip

quaint mantle
thorn isle
#

He should git gud

quaint mantle
#

ill try tho

humble tulip
#

Because it's true

quaint mantle
#

only the mob health

sacred mountain
#

minion spoonfed my storage hehehhehehe

quaint mantle
#

timmynator

granite owl
#

wdym where to put the code? entity damage event, get health, set health lmao

#

🤣🤷‍♀️🤔

eternal oxide
#

@quaint mantle Do you have this code in a github or something? Asking you for bits will take forever to find the section we actually need

granite owl
#

nah man hes right enough spoonfeeding if you really dont know about this then well

#

🤷‍♀️

golden kelp
#

how can I open the creative inventory for a survival player

granite owl
#

i think the api doesnt support that

#

i tried to and got errors

golden kelp
#

oh o

granite owl
#

creative inventories are heavily client sided

#

u can try but i didnt bother to

quaint mantle
#

but to lazy to pull the link

granite owl
#

maximum advantage?

golden kelp
#

yea like ton of stuff, like close to OP

humble tulip
#

probably just give them creative

#

and restrict stuff from there

granite owl
#

make a custom command

golden kelp
#

um not that way , i still want them to have health and stuff

humble tulip
#

oh

golden kelp
#

i m making a plugin which gives a random player addvantage for a YT vid

granite owl
#

u can still make them invincible by either

humble tulip
#

he wants them vincible

granite owl
#

cancelling or nulling entity damage for that player events

#

and so on

quaint mantle
#

ok found it

#

timmy

#

dms?

granite owl
#

what for? the code?

#

im not gonna write your code for you

quaint mantle
#

no

#

the

#

link

crimson terrace
#

can you send any less words in a message?

quaint mantle
#

alr

granite owl
#

like with a custom command or event or so

humble tulip
#

Half word per message

crimson terrace
#

damn

granite owl
#

okay im just gonna try to ask again now🤣

granite owl
#

does pdc support global namespaces?

golden kelp
#

player#setGameMode(GameModeEnum)

quaint mantle
crimson terrace
granite owl
#

without putting a string as namespace which is deprecated

humble tulip
hybrid spoke
granite owl
humble tulip
#

Maybe let the other plugin access the namespace

granite owl
#

and i dont always wanna target plugin nr1 with plugin nr2 as theyre supposed to still be able to work independently

humble tulip
#

Hm

granite owl
#

but i also dont wanna use nms anymore since its anoying to break ur plugin with every major patch

#

xD

crimson terrace
#

my tip is to set one of them as a dependency to the other and get the plugin instance

humble tulip
#

Does your plugin deoend on anything?

#

Like vault

granite owl
#

no

humble tulip
#

Steal vaults instance and nake keys

#

Oh

granite owl
#

everything is self written

#

🤣🤣

#

i mean i "can"

#

put a string as namespace

#

and use the generic minecraft namespace

#

ive done so to override the vanilla emerald block crafting recipe

#

but thats nasty

humble tulip
#

If i were u I'd do it and worry abt it when it's no longer supported

granite owl
#

haha

#

putting strings as plugin instance does work cause its overload is supported

#

but its marked as deprecated

golden kelp
#

How to get the text from a Component returned by Sign#getLines()

granite owl
#

obv

quaint mantle
#

bro

#

<insert_something_here>

golden kelp
#

xd

quaint mantle
#

timmy

#

dont u dare

#

ill complaint to mom

humble tulip
#

Are you still trying to format the health?

granite owl
quaint mantle
#

poooping

#

atm

golden kelp
ivory sleet
golden kelp
#

spigot

ivory sleet
#

if its paper you might wanna use the paper component serializers

sacred mountain
golden kelp
#

net.kyori.adventure.text.Component

ivory sleet
#

oh nvm

#

you're just getting a String[] right?

golden kelp
#

I get a list of components

granite owl
#

hes asking for the return value

golden kelp
#

Yep

#

wait

granite owl
#

like which object type exactly

ivory sleet
#

literally not

granite owl
#

huh?

golden kelp
#

wdym

ivory sleet
#

like getLines yield String[]

#

not Component or anything

#

thats from paper

crisp steeple
granite owl
#

xD

ivory sleet
#

and the method is then called lines() merely

granite owl
#

theres .lines for a string arra

#

?

golden kelp
crisp steeple
#

??

ivory sleet
golden kelp
ivory sleet
#

then you're using paper

ivory sleet
#

jeez

#

literally fucking not

golden kelp
#

this is NMS

ivory sleet
#

oh

#

myes

#

then you need to serialize the nms component

golden kelp
#

how

thorny dawn
#

fucking god

#

not nms

granite owl
humble tulip
#

Nms for a sign???

golden kelp
thorny dawn
#

what are u trying to do

golden kelp
#

just tryna get the lines off of a sign

humble tulip
#

Bruh

#

Don't use nms to get sign lines

#

Get the bukkit sign

#

And use getLines

granite owl
#

not deprecated as of 1.18.2

golden kelp
golden kelp
granite owl
#

the getLines() method

humble tulip
#

Get the block

#

If it's sign

golden kelp
#

thats done

humble tulip
#

Get the state and cast to sign

golden kelp
#

get its state and cast

#
            Sign sign = (Sign) event.getClickedBlock().getState();
ivory sleet
#

thats not nms

humble tulip
#

Sign.getLines

golden kelp
ivory sleet
#

thats paper

#

bruh

humble tulip
#

Lmao

granite owl
#

i can feel conclures frustration in my bones

crisp steeple
granite owl
#

after the 5th fime

#

time

golden kelp
#

wha

#

BRUH

#

fr

#

i thought i imported that spigot jar

#

🤣

granite owl
#

how

golden kelp
#

i m at peak of dumbness

crisp steeple
#

apparently not

granite owl
#

are you accidentially

#

importing the wrong api

golden kelp
#

got it, thanks

granite owl
#

not the BukkitSerializer?

golden kelp
#

i am sorry

ivory sleet
#

its fine

#

but yeah net.kyori.adventure stuff isnt nms

golden kelp
#

i m sorry x2

#

can a plugin dispatch a command but not inform the console bout it

ivory sleet
#

yeah

#

you can grab a Command instance directly

golden kelp
#

wdym grab it

#

nvm i cancelled the idea

limber owl
#

I mean, what???

ivory sleet
#

you use the wrong Level class

limber owl
#

no

ivory sleet
#

yep

#

and btw

#

its java.util.logging.Level.SEVERE

limber owl
#

then why tf did it said I use the right logging class

ivory sleet
iron glade
#

Does someone know how to compress a file back to GZIP format from the jar or how to prevent it from getting uncompressed in the first place?

limber owl
ivory sleet
#

🥲

humble tulip
#

lmao i followed the guide to using nms on spigot

#

and i have no idea how

#

but it worked

#

seems like magic tbh

#

maven reobfuscates nms methods

limber owl
#

well, you're no alone 😄

humble tulip
#

difference between reegisterGoals and behaviour goals?

#

why are they separate?

quiet ice
#

maven does not do it by default however

pine forge
#

Hey, i have a very simple code that is supposed to strip the color codes of a string. For some reason the ChatColor.stripColor method does not actually remove the color codes (image)

getLogger().info(data);
getLogger().info(ChatColor.stripColor(data));
#

Does anyone know what im doing wrong/how i can fix this?

eternal oxide
#

Those errors are not from that code

pine forge
#

Yeah i know its just logging a colored string and both logs are showing the color

#

But the second log is supposed to strip the color

quiet ice
#

What is data?

pine forge
#

Its just a string

quiet ice
#

Does it contain color codes or not?

eternal oxide
#

then its not even getting to that log code

pine forge
#

It does as you can see from the image

pine forge
#

Thats my plugin name in square brackets

quiet ice
#

If it does then strange, otherwise (e.g. if it uses ANSI-colors) it is the cause

#

Plus depending on the logger settings it might not be even influence-able by you

eternal oxide
#

are you saying "An entity is..." is the actual data you are passing to this?

eternal oxide
#

ah ok, makes sense now

thin delta
#

Anyone with custom biome generation experience using NMS?

pine forge
#

More info: Im getting the string (data) by hooking into log4j, so maybe data contains a weird charset or encoding so the stripcolor method cant recognize its a color code

quiet ice
#

Just use Datapacks at this point

thin delta
ivory sleet
quiet ice
#

(including color escapes)

eternal oxide
pine forge
ivory sleet
#

and minion

humble tulip
#

yes?

quiet ice
ivory sleet
#

brain/behaviour might be saved persistently

humble tulip
#

might?

pine forge
#

bukkit

quiet ice
#

Then it is a logger issue and nothing you can influence - though that would be strange considering that INFO should be white, not red

humble tulip
#

how does it even do that?

eternal oxide
#

can you show us the full data you are passing? show us where it comes from

ivory sleet
#

it uses dataupperfixer or whatever its called

pine forge
humble tulip
#

even without my plugin?

quiet ice
#

But what the hell is the string

ivory sleet
#

ye I mean its part of nms

quiet ice
#

Not the variable name, I know the name of the var

#

I want to know the contents of the string

pine forge
#

It is whats showing in the image

#

An entity is required...

quiet ice
#

Not the variable name, I know that it is data

#

Sigh

pine forge
#

This

#

and as you can see it contains a color code

#

even after calling stripColor on it

eternal oxide
humble tulip
#

@ivory sleet my custom goals can work without my plugin?? That doesnt make sense to me

pine forge
#

I told you its from an appender that hooks in to log4j

ivory sleet
#

oh no

pine forge
#

this is where it comes from

#

I dont think this helps you much

ivory sleet
#

not that but thought u were asking about the behavior "framework"

quiet ice
#

@pine forge Do

            data.codePoints().forEachOrdered(x -> {
                System.out.println(Character.toString(x));
            });
pine forge
#

what does that do

ivory sleet
#

but youll ofc need your plugin loaded in your case

quiet ice
#

Print the true string

eternal oxide
#

Shows every single character in the string

pine forge
#

okay

#

interesting

#

whats codePoints()?

humble tulip
#

was asking abt this

quiet ice
#

Obtains the stream of characters

#

However I assume that you have an ANSI escape somewhere, so of course ChatColor#stripColor is not going to recognise it

eternal oxide
#

Ype, as its from the append of Log4j its's already console formatted

pine forge
#

i think its this actually \x7Fc

#

Dont ask me where i got it from but that is inside of the string

eternal oxide
#

unicode

quiet ice
#

Wouldn't unicode be \u?

pine forge
#

In the console it just shows that though

eternal oxide
#

um, true

pine forge
#

I searched for that char encoding on the internet but i couldnt really find anything

#

Apparently its some delete char

#

but idk

eternal oxide
#

its ASCII

#

\x7F

pine forge
eternal oxide
#

Which means you need an ASCII strip method

pine forge
#

I could maybe convert it to utf8 or something

#

maybe in the appender itself

granite owl
# humble tulip

your custom goals obviously only work with the plugin. have you solved the issue that on server restart the entities get reverted back into their vanilla copy?

#

not /rl but full restart

humble tulip
#

no, im starting to experiment with nms

#

was asking why the 2 methods are separate

pine forge
#

I think theres like an option to specify the logging charset of an appender using a layout

quiet ice
#

I'd just do a .substring(2)

pine forge
#

but im not sure how that works

humble tulip
#

Conclure was telling me the goals are persistent

ivory sleet
#

no

pine forge
ivory sleet
#

but behaviors might be

humble tulip
#

difference?

ivory sleet
#

behaviors are like goals, but they might store state in an entity's brain

quiet ice
#

then just check if the first char is 0x7F, and if it is do substring(2)

humble tulip
#

ohh

ivory sleet
#

which is saved and loaded persistently

humble tulip
#

so that's probabyl why theyre separe

ivory sleet
#

mye

granite owl
#

goals are persistent beyond /rl ive tried that, but the problem is when you save and shutdown all entities get serialized into the world file, and this is where the custom entity gets stored as its vanilla superclass

humble tulip
#

i had a stroke with that last sentence

humble tulip
#

and respawned on startup?

pine forge
#

Is there some issue thingy for spigot? Maybe theyll fix/add this in the future (ascii color code stripping) @quiet ice

granite owl
#

when theyre being serialized there is nothing to kill

#

because the server is down

humble tulip
#

I mean on your plugin disable

granite owl
#

then they dont get serialized

humble tulip
#

if u wanna save your custom entities

#

no kill them on disable

#

and save them yourself

#

and spawn them back on enable

granite owl
#

safe in an external file?

humble tulip
#

yeah

granite owl
#

nah i hate that idea

#

i did that

#

but it doesnt work with mulitcraft for example

eternal oxide
granite owl
#

because of its stupid double backups

humble tulip
#

why would the panel matter?

#

i dont understand?

granite owl
#

because multicraft makes multiple backups

#

and restores the entity

#

and then u have 2

#

1 custom

humble tulip
#

wtf

granite owl
#

1 vanilla

#

if u kill them on shutdown

#

tried

#

and it played out like this

eternal oxide
#

and data = data.replaceAll("[^\\x00-\\x7F]", "");

pine forge
humble tulip
#

don't entities have uuids as well?

granite owl
#

@humble tulip ideal would be to inject the custom entity with its behavior in the vanilla map thats responsible for storing the entity but well idk how yet ill figure when its time

humble tulip
#

guess u can save those

ivory sleet
#

ye they do

eternal oxide
#

non

granite owl
#

and then let the vanilla server handle the serialization

humble tulip
#

but would you plugin have to load before thethe world loads then?

pine forge
humble tulip
#

to inject it into the map before deserialization by mc

eternal oxide
eternal oxide
#

No easy way to combine

humble tulip
#

well how would mc know how to deserialize it?

pale escarp
#

I have a custom villager trade plugin, any idea how to cancel manual input of items in the trading window, but allow selecting the items from the trade list?

granite owl
#

the idea is that you register the entity to the responsible map onEnable, and then when the server shuts down it automatically stores the custom entity

#

and then because its stored custom

#

it gets loaded custom

#

at least thats my theory

#

xD

humble tulip
#

but how will it know how to load

granite owl
#

obv ull have nullptr errors if u remove the plugin then

humble tulip
#

if it loads the entities before your plugin enables

granite owl
#

well thats the question

#

xD

eternal oxide
#

possibly text = text.replaceAll("[^\\x00-\\x7F]&&[\\p{Cntrl}&&[^\r\n\t]]", "");

humble tulip
#

you'd have to inject it into the map in onLoad

granite owl
#

well injecting onLoad doesnt work

#

usually

pine forge
granite owl
#

ive had to use a tasksheduler to inject my custom /list command to fix the multicraft /list console spam

#

because it didnt override onLoad

#

or onEnable

#

and i guess its the same

#

for any map

#

not just commands

sacred mountain
#

whats the possibility that generating a random uuid has the same uuid as an entity on the server

#

if thats even possible

#

the lotto is 1 in 45,057,474

subtle folio
#

Hello friends, im running 1.18.2 and im wondering if I can set the player's overhead name to their display name?

sacred mountain
#

lmfao

verbal kestrel
# sacred mountain if thats even possible

Well, a UUID is 128 bits in length, which is a huge possibility of numbers, the chance of having two the same is very unlikely, even with the pseudo-randomness of computers which increases the chance it's negligible with the way most algorithms generate them

subtle folio
#

Thanks!

pine forge
eternal oxide
#

I've no idea what that extra c is in your text

pine forge
#

Its the color char for red

#

§c

eternal oxide
#

oh

sacred mountain
#

another thing, how are listeners with the same priority level handled? multiple listeners with the priority set to highest

eternal oxide
#

in that case you need to match the ASCII and replace that +1

sacred mountain
eternal oxide
#

so just an additional section on the regex to match a color code

humble tulip
#

not sure

subtle folio
#

Does anyone have an example of how to set a scoreboard teams name?

sacred mountain
#

isnt there a scoreboard javadoc

subtle folio
#

its uncool

sacred mountain
#

?

subtle folio
#

because my school blocks all websites

#

and only allows a few

sacred mountain
#

why are you doing this at school lmao

subtle folio
#

becuase im in history class?

#

duh 😛

humble tulip
#

u want to set it or create a team with a name

subtle folio
#

create a team with a name

sacred mountain
#

team#setPrefix()?

humble tulip
#

there u go

subtle folio
#

thank you you're a life saver

sacred mountain
#

oh right u meant

eternal oxide
#

what color codes are there? 0-9 +a to?

sacred mountain
#

the name not the display

#

mb

eternal oxide
#

f?

humble tulip
#

a to f

sacred mountain
#

real ones use &g

humble tulip
#

only ones i know are 0 is black f is white and 4 is red

sacred mountain
#

i know them all hehe

humble tulip
#

&g is pink or yellow or something?

subtle folio
humble tulip
#

wtf is neon white

#

isnt that just white

subtle folio
#

whiter white

sacred mountain
#

0 is black
1 is dark blue
2 is dark green
3 is dark aqua
4 is dark red
5 is dark purple
6 is gold
7 is gray
8 is dark gray
9 is blue
a is green
b is aqua
c is red
d is light purple
e is yellow
f is white

humble tulip
#

oh wait

#

WTF

#

g is after f

sacred mountain
#

LMFAO

eternal oxide
#

no that won;t work

humble tulip
#

idiot moment for me

#

dont even know the alphabet

subtle folio
#

a b c e d g f

sacred mountain
#

l is bold
m is strikethrough
n is underline
o is italic
k is obfuscated
r is to reset all codes

humble tulip
#

what happened to q

sacred mountain
#

no clue

humble tulip
#

klmno q is left out then r

#

wait p as well

sacred mountain
#

¯_(ツ)_/¯

humble tulip
#

notch hats p and q

#

maybe he is dyslexic

#

or maybe he used r cus reset starts with r

subtle folio
humble tulip
#

Try and see

#

Idk

subtle folio
#

alright alright

humble tulip
#

I've actually never worked with scoreboards

subtle folio
#

how?

humble tulip
#

I hate visual stuff

#

I rather backend things

subtle folio
#

I see

#

with like db's?

humble tulip
#

Yes

iron glade
#

Is it allowed to upload a premium resource which downloads schematic files from a google drive folder?

#

I don't see another way without corrupting the files

iron glade
#

been trying for 2 hrs now but seems like everything corrupts the .schem files when exporting them from the jar

humble tulip
#

Are you using this.getResource?

#

Well plugin.getResource

sacred mountain
#

maybe include them seperately ? might compile weird

#

i had issues with schematics before

humble tulip
#

I used schematics from my plugin before and it worked

eternal oxide
sacred mountain
#

regex funny

sacred mountain
subtle folio
#

funny joke joking

iron glade
#

I'm either getting that it's not a GZIP file format

#

or some other error messages

humble tulip
#

I'm using plugin.saveResource

#

From javaplugin class

iron glade
#

me too

#

but the schematic gets decompressed

humble tulip
#

Weird

iron glade
#

gzipped schematic --> added to resources of jar --> jar runs on server --> schematics get extracted --> are uncompressed / corrupt

humble tulip
#

I'm not sure but are all schematics gzipped?

iron glade
#

no

#

but the api only takes zipped ones

#

afaik

humble tulip
#

Which worldedit?

iron glade
#

fawe

humble tulip
#

Idts

iron glade
#

?

humble tulip
#

I'll send sone code in a bit

iron glade
#

thanks

thin delta
#
ItemStack item = new ItemStack(Material.GLASS_BOTTLE, 1);

ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName("Magnifying Glass");
itemmeta.addEnchantment(); // This

How do I make an item have the enchantment glow but not really have an enchantment?

iron glade
#
public void addGlow(ItemStack itemStack) {

    itemStack.addUnsafeEnchantment((itemStack.getType() == Material.BOW) ? Enchantment.PROTECTION_ENVIRONMENTAL : Enchantment.ARROW_INFINITE, 1);

    final ItemMeta meta = itemStack.getItemMeta();
    meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    itemStack.setItemMeta(meta);

    }```
humble tulip
#

@iron glade can i see how you're compressing the schematics?

iron glade
#

they get compressed when I create them

#

with //schematic save [name]

#

I then directly add the created file to my resources in intellij

humble tulip
#

Can u dm me a schematic

#

I'm gonna try

iron glade
#

sure

harsh totem
#

Oh sure when he talks you do answer

#

Is this because of my avatar?

#

Racist.

winged anvil
#

anyone have knowledge of renting dedicated servers ?

limber owl
#

how can I add green stained glass pane material to itemstack in 1.8

pine forge
#

right?

eternal oxide
#

that will only match to any ascii followed by a color code

daring lark
#

how could i create animated hologram which displays item(i know i can use armorStand but how?)

eternal oxide
#

you could modify the first part to only match that specific ASCII control code

pine forge
#

which is not what i want

limber owl
pine forge
#

btw, it doesnt even work

#

the c is still there

daring lark
limber owl
frail sluice
#

how can I know when a villager levels up?

pine forge
#

also, i kinda want to convert the ascii characters to utf8 and then remove only the color codes

#

instead of removing every ascii char

eternal oxide
#

sec

uneven fiber
#

sex !

pine forge
#

so maybe i could just do java new String(data.getBytes(), StandardCharsets.UTF_8)

#

didnt work

pine forge
eternal oxide
#

still messing with regex

pine forge
#

i dont think regex is the perfect solution here

#

Because i want every ascii character to be parsed correctly not just the color codes to be removed

ivory sleet
#

use the Charset api perhaps?

pine forge
#

Does anyone know how to use log4j appenders/layouts?
I think theres an option to specify a charset

ivory sleet
#

that thing presumes data is already utf 8 compatible

pine forge
# pine forge +

Ive read on stackoverflow and some other sources that ascii is compatible with utf8

ivory sleet
#

myeah it is altho im still quite unsure if thatd work

final monolith
#

Hey guys, whats the fastest way to set blocks?

dusk flicker
final monolith
#

ive saw that setting blocks by NMS is faster than settin Bukkit Blocks, can anyone give me a example?

ivory sleet
#

anyway Lianecx what exactly are you converting?

#

since String(byte[],Charset) should work unless you feed it with a malformed input or sth

#

which is why you might wanna use the CharsetDecoder explicitly

quiet ice
#

I fear that they want to convert an UTF8 string to an UTF8 string

#

Since they do not know that java uses UTF8 by default for almost all strings

ivory sleet
#

that too

humble tulip
#

@ivory sleet when i build with maven, it takes a .schem file from my resources folder and modifies it when putting it into the jar

#

i'm not sure how to properly explain it

#

i guess i can open the file for u in n++

pine forge
quiet ice
#

Sure?

humble tulip
pine forge
humble tulip
#

left is the actual file

#

right is what ends up in the jar

quiet ice
#

Use a byte array

pine forge
#

\x7F This is one of the chars

pine forge
humble tulip
#

what ends up in the jar is larger as well

quiet ice
#

Ah I see I got confused there

ivory sleet
#

minion

quiet ice
ivory sleet
#

disable compression

humble tulip
#

ok

pine forge
quiet ice
#

It is irrelevant?

shell stump
pine forge
quiet ice
#

Java uses an encoding-agnostic String API

pine forge
#

it should be §

quiet ice
quiet ice
#

Did you want to use 0xA7 instead?

humble tulip
#

the problem is whatever is packaging my jar (maven) though

pine forge
humble tulip
#

because if i copy the schematic to the packaged jar everything works fine

pine forge
humble tulip
#

but if i rebuild with maven the schematic is broken again

quiet ice
#

Because 0x7F is DEL in 90% of non-windows charsets

quiet ice
pine forge
quiet ice
#

Only minecraft uses § for color codes

pine forge
#

?

quiet ice
#

The terminal you use probably only accepts ANSI escapes

pine forge
#

this is not what im talking about

#

Im trying to remove the color codes of the string. The colors show up in the console when i log the string but after logging the stripped string (ChatColor.stripColor()) it still shows the colors

quiet ice
#

Just prepend a ChatColor.YELLOW to your string and check if it goes yellow - if it does then discard my advise otherwise you should rethink whether this is really the right way to do it

pine forge
#

what way

#

The string shows up red in the console because its prefixed by a §c i dont really know what youre trying to test

quiet ice
#

My assumption is that an earlier logger adapter converted the $c to 0x7F c

humble tulip
#

@iron glade conclure said to disable compression

#

Idk how tho

ivory sleet
#

I dont use maven tho

humble tulip
#

Oh btw i should say

#

The file gets bigger

#

Not smaller

ivory sleet
#

oh

#

ugh

humble tulip
#

Like 700kb bigger

pine forge
quiet ice
#

Try using mvn clean package

pine forge
#

so minecraft / log4j still recognizes the color code

quiet ice
#

Not just mvn package

#

I do not know what exactly you are doing, so I can only guess

humble tulip
quiet ice
#

Yeah

humble tulip
#

That's what i use

quiet ice
#

Strange

humble tulip
#

I can send the schematic

ivory sleet
#

Lianecx do you have like a snippet of code or sth we can go on?

quiet ice
#

But my assumption you have something like

-> "§c XYZ"
-> "0x7Fc XYZ" (modified by spigot/paper/whatever)
-> (you log this string) (modified by you)
-> "[WHATEVER ANSI] XYZ" (modified by log4J)
-> log4j writes it to STDOUT

humble tulip
#

Try to put that in resources and then build

#

You'll see the file is different

ivory sleet
#

trying it now

#

didnt change for me

#

tho I use gradle

#

can you show me your pom?

humble tulip
quiet ice
frail sluice
#

does VillagerAquireTradeEvent gets called when a novice villager changes his trades on its own?

quiet ice
#

Set it to false and see what happens - afterwards you can apply the filter to special files (or just exclude the schem file from the filter)

humble tulip
#

What does that even do

#

@iron glade set filter to false

#

And try

quiet ice
#

Applies placeholders

humble tulip
#

Oh but there should t be placeholders in a schematic file

#

I guess we should still exclude it

#

Think this is the solution

eternal oxide
quiet ice
#

§ is 0xA7 iirc, not 0x7F

#

However at this point it would be easier to use a javaagent for this

eternal oxide
#

um yeah. I wonder where his delete is coming from

#

so its not actually the §. Thats confused me

#

so that means he can use \x7F[0-9a-fA-F]

spiral hinge
eternal oxide
#

Cannot invoke "org.bukkit.plugin.java.JavaPlugin.getResource(String)" because the return value of "me.kewlkidchristian.hidentag.HideNTag.getPlugin()" is null

#

Extends Spigot???

ivory sleet
#

messages.yml is not embedded in your jar perhaps

spiral hinge
spiral hinge
eternal oxide
#

its saying the Plugin reference is Null, not the resource

ivory sleet
#

Oh nvm I’m blind

pine forge
eternal oxide
#

try it an see?

vocal cloud
pine forge
eternal oxide
#

try a €

#

or ©

#

thats very close to the one thats being replaced

harsh totem
#

Player[] heroes = (Player) event.getRaid().getHeroes().stream().toArray(); why doesn't this work?
The console says Caused by: java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Lorg.bukkit.entity.Player; ([Ljava.lang.Object;
and idk what that means

eternal oxide
#

event.getRaid().getHeroes() returns?

harsh totem
pine forge
#

you can cast an entire array to another type?

eternal oxide
#

ok, you can;t cast a UUID to a Player

harsh totem
#

?

#

oh

pine forge
#

you have to foreach the heroes set and get the player by their uuid

eternal oxide
#

actually you are trying to cast an Arrayof UUID object to a Player

pine forge
eternal oxide
#

you can if you use a stream to map to a player

#

but no you can;t cast as he's trying

#

What are you wanting to do with the Heroes?

harsh totem
#

so I should do it like this?
Object[] heroes = event.getRaid().getHeroes().stream().toArray();

            Player player = Bukkit.getPlayer((String) p1);
            
        }```
pine forge
#

no

humble tulip
#

Lol

pine forge
#

replace Object with UUID

humble tulip
#

LOL

harsh totem
#

the IDE says

humble tulip
#

stream.map

pine forge
#

yes

#

wait what

eternal oxide
#

What precicely are you wanting to do withe these Heroes?

crimson terrace
harsh totem
eternal oxide
#
        heroes.forEach(id -> {
            Player player = Bukkit.getPlayer(id);
            if (player == null) return;
            
            //do things here
        });```
crimson terrace
#

does your class implement Listener?

#

not import, implement

pine forge
#

but if its gray youre not implementing it

crimson terrace
#

does the class youre trying to register as a Listener implement Listener

pine forge
#

it does not because the import is gray, means its not used

#

and hes registering this

crimson terrace
#

cmon, let them figure it out themselves 🙂

#

UwU

prisma osprey
#

OwO?

crimson terrace
#

no

prisma osprey
#

Ok

crimson terrace
#

only UwU

prisma osprey
#

ÜwÜ?

crimson terrace
#

yes, but youre on thin ice

prisma osprey
#

Understandable

pine forge
#

thats what i was expecting

#

it logs correctly though

#

But its encoded again

eternal oxide
#

You have no events to listen to and you are not registering the command

tender shard
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

eternal oxide
#

find a better tutorial? Video ones are usually bad

tender shard
#

register the command using getCOmmand("commdname").setExecutor(this)

#

and get rid of all the event listener stuff

eternal oxide
#

there are plenty on Bukkit/Spigot site to follow

pine forge
#

wrong reply

#

Do you know what i can do about that and why im not receiving the characters that are actually logged in the console?

quaint mantle
#

Please, can anyone help me here? I'm trying to deserialize an object from my Protection class using what I saved in yml file

#
public class Protection implements ConfigurationSerializable {

    @Override
    @Nonnull
    public Map<String, Object> serialize() {
        Map<String, Object> stringObjectMap = new HashMap<>();
        stringObjectMap.put(this.toString(), this);
        return stringObjectMap;
    }

    private final Block block;
    private final Player owner;
    private final Set<Player> playerSet = new HashSet<>();

    public Protection(Block block, Player owner) {
        this.block = block;
        this.owner = owner;
    }

    public Block getBlock() {
        return block;
    }

    public Player getOwner() {
        return owner;
    }

    public Set<Player> getPlayerSet() {
        return playerSet;
    }


    @Override
    public String toString() {
        return "Protection{" +
                "blockLocation=" + block.getLocation() +
                ", owner=" + owner.getName() +
                ", playerSet=" + playerSet +
                '}';
    }
}
C2d93faa-eecf-6f70-9abe-67abcfd01f2f:
- &id001
  ==: me.armando_sales.primeiro_plugin.eventos.Protection
  ? Protection{blockLocation=Location{world=CraftWorld{name=world},x=10.0,y=-60.0,z=-1.0,pitch=0.0,yaw=0.0},
    owner=Armando_Sales, playerSet=[]}
  : *id001
        for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
            if (CustomConfig.getContainersConfig().getList(onlinePlayer.getUniqueId().toString()) != null) {
                List<?> list = CustomConfig.getContainersConfig().getList(onlinePlayer.getUniqueId().toString());
                for (Object object : list) {
                    getEventoBlockPlace().getProtections().add(((Protection) object));
                }
            }
        }
-org.yaml.snakeyaml.error.YAMLException: Unexpected referential mapping structure. Node: <org.yaml.snakeyaml.nodes.MappingNode (tag=tag:yaml.org,2002:map, values={ key=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value===)>; value...
eternal oxide
#

all colour codes have been replaced by ASCII 7F

tender shard
#
public Map<String, Object> serialize() {
    Map<String, Object> stringObjectMap = new HashMap<>();
    stringObjectMap.put(this.toString(), this);
    return stringObjectMap;
}
WTF
eternal oxide
#

but the actual colour c,a,e etc are still there

tender shard
#

you have to put the fields into the map

#

e.g. map.put("block", block) etc

#

map.put("player",player.getUniqueId());

quaint mantle
#

the yml key?

tender shard
#

and then you need a static deserialize method that turns the map back into an object

#

why are you checking the commands name in your onCommand method? o0

#

and why do you return false?

pine forge
tender shard
#

and why is your code in turkish

eternal oxide
pine forge
#

I already tried setting a custom charset in my appender

tender shard
#

idk what language it is

#

anyway it should be in english 😄

#

Player oyuncu = (Player) sender;

#

so what exactly isn't working?

#

any error messages?

#

did you register the command in your plugin.yml?

pine forge
#

I can send you the console logger file

tender shard
#

you have to do that

#

in plugin.yml:

#
commands:
  bilgi:
eternal oxide
pine forge
#

DMs or here?

#

Its quite big

eternal oxide
#

start a thread

#

?paste

undone axleBOT
tender shard
#

yes

quaint mantle
#

can I serialize a block?

tender shard
#

but you can serialize a location and blockdata

quaint mantle
#

thank you

coarse shadow
#

send x y z seperately instead of sending the whole info about location

#

guys how can i make an item unstackable

quaint mantle
#
player.sendMessage(ChatColor.DARK_GRAY + " " + ChatColor.BOLD + "⬛ " + ChatColor.GREEN + "Player's Location: " + ChatColor.GOLD + "X=" + player.getLocation().getBlockX() + " Y=" + player.getLocation().getBlockY() + " Z=" +player.getLocation().getBlockZ());
#

if you want double values use getX(), getY(), getZ()

subtle folio
#

gamers how do I serialize a List<Object>?

ivory flume
harsh totem
#

I went into a village while I had bad Omen X (10) and started a raid.
I want to be given hero of the village 10 when the raid is done but when I do this the effect amplifier becomes 5 when it shouldn't.
this is the code PotionEffect effect = new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE, 120000, event.getRaid().getBadOmenLevel());
its in RaidFinishEvent

subtle folio
ivory flume
#

depends on how you want it

subtle folio
#

i want to save it to a yml file

quaint mantle
# subtle folio gamers how do I serialize a List<Object>?

I'm doing like that:

CustomConfig.getContainersConfig().set(protection.get().getOwner().getUniqueId().toString(), EventoBlockPlace.getProtections().stream().filter(protection1 -> protection1.getOwner().equals(player)).toList());
                    CustomConfig.saveContainersConfig();
quaint mantle
#

```java
<code here>
```

#

np

coarse shadow
harsh totem
#

why can't a raid's bad omen level be above 5?

subtle folio
harsh totem
#

I can summon a raid when I have bad omen 255 tho

river oracle
#

Minecraft limits same reason you can't obtain sharpness 100 in vanilla

humble tulip
wide coyote
humble tulip
wide coyote
river oracle
#

Si senor

coarse shadow
#

there are no such method as maxstacksize iirx

wide coyote
coarse shadow
#

oh with reflection

wide coyote
harsh totem
coarse shadow
#

i think ima go with pdc lol

humble tulip
#

Would it persist tho

wide coyote
#

yeah thats easier

river oracle
#

Creative mode

#

Or

#

Commands

harsh totem
#

I meant in the plugin

river oracle
#

Just apply bad omen 255 Or something

harsh totem
river oracle
#

Mojang probably has hard caps on max waves spanws etc

harsh totem
#

can I use a formula to get the used bad omen amplifier by the raiders?

#

does that exist

livid basin
#

Hey, I want to create a command for change the max HP nummber of à player. However when I try to use "p.setMaxHealth(args)" I can't because it's an List and not a double anyone knows how I can do for create my command ?

humble tulip
#

And whichever arg

#

Or double or whatever

harsh totem
livid basin
harsh totem
#

its an array

river oracle
#

Learn about Java arrays before continuing is my reccomendation

kindred valley
#

?paste

undone axleBOT
livid basin
harsh totem
#

the IDE

livid basin
harsh totem
#

@river oracle so you think that I need to save the amplifier in the class?

harsh totem
#

just use the array

iron glade
#

Anyone knows why this is not triggering?

@EventHandler
    public void onMoveWhenAbducted(PlayerMoveEvent e) {

        Player p = e.getPlayer();
        Location loc = p.getLocation();

            Location oneUp = loc.add(0, 1, 0);

            if (loc.getWorld().getBlockAt(oneUp).getType() == Material.BLACK_STAINED_GLASS) {

                p.teleport(loc.add(0, 2, 0));
                p.getActivePotionEffects().clear();

            }```
livid basin
harsh totem
#

?learnjava

undone axleBOT
harsh totem
#

@livid basin

#

learn how to use arrays please

#

array is not a variable type, its a variable structure or whatever it's called in English

quaint mantle
#
c3c73faa-eeef-2f10-9bae-67abcdd00f5f:
- ==: me.armando_sales.primeiro_plugin.eventos.Protection
  owner: &id001
    ==: Player
    name: Armando_Sales
  location:
    ==: org.bukkit.Location
    world: world
    x: 13.0
    y: -60.0
    z: -4.0
    pitch: 0.0
    yaw: 0.0
- ==: me.armando_sales.primeiro_plugin.eventos.Protection
  owner: *id001 #<<<
  location:
    ==: org.bukkit.Location
    world: world
    x: 18.0
    y: -60.0
    z: -5.0
    pitch: 0.0
    yaw: 0.0

Is this correct? I mean *id001 is a pointer to the address bc is the same player right?

harsh totem
#

isn't this skript?

wide coyote
quaint mantle
#

this is a list of Protection that are serialized in a yml file

wide coyote
#

and do not add to location directly, use Location#clone

harsh totem
#

oh ok

#

idk how to work with yml's

#

sorry

humble tulip
#

I do know

#

Glass can never be 1 blockabove the plauers feet

#

Cuz that's where their waist is

#

Look 2 blocks above

harsh totem
#

my server gives me an error in console when I join ;-;

humble tulip
wide coyote
#

ah

iron glade
#

I ended up with ```java
Block above = p.getEyeLocation().add(0,1,0).getBlock();

        if (above != null && above.getType() == Material.BLACK_STAINED_GLASS) {```
#

works now

humble tulip
iron glade
#

only problem is p.getActivePotionEffects().clear(); is not removing potion effects

iron glade
humble tulip
#

Maybe iterate thru the list and do p.removePotionEffect

#

Could be a copy being returned

#

Also if u just wanna remove levitation, just remove that

#

Or the effects you added

iron glade
#

true

#

GameMode.CREATIVE

#

actually

#

player.getGameMode() == GameMode.CREATIVE

#

np

harsh totem
#

tf my server doesn't load

#

it crashed immediately

iron glade
#

check ur server properties file

#

show your whole code

#

if (player.getGameMode(GameMode.CREATIVE))

#

is the problem

iron glade
humble tulip
#

Lol

iron glade
#

@humble tulip btw I tried everything and it*s not removing the potion effect 0.o

humble tulip
#

Can i see?

iron glade
# humble tulip Can i see?
for(PotionEffect effect : p.getActivePotionEffects()) {
             Bukkit.broadcastMessage("§aEffect: " + effect);
             if(effect.getType() == PotionEffectType.LEVITATION) {

                        p.removePotionEffect(effect.getType());
                        break;

                    }

                }```
humble tulip
#

Is the effect being broadcasted?

#

An if statement needs a true or false input

iron glade
#

Just replace java if (player.getGameMode(GameMode.CREATIVE)) with java if(player.getGameMode() == GameMode.CREATIVE) {

humble tulip
#

So you need to compare the players game mode to creative

#

Using ==

slate mortar
#

?learnjava

undone axleBOT
iron glade
humble tulip
#

But not removed

iron glade
iron glade
slate mortar
iron glade
slate mortar
#

reminds me of the year at which i'll be funny

iron glade
#

never?

slate mortar
#

._.

iron glade
#

: P

#

np

slate mortar
iron glade
#

It's because I don't want to summon the smiley

slate mortar
#

it reminds me of people who put spaces BEFORE instead of AFTER dots

humble tulip
#

:)

slate mortar
#

like this .

#

awful

iron glade
slate mortar
#

who uses that feature anyway

iron glade
slate mortar
#

you old?

iron glade
#

you know how old I am

humble tulip
#

I have no idea why it doesn't rekove the effect

#

It should

iron glade
slate mortar
pastel juniper
#

How can I update an inventory without setting the cursor to the middle???

iron glade
#

open it again

#

iirc

slate mortar
#

that does indeed reset the cursor afaik

iron glade
#

fock

humble tulip
#

Set the contents

#

Without opening an inventory

slate mortar
#

i dont think that'll change anything

#

at least changing item's meta doesn't

pastel juniper
#

I want a specific item to be updated

slate mortar
#

but its worth a try ig

slate mortar
humble tulip
#

I'm pretty sure setting one item doesn't reset the cursor

slate mortar
#

yea, but i have no idea if it even updates the inventory automatically

humble tulip
#

I'm working on a plugin rn where when u click the in its updated and the cursor isn't reset

slate mortar
quaint mantle
#

how do i make a database that saves player inventories

pastel juniper
slate mortar
#

updateInventory doesn't "update" the inventory afaik

#

it only syncs some packet-like shit

pastel juniper
#

😦

slate mortar
#

idk if thats enough to update changed items

humble tulip
#

Click the inventory*

humble tulip
#

Why do u need to use that

slate mortar
slate mortar
humble tulip
#

Yep

slate mortar
#

interesting

#

it doesn't when you just change item meta's

#

thats why i was confused

humble tulip
#

Set back the item

#

In the inv

slate mortar
#

yea, that can be a bit confusing when using it for like 50 items

#

like, i remember me doing that all manually 🤡

humble tulip
#

Well if you want it to be seamless,

#

You're gonna have to set it