#help-development

1 messages · Page 1401 of 1

wraith rapids
#

see how they do it I suppose

young knoll
#

Nah you can do that

wraith rapids
#

there are many ways of doing tab completions

vital ridge
#

kk

young knoll
#

You just won't have the start of an argument, so you just show all options

wraith rapids
#

with the way how the args array is populated I don't see how that's possible to do

vital ridge
#

Or like

wraith rapids
#

you can't discriminate between "writing arg 0" and "finished writing arg 0"

#

because it ignores spaces

vital ridge
#

whatsu mean

#

maybe i can check

spring river
#

Hello, I want to create an invisible armor stand but it seem that setVisible(false) method doesn't work. Do you know if that is a bug plz ? I'm using spigot 1.16.5

vital ridge
#

if args[1] is ""

#

aka nothing yet

wraith rapids
#

but is it?

vital ridge
#

Well In my command args[1] is something

#

its either

young knoll
#

?paste

queen dragonBOT
vital ridge
#

enable or disable

wraith rapids
#

it might be different for the tab executor, but the command executor doesn't have empty strings "" popping up in the args i don't think

young knoll
#

That's what I have used

wraith rapids
#

/kill -> args = []
/kill_ -> args = []
/kill_n -> args = ["n"]
/kill_n_ -> args = ["n"]
/kill_n_i -> args = ["n","i"]

#

iirc it goes like this, could be wrong though

unreal quartz
#

i am pretty sure it is populated with something, as my conditional for args.length == 1 is satisfied when just typing /q

young knoll
#

Yeah same with the code I showed

eternal oxide
#

args[] is String array not char

wraith rapids
#

indeed

#

a char array would have been args = ['n','i']

vital ridge
#

it only autocompletes if i do /fm (letter)

unreal quartz
#

version?

vital ridge
#

1.16.5

limpid veldt
#

is it legal to upload a resource that is not strictly yours (i.e. a dead plugin that you decompiled, fixed and updated)?

unreal quartz
#

not quite sure.. this works just fine for me (no letters given)

wraith rapids
#

"no"

#

but nobody will care probably

vital ridge
pure glacier
eternal oxide
wraith rapids
#

unless they've licensed it under "do whatever the fuck you want" or similar, you can't modify and upload it even if the author is dead

#

that said

#

nobody will care

#

and you will be doing the world a service

young knoll
#

MIT hopefully

wraith rapids
#

just do it anonymously

eternal oxide
#

Not updated in 6 months is not necessarily dead.

limpid veldt
#

not updated since 2017 and it has no licensing

wraith rapids
#

if there is no license, then you can't

#

no license means you can't do shit with it

eternal oxide
#

No licencing means, no you can;t modify and upload it

young knoll
#

Defaults to ARR iirc

limpid veldt
#

so only modify and use it personally?

glossy scroll
#

Yes

eternal oxide
#

not even that really

glossy scroll
#

Nah you can use anything for personal use

vital ridge
#

@unreal quartz can you show me the code you used for your autocomplete?

glossy scroll
#

Licenses get involved for when its commercial use or distributed

eternal oxide
#

Only in teh form its released in. Not modify

wraith rapids
#

elgar by the way

young knoll
#

I mean you could always completely rewrite and rename it

#

I guess

glossy scroll
#

But i must say that im not giving legal advice

wraith rapids
#

where did that ico5 for towny go

wraith rapids
#

it used to be on the palmergames homepage

#

but somebody has put it through a redesign

limpid veldt
#

kk, thx

wraith rapids
#

and now I can't find shit on it

eternal oxide
#

Its on github now

wraith rapids
#

which one

#

i checked the townyadvanced org but I didn't see it

eternal oxide
wraith rapids
#

legacy sounds scary

eternal oxide
#

It just had some Towny specific bits added while I was gone. When I came back I updated it to run stand alone again.

mortal hare
#

so i've been tinkering around with the multithreading and i think about arrays.

Imagine i read primitive array index in first thread and set index of array from another. I don't care if its visible to the other thread or not, but im thinking about if the second thread would pass the new value from index from the cache to RAM. How long does cache hold the value? Is there a probability that cache wouldnt pass the set value to the future threads?

wraith rapids
#

"good luck" basically

unreal quartz
vital ridge
#

what is your version?

unreal quartz
vital ridge
#

mkay

cold field
#

Hi guys, I would like start using brigadier but I don't know what should I use as command source. Any suggesstions?

vital ridge
#

interesting

mortal hare
#

If so, how can Bukkit.getOnlinePlayers() be safe to read async, when its not volatile field, and can update anytime when the player leaves?

wraith rapids
#

basically this ^^

jagged badge
#

it work 🙂 thx

ivory sleet
#

well its not like commodore substitutes brigadier or vice versa empee

mortal hare
#

But everyone does so

#

huh

wraith rapids
#

the worst that's going to happen is just that the data is out of date

vital ridge
#

@unreal quartz yeah i got it fixed I watched a tutorial from 2014 before and added a dumb if statement

cold field
wraith rapids
#

which makes people think it's safe

vital ridge
#

to check if args[0] is not equal to ""

wraith rapids
#

because it doesn't explode

mortal hare
#

its mapped brigadier from NMS

vital ridge
#

Thanks!

ivory sleet
#

commodore complements brig

paper viper
cold field
#

ah wow

wraith rapids
#

commodore is nice

mortal hare
#

It lacks some features tho

#

at least when i've tried it

cold field
#

sick names

wraith rapids
#

i don't really use it but it's nice

#

i think

eternal oxide
ivory sleet
#

what dovidas, I mean what does it lack of

cold field
#

Thanks everyone

vital ridge
#

gotchu

wraith rapids
#

brigadier gives me pimples

young knoll
#

I don't believe the client does that on its own

#

Hence StringUtils.copyPartialMatches

wraith rapids
#

what is the default chatbox width in pixels

#

i've changed mine to something and i don't want to reset to defaults to figure out

mortal hare
#

type support if i remember correctly. It has primitive types, but as always if you're gonna use such a library, you wanna remove boilerplate of yours

ivory sleet
#

?

#

oh the .commodore thing

#

I mainly use it for

wraith rapids
#

some thread on hypickle says 320 pixels

mortal hare
#

atleast i've never saw how to implement it

ivory sleet
#

I just use normal color codes and it works fine

visual tide
#

im trying to make a /spawn thing, but i want to wait 5 seconds but i dont want to block the plugin from working while those 5 seconds pass, how would i do this?

wraith rapids
#

rreeeee why is it a fucking slider

young knoll
#

Scheduler

wraith rapids
#

it's jumping between 318 and 322

#

i can't fucking set it to 320

unreal quartz
#

have you tried asking politely

wraith rapids
#

it looks to be going by increments of 4

unreal quartz
#

oof

mortal hare
#

It works fine, but it needs some polishing to be used, at least for me. It could be the best command api if it would implement more utility classes. Its lightweight

wraith rapids
#

i made my gui scale huge

#

i can barely see the buttons

#

managed to set it now

#

sliders are cancer

mortal hare
#

well in some cases lightweightness is good

#

but eh

#

i prefer more than less

#

its a preference

ivory sleet
mortal hare
#

yea

#

shame Spigot

#

doesn't support this

ivory sleet
#

yup total agreement

young knoll
#

PR

mortal hare
#

like they have ability to do, its not that hard to implement, even license for brigadier have been changed

ivory sleet
#

yeah yeah fr

limpid veldt
#

dev has no licensing, hasnt been active on the forums since 2020 and also after finding their disc they havent posted since 2019

#

f

wraith rapids
#

republish it and license it under a fake name

#

then use that with your real name/real identity

#

if it leads to legal action the fake sockpuppet goes in jail but you'll be fine

young knoll
#

Would you even get jail time

wraith rapids
#

not really, nobody cares anyway, and nobody is going to pursue legal action either

#

unless you become big like hypickle and somebody does craftbukkits to you

olive lance
#

ik null.equals() doesnt work but equals(null) will not throw an exception or yes?

wraith rapids
#

why even ask that

young knoll
#

Just do == null

dusty herald
#

^

wraith rapids
#

a.equals(null) will never return true

olive lance
#
        Faction playerFac = plugin.getData().getFaction(player);
        for(Faction f : plugin.getData().getFactions()){
            if(f.hasClaim()){
                if(f.getClaim().containsLocation(event)){
                    if(f.equals(playerFac)) return true;
                    return false;
                }
            }
        }
        return true;
    }
ivory sleet
#

Objects.equals(null,null) might work

olive lance
#

playerFac may be null

wraith rapids
#

it will either blow up because a is null

#

or return false because a is not null

olive lance
#

f.equals(playerFac)

wraith rapids
#

use Objects.equals(f, playerFac)

#

or f == playerFac

olive lance
#

ok ty

visual tide
#

im trying to make a /spawn thing, but i want to wait 5 seconds but i dont want to block the plugin from working while those 5 seconds pass, how would i do this?

young knoll
#

Runnable

wraith rapids
#

or bukkitrunnable

#

or if you're a gigachad, an async thread that sleeps for 5 seconds

limpid veldt
wraith rapids
#

it obviously is

#

the point is to not get caught

dusty herald
#

lmao says the alt king himself

young knoll
#

When I say runnable I usually mean bukkit runnable

wraith rapids
#

that's the whole reason you're making an alt

dusty herald
#

how many alts do you have now NNYa?

wraith rapids
#

dozens

#

i have 13 in paper rn

#

though 2 of them got nuked

#

so 11

limpid veldt
#

large IQ moment

wraith rapids
#

discord apparently does some fancy alt detection shit, will have to muster the effort to get disposable phone numbers to verify those 2 at some point

vital ridge
#

can i check if a runnable is equal to null aka is not currently running

limpid veldt
#

I had no issues with getting alt disc accounts. it doesnt like things such as minutemail but legit gmails work

vital ridge
#

talking about bukkitrunnable

wraith rapids
#

that's not how anything works

#

yeah the detection is pretty difficult to trip, you need to be really blatant

vital ridge
#

which message was for me?

wraith rapids
#

but a few days ago when I was cycling through like 8 accounts in the span of 20ish seconds, the two last ones got locked

limpid veldt
#

oof

wraith rapids
#

but yeah, you need to be really blatant about it

limpid veldt
#

hmmm 8 accounts on the same IP

lofty junco
#

does anyone know how to remove an entity if an entity is spawnning

wraith rapids
#

entity.remove

spring river
#

Hello, setVisible work on armor stand on 1.16.5 version please ?

glass sparrow
#

yes

#

no

spring river
#

oh

#

why ?

glass sparrow
#

did you try it

spring river
#

yes

#

it's doesn't work

young knoll
#

I mean

#

It does

glass sparrow
#

thats odd

#

did you debug

spring river
#

Yes, my armor stand is created

glass sparrow
#

?paste

queen dragonBOT
wraith rapids
#

are you sure you're calling ArmorStand::setVisible and not LivingEntity::setInvisible

glass sparrow
#

show

spring river
#

yep, i've cast my entity

#

and i call setVisibile

#

His base plate is disable

#

he got a custom name

#

but it still visible

eternal night
#

just paste that code xD

#

makes a lot easier

#

?paste

queen dragonBOT
eternal night
#

:>

spring river
#

np :p

glass sparrow
#

show update name

spring river
#

I've try to call setVisible each time when i'm using teleport on the armor stand, but it's doesn't work

#

Do you have any idea ? :p @glass sparrow

eternal night
#

what exact version are you running ?

#

/version

spring river
#

2991-Spigot-018b9a0-f3f3094

#

I've download it yesterday

eternal oxide
wraith rapids
#

consoooomer

wraith rapids
#

must CONSOOOOM

eternal night
#

can't reproduce with either a consumer setup or the used setup

glass sparrow
#

yea i got no idea i cant reproduce

wraith rapids
#

what are you, an eunuch

glass sparrow
#

what the fuck

wraith rapids
#

dude can't reproduce

#

where did your balls go

eternal oxide
#

a rather public revelation

glass sparrow
#

NO

eternal oxide
#

It OK. We won't judge

glass sparrow
#

i can reproduce guys i swear

wraith rapids
#

we'll see about that

glass sparrow
#

uh oh

olive lance
#

fire extinguisher emoji...

#

looks sus

wide imp
#

is there a way to check whether or not a horse has a lead on it or not

wraith rapids
#

the javadoc search box is a handy tool

wide imp
#

i didnt think it would be under isLeashed i was looking for soemthing with 'lead' my bad

#

but ty ❤️

mortal hare
#

Well multithreading is such a pain in the ass

#

in this server software

wraith rapids
#

indeed

#

what are you trying to do specifically

#

something with packets

mortal hare
#

i'm recreating clientside inventory actions inside serverside

#

it works

#

but im using async netty channel handler

#

and im worried that by setting items in async

#

would break the server

#

i set the items via main thread using NMS dedicated server object .executeSync() method

#

it works

spring river
mortal hare
#

but now im thinking about iterating the items in async

wraith rapids
#

mmm

eternal night
mortal hare
#

and it seems there's no guarantees that the thread cache would flush

eternal night
#

the callback method allows you to mutate the entity before it is added to the world afaik

eternal oxide
mortal hare
#

since list is not atomic

kind coral
#

does FileConfiguration#set override configuration?

eternal oxide
#

Lynx got you

mortal hare
#

heck even Bukkit.getOnlinePlayers() is not technically safe

eternal night
#

just ignore potential data races and go for it

spring river
#

Ok i'm a fucking retard, I'm really sorry for the stupid question. I'm using setVisible(true) on other method of my code

eternal oxide
#

99% of the API is not safe. Most reads will be ok but no guarantees

spring river
#

🤡

eternal night
#

sigh

#

😂

spring river
#

Thanks all for your help and sorry :p

mortal hare
kind coral
#

guys, i am trying to store inventories into the config, tho when setting up the "isOnline" it destroys the inventory https://paste.md-5.net/koyokiyilu.java like it removes it from the config, if i remove the 2 instructions (set and save) contents do not disappear, how can i fix this?

eternal oxide
#

Why are you bothering to flag as online or offline?

wraith rapids
#

using bukkit config api to save player data 👀

eternal night
#

Bukkit#getPlayerExact does the same

#

just check if there is a player currently online 😂

#

not like this is cross server

mortal hare
#

In Java, threads doesn't cache any object or variable, they just have a reference to an instance of an object. does this mean if i access arraylist from another thread it stores the arraylist reference or the whole primitive array reference with it

wraith rapids
#

java doesn't cache anything no

mortal hare
#

if it stores only the list reference that's why its updating it

wraith rapids
#

but the underlying processor might

#

and does

mortal hare
#

so JVM only give opportunity for CPU to store reference to the object from another thread

wraith rapids
#

threads operate on memory

#

memory may be locally cached by the processor

#

two threads may run on two different processors which may have cached different values for what the threads consider to be the same memory

mortal hare
#

and what if the cache is never flushed or flushed very slowly

#

doesn't that make the code unsafe?

wraith rapids
#

unless there are memory barriers or the like that ensure that you're not operating on stale data, yes

#

locks, synchronization and whatnot are ways to make this happen

#

as for how they make it happen, it depends

#

if you ask someone to explain what locks and synchronization does under the hood, the best you will get is an overly simplified explanation of there being a cache and stuff being read past that cache from the main memory

#

which is not what really happens

#

what really happens is an impl detail that changes from processor to processor

mortal hare
#

what are your suggesting if i cant edit the code NMS or replace the list with atomic one

wraith rapids
#

i'm not sure

mortal hare
#

synchronisation is also not an option

#

since those lists are used both by NMS and internally by bukkit

wraith rapids
#

what is this list

mortal hare
#

ArrayList

wraith rapids
#

yes but what is it

#

what does it do

mortal hare
#

List of NMS ItemStacks

wraith rapids
#

of an inventory?

mortal hare
#

yes

#

inventory view one

wraith rapids
#

i vaguely remember someone saying that inventories themselves are thread safe to some extent

#

not sure if they were talking about bukkit inventories or the underlying nms ones

mortal hare
#

🤔

#

eh fuck it

#

im gonna sync

#

setting of the items

#

but leave iteration

#

in async

#

There should be only the small chance

#

idk..

wraith rapids
#

why are you iterating anyway

mortal hare
#

im handling click actions

#

via packets

wraith rapids
#

are you like trying to figure out where shift clicked stacks are getting sent

mortal hare
#

yes actually

eternal oxide
#

Is this an inventory you create yourself or some game inventory?

mortal hare
#

is there any way to get the shift clicked stacks?

#

because i tried searching

wraith rapids
#

i don't think so

mortal hare
#

packets and registered packet listener

#

to no avail

wraith rapids
#

pretty sure the client and the server just compute it both without telling one another what the result is

dusty herald
#

NNYa you're missing the shit storm in #general

mortal hare
#

it seems server handles the placement due to security measures

wraith rapids
#

general doesn't exist

#

i guess i could take a look

#

i knew redempt was an anarcho libcuck

mortal hare
#

because there's no data between client and server regarding clicked slots apart from dragging "paint" mode

wraith rapids
#

i always knew

#

i can smell it

mortal hare
#

that's why its threadsafe

#

it uses copyonwritearraylist

#

inside NMS

#

Bukkit.getServer().getOnlinePlayers() is totally thread safe.

eternal oxide
#

Nice to know

vital ridge
#

Hey

#

Does anybody know

#

Why some particles act very weird

#

example end rod particles

#

when you spawn them with code, they get thrusted around like explosion

#

And could I fix that some how?

mortal hare
#

particles have offsets

vital ridge
mortal hare
#

check your offset values

wraith rapids
#

you need to specify the velocity properly

solemn shoal
#

tfw someone made the bukkit api available on minecraft

#

through fabric

mortal hare
#

yea i've saw it

vital ridge
mortal hare
dire marsh
#

oh

mortal hare
#

but on fabric

dire marsh
#

god

solemn shoal
dire marsh
#

lmao people are gonna run out of names one day

solemn shoal
#

its a fabric mod that loads bukkit plugins

vital ridge
wraith rapids
#

maybe

dire marsh
#

i mean, cool, but eh

wraith rapids
#

particles are kind of fucked

vital ridge
#

theres no method for that

wraith rapids
#

working with them is cancer and I never remember which button does what

mortal hare
#

Particles have location, offset and velocity properties

#

check those

wraith rapids
#

it doesn't help that the param names aren't specified in the api either

#

need to always look them up from the fucking javadocs

vital ridge
#

How can i check those

mortal hare
#

when you spawn particles

dire marsh
#

particle api is awful to work with

mortal hare
#

you specify these

#

i've worked with particles like

#

year ago

wraith rapids
#

i don't think it's entirely bukkit's fault

#

pretty sure it's like a protocol limitation from mojang why they're so trash

vital ridge
#

You mean like

#

example dustoptions?

wraith rapids
#

but i think someone should eventually write a decent wrapper api for them

#

because god

mortal hare
#

what about effectlib

#

i've saw this lib thrown around quite alot

#

for particle effects

wraith rapids
#

never heard or used it

vital ridge
#

dovidas how can I specify them tho?

#

Is it something like

#

dustoptions?

#

where I spawn the particle and fill extra params

mortal hare
#

oh yeah

#

my bad

#

i've just realised

#

how fucked up api really is

#

Options which can be applied to redstone dust particles

#

~ DustOptions

opal juniper
#

Redstone (dust)

wraith rapids
#

iirc

mortal hare
#

#World.spawnParticle​(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)

wraith rapids
#

you need to spawn particles 1 at a time if you want to set the velocity manually? i think

#

the first 3 doubles are the place where it's spawned

#

the int is the number of particles to spawn

vital ridge
#

Yeah im spawning 1 at a time

#

so how do i know

wraith rapids
#

if count is 1, the last 3 doubles specify the velocity

vital ridge
#

whats the best offset x y z

mortal hare
#

why is particle isn't class type

vital ridge
#

I mean

#

I just want it to be like a normal one

wraith rapids
#

if count is > 1, the particles spawn randomly in a box specified by the last 3 doubles

#

iirc that's how it works

#

set the last 3 doubles to 0.0

mortal hare
#

it has properties like location

#

offset

#

yet all we get in api

#

is enum class

wraith rapids
#

the issue is the underlying mojang shit impl of it

#

they don't actually have specific parameters for stuff like velocity and offset

#

they reuse the same parameters

vital ridge
#
Bukkit.getWorld(worldName).spawnParticle(particle, location, 1, 0.0, 0.0, 0.0);
wraith rapids
#

what is offset in one context is velocity in another

#

and the api builds off of that so the api is shit too

slim magnet
#

Should I do stand.getEntityId() == head.getEntityId() or stand.equals(head)? Which is better/faster?
Both are ArmorStand's

wraith rapids
#

what

mortal hare
#

it depends how entityid is implemented

#

both are implementable methods by the class

#

there's no way you can tell which is faster by not digging in to the code

slim magnet
#

hm

wraith rapids
#

i don't remember if the bukkit entities implement equals properly

#

i know == won't work here because both are bukkit wrappers

#

get the UUID of both entities and .equals

mortal hare
#

isn't entityid primitive data type?

wraith rapids
#

yeah

#

it's like an int i think

mortal hare
#

then why it wouldnt work

#

for comparing

wraith rapids
#

it would, I meant == on the entities themselves

mortal hare
#

oh

#

yeah

wraith rapids
#

that said I really don't like the entity id concept at all so I just kind of refuse to touch that value

#

it'd probably work

mortal hare
#

try booting up jdgui

#

or intellij

#

and decompile the class

#

to see which gets the type faster

wraith rapids
#

doesn't matter anyway

slim magnet
#

are entity id's unique?

mortal hare
#

yea

#

its negligible

wraith rapids
#

you won't be doing it so often as for it to actually make any difference

mortal hare
#

yes

slim magnet
#

per world per entity type?

wraith rapids
#

they should be unique, yes

#

at least in some context

mortal hare
#

i think they're like container ids

#

one container = one id

wraith rapids
#

but there are only 2^31 of them

slim magnet
#

ok whats the different between it and the UUID?

wraith rapids
#

so it's possible that there might be some collisions

#

the entity id is only valid for the lifetime of that entity object

#

the next time it's loaded in, it will have a different id

#

UUID is univerally unique

#

and will always be the same

slim magnet
#

server would die with more than 2^31 lolol

mortal hare
wraith rapids
#

with 2^31 loaded at the same time yes

slim magnet
#

Oh true

wraith rapids
#

but servers have literally thousands of mobs instantiated per second constantly

slim magnet
#

Okay good to know, I'll use the former comparison

wraith rapids
#

so it's entirely possible that the counter will overrun eventually

#

which is why I don't like it

#

granted the whole fucking server will explode if that happens

mortal hare
#

open 2^31 unique chests at the same time

wraith rapids
#

but that doesn't mean I like it

mortal hare
#

and the server will crash due to integer overflow and enormous chunk lag

slim magnet
#

it's for a minigame so the entities would live long anyways so its okay

#

wont*

lofty junco
#

Does anyonw know how to cancel the entity spawn event

wraith rapids
#

event.setCancelled(true)

lofty junco
#

Why is this not working...

wraith rapids
#

what

mortal hare
#

what

#

is this event inside method

lofty junco
#

i want to canel the event if the entity is an villiager

lofty junco
#

entity spawn event

mortal hare
#

have you added @EventHandler annotation to it?

lofty junco
#

yes

wraith rapids
#

is it getting called

mortal hare
#

have you tried debugging it by sending messages to yourself or the console

lofty junco
#

its working almost there are so many villagers

wraith rapids
#

what

lofty junco
#

after i start my server but i want to spawn just one

wraith rapids
#

👀

lofty junco
#
  1. I want to spawn a villager after that im checking if the type of the entity is a villager if it is true i want to cancel it
mortal hare
#
@EventHandler
public void onEntitySpawn(EntitySpawnEvent event) {
  if (event.getEntityType() == EntityType.VILLAGER) {
    event.setCancelled(true);
    event.getLocation().spawnEntity(//bla bla i dont remember look at javdocs);
  }
}
#

this is all i can offer to you

wraith rapids
#

this is the highest iq server

spring river
#

Excuse me, when I teleport an Entity with teleport method, I need to relog on the serveur to see the new location of the entity. Do you know why plz ?

wraith rapids
#

is it riding something

mortal hare
#

have you tried entering new dimension inside the server

spring river
mortal hare
#

and going back

mortal hare
#

try it

#

it should reload the chunks

spring river
#

Ok

mortal hare
#

or use dev hotkeys

#

to reload chunks

spring river
#

yes it's working

mortal hare
#

F3 something

lofty junco
#

the problem is that i want to just the villager one time

#

is the awnser

#

World world = Bukkit.getServer().getWorld("world");
Location finalEntityLocation = new Location(world, 66 + .1111111f, 66, -125);
Entity newEntity = world.spawnEntity(finalEntityLocation, EntityType.VILLAGER);
newEntity.setCustomName("TEST");
entitySpawnEvent.setCancelled(true);

spring river
#

It's possible to fix automatically that (and not reload player loaded chunk ?)

mortal hare
#

that's literally what i've made

#

oh

#

nvm

#

put this inside the main method

#

and implement the listener

#

which cancels

lofty junco
mortal hare
#

the villager type spawning

#
@EventHandler
public void onEntitySpawn(EntitySpawnEvent event) {
  if (event.getEntityType() == EntityType.VILLAGER) {
    event.setCancelled(true);
  }
}
lofty junco
#

see my code

mortal hare
#
@Override
public void onEnable() {
  World world = Bukkit.getServer().getWorld("world");
  Location entityLoc = new Location(world, 66 + .1111111f, 66, -125);
  Entity newEntity = world.spawnEntity(entityLoc, EntityType.VILLAGER);
  newEntity.setCustomName("TEST");
}
#

this would ensure that villager spawns everytime the plugin starts

#

although you need to kill it

#

if you would reload this with plugin manager

lofty junco
#

i need it on entityspawn

mortal hare
#

and above the code for handling villager spawns

#

why

#

you said it you need it when server starts

#

place 1 villager

lofty junco
wraith rapids
#

good luck

mortal hare
#

Not to be rude or anything, but if there's plugin that's suitable for you why not use it

#

instead of making bootleg version of it

glass sparrow
#

to have the fun of fixing bugs

mortal hare
#

No joke

#

i've never played a game

wraith rapids
#

if this is your first plugin, try doing something simpler instead

mortal hare
#

properly for past 7 months

#

due to my addiction to coding

lofty junco
glass sparrow
wraith rapids
#

link the entire class in a pastebin or something

mortal hare
#

yea ^^

wraith rapids
#

and describe thoroughly and verbosely what is going wrong

#

don't monkey slam the keyboard

mortal hare
#

its hard for people who are from foreign countries to speak english here

#

i do understand it

#

but

#

im a foreigner myself

wraith rapids
#

most people are

mortal hare
#

yea

#

that's the point

#

this discord server decreases my productivity by 50%

wraith rapids
#

working with complicated chat based layouts is cancer

#

having to left justify 20 million fucking elements per row is cancer

mortal hare
#

preinitialise them

#

but why

#

chat is CHAT

wraith rapids
#

i'm writing a chat based interface for a stonk market

#

i want it to be nice and tidy and have columns for shit like price and quantity and total offer and the seller/buyer name

#

and i also want it to be adjustable for different chat widths

#

so literally everything needs to stretch and contract and squeeze and bounce

ivory sleet
#

u use git or smtng? or do u just code w/o vc

wraith rapids
#

i use git when i feel like it

ivory sleet
#

yeah github or smtng else?

wraith rapids
#

usually not because the intellij integration for git keeps spamming git subprocesses every 0.5 milliseconds if the project is imported into git

#

and it taxes my system resources

ivory sleet
#

oh yeah you cant disable that?

wraith rapids
#

i'm not sure

#

i haven't had the effort to look

ivory sleet
#

fair enough, anyways whats ur name on gh? the same as discord or confidential?

wraith rapids
#

do i look like a guy who uses a single account

ivory sleet
#

good point, I mean like a main account rather

wraith rapids
#

i have a couple of accounts for paper and one for an org for my serbur

#

i don't have any public projects on any of them though

#

i think i have an untouched slimefun fork on one of them

ivory sleet
#

ah well lets call it a day then

wraith rapids
#

i might write an optimization guide or something eventually

#

that'll probably be on github

#

so at least you have something to look forward to

ivory sleet
#

lmk when ur finish 😮

mortal hare
#

Someone should make a skin farm API (like mineskin)

#

using education edition teacher accounts

#

they allow java edition to render 4K resolution skins

#

with full transparency support

wraith rapids
#

someone made some sort of a plugin for it but I think you still had to upload the skins manually

mortal hare
#

yea there's transparent heads plugin

#

but its not for skins like SkinsRestorer

#

well

#

some python magic with selenium or magicsoup libraries would do for this

glass sparrow
#

4k resolution heads in java

#

pog

mortal hare
#

yea

#

you can render fat ass kim jong un

#

in netflix quaity

upper vale
#

is it possible to raytrace through entities but not blocks

eternal oxide
#

yes

#

rayTraceBlocks

wraith rapids
#

brilliant

sage swift
#

any way to cancel bow being drawn back? setCooldown works, but about 80% of the time

wraith rapids
#

uuuh

#

smells clientside

novel hornet
#

can some help with some code help

wraith rapids
#

maybe

novel hornet
#

e.getPlayer().getWorld().spawnEntity(l, EntityType.PRIMED_TNT); for some reason the 1 is a error

wraith rapids
#

what is the error

novel hornet
#

i'm trying to spawn 1 PRIMED_TNT but it's not working

wraith rapids
#

what is the error

past glen
#

so I have an item called the midas ingot, and I want to incorporate that into the recipe for my custom midas sword item, how do I do that?

wraith rapids
#

create a recipe with an ExactChoice

novel hornet
#

ayyy skyblock player

wraith rapids
#

ExactChoice takes an ItemStack rather than just a Material

novel hornet
#

make a hyp that crashes a server

eternal oxide
#

what?

novel hornet
#

nvm

novel hornet
eternal oxide
#

you have no 1 in the code you posted

wraith rapids
#

it doesn't want a number

#

it wants the location

#

you aren't spawning 1 PRIMED_TNT

#

you are spawning a PRIMED_TNT at l

eternal oxide
#

L

past glen
#

how do I use exact choice? I cant find a good article

wraith rapids
#

new RecipeChoice.ExactChoice() or something, I don't quite remember

quaint mantle
#

new RecipeChoice.ExactChoice(ItemStack)

past glen
#

k

#

then I use that in my crafting recipe?

wraith rapids
#

yes

past glen
#

k

#

gonna test it real quick

#

theres an error, something about null itemstack

#

heres my code

#
        ItemStack material = new ItemStack(ItemManager.midas_ingot);
        ItemStack item = new ItemStack(Material.GOLDEN_SWORD, 1);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName("§6Midas Blade");
        List<String> lore = new ArrayList<>();
        lore.add("§6this blade originally belonged to");
        lore.add("§6king Midas and can turn mobs to gold");
        meta.setLore(lore);
        meta.addEnchant(Enchantment.LUCK,1, true);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        item.setItemMeta(meta);
        midas_blade = item;
        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("midas_blade"), item);
        sr.shape(" G ", " G ", " S ");
        sr.setIngredient('G', new RecipeChoice.ExactChoice(material));
        sr.setIngredient('S', Material.STICK);
        Bukkit.getServer().addRecipe(sr);

    }```
wraith rapids
#

paste the actual error

past glen
#

hold on lemme get it again

wraith rapids
#

the error is always the most useful part of an issue

#

it shows what happened, where, and usually why

past glen
#
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[patched_1.16.5.jar:git-Paper-580]
        at org.bukkit.inventory.RecipeChoice$ExactChoice.<init>(RecipeChoice.java:171) ~[patched_1.16.5.jar:git-Paper-580]
        at org.bukkit.inventory.RecipeChoice$ExactChoice.<init>(RecipeChoice.java:160) ~[patched_1.16.5.jar:git-Paper-580]
        at com.profmonkey07.moreswords.items.ItemManager.createMidas_Blade(ItemManager.java:60) ~[?:?]
        at com.profmonkey07.moreswords.items.ItemManager.init(ItemManager.java:27) ~[?:?]
        at com.profmonkey07.moreswords.MoreSwords.onEnable(MoreSwords.java:14) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-580]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-580]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-580]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-580]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-580]
        at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:580) ~[patched_1.16.5.jar:git-Paper-580]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.16.5.jar:git-Paper-580]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1055) ~[patched_1.16.5.jar:git-Paper-580]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-580]
        at java.lang.Thread.run(Thread.java:834) [?:?]
[16:03:50 INFO]: [MoreSwords] Disabling MoreSwords v1.0
wraith rapids
#

what is on line 60 of the code you pasted

past glen
#

sr.setIngredient('G', new RecipeChoice.ExactChoice(midas_ingot));

wraith rapids
#

are you sure midas_ingot is not null

past glen
#

lemme check

#

public static ItemStack midas_ingot;

#

nope

#

not null

wraith rapids
#

it kinda looks null

past glen
#

but the itemstack is outside the void

wraith rapids
#

the variable looks like it's null

past glen
#

private static void createMidas_Blade(){
ItemStack item = new ItemStack(Material.GOLDEN_SWORD, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§6Midas Blade");
List<String> lore = new ArrayList<>();
lore.add("§6this blade originally belonged to");
lore.add("§6king Midas and can turn mobs to gold");
meta.setLore(lore);
meta.addEnchant(Enchantment.LUCK,1, true);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(meta);
midas_blade = item;
ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("midas_blade"), item);
sr.shape(" G ", " G ", " S ");
sr.setIngredient('G', new RecipeChoice.ExactChoice(midas_ingot));
sr.setIngredient('S', Material.STICK);
Bukkit.getServer().addRecipe(sr);

}
#
    public static ItemStack wither_sword;
    public static ItemStack midas_blade;
    public static ItemStack ice_sword;
    public static ItemStack obsidian_sword;
    public static ItemStack lifesteal_sword;
    public static ItemStack midas_ingot;


    public static void init(){
        createWither_Sword();
        createMidas_Blade();
        createIce_Sword();
        createObsidian_Sword();
        createLifeSteal_Sword();
        createMidas_Ingot();
    }```
wraith rapids
#

print it with system.out

#

it's probably null

past glen
#
        ItemStack item = new ItemStack(Material.GOLD_INGOT, 1);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName("§6Midas Ingot");
        List<String> lore = new ArrayList<>();
        lore.add("§6used to craft midas blade");
        meta.setLore(lore);
        meta.addEnchant(Enchantment.LUCK,1, true);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        item.setItemMeta(meta);
        midas_ingot = item;

        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("midas_ingot"), item);
        sr.shape("GGG", "GGG", "GGG");
        sr.setIngredient('B', Material.GOLD_INGOT);
        Bukkit.getServer().addRecipe(sr);
    }```
#

k

#

print what?

wraith rapids
#

the value of midas ingot

past glen
#

wym value?

wraith rapids
#

hhhh

past glen
#

srry complete beginner here

wraith rapids
#

system.out.println(midas_ingot)

past glen
#

print it at the beginning?

wraith rapids
#

immediately before this line

#

sr.setIngredient('G', new RecipeChoice.ExactChoice(midas_ingot));

past glen
#

k

#

you were right

#

but I cant figure out why its null

#

I did everything to make it

#
        ItemStack item = new ItemStack(Material.GOLD_INGOT, 1);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName("§6Midas Ingot");
        List<String> lore = new ArrayList<>();
        lore.add("§6used to craft midas blade");
        meta.setLore(lore);
        meta.addEnchant(Enchantment.LUCK,1, true);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        item.setItemMeta(meta);
        midas_ingot = item;

        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("midas_ingot"), item);
        sr.shape("GGG", "GGG", "GGG");
        sr.setIngredient('B', Material.GOLD_INGOT);
        Bukkit.getServer().addRecipe(sr);
    }```
#

oops

wraith rapids
#

you are calling create midas ingot after you are calling your other code

past glen
#

heres the actual code for it ```private static void createMidas_Ingot(){
ItemStack item = new ItemStack(Material.GOLD_INGOT, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§6Midas Ingot");
List<String> lore = new ArrayList<>();
lore.add("§6used to craft midas blade");
meta.setLore(lore);
meta.addEnchant(Enchantment.LUCK,1, true);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(meta);
midas_ingot = item;

    ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("midas_ingot"), item);
    sr.shape("GGG", "GGG", "GGG");
    sr.setIngredient('G', Material.GOLD_BLOCK);
    Bukkit.getServer().addRecipe(sr);
}```
wraith rapids
#

it's going to be null until create midas ingot makes it not null

past glen
#

but I have create midas ingot

wraith rapids
#

yes. but you're calling it too late

past glen
#

wow, Im dumb

wraith rapids
#

you call create midas blade before you call create midas ingot

past glen
#

just realized that lmao

unkempt ore
#

How should I get a level from an XP amount?

wraith rapids
#

i remember the xp related math being super cancer

unkempt ore
#

I couldn't find a method, so I thought to rearrange the equations in the wiki

#

The equations to get total XP given the level. Rearranged them to get the level

#
// 0-16: -3 + sqrt(9 + xp)
// 17-31: 8.1 + 0.1*sqrt(-7839 + 40*xp)
// 32+: 18.35 + 0.03142696*sqrt(-158362 + 225*xp)
public int getLevel(int xp) {
    if (xp <= 352) {
        return (int) (-3 + sqrt(9 + xp));
    } else if (xp <= 1507) {
        return (int) (8.1 + 0.1*sqrt(-7839 + 40*xp));
    } else {
        return (int) (18.35 + 0.03142696*sqrt(-158362 + 225*xp));
    }
}
#

Not sure if this would...work

waxen plinth
#

Well you can test it pretty easily

unkempt ore
#

I did test it

#

It seems okay

waxen plinth
#

You can get a player's level and also their total XP

#

Well is it accurate or not?

unkempt ore
#

It seems alright, but I'm insecure about it somehow

waxen plinth
#

Relatable

#

Test it on a bunch of values

#

Like 1 less than a level up

#

And 1 more

#

To make sure it's correct

#

Make sure to get each case, like those where it's over 352 and then again over 1507

wraith rapids
#

plug it into mockbukkit and write a test 👀

waxen plinth
#

Oh look who's back

wraith rapids
#

i don't think mockbukkit does xp though

unkempt ore
#

I'm pretty sure I understood correctly. I'm insecure about the ranges. The wiki says "0-16", "17-31", and "32+", but does that mean [0, 16], (16, 31], (31, inf)?

wraith rapids
#

test it on a server, call the set xp methods on a player and see what the get level methods say

#

or cuntpaste the math from nms

unkempt ore
#

But seriously though, I don't know if there's some convention I'm missing here, but

#

Does 0-16, 17-31 mean [0, 16] (16, 31] or [0, 17] (17, 31]

#

I'm sure I'm just being a dumbass here somehow

wraith rapids
#

unless the wiki explicitly says inclusive or exclusive, who knows

#

but, based on how the ranges are 0-16 and 17-31, I would guess they are all inclusive

#

since otherwise there would be a gap between 16 and 17

unkempt ore
#

If they're inclusive, there's a gap betwe-

#

Oh, wait, that makes sense

wraith rapids
#

0 (exclusive) - 16 (exclusive) would mean values 1 through 15

unkempt ore
#

Yes

#

But wait

#

You can be level 0

wraith rapids
#

you probably start at level 0 yes

#

it probably just doesn't render as level 0

#

the number is probably absent

unkempt ore
#

There's no 0, but it's before 1 shows up

#

Honestly, due to the nature of how levels work, I'd say inclusive ranges make sense. Since even level 16.00001 would theoretically be level 16

#

And level 16.9.. is still level 16

wraith rapids
#

if we want to bring decimals into it, it would have to be 0 (inclusive) - 17 (exclusive)

unkempt ore
#

Actually, hold on. The wiki says the first equation applies to levels 0-16, but 352 XP is level 16 on the dot

wraith rapids
#

just copy it from nms

#

the wiki fucking sucks

#

they don't know anything about anything

unkempt ore
#

One time I tried making an arrow calculated with the gravity equation, but couldn't. All I was missing was a meters/second velocity to plug in, but didn't think of how to get it. I turned to the source, and I wish I hadn't

#

Entirely obfuscated

wraith rapids
#

iirc it just adds some number of downwards velocity every tick and then multiplies the vector by 0.99 something for the slowdown

#

i don't remember which order it was in

unkempt ore
#

Nah, nah, I wanted a perfect trajectory at a 45 degree launch angle given a desired landing distance at the same Y level

#

The equation yielded meters/second, but "launch force" had no conversion to that, which was my dead end

lofty junco
#

Does anyone know why this is happening

wraith rapids
#

try pasting the full exception

#

looks like infinite recursion though

lofty junco
wraith rapids
#

you're spawning an entity and then listening to it spawning and then spawning an entity and then listening to it spawning and then spawning an entity and then listening to it spawning and then spawning an entity and then listening to it spawning

lofty junco
#

I want to change entities with villager for example but a lot of villagers spawns in the specific location and an error appears

wraith rapids
#

don't recurse infinitely

lofty junco
#

What could be the best fix for this problem

jagged badge
#

when I interact with an entity, the event is called 4 times. I will be able to modify it, but I wanted to know if there was a simple way, known, to change that

            public void onPacketReceiving(PacketEvent event){
                if(event.getPacketType() == PacketType.Play.Client.USE_ENTITY){
                                    TODO...
....
wraith rapids
#

launch force is in blocks per tick

#

which is meters/second times 20

#

20 meters/s = 1 blocks/tick

unkempt ore
#

For real?

#

I could try doing this again then, holy. You found a conversion factor

wraith rapids
#

basically everything in minecraft is in blocks/tick

#

the velocity of an entity is just the vector that is added to its position every tick

unkempt ore
#

DMed you the attempt

#

No images here

#

But, that's the direction I was going with that

wraith rapids
#

keep in mind though that real life gravity and minecraft velocity don't work quite the same

#

minecraft gravity works by adding a fixed downward velocity every tick

unkempt ore
#

Gravity would just be lowering velocities vertically by a constant, I assume

#

Yeah

wraith rapids
#

but the velocity is then also slowed down to a factor of 0.94 or something

#

which means that items that go faster sideways accelerate slower downwards

#

since the total blocks/tick slowdown is based on the actual velocity of the object

#

say the factor is 0.9

#

and the object is going 100 blocks sideways per tick

#

after the slowdown it only goes 90 blocks sideways

#

the added 0.0 something that goes downward gets lost in that reduction

unkempt ore
#

Hey, have you taken calculus?

wraith rapids
#

not really

#

but yeah it'll probably be "about the right value"

unkempt ore
#

Interesting

errant snow
#

Anyone know of the non-deprecated way of putting colors on a map? All of the MapPalette colors are deprecated but there's no reference to what I should use as an alternative

wraith rapids
#

i remember there being a way

#

it was somewhat obvious

#

i don't remember what it is though

worldly ingot
#

I don't think anyone ever drafted an alternative

#

It was something I had wanted to do but never got around to completing

sullen marlin
#

there's drawText and drawImage ?

errant snow
#

Yeah but I'm not trying to draw an image or text, just want to set pixels on the map. I know I can use the deprecated colors but I'm trying to avoid that

earnest junco
#

allows you to draw text on it pretty easily too

errant snow
#

Alright, I'll give it a shot

#

Thanks

quaint mantle
#

is there an other easy way to store players uuid doing it this way errors on "UUID to long " setPlayerToReport(Bukkit.getPlayer(UUID.fromString(e.getCurrentItem().getItemMeta().getLore().toString())));

earnest junco
#

e.getCurrentItem().getItemMeta().getLore().toString() obviously thats gonna be too long for a UUID lol

errant snow
#

@quaint mantle you can use the item's PersistentDataContainer to store the UUID

quaint mantle
earnest junco
wraith rapids
#

use the persistent data container

earnest junco
#

^

quaint mantle
sage swift
#

since when is EntityDeathEvent not called for players

wraith rapids
#

seems like one of those things that probably should be called but most people don't expect it to be called

quaint mantle
#
@EventHandler
    public void onCurse(AsyncPlayerChatEvent e) {
        Player p = e.getPlayer();
        List curse = Main.getInstance().getConfig().getStringList("banned-words");
        if (e.getMessage().equalsIgnoreCase(curse)) {
            e.setCancelled(true);
            p.sendMessage(Main.getInstance().getConfig().getString("curse-message"));
            p.kickPlayer("Please do not curse in chat!");
        }
    }

I cant wrap the getStringList() with String.valueOf() so that doesn't work im trying to create an anticurse thing where when someone says one of the words in the "banned-words" part of the config the message is deleted my error is with the variable im having trouble with getting the string list

sage swift
#

List curse

#

should be parametrized

#

List<String> curse

#

then what you can do is use List#contains

#

and you can replicate equalsIgnoreCase by making the message and curse word list lowercase

quaint mantle
#

oh ok thx

wraith rapids
#

use a set

#

list contains is slower and set represents the intent of what you're trying to do better

#

and don't get it from the config every time, precompute it on startup or something

sage swift
#

.getStringList("curse-words").stream().map(String::toLowerCase).collect(Collectors.toSet());

wraith rapids
#

fuck you

sage swift
#

why

wraith rapids
#

ssssttttreeeeammmmmmsmmsms

#

absolutely haram

#

i guess that is fine though

errant snow
#

Everytime I restart the server, the map's custom MapRenderers are removed and I have to reapply them, is there a way to have them persist across restarts?

wraith rapids
#

i doubt it

#

the server would need to be given a way to obtain the renderers when the items/entities are loaded in at random

waxen plinth
#

Streams are great if you don't care about sacrificing a bit of performance for cleaner code

#

In cases where performance isn't critical they're 👌

olive lance
#

ight think i just finished rewriting my whole plugin who want the before after

wraith rapids
#

everything must absolutely use imperative for loops and be like 30 times the lines and characters than the stream counterpart

quaint mantle
sage swift
#

you make it into a set

#

so make it Set<String>

waxen plinth
#

Change it to Set<String>

quaint mantle
#

ah ok

waxen plinth
#

It's a better data structure for your needs

#

Depending on how you check that is

#

If you iterate, use a list

#

If you call contains on the container, use a set

olive lance
#

oh my god

#

sorry

#

its so big...

quaint mantle
wraith rapids
#

that's what she said

olive lance
#

boom

quaint mantle
wraith rapids
#

curse is a set

quaint mantle
#

yes and it says it requers a string

#

it meaning

#

if (e.getMessage().equalsIgnoreCase(curse)) {e.setCancelled(true); }

wraith rapids
#

what you want to do is see if the message has a word in it that is contained in the curse set

sage swift
#

again, Set#contains

#

dont use String.equals(Set)

wraith rapids
#

what you are doing now is seeing if the message is equal to the entire set

sage swift
#

that will yield nothing

olive lance
#

is my code good enough for premium now

wraith rapids
#

probably not

#

or, well, i don't know

#

spigot's requirements are kind of loose iirc

olive lance
#

i sent my whole project a few msgs up

sage swift
#

premium shouldnt really be a goal i think

wraith rapids
#

needs more packages

#

almost everything is in one package

olive lance
#

i just want it to be good

#

true

#

ok i added more packages

#

is it AAA now

sturdy elk
#

Hi, previously I saw that I can add my own configurations by putting getConfig().addDefault("perms", "blabla.blabla"); I wanted to know if it is correct what I am putting if in the case it is ok as it could be with a StringList.

wraith rapids
#

define 'I can add my own configurations'

young knoll
#

You can use a List<String>, yes

wraith rapids
#

you generally don't add configuration options by adding defaults

#

defaults will not be visible in the config.yml and the end user won't know of the option's existence

young knoll
#

I actually have no idea what those do, I just say some mention of them in the source

wraith rapids
#

a config default is a value that is used when the end user has not defined any value for a config option

sturdy elk
#
List<String> list = new ArrayList<>();
list.add("asdasdsd");
list.add("asdasdsd2");
list.add("asdasds3");

getConfig().addDefault("perms", list);```
Like this?
wraith rapids
#

to add a config option, you want to create a config.yml in your resources directory, and write the option in there

#

and then access it as normal

young knoll
#

Huh, I always use the get overloads that take a second argument for a default

#

That’s useful

wraith rapids
#

yeah nobody uses it

#

it also copies the defaults from your config.yml

wraith rapids
#

so there's no need to use it, either

#

anything you write in config.yml is automagically a default value

young knoll
#

What if the config file just doesn’t have the entry

wraith rapids
#

then there is no default for it and it'll be null

young knoll
#

Maybe I should just not be lazy and make a config updater

wraith rapids
#

use some config api tbh

#

bukkit's is garbage

young knoll
#

Would be nice if spigot updated to the newer SnakeYaml that supports comments

sturdy elk
#

So is what I just sent okay?

wraith rapids
#

configurate is alright but might be a bit oop purist for the average guy

sturdy elk
#

:v?

wraith rapids
#

no, that is not how you add a config option

#

again, open up your config.yml in your IDE and just add it there

sturdy elk
#

okay 😔

wraith rapids
#
perms: 
- "a"
- "b"
- "c"
#

that will then be the default value and the config.yml that is copied from your jar when you call saveDefaultConfig or whatever that method is will contain it

sturdy elk
#

If I know how it is

#

But what I want to get to is NOT to add it to the config, only with code

young knoll
#

I don’t see a reason not to have the defaults visible to the user

wraith rapids
#

then you can't use comments in your config

young knoll
#

Prevents them from getting confused

#

saveDefaultConfig kills comments anyway

wraith rapids
#

nah

#

saveconfig does

#

savedefaultconfig just cuntpastes your bundled config.yml

#

so it keeps comments

young knoll
#

Didn’t the last I checked

#

Huh

wraith rapids
#

or am i talking about loaddefaultconfig

olive lance
#

how do i see how many posts i have

young knoll
#

Might be that one

wraith rapids
#

i don't remember the methods, haven't used bukkit config api in ages

sturdy elk
#

Don't worry, it won't be an uploaded plugin or anything like that, I was just wondering how to use it xd

olive lance
#

pretty sure i meet all the premium requirements but its still greyed out

wraith rapids
#

really hungry for that jew gold huh

olive lance
#

nah im not gonna post it yet

#

havent even tested it lol

sturdy elk
wraith rapids
#

iirc you have to have at least one not premium resource before you can open a premium resource

olive lance
#

i have 5

#

6

#

granted theyre ass

#

half were made in 2015 when i was like 12

young knoll
#

As it stands the current requirements are:
8 week old account
80 posts + 20 positive ratings
3 free resources
Two-step verification enabled

olive lance
#

ah two step

#

that is what im missing

#

so does anybody test the plugin when you upload it or they just read the code? could use a free testing service lmaoo

#

ok i wasnt actually gonna do that

young knoll
#

Good question

#

I would assume yes?

quaint mantle
#

if not it would be scamming right

wraith rapids
#

they at least pretend to look at it

#

though, considering some premium resources, it's kind of doubtful whether they do

deep solstice
#

Kinda dumb question- I see that a lot of people put final in their variables, and I understand what it does. Is there any other reason for people doing this? I get that it basically "locks" the variable, but is there anything else I am missing?

wraith rapids
#

for variables, it doesn't "matter"

#

the compiler will basically always be able to infer whether or not that variable is effectively final

deep solstice
#

kk, thanks

wraith rapids
#

but

#

that doesn't mean there is no reason not to use it

#

there are certain things that need final/effectively final variables

#

such as lambdas

deep solstice
#

yeah i get that, just thought it was more work to do lol

#

i get that now, thanks

wraith rapids
#

in such cases you definitely should declare them final

#

to specify your intent

#

"this must be final"

#

some people also say that making literally everything final makes compiling faster but that sounds pretty dubious

deep solstice
#

lmao ok, thanks

paper viper
#

Is there a packet to force players to unload a resourcepack?

#

or use a new one directly (by unloading the old resourcepack and loading the new resourcepack)

#

Because the set resourcepack url method for the Player class for some reason sends a packet to the client to load the resourcepack existing

#

but not a new one

#

do I need to provide a hash?

young knoll
#

If you don’t have a hash and the client already has one downloaded it will use that

drowsy helm
#

if the hash is different it will redownload the resourcepack iirc

young knoll
#

Correct

#

Otherwise I’m not sure what it uses

#

File name? URL? No idea

cinder thistle
#

Code quality > functionality > performance

wraith rapids
#

performance > everything else

young knoll
#

Netbeans likes to tell you to make every variable that can be final final

drowsy helm
#

how would you guys go about syncing two inventories between servers?

#

im just thinking send an update to redownload the inv each time an update is made to it

#

but eh

wraith rapids
#

depends

crude charm
#
                String winMessage = plugin.getConfig().getString("win-message");
                winMessage.replaceAll("%outcome%", String.valueOf(outcome));
                winMessage.replaceAll("%wonamount%", String.valueOf(wonamount));

                String looseMessage = plugin.getConfig().getString("loose-message");
                looseMessage.replaceAll("%outcome%", String.valueOf(outcome));
                looseMessage.replaceAll("%lostamount%", String.valueOf(gambledAmount));

why is this not replacing?

drowsy helm
#

replaceAll returns a string

#

you have to set winMessage to it

stone sinew
crude charm
#

hmm

#

this is very misleading

drowsy helm
#

not really

stone sinew
crude charm
#

oh