#help-development

1 messages · Page 2040 of 1

tender shard
#

NOT empty

#

oh wait

#

you are right

#

it's actually valid without a value

#

nevermind

glossy venture
#

why is the if statement not being called?

tender shard
glossy venture
tender shard
#

just the body is not called

glossy venture
#

ok the body

#

fine

#

fuck

tender shard
#

beause api is string with a value of "null"?

glossy venture
#

im stupid

#

ight

low temple
glossy venture
#

i thought it said == for some reason

tender shard
#

oh lao

tender shard
glossy venture
#

nah thats not the reason

tender shard
#

well I didn't see it either lol

glossy venture
#

i was just being stupid

tender shard
#

code is supposed to be blocky

#

no fancy chars

low temple
#

Maybe his ide automatically does that

tender shard
#

you also have valid identifiers red all the time?

#

good, lol

#

ugh

low temple
#

In spigot is there a way to catch Chuck generation events? Like if I wanted to replace a block with another one while it’s being generated?

tender shard
#

still weird

#

but better than what the dude above posted

#

red/orange should catch attention

#

i.e. for errors etc

low temple
#

Redish variable names always looks like something is wrong w ur code

tender shard
#

yeah but's basically every IDE's default

#

sure, if you prefer errors to be green, why not

low temple
#

Like something isn’t imported correctly

tender shard
#

it just confuses everyone else

low temple
#

My keywords are blue

river oracle
low temple
tender shard
#

get rekd

low temple
#

Light mode users should be banned from programming

tender shard
low temple
#

I can’t imagine staring at a flash bang for hours while trying to code something

tender shard
#

you guys really need to see an eye doctor

#

that's not bad but also not good

#

get a "Gleichtsichtbrille" and you spend 3k

#

lol

#

for just 1k?

#

not bad

#

decent price

low temple
#

I’m shortsighted as fuck

tender shard
#

THANKS, OBAMA

#

it was a joke lol

tender shard
#

german prosecutors already try to fuck the big gas station companies for doing "illegal" prices

#

but it'll probably take 2 years until sth happens lol

regal carbon
tender shard
regal carbon
#

createSignUpdater

tender shard
regal carbon
#

it sends one, but its receiving multiple messages

tender shard
#

then it's a bug in your BungeeMessageAPI class I guess

#

where did you get this class from?
seems like this "BungeeMessageAPI" is actually meant to broadcast to the other servers instead of just to the proxy

#

(just a wild guess)

#

?paste (for me)

undone axleBOT
tender shard
#

this also won't work

#

fuck this whole type erasure thing

#

java generics and arrays will never become friends I guess

#

I guess it'll have to be a Object[] instead that people must cast to D[]

#

but then I can't make it a generic PDC type

#

FML

#

I need some smart people

#

@worldly ingot

#

sorry for ping but I know you're smart

tender shard
#

go see a doctor

quiet ice
#

I'd Wrap the Array, but idk what your exact issue is

tender shard
quiet ice
#

Actually

#

Could't you treat the Array as a Java lang Object?

#

It should be possible to Cast int[] to Object and the other way around.
It's hacky but May work

tender shard
#

even if an Object[]contains only ints, you can't cast it to int[]

quiet ice
#

I am talkimg about Object, Not Object array

tender shard
#

oh yeah sure it'd work for a normal object

#

but I need a generic array

quiet ice
#

Create one of Just read one?

tender shard
#

I need sth like

String[] array = myMethod.getArray(String.class, ...);
#

WITHOUT casting or anything

#

and without having to pass String[].class

#

but yeah I guess it's not possible at all

#

I can instantiate a T[] from just having T.class but that won't help me in actually infering that as type argument

quiet ice
#

Ah yeah you would have to have Specialized Methods for that

tender shard
#

but it needs to be generic

#

ever wondered why List.toArray() requires an empty array? this is the reason

quiet ice
#

Or just require the use of Valhalla. But idk If they have already Preview builds for that

tender shard
#

idk what valhalla is

tender shard
quiet ice
#

Ah you mean that

#

But you can still Pass a non-empty array

tender shard
#

you have to at least once call a method with your class instance

tender shard
quiet ice
tender shard
#

ACF works like this:

PaperCommandManager acf = new PaperCommandManager(this); // Als oworks on spigot, although it's called Paper...
acf.registerCommand(new MyCommandClas());
quiet ice
#

They have a subproject for "Universal Generics" iirc

tender shard
#

hm

#

thanks, I'll have a look

quiet ice
#

But it will still Take years until we can make use of it. Sadly.

#

Because Backwards compat et al

rough drift
#

would adding an entry to the ban entry of type name add the player's uuid or the player's name?

tender shard
undone axleBOT
rough drift
#

it says it will return a uuid iirc

tender shard
rough drift
#

yes

#

ofc

#

aren't we in the spigot discord?

tender shard
#

is it in Bukkit?

#

I mean, Bukkit class?

rough drift
#

i don't recall

#

lemme check

#

yep

tender shard
#

please tell us exactly the method you're talking about

rough drift
#

its in bukkit class

tender shard
#

Bukkit only has a method to ban the IP

rough drift
#

Bukkit.getBanList(BanList.Type.NAME)

tender shard
#

it says "banned names"

rough drift
#

iirc in newer versions it returned a uuid

tender shard
#

so I am pretty sure it actually uses names

rough drift
#

lemme check on 1.17

tender shard
#

if it indeeds bans UUIDs, it shouldn'T be called "Name" but "OfflinePlayer" or "UUID" or sth like that

#

but yeah doesn't mean I'm 100% right, maybe the bukkit names are just cursed

#

but if it explicitly says "name", I guess that does mean "name"

rough drift
#

hold on loading a 1.17 plugin

tender shard
#

also bukkit keeps track of "old" player names

#

so if you ban "mfnalex" now, and I now change my name to "mfnblex", the server knows I was mfnalex beforehand

rough drift
tender shard
rough drift
#

from Bukkit#getBanList

#

its javadoc

#

no?

tender shard
#

you were using paper or sth

rough drift
#

nope

#

spigot 1.17.1 api

tender shard
#

in 1.18.X the words "no longer supported" don't even appear anywhere

rough drift
tender shard
rough drift
#

yes

#

and 1.17.1

rough drift
#

spigot api

tender shard
#

I have no idea where you got those javadocs from

rough drift
#

thats the wrong place

#

LMFAO

#

its Bukkit#getBanList method

#

not the banlist class

tender shard
tender shard
#

sorry

#

yes you're right

rough drift
#

Ayo bro

#

i ain't hallucinating

#

^

tender shard
#

well, idk if md was drunk but how are peopole suppose to use a UUID ban list if it doesn'T exist?

#

maybe create an issue on the stash, asking that

rough drift
#

?stash

undone axleBOT
tender shard
#

the docs say "don't use name, use UUID" but the API doesn't provide a UUID ban list

#

so yeah I'D definitely consider this a bug

rough drift
#

again, thats the wrong method/class

#

its Bukkit#getBanList

rough drift
tender shard
#

@sullen marlin the docs tell people to use UUIDs instead of names to ban players, yet there's no BanList.Type.UUID ?

rough drift
#

ohk

tender shard
#

I already pinged md

#

exactly

#

that's my reason to ping him

#

docs say use "UUID"

rough drift
#

alex, do i drop support for 1.16 and get hate from all the kids that can't install via version/backwards?

tender shard
#

tbh I don't really care 😄

rough drift
#

like, they are so fricking annoying

#

"hey add 1.16 support ples"

#

1.16

#

ADD

#

SUPPORT

#

LES

#

AASADAS

tender shard
#

do you sell plugins?

rough drift
#

DAS

tender shard
#

or are they free?

rough drift
#

no

#

everything's free and open source

tender shard
#

if your plugins are free you must support more versions to not get hate

rough drift
#

i might sell something in the future, but for now everything we make is free and open source

tender shard
#

I currently do 1.16.X+

rough drift
#

well imo atleast suppor 1 version behind, thats what i'd want to do (since some people might have not yet updated to latest)

tender shard
#

once 1.19 comes out, it'll be 1.17+

rough drift
#

^

#

yes

#

intellij tells you

#

hover over mined data

#

and it will convert it to a record

#

yes?

#

more actions

#
public record MinedData(Material block, Location blockLocation, long minedAt) {}
#

done refactored it

#

yes

#

ofc

#

everything inside it

rough drift
#

(only thing is getters are .block() .blockLocation() and .minedAt())

tender shard
#

I fucking hate generics when it comes to arrays

#

how is it possible that I managed to make Lists, Sets, Maps, etc possible but not simple arrays, smh

#

you know what? fuck arrays

#

if people wanna use them, you gotta use a list and use toArray

#

won't work

lilac dagger
#

i told you

tender shard
#

because of type erasure

lilac dagger
#

arrays need a lot of work haha

tender shard
#

yeah I could easily make it work by requiring people to pass an empty array

#

but that just doesn't look right

#

I mean

#
DataType.asArray(DataType.ITEM_STACK, DataType.ITEM_STACK[])
#

no

#

then people should just use a list instead

#

I want this to work:

PersistentDataType<?,ItemStack> type = DataType.asArray(DataType.ITEM_STACK));
#

they shouldn't be required to give both, T and T[]

#

you know what, fuck it

#

I just consider it done now

#

it supports Map<ItemStack,Date> and other weird stuff,I guess that's enough

young knoll
#

Itemstack, date?

#

Interesting

tender shard
#

it takes everything for which you have a PersistentDataType

#

You could even do a List<List<List<ItemStack>>>

#

and stuff like that

#

it supports basically everything

#

for example even HashMap<String,HashMap<List<Integer,ItemStack>>>

#

the only thng currently on my todo list is to add a DataType for Enums

#

right now you still gotta use strings and parse them manually

young knoll
#

Does it store all this as bytes

tender shard
#

you cannot believe how happy I am

#
        PersistentDataContainer pdc = player.getPersistentDataContainer();
        Map<String,Integer> map = new HashMap<>();
        map.put("mfnalex",27);
        map.put("mfnalex's Father",67);
        map.put("md_5",31);
        NamespacedKey key = new NamespacedKey(this, "persons-to-age-map");
        pdc.set(key, DataType.asMap(DataType.STRING, DataType.INTEGER), map);

        Map<String,Integer> storedMap = pdc.get(key, DataType.asMap(DataType.STRING, DataType.INTEGER));
tender shard
young knoll
#

I’ll take that as a yes

tender shard
#

somehow my DataType library got some hate on spigot

#

I mean, I get it, it wasnt exactly revolutionary

#

but once I post this update and people still claim it's "not useful", then they simply didn'T understand what it does, smh

#

I am actually really proud of me right now lmao

vocal cloud
tender shard
#

❤️

young knoll
#

Liziscute

opal juniper
vocal cloud
opal juniper
#

lol

tender shard
#

only thing left for me is to add an Enum data type

vocal cloud
tender shard
#

Am I the only one who learnt on how lambdas etc work by letting IntelliJ convert my old code?

young knoll
#

Who’s Liz anyway

tender shard
#

404

lilac dagger
#

i was an eclipse user when i learn so i assume yes

tender shard
opal juniper
#

very dramatic

lilac dagger
#

yes

#

now i'm working on a project

tender shard
#

a song about a real life school shooting

unreal quartz
#

Epic

opal juniper
#

:/

tender shard
tender shard
#

fuck you

unreal quartz
tender shard
#

@unreal quartz

#

yeah

#

you got me riht

#

you are a used tennis sock

unreal quartz
#

riht

tender shard
#

or at least that's how you smell like

vocal cloud
unreal quartz
tender shard
vocal cloud
tardy flame
#

What's hetero

young knoll
#

Yeah sadly eclipse doesn’t do that

vocal cloud
young knoll
vocal cloud
tender shard
# vocal cloud Sorry I'm taken~

it's not hetero if you so "no hetero" after fucking a girl (or a boy if you're a girl. if you're trans, it get it gets a bit more complicated)

vocal cloud
opal juniper
young knoll
#

Yeah heck women

#

Jk plz date me

tender shard
#

if you don'T like me, ask jokni out

#

jokni is definitely bi-curious

vocal cloud
#

Anyways time to record a spigot tutorial and fail miserably hyperKEKW

tender shard
#

am I the only one who hates video tutorials?

#

a written tutorial is so much better

vocal cloud
#

Provide all the tutorial code in the description hes_UwU

tender shard
#

"Hey wassup thanks 4 watching my shitty tutorial, pls sub & leave a comment bla bla" and after 38 minutes it starts

vocal cloud
#

ASMR coding

tender shard
upper niche
#

I've found that kody simpson offers pretty good tutorials
nice and concise, links other resources sometimes, and shows what his code does periodically

vocal cloud
#

Println

young knoll
#

It depends

#

Some people do much better with videos

eternal needle
#

Hi, i wonder if its poseble to use this ** translateAlternateColorCodes** and do that to a list i have i config?

i use now

ChatColor.translateAlternateColorCodes('&', "messages");

Tag me 😄

sage dragon
#

What's the easiest way of predicting where an arrow would land? 🤔

I have no idea of how fast they are or how they fly 😅

midnight patrol
young knoll
eternal needle
young knoll
#

I just told you how

#

How would that imply it’s not possible

#

You could do it with a stream too if you wanted

grim ice
#

i cant imagine something you make being useless so I automatically assume they're idiots :)

#

oh the More persistent data types thing

#

its awesome, ignore anyone saying it sucks

vast sapphire
#

Something like this ```yml

Armorshop:
Slots:
1:
material:
action: SELL, BUY
sellprice:
buyprice:

#

But yeah

#

For each slot in a shop

grim ice
#

lol tf

#

ur formatting

sage dragon
eternal needle
# young knoll I just told you how

how do i do it in a list? is it like

messages:

  • "&7[&aTips&7] &eAh er en 24/7 åpen shop"
  • "&7[&aTips&7] &eBruk /report grunn on man finner en feil"
  • "&7[&aTips&7] &eHusk vi har et kar bruk /map"
  • "&7[&aTips&7] &eMan kan lage shop se i spawn"
  • "&7[&aTips&7] &eMan kan søke om warp på /report eller på en ticket i discord"
  • "&7[&aTips&7] &eDet er av og til events på servern med spill penger og rank"

is it 1-2-3-4...

hollow bluff
#

loop through it

eternal needle
brave sparrow
#

?learnjava

undone axleBOT
nova prism
brave sparrow
#

@sage dragon what are you actually trying to do

grim ice
#

u dont know how to loop thru a list u should learn java

sage dragon
vast sapphire
brave sparrow
#

you could probably do it better by messing with NMS

#

making arrows hit falling blocks

vast sapphire
#

I prefer to recode Minecraft

#

Then add my plug-in

#

Ma is good too

brave sparrow
#

that's where a lot of my spigot patches have come from lol

#

i needed minecraft to behave differently so i made it so

vast sapphire
#

W

hollow bluff
sage dragon
eternal needle
hasty prawn
young knoll
#

Now we need to allow plugins to do controlled patching of internals

eternal needle
hasty prawn
#

That's fine if this.messages is a List<String>

onyx fjord
#

How can i add stuff to a message before all the content

#

aka

somethingiadded name: <message>

ivory sleet
#

if u use the event basically event.setFormat("somethingiadded %s: %s")

onyx fjord
#

ye but i dont wanna change format

#

i just want to include "my thing" to existing message

hasty prawn
#

huh

ivory sleet
#

thats not how it works tho

onyx fjord
#

then how do plugins like interactivechat do that

hasty prawn
#

I'm still unsure what you're trying to do and why you're trying to avoid setFormat

spare canyon
#

is there a simple way i can make certain players not appear in the tab list?

#

per player ofc

hollow bluff
#

packets?

muted sand
#

is there any benefit to using protocol lib for packets opposed to nms itself?

vocal cloud
#

protocol lib does it for you. That's about it. If you want to not require a library then do it yourself

muted sand
#

oh, alright!

viral crag
#

anyone know how to control/restrict/supress ProjectileLaunchEvent event ? LaunchProjectile seems to call it and creates a bad loop that crashes servers - canceling the event doesnt work

young knoll
#

Use a simple Boolean

#

Toggle it before and after you call lauchProjectile

#

And ignore the event if it is set

viral crag
#

already tried that, it doesnt work either

#

sort of wondering if it re-fires the event after exit

young knoll
#

That should work fine

#

I’ve used that method with various events

viral crag
#

oh, and any idea how to remove a few thousand arrows short of rollback? - it seems the server doesnt suppress the event itself either

young knoll
#

/kill @e[type=minecraft:arrow]

viral crag
#

nope, cant do that if not in the chunk and loading the chunk crashes the server trying to tick the arrows

safe edge
#

Delete chunk data

viral crag
#

yeah, that was my other possible thought

eternal needle
#

Hi i need help with this, i need to have colors on my messages but its in config.

this is my code and it's not working

for (String i : instance.getConfig().getStringList("messages")) {
                ChatColor.translateAlternateColorCodes('&', i);

pls help and tag me

viral crag
#

result.append(ChatColor.WHITE);

eternal needle
hollow bluff
#

It works with every color, it was just an example

viral crag
#

works just fine was long as the client understands the code

eternal needle
young knoll
#

You are translating the string

#

But not storing it to a variable or anything

#

So you can’t access it later

eternal needle
hollow bluff
#

omg

vocal cloud
#

You do that by learning java I imagine

hollow bluff
#

ur not even sending the message

lapis widget
#

?learnjava

undone axleBOT
hollow bluff
#

Learn java please

eternal needle
hollow bluff
#

you need to get the player first 🙄

viral crag
#

might just be a general broadcast

hollow bluff
#

either way, he isnt sending anything with his code

onyx fjord
#

yall have an idea why
button.addExtra(msg.toString());

prints

#

this crap?

#

msg is a ChatMessage btw

crimson terrace
#

looks like youre printing an object

onyx fjord
#

so how do i get raw text from ChatMessage?

crimson terrace
#

let me check

#

the ChatMessage is your own class?

onyx fjord
#

yep

maiden thicket
#

override toString

#

and return a custom string (in this case your message)

crimson terrace
# onyx fjord yep

you might have to override toString and tell it what you want it to print

onyx fjord
#
    public ChatMessage(String player, String message) {
        this.player = player;
        this.message = message;
    }
#

this is what chatmessage is

maiden thicket
#

yes do

#

so

#

override toString

#

and return this.message

crimson terrace
#

^

onyx fjord
#

okay i just did a 1000iq thing

#

thank yall for help

#

i have to say

#

nevermind

#

i kinda f up

#

how do you get like entire message formatted in the chatevent?

viral crag
#

glue it together - or do you mean catching it?

onyx fjord
#

lets say my message looks like this: [Somerank] somename: somemessage

#

i want to get that entire thing

viral crag
#

setMessage() is the one to be sent

#
setMessage(String message)
Sets the message that the player will send.  ```
#

you really are being a pita

#
@NotNull
public String getMessage()
Gets the message that the player is attempting to send. This message will be used with getFormat().
Returns:
Message the player is attempting to send ```
onyx fjord
#

chill guys 😛

viral crag
#

"i want to get that entire thing"

onyx fjord
#

ye thats what i want

#

bro yk what

#

i think ima recode that shit

#

i cant live with those alphabet variables

#

which i didnt make additionally

#

idek

#

probably the one with higher priority on event

#

is format.toString() gonna not print weird shit

viral crag
#

garbage in = garbage out - it will convert whatever you give it to a string

#

that includes what you already tried to do

onyx fjord
#

o.o

half hare
#

I am using 1.18.2 for my plugin and im trying to place beds

#

It works if I use Material.RED_BED

#

But if I try any other colour the bed doesnt spawn

#

Can anyone help?

#

Please ping me

#
public void setBed(Location bedFootLoc, BlockFace facing, Material material){
        BlockState bedFoot = bedFootLoc.getBlock().getRelative(facing).getState();
        BlockState bedHead = bedFoot.getBlock().getRelative(facing).getState();
        Material mat = Material.RED_BED;
        bedFoot.setType(material);
        bedHead.setType(material);
        byte data;
        byte data1;
        if(material.equals(Material.RED_BED)){
            data = 0x3;
            data1 = data;
            data1 |= 0x8;
        } else if(material.equals(Material.GREEN_BED)){
            data = 0x0;
            data1 = data;
            data1 |= 0x8;
        } else if(material.equals(Material.BLUE_BED)){
            data = 0x1;
            data1 = data;
            data1 |= 0x8;
        } else {
            data = 0x2;
            data1 = data;
            data1 |= 0x8;
        }
        bedFoot.setRawData((byte) data);
        bedHead.setRawData((byte) data1);
        bedFoot.update(true, false);
        bedHead.update(true, true);
    }
#

It only works for Material.RED_BED

#

I've tried passing through Material.GREEN_BED, .BLUE_BED and .YELLOW_BED but they do not work

#

if I change the material to RED_BED for all of them

Material mat = Material.RED_BED;
        bedFoot.setType(mat);
        bedHead.setType(mat);

it works perfectly

#

I am using 1.18.2 and ive declared api version 1.18 in my plugin.yml

#

so I dont know why its not working for Material.<COLOUR>_BED and only works for Material.RED_BED

#

:/

quaint mantle
#

like this?

                                ItemStack item = player.getInventory().getItem(i);
                                if(item.getType().equals((profile.getRefill() == Refill.SOUP ? Material.MUSHROOM_SOUP : Material.POTION)))
                                    player.getInventory().getContents()[i].setType(Material.AIR);
                                    break;```
tardy delta
#

whats wrong with for (int i = 0; i < inv.size(); i++)?

#

also there's a inv.setItem method

muted sand
#

how do I show particles to all players but a specific player?

would I use the show particle thing, and use a for loop? or is there something easier (and possibly faster)?

tardy delta
#

to all players but a specific player?

#

i assume you want to exclude a player?

muted sand
#

wasn't there that other method that shows it to everyone? is there a way to uh, stop them from seeing the particle?

tardy delta
#

it will stop when you stop sending them

muted sand
#

oh.

hasty prawn
#

You should just use Player#spawnParticle as Zacken suggested.

muted sand
#

oh well, alright! thanks!!

viral crag
half hare
#

is that my error? becos it works for Material.RED_BED

viral crag
#

bedFoot.setRaw type or data

half hare
#

Could you please give an example?

viral crag
#

you sort of have two combined methods that would be unpredictable

dreamy chasm
#

Hi, anyone got recommendations for storing persistent data on blocks, was originally storing data in a flat file along with the co-ords but it seems impractical?

viral crag
#

you use bedFoot.setRawData() use bedFoot.setRawType() instead of bedFoot.setType()

half hare
#

setRawType or setType?

viral crag
#

bedFoot.setType() is to be used on Block I believe, unsure what happens if you try to use it on BlockData

half hare
#

Whats the object for .setType()?

#

Im trying to look through docs and i dont see it

viral crag
half hare
#

Ah

#

Thanks

#

But then how do I cater for the bed head and bed foot

#

Are they separate blocks?

viral crag
#

they are now

#

handle them both the same way, for color I dont think you can specify different ones

viral crag
half hare
#

Ahhh i think i understand

sacred mountain
#

im stupid

half hare
#

Hold on ive just seen a method for setting colour

viral crag
#

there is an interface for it yeah

#

hmm, I guess we are not supposed to use setRawData() any more

sacred mountain
#

is this the same?
Math.log((distance * (Math.pow(Math.E, minDamage) - Math.pow(Math.E, maxDamage)) / maxDistance) + Math.pow(Math.E, maxDamage));
And

#

does java handle certain things differently

viral crag
#

setData(MaterialData data), setType(Material type), and then update() the BlockState seems to be what the api suggests now or you can setBlockData(BlockData data) and then update()

#

log is not ln

ivory sleet
#

Have you tried running a test case for both ways to calculate said formula?

#

Yeah it’s just log with base 10 probably

sacred mountain
#

ill do some tests

sharp bough
#

im using saveConfig() in the onEnable() to create a config file if theres none, is there a better way of doing this?

#

or whats the proper way of doing this

quaint mantle
#

hey guys how can i make a compass to teleport in onother world (no extern plugins)

#

yes

pliant oyster
#

How do I use a vector for locations

quaint mantle
#

idk

pliant oyster
quaint mantle
#

idk how

pliant oyster
#

do you want to use interact event?

quaint mantle
#

Does anyone know why this doesn't work?
So I want to replace Mushroom soup or potion with air in the player's hotbar (first 9 slots of inventory). Only one mushroom soup or potion not all.
But it doesn't seem to work.

                            for(int i = 0; i<player.getInventory().getSize()-1; ++i) {
                                ItemStack item = player.getInventory().getItem(i);
                                if(item.getType().equals((profile.getRefill() == Refill.SOUP ? Material.MUSHROOM_SOUP : Material.POTION)))
                                    player.getInventory().getContents()[i].setType(Material.AIR);
                                    break;
                            }
                        }```
gleaming grove
#

Hi is it possible to get a class with generic parameter as class object?

sharp bough
#

should i give a shit about this?

pliant oyster
tardy delta
#

you need to provide a class object to the method/ constructor

pliant oyster
#

How do I use a vector for locations

#

Like I want a vector to be a location but it gives errors

gleaming grove
pliant oyster
#

Location loc = new Location(player.getWorld, vectorName)

brave sparrow
#

this isn't C++ where each <T> gets compiled to its own class

#

when java compiles it just converts T to Object at runtime

gleaming grove
#

well that's sad, anyway thanks for deep answer

grim ice
#

library idea i beg

vagrant edge
#

yo, in spigot, what is the packet that corresponds to ClientboundSetPlayerTeamPacket (remapped)?

PacketPlayOutScoreboardTeam?

grim ice
#

that isnt spigot api

quaint mantle
grim ice
#

that is vscode

#

not/

#

its intellij

spring minnow
#

how can i make a item spawn in random chests like stronhold chests?

quaint mantle
spring minnow
#

Thanks

grim ice
#

give a library idea

#

i beg ya

spring minnow
#

quite difficult to understand through the methods xD

#

how can i enable the lootTable i create?

gleaming grove
quaint mantle
#

ugly theme

grim ice
#

Nope

gleaming grove
#

well if you were work everyday with C# you would get use to this theme

grim ice
#

imajin ur role color is an ill liver piss color

#

you have no room to talk

#

(jk)

quaint mantle
grim ice
#

yes.

spring minnow
#

@quaint mantle i@ for help if you're able please answer xD

#

if not its fine

quaint mantle
#

idk how it works either

spring minnow
#

Ohw

#

😦

#

i can't find any tutorial

#

may its not even possible with Bukkit api but only with nms

#

because i only found that lootTable is used for mobs

quaint mantle
#

how do i turn a getUniqueId into a users username?

#

Just wondering

#

tysm

#

im making a discord verification thingy

#

so yea xd

spring minnow
#

Thanks

#

I appreciate that

raw ibex
#

what does Player.getHealth() return?

#

Ok

#

So HP or hearts?

spring minnow
#

to check if the loot comes from a chest i can just do if(loot.getEntity() == null) right?

spring minnow
raw ibex
#

ok

spring minnow
#

1 hearth = 2

grim ice
#

o

#

item meta serializer?

spring minnow
#

i would like to have that too

#

would've*

raw ibex
#

do emojis work with Player.sendMessage()?

spring minnow
#

now i don't use json anymore

spring minnow
raw ibex
#

❤️

#

would that work

spring minnow
#

no wait

#

only the :\

#

the text ones

#

<'3

raw ibex
#

ok

spring minnow
#

only like this

raw ibex
#
                d.sendMessage(ChatColor.AQUA + p.getDisplayName() + "is on " + p.getHealth()/2 + "❤️");
#

so this is fine?

spring minnow
#

wait what?

raw ibex
#

ykw ill just do HP

spring minnow
#

never tried that

raw ibex
#

people have told me not to make an instance of my main class, so what should i do instead?

tardy delta
#

use dependency injection where possible

raw ibex
#

whats that

quaint mantle
#

?di

undone axleBOT
quaint mantle
#

😐

grim ice
#

json bad

#

haha

#

extends ConfigurationSerializable

#

No need for a library

#

ur mom

#

im jk

hasty prawn
#

The lib I'm working on could probs do that lol

#

Although it'd be annoying to setup probably

#

Eh maybe, depends on what parts of the meta you saved ig

grim ice
#

why json

#

when you can do it with yam

#

yaml

quaint mantle
#

Is there a function to delete something from the config?

#

so i just set the object to null

#

or

lapis widget
#

set a object to null

#

;p

quaint mantle
#

kk ty

lapis widget
#

yes

sharp bough
#

why does this happen? if its null then the first condition would run, otherwise it cant be null

#

suggested solution: player.sendMessage(Objects.requireNonNull(config.getString(playerId)));

#

but i dont understand the point of doing that

grim ice
#

you dont need a lib for that either actually

hasty prawn
#

My Lib stores any object in Json/Yaml format so

grim ice
#

configurationserializable

hasty prawn
#

It doesn't only apply to ItemMeta

grim ice
#

make into json

#

then make into yaml

#

Jackson:

#
    public String asYaml(String jsonString) throws JsonProcessingException, IOException {
        // parse JSON
        JsonNode jsonNodeTree = new ObjectMapper().readTree(jsonString);
        // save it as YAML
        String jsonAsYaml = new YAMLMapper().writeValueAsString(jsonNodeTree);
        return jsonAsYaml;
    }
#

got from google

#
public String convertYamlToJson(String yaml) {
    ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
    Object obj = yamlReader.readValue(yaml, Object.class);

    ObjectMapper jsonWriter = new ObjectMapper();
    return jsonWriter.writeValueAsString(obj);
}
#

use the second method when serializing with ConfigurationSerializable

#

save it into the file u want

#

when u need to, change it to json again

#

as its using the same library it prob will work correctly

#

hopefully

quaint mantle
#

How do I generate a random string?

#

EX: When ran, generates JDAKD

#

or BCYRA

dapper ether
#

what design pattern should i use for island generatzion?

lavish hemlock
tardy delta
#

UUID.randomUUID().toString() kekw

lavish hemlock
#

He wants random strings of 5 chars long :p

crude loom
#

Any idea as to why this crashes my server?

 @EventHandler
public void onPlayerUse(PlayerInteractEvent event) {
          if (p.getInventory().getItemInMainHand().getType() == Material.PAPER && event.getHand() == EquipmentSlot.HAND & (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
            ItemStack item = p.getInventory().getItemInMainHand();
                p.getInventory().remove(item);

}
}

(its not the entirety of the method but just the code i think is responsible for this)

tardy delta
#

.substring(0, 5) kek

crude loom
#

ok ill paste this in a different place this is unreadble

hasty prawn
#

?paste

undone axleBOT
lavish hemlock
#

It's inefficient to use a random UUID -> toString -> substring

#

My solution is much less hacky

tardy delta
#

ye :c

hasty prawn
#

Paste the crash report as well

crude loom
lavish hemlock
#
private final Random rand = new Random();

public String generateString(int length) {
    final var str = new StringBuilder();
    for (int i = 0; i < length; i++) {
        final char c = (char)(r.nextInt(26) + 'a');
        str.append(c);
    }
    return str.toString();
}
crude loom
#

It's something to do with the removal of the item from the player's inventory, but I don't know why does it cause a crush

crude loom
tardy delta
#

what is the 26?

lavish hemlock
tardy delta
#

ah

#

how did i forgot that

brave sparrow
lavish hemlock
grim ice
#

makes ur code faster but not that much in this case since theyre all cheap

#

but just an overall suggestion

crude loom
#

What do you mean by cheap?

grim ice
#

opposite to expensive for resources

brave sparrow
#

@crude loom cancel the event and it will fix the crash

grim ice
#

computer resources

lavish hemlock
crude loom
brave sparrow
#

16

#

Wait

#

36

#

as text?

grim ice
brave sparrow
#

36

grim ice
#

how is

#

5a

#

a char

tardy delta
brave sparrow
#

?

gleaming grove
#

is it possible to pop up "open link window" with out need to click on the TextComponent ?

brave sparrow
grim ice
gleaming grove
tardy delta
#

char is basically an int

lavish hemlock
#

Because the character value of a (it's codepoint) is not 0

#

I'm not sure if it uses ASCII or UTF-8 but yeah

#

0 as a character would be NUL

grim ice
#

i dont get how adding a number to a character makes a character

crude loom
brave sparrow
#

because a character is really a number @grim ice

lavish hemlock
#

Yeah

grim ice
#

what

brave sparrow
#

So you can add a number to it and the character produced will be whatever the equivalent is for that number

brave sparrow
ancient plank
#

you're a number lol

lavish hemlock
#

I mean technically he is just text on my screen rn so

#

yeah Alex

#

you are a number

brave sparrow
#

I’m number 1

gleaming grove
crude loom
gleaming grove
lavish hemlock
#

Yeah

#

Java 10 introduced var

crude loom
#

Ah, then mine isn't updated

grim ice
#

but like i dont get how adding a

#

codepoint to a random number

#

makes a letter

brave sparrow
#

‘a’ is just a number

grim ice
#

it would produce some random character

lavish hemlock
#

There's essentially a range of characters that represent a to z in ASCII

brave sparrow
#

‘a’ = 97

grim ice
#

how is it a letter

lavish hemlock
#

If we were just to generate 0 to 26, then we would end up with special characters and not letters

brave sparrow
#

you’re adding 5 to 97

lavish hemlock
brave sparrow
#

You understand that characters are just numbers yes?

grim ice
#

oh so if we used 97 instead of a it would do the same

brave sparrow
#

And sequential letters are sequential numbers

lavish hemlock
#

Although I actually need to check what encoding Java characters use...

brave sparrow
#

Well you have to tell the language that it’s a character

lavish hemlock
#

The char data type is a single 16-bit Unicode character.

#

Okay so it's actually UTF-8 and not ASCII, but the same applies still

brave sparrow
#

You can do char a = (char) 97; iirc

grim ice
#

cool

grim ice
#

a is 61 in utf8

#

but 61 doesnt work

#

however 97 works

lavish hemlock
#

That's because a is 0x61 and 97

#

Character tables show the hex value

#

Hexadecimal (0x61) is different from decimal (97)

grim ice
#

?=@EU,BSOP>,G?RNJ,KBIKF,NUIAU,AVFF@,JVACE,KJHOG,T=C?>,NLTFE,KHSIJ,QVJU@,MME>S,BQ>CM,@KJQH,B=HGS,UNQNV,=TORU,NUJFA,RRATD,HAEBV,NTIVO,KPGH>,GQU=L,>PKV>,DG=OC,N=UEV,ULTR@,?EMBJ,PSLVF,FMOMU,ALJPQ,Q@BUN,B>APN,VL@R>,EQACJ,V@J=P,CNEB?,FTOA=,@CCFP,LLGO>,=ABTQ,HOBAS,R?CRL,TMIFJ,?SNLG,E?G?=,ILJNS,OOH=U,TPIIN,MCJNU,CCDNG,DHOBA,UCG@R,@S=BJ,FIKLV,DBKBQ,TD@M>,B>NA?,CHB@Q,OOVFF,CF@N?,@?EVD,OKR@H,B>>PD,BGC=>,?JEBS,?GOT=,>I>DG,DAFSG,GTP?R,@DNKR,JNJ??,@LPGI,O=COT,EDS>U,FARKF,EDEBQ,NKFAC,LNH=V,D?>EC,AHVCF,JTNUT,GQ@N@,CGCOH,KA?TL,VILJT,KCDIC,JMG>G,GKFL>,QGG?N,?FKVU

lavish hemlock
#

Oh okay

grim ice
#

thats the result with 61

grim ice
#

so it used the decimal value not the hexademical

lavish hemlock
#

Yes

#

Because you're using an integer literal, not a hexadecimal literal

grim ice
#

with

#

0x61 it worked

#

so yeah

lavish hemlock
#

Anyway so a in ASCII is 45 iirc

grim ice
#

no

#

i dont think so

lavish hemlock
#

Oh nvm

#

It's actually the same across ASCII and UTF-8

grim ice
#

45 is hyphen as far as i remember

#

im awesome i still remember it from 12 days ago

#

kek

quaint mantle
#

Can you import JDA as a dependancy?

#

It connects minecraft to discord

chrome beacon
#

Yes

#

Just shade it or use the library loader

pliant oyster
#

How can I remove the respawn menu from ppl who die, cuz instead of showing the respawn menu I want them to go into gamemode spectator instead

#

wdym

#

ohhh

#

I see

#

and then just respawn them

#

yeye

desert musk
#

unfortunately i got to the "right click the workspace directory..." part and i'm already having problems

pliant oyster
#

wait how can I completely remove the respawn screen

desert musk
#

right clicking the workspace directory doesn't do anything

chrome beacon
#

Highly recommend a proper IDE like Intellij

desert musk
#

LMAO

#

so scuffed

#

🤦‍♂️

desert musk
#

feel free to shill it to me if you want

#

i just havent heard much better of it than vscode

chrome beacon
#

Intellij has much better support for Java and better syntax completion. It's also what most of us use here so you can get better help

#

If you have a weak machine you can continue to use VSCode since Intellij is a bit heavier on your system

pliant oyster
#

wait

#

so is it gonna still show the respawn screen?

#

cant I just cancel out the last damage and put them in spectator that way

hollow bluff
chrome beacon
#

You probably won't even notice the respawn screen

#

It's a 20th of a second

#

(if you delay it one tick at 20tps)

#

If you don't want this you can use the doImmediateRespawn gamerule. I think the client can handle that one, not 100% sure

pliant oyster
#

wait

#

lemmie send u my code

#

lmk if it works like this

young knoll
#

Pro tip, you can just use runTask for a tick delay

pliant oyster
#
        Player player = e.getEntity().getPlayer();

        player.setGameMode(GameMode.SPECTATOR);

        new BukkitRunnable(){

            @Override
            public void run() {

                player.spigot().respawn();
                player.setGameMode(GameMode.SURVIVAL);


            }
        }.runTaskLater(Otib.getInstance(), 3 * 20);

    }
#

how lmfao

hollow bluff
#

3 seconds? They’ll see the respawn screen

opal juniper
#

So i got ${project.basedir}, but how can i get the parent directory to that

pliant oyster
#

I thought it happens after 3 seconds

#

like they die and respawn

#

I think I'm just gonna cancel out the last damage and just set them in spectator

#

that's how most minigames do it

#

idk how to cancel it out tho

hollow bluff
#

Cancel death event 👍👍

#

I’ve actually never tried it before ahahah

pliant oyster
#

do I have to use EntityDamageByEntity event?

hollow bluff
#

Yeah thats true

tall dragon
pliant oyster
#

idk how they work

pliant oyster
tall dragon
#

there is a way to remove respawn screen with packets

hollow bluff
#

What is your goal tho?

pliant oyster
#

ok so basically

#

I dont want a respawn screen at all lmfao

hollow bluff
#

then just set the tick to anything other than 3 sec

#

And you are done

pliant oyster
#

most minigames just cancel out last damage so they dont actually die and just say they died

#

that's what I wanna do

bleak spindle
#

e

dreamy chasm
#

is anyone able to help with maven shading, I have added a dependency/repository and configuration to maven shade in pom.xml but whenever it tries to run something related to the library it says ClassNotFoundException?

chrome beacon
#

Make sure to use the shaded jar

dreamy chasm
#

is that outputted somewhere different?

chrome beacon
#

No there should just be 2 jars in the target folder

bleak spindle
#

jiohjkg fghvhghghg

dreamy chasm
#

I make it output directly to my plugins folder, only 1 appears in there

chrome beacon
#

One with the suffix -original and one without. You need to use the one without suffix

#

Could you show your pom

#

?paste

undone axleBOT
dreamy chasm
#

it gets everything fine while im developing, but compiling I guess its just missing it out

chrome beacon
#

Why are you compiling with Java 9

dreamy chasm
#

uh, I am not sure, I dont think I changed anything

#

but I must have

chrome beacon
#

Also where are you changing the output folder?

dreamy chasm
#

I am using intelliJ and I just have it in my build configuration to output when it builds

chrome beacon
#

What's the configuration of that

dreamy chasm
#

of the artifact?

chrome beacon
#

Yes

dreamy chasm
#

you can see it has the MorePersistentDatatypes in it

chrome beacon
#

ah I see so you're not even using maven

#

Which is why you're having issues

#

Maven can't shade if you don't use it to make your jar

dreamy chasm
#

oh, how can I make it use maven, I kind of assumed it was beforehand, where can you see its not using maven?

wet breach
#

the screenshot tells those who know

crude loom
#

Configs

chrome beacon
#

Anyways click the + in the top left and add a new maven configuration

#

and tell it to run package

modest shard
#

i am trying to make a sword apply wither effect to entities it damages and i included lore shown and using eventhandler listener also shown, but the weapon does not give wither effect can anyone help me with this?

chrome beacon
#

I don't recommend using lore to detect stuff like that

#

Use pdc

#

?pdc

modest shard
#

oh

#

thanks never heard of pdc

#

ill give it a shot

chrome beacon
#

Also avoid deprecated methods

modest shard
#

ok

#

even tho its not recommended, if i removed the deprecation, would it work theoretically

tall dragon
#

its not always deprecated for removal

modest shard
#

oh

tall dragon
#

no?

#

sometimes methods get marked deprecated simply because they are thread blocking

#

simply to warn you

chrome beacon
#

deprecated methods should be avoided. That's the whole point of the annotation

modest shard
#

if i undeprecate it would it work maybe?

tall dragon
#

wdym not really

#

yes

chrome beacon
#

They get marked because there are alternatives that should be used instead

#

You don't add a deprecated annotation just because something is blocking. You add it because there is a non-blocking variant that should be used instead

#

Or if you use it like mojang it can mean "don't call"

brave sparrow
#

Not “has been replaced”

#

Deprecation is typically a warning that a method or class is being removed soon and so you should stop using it

lost matrix
#

Not necessarily

tall dragon
#

i disagree

tardy delta
#

take a look at Bukkit#getPlayer(String)

tall dragon
#

pretty sure even spigot has had a deprecated method simply because it was blocking

#

yes

lost matrix
#

Or RecipeChoice.ExactChoice. Deprecated because its draft api.

tardy delta
#

it just tells you to use another method but sometimes there is not other way

vital yacht
#

If you see something deprecated it means you should not trust that method to work in future versions unless it is explicitly said that it will continue to work.

glossy venture
#

you have to be fucking kidding me

#

nO yOu nEeD tHe eXaCT tYpE oThErwISe iM goNNa crY

tall dragon
#

just refactor :D

glossy venture
#

yeah but then it introduces more complexity somewhere else

#

then it needs some other shit in some other place

#

it can never just work without conflicts

pliant oyster
#

?jd

mortal hare
#

have anyone used C++ or C from here?

mortal hare
#

ConfigurationHelper<?>

glossy venture
#

doesnt work

#

but i fixed it

mortal hare
#

what's C

#

internally

mortal hare
glossy venture
#
public <C extends ConfigurationSection> ConfigurationHelper<S> child(String key,                               Supplier<ConfigurationHelper<C>> supplier,                                          Consumer<ConfigurationHelper<C>> consumer) {
        ConfigurationHelper<C> helper = (ConfigurationHelper<C>) createChildren(key, supplier);
    // ...
}
glossy venture
mortal hare
#

If i dereference struct pointer

#

will it make a copy of the structure inside thel local variable

glossy venture
#

nah

#

well idk

#

lemme search

magic gazelle
#

is Player#displayName supposed to not be persistent?

tall dragon
#

how do you mean persistent

#

like as in when they go offline?

magic gazelle
#

yeah

#

i just want to know if that's intended or not

tall dragon
#

if a player is offline u cant use Player iirc

glossy venture
#

found this

mortal hare
#

Player objects get stale

tall dragon
#

only OfflinePlayer

mortal hare
#

after they log off from the server

#

Use UUID's instead

#

Yea but a structure is a weird type

#

its like a pointer ot many variables

#

like an array

glossy venture
#

THIS SHOULD LITERALLY WORK

#

FUCK GENERICS

mortal hare
#

maybe the imports are messed up?

magic gazelle
#

I guess that answered my question?
To recap: Player objects do not save displayName anywhere, so you just have to re-assign that for every onJoin
And when saving the displayName, save it as like, UUID:displayName

pliant oyster
#

How can I make an arrow one shot no matter what, without using enchants

tall dragon
magic gazelle
mortal hare
#

if its username of the player you don't need to save it, if you have custom name you should.

tall dragon
#

ah thats what u mean

magic gazelle
#

it's custom username

magic gazelle
#

1s

mortal hare
#

i havent touched api for a long time so i cant really tell you

tall dragon
mortal hare
#

it really does

#

use the arrow operator people

#

i wonder what happens if you declare rvalue reference as a variable

magic gazelle
#

it's in Kotlin but that's the gist

mortal hare
glossy venture
#

just set entity health to 0

magic gazelle
#

can't

glossy venture
#

to kill it

magic gazelle
#

I looked in the javadocs

glossy venture
#

tf

magic gazelle
#

no Health = 0

#

which is stupid

#

!jd

glossy venture
#

setHealth(...)

#

there are no exposed fields

#

nothing works like that

magic gazelle
#

no I mean there's no setHealth(0)

#

sorry used to kotlin

#

no health though.

pliant oyster
#

I want an insta kill no matter what