#help-archived

1 messages · Page 88 of 1

radiant pollen
#

That seems weird, but I have no other ideas.

buoyant path
#

Anyone willing to make nms npcs with pathfinding, they would target a certain player if they are a "Villain". They need to have armor and should have the ability to follow a player when I want it to. I have a system for the villain/neutral thing already set up, I would just need the nms because I don

#

don't have much experience with it

#

I also develop so it wouldnt just be you in the dark

radiant pollen
#

You might have more luck asking on the forums for someone to actually help you code something.

#

?services

worldly heathBOT
frigid ember
#

using VaultAPI how would i get the name of the rank? with color?

formal nimbus
#

Does anyone know what the best way to create an expandable inventory would be? As in multiple pages, and when 1 page is filled up, a new one is automatically created

#

I could make a new inventory every time the previous one gets filled up, that's not too difficult, the problem is how do I reference that inventory?

tulip pendant
#

Someone help me 😦 I placed my resource pack in the minecraft folder but it's not working :(
ping me if you know what the problem is

formal nimbus
#

That is really really vague

naive goblet
#

Jet

#

You should probably use a map or something for that

#

And then a method to check if filled and yeah create a new one in the right order then

formal nimbus
#

@naive goblet how would I use a map?

stark briar
#

When i want to include data/datapacks to my plugin, where do i put them?

formal nimbus
#

why would you need to include a datapack with a plugin?

#

I don't think u can include a datapack with a plugin

stark briar
#

I have vanilla loottables i want to use

#

Theres a “Bukkit” datapack, which says: for data provided by plugins or stn like that, so somehow it must be possible

frigid ember
#

why wont Bukkit.getServer().getOnlinePlayers().size(); erroring Error:(12, 58) java: cannot find symbol
symbol: method size()
location: class org.bukkit.entity.Player[]

fleet crane
#

thats really a dummy thing; datapacks are independent from plugins

#

@frigid ember you're trying to compile against a REALLY old version

#

like > 5 years old

frigid ember
#

thats big oof isnt it

#

if i do 1.5.12 it works on all version still right?

#

1.15.2

fleet crane
#

depends; but usually on later versions are supported not older versions

stark briar
#

I think its not dumb, using minecraft external files for plugins, i mean it saves you much time instead of codeing Recipes etc

frigid ember
#

yea no it still does it on 1.15.2

fleet crane
#

you might be getting an old version from another depend

#

make sure spigot is at the top of your depend list

frigid ember
#

ahh i know why

#

spigot at the top?

fleet crane
#

first

frigid ember
#

where?

fleet crane
#

above any depends you may have on other plugins

#

idk, depends on your IDE/build system

frigid ember
#

Intellji Maven

fleet crane
#

so at the top of your <dependencies> section in pom.xml

frigid ember
#

it is.

#

well bukkit is? is that fine?

#

nvm ill just add spigot

#

Nah still does it.

stable egret
#

is there any way to use more than one cores for spigot servers?

frigid ember
#
            for (String s : HubCore.getInstance.getConfig().getConfigurationSection("queues").getKeys(false)) {``` any reason for this to be null?
brisk mango
#

@velvet halo there is plenty tutorials on the internet how to use ScheduledExecutorService

#

keep in mind that its an Async executor though so you cant kick players, change blocks, spawn mobs and things that need to be on the main thread

#

and a really good advantage of that is it uses TimeUnit so its better than the bukkit's scheduling crap

#

getInstance returns null perhaps?

#

or the section, anyway use dependency injection instead of singleton pattern

#

ive already explained why its better in the case of bukkit plugins/overall

#

@frigid ember

#

also, getInstance should be a method, thats how you name methods not fields.

frigid ember
#

huh

brisk mango
#

I mean that you probably have


public static HubCore getInstance;

#

in your main class, thats not a name of method

#

its a field

#

should be instance and then make a method that returns that if youre gonna go ahead and use singleton pattern

frigid ember
#

i got lazy

brisk mango
#

I mean

#

wants to code

#

cba to code

#

make up your mind

frigid ember
#

oh wtf

#

nvm

brisk mango
#

you probably didnt set instance = this; onEnable()

#

so it returns null

frigid ember
#

HuBcore.getInstance is ()

#

its a method holy fuck i cant speak at 5 in the morning

#

Also yes i did set instance to this

brisk mango
#

fine, could you just use a dependency injection

frigid ember
#

how so?

brisk mango
#

Passing objects through the class constructor

#

private final HubCore instance;

public ClassName(HubCore instance) { this.instance = instance; }
frigid ember
#

this is in the class with the error right.

#

just so i aint messing it up

brisk mango
#

Wdym this is in the class

frigid ember
#

the class where for (String s : HubCore.getInstance.getConfig().getConfigurationSection("queues").getKeys(false)) { is.

brisk mango
#

so remove HubCore.getInstance()

#

and do instance.getConfig()

#

lol

frigid ember
#

and put instance

#

ik

brisk mango
#

bruh you cant use both either use SP or DI

#

i already said what could be null. Either the section or getInstance() but u said u set it to this onEnable()

#

so the section is null perhaps.

frigid ember
#

how would the section be null tf

brisk mango
#

I mean if u get a null pointer theres a reason

#

lol

frigid ember
#

the section is in the config file 😄

brisk mango
#

maybe it has no keys then

frigid ember
#

keys..

#

keys yes

#

whats a key in a config file?

brisk mango
#

um

frigid ember
#

i am losing my mind at 6 in the morning

brisk mango
#

section has keys

#

``

section1:
section2: <- key
value1: 2381723
value2: 2318721
``

#

getKeys(false) would return section2

frigid ember
#

queues: YourServer: name: "HCF" maxplayers: 120 paused: true YourServer2: name: "Kitmap" maxplayers: 120 paused: true

#

is what i have.

brisk mango
#

im not sure but i think you need to follow the YAML format

#

which is you should have 2 spaces

#

in queues: YourServer:

frigid ember
#

ok.

sturdy oar
frigid ember
#

ok fixed it but i still need help with the null

brisk mango
#

i mean that should fix it

frigid ember
#

what?

#

the dep injection?

brisk mango
#

no

#

by having 2 spaces in the YAML

frigid ember
#

oh...

#

no it didnt.

brisk mango
#

bruh no idea

#

if getInstance() is not null and section is not null too

#

and it have keys then i have no idea why it returns null

#

make sure u compile it and reload the server

frigid ember
#

i restart the server everytime and compile it.

brisk mango
#

no idea

frigid ember
#

the thing is it works fine in a different class

#

what possible could be null...

#

@brisk mango just checked this is returning null HubCore.getInstance().getConfig().getConfigurationSection("queues")

stable egret
#

is there any way to use more than one cores for spigot servers? pls help

frigid ember
#

ye

#

its after my knowledge a default feature in paperspigot, @hoary parcel correct me if I'm wrong

hoary parcel
#

It's not called paper spigot, just paper

#

And yes, paper uses multiple cores for all kind of stuff

#

This isn't the place to discuss this tho, discussion about paper should be on papers discord

frigid ember
#

True

oak stump
frigid ember
#

Arrays start to count at 0

#

seems like your array is out of bound

#

you also never checked args length

oak stump
#

oh ye

frigid ember
#

means you are trying to access a index which is not given

brisk mango
#

LMAO

#

THat fucking code

#

"I fully know java"

#

honestly ur a meme @oak stump

frigid ember
#

lulz

oak stump
#

lol wish i wuz then i wouldnt look so dumb xD

brisk mango
#

u fully know java yet u use == for comparing strings and method calls from a constructor

#

first of all

oak stump
#

?paste

worldly heathBOT
velvet halo
#

That is exactly how you compare strings, you use an == operator 👍

brisk mango
#

learn how return/return true/false works , and learn when to use non-primitive types and primitives

#

@velvet halo
👌

frigid ember
#

nope u use equals methode to compare strings lol

brisk mango
#

hes joking obviously

velvet halo
#

:3

brisk mango
#

because this dude said he is 12

frigid ember
#

Wasn't sure about that one yikes

brisk mango
#

and he is fully able to develop java

#

yet he is worse than most the noob plugin developers

frigid ember
#

" To develop java " working on a own jvm then, huh?

brisk mango
#

in java

#

i meant

frigid ember
#

xd

velvet halo
#

I am making microsoft java in java

#

I am combining windows xp and java

frigid ember
#

CJ# then?

brisk mango
#

and 1 more thing, ItemMeta and lore can be null @oak stump

velvet halo
#

No C++CJS#

brisk mango
#

just take look at some java course before doing this

#

u dont know legit nothing

frigid ember
#

OOooii @velvet halo bro I'm in

brisk mango
#

F#

frigid ember
#

symb0lizm do whatever you want

lofty mica
#

Does anyone know how to stop an ender crystal to destroy other crystals in range (i allready canceled the EntityExplodeEvent)

frigid ember
#

ye

#

make it an own entity which can't explode

#

or just disable explosions in the area

lofty mica
#

make it an own entity which can't explode
@frigid ember how do you mean this?

oak stump
#

quality English entered the chat

frigid ember
#

Endercrystal c = new Endercrystal {}; and just make it non-exüöpsove

lofty mica
#

quality English entered the chat
@oak stump Sorry im from germany and i know my english isnt the best but i try it at least instead of using only google translator

oak stump
#

no worries lol

frigid ember
#

Bin auch deutsch @lofty mica dm einfach wenn du labern magst

pastel basin
#

@lofty mica listen for EntityDamageByEntityEvent and check if the victim and damager are both ender crystals then cancel it

lofty mica
#

@lofty mica listen for EntityDamageByEntityEvent and check if the victim and damager are both ender crystals then cancel it
@pastel basin is also already canceld. no entitys get damage no blocks get destroyd only nearby crystals disapear

#

if i hit the left then nothing will be destroyd and nobody gets damage only the right crystal also disapears

frigid ember
#

then disable the trigger event

#

like just check which causes the second one to vanish and cancel that one

lofty mica
#

@proud furnace ja und du must ihn sichtbar machen

#
        Entity entity = world.spawnEntity(location, EntityType.ENDER_CRYSTAL);
        entity.setCustomNameVisible(true);
        entity.setCustomName("name");
#

then disable the trigger event
@frigid ember Wich event do you mean exactly i cant find a "TriggerEvent" in the spigot doc's

brisk mango
#

lol

forest sigil
#

Anyone here got any experience with forge servers? Currently trying to set one up but receiving an error upon startup, never had this before.

velvet halo
#

You are asking a question in the wrong community @forest sigil

lofty mica
#

Anyone here got any experience with forge servers? Currently trying to set one up but receiving an error upon startup, never had this before.
@forest sigil You need to install the vanilla minecraft server in the same folder

forest sigil
#

I'm asking a question in a community full of minecraft players, surely someone will know.

lofty mica
#

Hast du schon das ExplosionPrimeEvent probiert?
Nein probiere ich jetzt aber mal

velvet halo
#

@proud furnace and @lofty mica if you are just going to talk german between urselfs may as well do it in private PMS

lofty mica
#

Oh ok sorry i will talk english

forest sigil
#

Speak whatever language you want lol, isn't any rules.

lofty mica
#

ExtraLimo did you also got warned for marking peoples xD

velvet halo
#

I never said it was against the rules

#

Just said if they are having a conversation in german just between the two of them then they can just talk privately 🤷‍♀️

lofty mica
#

yeah is at me the same

sturdy oar
#

why is ItemStack#getItemMeta() marked as @Nullable

#

in which case would that be null

brisk mango
#

Vanilla items have no ItemMeta @sturdy oar

#

like found items.

#

and AIR also has no ItemMeta

sturdy oar
#

Well in that case I think I might have to ignore Intelli's warning

hoary parcel
#

Doesn't get item Meta create one if needed?

sturdy oar
silk bane
#

i can't think of any case where it could be null

brave tapir
velvet halo
#

SkullMeta can be null...

#

Not all itemstacks are going to have a player head material...

sturdy oar
#

???

#

I'm creating the itemStack

lofty mica
#

if anyone want to know the solution for my problem: ```java
@EventHandler
public void onExplosionPrimeEvent(ExplosionPrimeEvent event) {
if (event.getEntity().getType() == EntityType.ENDER_CRYSTAL) event.setRadius(0);
}

velvet halo
#

Oh

#

hmm

sturdy oar
#

I'll just add this, @SuppressWarnings("ConstantConditions")

silk bane
#

Objects.requireNonNull works too

sturdy oar
#

well that adds an extra check tho

brave tapir
sturdy oar
#

I mean it's not performance expensive

#

but it's also not required

hoary parcel
#

Jvm will optimize it away

#

Can also add an assert, thats not present in runtime at all

brave tapir
#

Is any option to set plugins "weight"?

sturdy oar
#

just use plugin:command

velvet halo
#

Too me it seems logical why skullMeta is still null

#

but alright 🤷‍♀️

brave tapir
#

Yes. I know that :// hmm.. ok, so i will be using that

velvet halo
#

casting itemMeta to being a skull meta is gonna return null because how is an itemMeta going to know the an itemstacks material is a player head.

silk bane
#

what are you on about

sturdy oar
#

yeah 😒

#

SkullMeta extends ItemMeta

velvet halo
#

I know it does

sturdy oar
#

it's 100% safe, since I'm creating myself an ItemStack which will ONLY be a playerhead, a skullMeta can always be created

velvet halo
#

I know it is a 100% safe

#

but the IDE won't know if it is

sturdy oar
#

that's why I'm silencing it

velvet halo
#

Why it still thinks it is null

silk bane
#

@hoary parcel do you have any ideas for when getItemMeta could ever be null?

velvet halo
#

When casting it to SkullMeta...

silk bane
#

just so you know, the jvm throws a classcastexception when the object is of the wrong type

#

it doesn't magically make it null

velvet halo
#

I know

silk bane
#

clearly not

velvet halo
#

You are not getting my point obviously

sturdy oar
#

I'm getting basically every method highlighted from ItemMeta

#

even setDisplayName

#

it's kinda annoying

#

I'll have to suppress the whole class

velvet halo
#

Since ItemMeta has many inherited classes when casting it to a derived class the IDE wants todo a null check to make sure if itemMeta currently holds that derived class.

silk bane
#

no.

velvet halo
#

Then why does the IDE still think skullMeta is null?

silk bane
#

because the spigot API annotates getItemMeta as nullable

brisk mango
#

Its just there to inform you it might be null @sturdy oar

silk bane
#

and now i see why - itemmeta is null for AIR

brisk mango
#

Not only for air @silk bane

silk bane
#

there is no other case where itemmeta is null

brisk mango
#

there is lol

#

vanilla found items

silk bane
#

i have the source in front of me @brisk mango

brisk mango
#

have no ItemMeta

silk bane
#

no, they generate itemmeta when the method is called

brisk mango
#

bruh, vanilla found items dont have an ItemMeta

sturdy oar
#

the hell are vanilla items

brisk mango
#

found items

silk bane
#

getItemMeta returns a value for them

brisk mango
#

No they dont, I disscused w choco about this @silk bane

silk bane
#

@subtle blade

brisk mango
#

it returns null for vanilla found items

sturdy oar
#

could you give me some examples of 'vanilla found items'

brisk mango
#

Found items in mineshaft minecart for example

sturdy oar
#

oh those

silk bane
#
            return CraftItemFactory.instance().getItemMeta(getType(item));
        }```
#

literally creates itemmeta if it doesn't have any

velvet halo
#

Items in treasure chests

sturdy oar
#

Why the hell wouldn't they come with a meta

brisk mango
#

where is that in the code you sent

#

they dont bruh

silk bane
#

CraftItemStack

sturdy oar
#

but they have a name

#

weird

brisk mango
#

@subtle blade

#

Yeah a name

#

not an ItemMeta

silk bane
#

@subtle blade explain yourself

subtle blade
#

Boys... I’m working

#

Do you fucking mind

brisk mango
#

just answer a question

silk bane
#

lol

subtle blade
#

Don’t ping if it’s not fucking urgent

#

Leave me alone

sturdy oar
#

bye

#

I didn't pin by the way

brisk mango
#

Just say that vanilla items dont have an ItemMeta

#

lol

silk bane
#

anyway, it won't return null for those

brisk mango
#

we've discussed about this

silk bane
#

you can check the source to verify

velvet halo
#

lol arguments about trying to prove people wrong

#

Gotta love em

brisk mango
#

It might not return null but it doesnt have an ItemMeta if its found @silk bane

sturdy oar
#

I think as well that they would have a meta

#

it's nonsense otherwise

brisk mango
#

Iirc the only case it can return null is AIR

silk bane
#

that's literally what i just said but ok

brisk mango
#

no

silk bane
#

sigh

#

i'm out

brisk mango
#

I didnt mean thats its null

#

I meant that it doesnt have an ItemMeta

#

for vanilla items

silk bane
#

no point anymore

brisk mango
#

whatever bruh

velvet halo
#

lol

#

Ya'll need to chill

brisk mango
#

I didnt check the source but I thought it returns null

#

for the items

naive goblet
#

ItemMeta can be null?

brisk mango
#

yeah

naive goblet
#

But it’s getter from ItemStack would return a new ItemMeta if null

#

iirc

hoary parcel
#

@silk bane I know that that method can return null

#

I don't exactly remember how

silk bane
#

AIR

hoary parcel
#

Just look at the code

brisk mango
#

bruh we we just said it

silk bane
#

just checked the code

#

it's only for AIR

#

¯_(ツ)_/¯

hoary parcel
#

Bukkit api Design 101

brisk mango
#

thats why its annotated as @Nullable

silk bane
#

all those ide warnings every time you use itemmeta

hoary parcel
#

Make Sure to never be consistent

velvet halo
#

Explain how this creates new item meta? (This isn't to argue or prove you wrong just a general question)

silk bane
#

just on the off chance that someone creates an itemstack of air

#

CraftItemFactory#getItemMeta creates a new itemmeta

hoary parcel
#

Well, a good API design would be to return a airmeta for air

#

Or a immutable meta

brisk mango
#

it doesnt create a new ItemMeta

hoary parcel
#

Or smth

#

But hey

#

It's bukkit

brisk mango
#

it gets an ItemMeta

#

lol

#

there is nothing like

hoary parcel
#

And craftmetaitem is the worst class in bukkit anyways

brisk mango
#

return new CraftItemMeta(...

silk bane
#

you're welcome

brisk mango
#

this shit is weird as fuck

hoary parcel
#

It's bukkit

brisk mango
#

why its named lik ethis

#

its not bukkit

#

this is NMS

#

lol

silk bane
#

no this is craftbukkit

#

you've made like 4 wrong statements in a row

brisk mango
#

how is this craftbukkit

#

and how did i make 4 wrong statements in a row

silk bane
#

the file is in the package org.bukkit.craftbukkit.inventory

#

the name is CraftItemStack

brisk mango
#

ah yes youre right

hoary parcel
#

When I say bukkit I often refer to the whole shit stack

velvet halo
#

Confusion why you would do getType(item) again in the getItemMeta function when it is done again in the switch statement o.O

silk bane
#

we should all move to glowstone

pastel basin
#

no, we should move to canary

hoary parcel
#

It still inherts the bad API 🤷

silk bane
#

crap

#

i meant bedrock

hoary parcel
#

Haha

#

So from bad API to php?😂

pastel basin
#

i meant bedrock
i agree

silk bane
#

hell yeah

hoary parcel
#

Or to copy of bad API?

velvet halo
#

why not make a new craftbukkit? 🙃

#

I will give you a cheese sandwhich if you do so

hoary parcel
#

Well, I take an alternative approach, trying to make the stack better

brisk mango
#

I mean, the whole code of minecraft is shit, both spigot and minecraft client lol

hoary parcel
#

No it isn't, vanilla has gotten really clean

silk bane
#

and he does it by using mojang's mappings in a somewhat questionable way

brisk mango
#

It was atleast

hoary parcel
#

Look at how vanilla handles blocks via the material enum in bukkit ^^

brisk mango
#

i've went through it a couple times

#

its really poorly designed

#

overriden method calls from constructors etc

hoary parcel
#

I was taking about my contributions to paper there konsolas

velvet halo
#

How long ago was this beta 1.2?

pastel basin
#

No it isn't, vanilla has gotten really clean
You mean less worse

hoary parcel
#

The shit I do with mojang mappings for dyescape isn't clean in any way 😂

silk bane
#

ah

hoary parcel
#

I mean, it's better than protocollib and stuff

velvet halo
#

when is that coming out?

silk bane
#

how much work on dyescape has to be redone every major minecraft update?

velvet halo
#

Will dyescape ever release lol

hoary parcel
#

The last updates were really easy

#

We don't do much stuff that uses code that changes

#

And most stuff is abstracted anyways

silk bane
#

cool

velvet halo
#

in 6 days it has been 3 years since dyescape became a thing

hoary parcel
#

I only been with them for half of that time so don't blame me 😂

#

In the time I was with dyescape we went from 1.12 to 1.15

velvet halo
#

So you made it go 2x faster 😛

hoary parcel
#

And I replaced all public plugins

velvet halo
#

maybe it would have been 6 years if you didn't show up xD

hoary parcel
#

Maybe

#

But like, the game is actually playable now

brisk mango
#

It was playable before too?

hoary parcel
#

Now it's only about fixing bugs, helping content team code the content in (it's a giant json file hell) and implementing small new features

velvet halo
#

Do you guys have a quality assurance team?>

hoary parcel
#

Well, we test internally and plan on to recruit active community members

#

It's something we talked about but haven't done yet because there wasn't really anything that could be tested easily

#

But yes, we want to avoid the hegemondastrophe at all cost obviously

velvet halo
#

What is that? My dutch background doesn't understand what hegemondastrophe is xD

hoary parcel
#

The hegdemony catastrophe 😂

#

It's the server city works for

#

Big hype, 2k ccu at launch, everything went up in flames, shit was buggy, now they happy if they have 5 players

velvet halo
#

o.O

#

Lol that sounds like Rowlings Realm to me

hoary parcel
#

We are more about moving slow and save and natural growth and stuff

velvet halo
#

I remember that harry potter server had 2000 people come online for launch

#

one week later it was dead

frigid ember
#

To be honest Rolings Realm wasn't that awesome, played with my lil sis a bit on it recently and it was trash

whole sigil
#

do you guys know why newtshop-gui-shop dont exist any more ?

tawny gale
#

Hey I bought a plugin but I didn't receive it it's been 2 weeks now, and the developper don't answere to me ^^ can you help me please ? (i'm french sry if my english is bad)

naive goblet
#

sounds like a scam. Contact the staffs

snow raft
#

Hi everyone,

Since days, I tried to reproduce the behavior of a jukebox with a custom song of my resource pack.
The song is located to: minecraft:custom.<song_name>

I just want than my players ears a song in an area just like the jukebox do with CD.

With command bloc, I can't reproduce the same behavior.

So, here is a list of the features I'm looking for:
    Play a song from a resource pack, in a coordinate thanks to a command or a bloc as a target.
    Set a radius to define at which distance the song will be heard.
    Loop the song.
    The song will be heard by everyone walking by.
    Compatible with 1.15.2
Thanks a lot for your help.
I didn't find any existing plugin.

Have a good day!

-LArchitect
naive goblet
#

?

#

ok

copper star
#

Im having a problem with my Plugin "GriefPrevention". So If someone has 3 accounts and if logon with more than 3 accounts the 4th+ account gets instantly banned.

naive goblet
#

disable that in config

copper star
#

So MaxAccountPerIpAddress = false

naive goblet
#

Either that or change the number of accounts/ip

copper star
#

and then you do /gpreload

naive goblet
#

ig

copper star
#

Still dosnt work

#

i got banned again

naive goblet
#

maybe reload

copper star
#

or restart server

naive goblet
#

and be sure you have the appropriate config for your version of gp

#

yeah reboot is even better

copper star
#

the config works because i disabled claiming in certain worlds and it worked

#

ok a restart makes it work

#

it works now

whole sigil
#

do you guys know why newtshop-gui-shop dont exist any more ?
@whole sigil any idea ? ? ?

deep olive
#

"Connection Refused" this error when my friend tries to enter the sv and sv is hosted on my hoteador what should I do?

frigid ember
#

wtf is a hoteador

#

sv = serveR?

deep olive
#

sorry I'm a Brazilian router and I remembered how I spoke in English

#

sv = server

#

yes i open my server via my router's ip

frigid ember
#

ok

#

you port forwarded, right?

deep olive
#

yes

frigid ember
#

alright, is your friend able to join other servers?

deep olive
#

possibly yes, when he tries to enter my server this error "Connection Refused"

frigid ember
#

I found a typo in the documentation for bukkit

#

kind of a typo

#

it's actually incorrect information that seems to be copied from somewhere else

frigid ember
#

@tawny gale @naive goblet normally premium resources are reviewed by staff before release

#

may just try to message the author using another medium

#

e.g. twitter or discord

lilac quarry
#

Whats the perm of /ptime command?

icy cradle
#

essentials.ptime

#

Anyone free to have a quick chat in pm about some code ive written that isnt working correctly?

frigid ember
#

sure

oak stump
frigid ember
#

Seems like you initzialized it twice

#

use JavaPlugin.getPlugin(Main.class) to access methods of your plugins main

oak stump
#

i cant find where tho

frigid ember
#

Kiddin me? Line 27 lol

oak stump
#

its not tho

frigid ember
#

it is, in your error message it states to look at line 10 in your main class which is on enable

#

passing a main class causes the error

oak stump
#

line 10 in my main class is public class Main extends JavaPlugin

#

so

frigid ember
#

The Problem is you double init stuff, gosh, get your stuff right and focus on learning how to write stuff

#

for example get some extra help command class

oak stump
#

sorry lol, im just tired

#

im debugging it for a friend

frigid ember
#

also you dont need to translate color codes manually

#

Pls learn how to work organized first if thats your work

oak stump
#

its not for once

frigid ember
#

Pls tell the author then to organize stuff according to the java naming conventions, coding guidelines and to use the spigot api correctly.

oak stump
#

lol sure xD

#

how would i fix the error tho?

frigid ember
#

I don't know and I won't find out since I don't want to hurt my eyes and torture myself lol

oak stump
#

lol

frigid ember
#

pls help

#

smeltery is not working in my server

#

logs?

#

sec

#

Btw don't mind censoring the IP's of your users, I am sure they like having there IP's exposed in public @frigid ember lol

#

@frigid ember pls help me fixing it

#

plsss

#

the plugin isn't even loaded at startup lol

#

what plugin

#

smeltery

#

i dont have plugin named like that

#

and how is it named then?

#

i have an issue that all smeltery is not working

#

so furnaces not working at all?

#

yes

#

pls help

#

@frigid ember is worldguard or griefprotection may blockign it?

#

maybe

#

how can i fix that ?

#

command ?

#

Idk, may by combat with the plugins?

#

Just figure it out by debugging your stuff manually

#

i use worldgurd

#

Yeah just mess arround till it works lol

frigid moon
#

temporarily remove plugins till it works

#

then figure out what in that addons i messing with it

naive goblet
#

normally premium resources are reviewed by staff before release
@frigid ember indeed and always. But if I understood the case right then he was the buyer which has nothing involved in what you're talking about.

frigid ember
#

why does 1.8.9 not exist?

tiny dagger
#

it's just a client update

#

not server

frigid ember
#

ok what

tiny dagger
#

what

#

there was NO reason to make a 1.8.9 server

frigid ember
#

so 1.8.8 is the same thing as 1.8.9

tiny dagger
#

yes

frigid ember
#

ok

naive goblet
#

server sided yes

tiny dagger
#

the client is different

#

but not enough to require a new server version

frigid ember
#

the recipe iterator doesn't seem to get any MerchantRecipe
how would I get all the Merchant Recipes?

finite belfry
#

How to make ranks and permission stuff on bungeecord?

tiny dagger
#

looking for a plugin?

finite belfry
#

Yes

tiny dagger
#

did you searched first?

#

i think lucky perm

#

has a bungee module

finite belfry
#

Yes but luckperms don’t wrk by MySQL

tiny dagger
#

why would you want a mysql system for bungee?

finite belfry
#

And I tried to put the luckperms plugin in the bungee plugin folder but it doesn’t work

floral isle
#

@finite belfry you must usw the bungee version of luckperms

finite belfry
#

ok!

stark briar
#

Is it normal, that things like give @p itemXY{Enchantments:[{}]} dont work on Spigot Servers?

#

When i modify using /data merge, as long as it lays on the ground, its fine, but when i pick it up again the NBT Data is gone

rapid yacht
#

Why is bungee cord so expensive :/

naive goblet
#

Huh

hallow surge
#

I made a simple list in my config how do I get it to go to the next line after each message here is my code

String hlpmsg = plugin.loadString("HelpMessage");
  if(hlpmsg != null) {
    p.sendMessage(hlpmsg);
}```
frigid ember
#

I do hlpmsg.split("\n")

hallow surge
#

i tried that it didnt work probably something i did wrong while doing the list

#
public String loadString(String config_value) {
        getConfig().getStringList("HelpMessage");
        return ChatColor.translateAlternateColorCodes('&', getConfig().getString(config_value));
    }```
frigid ember
#

is "HelpMessage" a string or a string list?

hallow surge
#

shoot

#

its a string list

naive goblet
#

Well y2k u can load a stringlist from strings

#

not sure about the other way. However change return type to List<String>

hallow surge
#

okay

naive goblet
#

also

#

I'd do something like this

hallow surge
#

you cant return just List<String>

naive goblet
#
String getStringList() {
  return getConfig()
  .getStringList("some.list.path")
  .stream()
  .map(Utils::color)
  .collect(Collectors.toList());
}```
#

It requires you to have a color method that only takes a single String param

hallow surge
#

ah

#

so my question on my main class

#

is what should i exactly return

naive goblet
#

return an ArrayList<>

hallow surge
#

when i return anything

#

it asks for arguments

naive goblet
#

ChatColor.translateAlternateColorCodes('&', getConfig().getString(config_value));

#

this would return a single string

#

you'd need to loop the color method on all list elements

#

then return that list

hallow surge
#

Why does it error if i change getString

#

to getStringList

naive goblet
#
List<String> getStringList() {
  List<String> loredList = new ArrayList<>();
  for (String line : getConfig().getStringList("HelpMessage")) {
    loredList.add(ChatColor.translateAlternateColorCodes('&', line));
  }
  return loredList;
}```
#

make a new list

#

and loop throug the original list but everytime you translate color

#

return the new list

neon matrix
#

I see some resources claiming that PlayerInteractEvent is the event I should listen for to cancel trampling of crops.
However; all the resources I have found are outdated by a few years each.
I'm wondering if PlayerInteractEvent is still the event I should be subscribing to

hallow surge
#

yea probably

#

unless there is a new event

neon matrix
#

I am quite surprised honestly that this wouldn't fall under BlockBreakEvent

naive goblet
#

PlayerInteractEvent should be the event. The movement event only determines when player moves and afaik there is no "PlayerCropDestroy" event.

hallow surge
#

Conclure I get an error onGetStringList()
Syntax error on token "getStringList", AnnotationName expected after this token

naive goblet
#

Yeah that's true

chrome lark
#

Yea, Interact event sounds fine, given that that trampling is an interaction

neon matrix
#

So farmland is a partial block; will PlayerInteractEvent#getBlock or whatever return the farmland, or the crop

naive goblet
#

Hwiggy it's probably to seperate when a player breaks a crop by left clicking from when a player is actually jumping on a crop to destroy it.

#

Y2K send ur method

#

I also suggest to get some more general experience about java List<E> and arrays in general.

neon matrix
#

I love the javadoc comments on Action.PHYSICAL

hallow surge
#

fixed

neon matrix
#
 /**
  * Stepping onto or into a block (Ass-pressure)
hallow surge
#

i accidently put it in another method

naive goblet
#

lol

hallow surge
#

shhh

naive goblet
#

Hwiggy fr yeah it's really questionable

#

I mean perhaps it is BlockBreakEvent now? Then I'm outdated.

chrome lark
#

other events are often also fired from PIE

naive goblet
#

yeah

chrome lark
#

PIE is just super early, so makes stuff like that ideal

naive goblet
#

thats true

hallow surge
#

what shold i put in place of loadString?

                if(hlpmsg != null) {
                    p.sendMessage(hlpmsg);
                     
                    }``` if i change it too getStringList i get errors
naive goblet
#

yes lol

#

List<String> != String

hallow surge
#

im aware xD

#

thats why the errors exist

#

but i get errors on p.sendMessage

#

if i change it to a list

naive goblet
#

You make String = List<String>

#

well

#

make a method to send an array of messages to a cmd sender?

#

you can use varargs for that :]

naive goblet
#

@quaint atlas if you're coding why not apply the damage afterwards?

#

Manipulate it

quaint atlas
#

Thats the problem. Im not coding. Thats why I asked in general for some premade solution

naive goblet
#

That complicates stuff though.

quaint atlas
#

Havent found any specific rules, so I thought, this channel is for spigot/bc help only 😄

naive goblet
#

This problem is spigot related?

tulip pendant
#

Does anyone know how to add permissions I'm using Luck Perms and it also has a web editor please if anyone is good at permissions or generally is a good dev please contact me in rlly in need of a dev

quaint atlas
#

Well, kinda. So... :D

Is there some way to make Sharpness work like Power? So instead of flat DMG, its actually x% + lvl?
Thank you!

naive goblet
#

SaltyDaddy I don't think there exist something like that

#

DogLover /lp user/group <name> perm set <perm.node>

cerulean snow
#

In my listener for InventoryClickEvent, the code runs fine if a player clicks on the given ItemStack, but if the item is damaged, it doesn't work even if its the same item type.

obsidian pulsar
#

Hey, I'm having a hard time downloading Spigot and setting it up with Visual Studio Code would appreciate any tip:)

frigid ember
#

Why do you want to use it with VSC tho? @obsidian pulsar

obsidian pulsar
#

Its just the ide that i already have downloaded

swift compass
#

Hi

#

How to get a first key and value from hashmap ?

#

HashMap<String,ArrayList<String>> playerInfo = new HashMap<>();
playerInfo.put(getPlayerGroup(playerName), (ArrayList<String>) getPlayerPermission(playerName));
return playerInfo;

zinc ingot
#

there is no first key

#

you can get a key if you get the entry set and use an iterator to get an entry

naive goblet
#

Tadzio you may use a MultiMap when storing a Collections iirc -> (manages it better)

swift compass
#

How it use ?

naive goblet
#

Map<K, V> map = new MultiMap<>();```
#

Preferibly V would be Iterable

swift compass
#

ok

#

Thanks

naive goblet
#

But as Banana said

cerulean snow
#
            ((Damageable)currentItem.getItemMeta()).setDamage(0);
                    if(currentItem.equals(new ItemStack(Material.ELYTRA))) {
                        ((Damageable)currentItem.getItemMeta()).setDamage(damage);
                        Player p = (Player) playerInv.getHolder();
                        p.sendMessage(ChatColor.DARK_RED + "You can't use that in spawn!");
                        for(int i = 0;i<enchantments.size();i++) {
                            currentItem.addEnchantment(enchantments.get(i),enchLevel.get(i));
                        }
                        event.setCancelled(true);
                    }```
int damage = ((Damageable)currentItem.getItemMeta()).getDamage(); returns a NPE if its an elytra with damage clicked. Not sure why
#

any help?

naive goblet
#

ItemStacks, ItemMetas isn't Damagable

red zenith
#

If you're holding a Chest ItemStack in your hand or if it's in your inventory, it's not considered to be a TileEntity, right?
I was under the impression that when a chest has been placed somewhere that it becomes a TileEntity?

naive goblet
#

it's for entites

#

innit?

#

or am I wrong?

cerulean snow
#

ive tried using the itemstack but then it returns with a casting error

pastel condor
#

what are you casting?

cerulean snow
#

an itemstack to damageable

pastel condor
#

um

#

they are completely different

cerulean snow
#

im just trying to check if an elytra has durability damage, its giving me a lot of trouble

pastel condor
#

just a note, damageable is for entities

cerulean snow
#

am i missing something? damageable is stated to be used with item stacks

naive goblet
#

Don't use that interface

tiny dagger
#

i think damageable is used for that

#

it's the new durability

#

yup

#

for meta

#

probabily there is an entity damageable too

naive goblet
#

oh yeah

tiny dagger
#

not sure

naive goblet
#

He doesn't need to use it for casting though?

tiny dagger
#

is discord dying for you too guys?

pastel condor
#

((Damageable) item.getMeta).getDamage()

#

I think

naive goblet
#

yes

#

wtdf

pastel condor
#

where item is your item stack

cerulean snow
#

I

pastel condor
#

discord is so laggy

#

@cerulean snow

cerulean snow
#

I've tried that but it returns with an NPE

pastel condor
#

use that

#

use instance of

#

if (item.getMeta instanceof Damagable)

naive goblet
#

Idk Damagable should be useful

#

but it doesn't have any classes extending or implementing it

quaint atlas
#

Is there any plugin request section on spigot forum?

pastel condor
#

yes there is

#

?services

worldly heathBOT
pastel condor
#

people post stuff there

quaint atlas
#

"at least 20 posts" well damn

#

I have acc with 20 premium plugins, but now I need to spam the forum? 😄

tiny dagger
#

well spaming is the way...

#

to get banned

#

so go ahead 👀

quaint atlas
#

That was meant to be ironical

cerulean snow
#

@pastel condor if(currentItem.getItemMeta() instanceof Damageable) { Player p = (Player) playerInv.getHolder(); p.sendMessage(ChatColor.DARK_RED + "test"); Damageable itemDamage = (Damageable) currentItem.getItemMeta(); int damage = itemDamage.getDamage(); itemDamage.setDamage(0); if(currentItem.equals(new ItemStack(Material.ELYTRA))) { //((Damageable)currentItem.getItemMeta()).setDamage(damage); p = (Player) playerInv.getHolder(); p.sendMessage(ChatColor.DARK_RED + "You can't use that in spawn!"); for(int i = 0;i<enchantments.size();i++) { currentItem.addEnchantment(enchantments.get(i),enchLevel.get(i)); } itemDamage.setDamage(damage); event.setCancelled(true); return; } }

#

the message is sent to the player at the top, but nothing else runs

#

no errors in console

pastel condor
#

can you show me the higher up code?

#

how is that being called?

#

a listener?

#

command?

#

@cerulean snow

cerulean snow
#

a listener, InventoryClickEvent

scenic ocean
#

The if statement won't match since the object reference for the players current item is different to a new object reference

#

Compare the material of the itemstack instead

pastel condor
#

I would assume current item is event.getClickeItem()?

cerulean snow
#

nice that worked. changed the if statement to if(currentItem.getType().equals(Material.ELYTRA))

#

thanks for help @pastel condor @scenic ocean

pastel condor
#

oh yes you would want to do that 🙂

obsidian pulsar
#

Anyone here can help me with setting up Spigot?

surreal sedge
#

hello
I have a location, and I try to modify the block at this location :

        Material sign_material = Material.OAK_SIGN;

        Block block = this.location.getBlock();
        block.setType(sign_material);
        block.setBlockData(sign_material.createBlockData());
        Sign sign = (Sign) block.getState();

I modified the sign variable with sign.setLine(index, line), but this don't modify anything, my sign is empty
I read after that with getState(), I have an immutable view of the block, so how can I modify it really ?

frigid ember
#

There should be a sign.update() method.. or something like that

frigid ice
#

Yeah, a BlockState represents a block state, not a current block

#

If you make changes to it, you have to call update()

surreal sedge
#

oh yes, I see
does it works too if I modify sign_material.createBlockData() as a sign, and use setBlockData of this block_data ?

peak marten
#

Hey all, a question, what would be a good approach of have an player like object. Perhaps passing the player instance in the constructor?

subtle blade
#

Gonna need a lot more than that

#

What are you trying to do

peak marten
#

Well I have a player that will have some specific additional properties on top of the existing spigot Player

#

So I try to have a class that contains the additional properties

subtle blade
#

So passing it through the constructor isn't much of an option here. Player instances are thrown out after they log out. A new instance is created every join.

peak marten
#

I applications you would extend the class, but I don't think I can extend Player myself or if that would be a good idea is it?

#

in*

subtle blade
#

No. CraftBukkit implements Player, plugins cannot. It won't work

#

Your best bet is to have a Map<UUID, ClassRepresentingAdditionalProperties>

#

UUID being the player's UUID, obviously, and the value being whatever class you're going to use to hold said properties

peak marten
#

hmm

subtle blade
#

If at any point in the properties you need a Player, pass it to the method as an argument. You should be able to supply a player whenever you need to call it

peak marten
#

But what if I use the constructor, and use events Join and leave event to remove the class?

subtle blade
#

Sure though you're also going through a lot of hassle for no reason

peak marten
#

hmm

#

I see

subtle blade
#

It's an option, and a viable one at that. I just don't think it's really necessary in this case when you can just pass players as method arguments when necessary

#

If you're holding properties, I'm sure that more often than not a Player won't be required in that class anyways

peak marten
#

So you would keep the properties stored in a hashmap instead

#

I see your point

#

But I believe it would be fine to have a reference to the player object itself right?

#

or would you always read the properties from the hashmap?

subtle blade
#

When required, you'd fetch them from the map, yes

peak marten
#

Okay, it makes sense.

#

Thank you Choco 🙂

subtle blade
#

Pleasure

toxic kayak
#

hey guys!

#

does anybody know a way to disable mobai in 1.8.8?

young dawn
#

What are some good hosting platforms for servers? I had a $9 plan with MCProHosting, but I'm considering switching because I see a lot of other platforms that have cheaper, yet higher quality services.

toxic kayak
#

Nodesavior!

#

Is a great host

#

Excellent support as well

#

@young dawn

young dawn
#

I'll check it out

toxic kayak
#

Very cheap as well

#

Currently got our main server (16gb) running on them for about $24

frigid ember
#

ggservers was ok.. better than mcprohosting 😂 they were dead except for their support

inland depot
#

Is there a way to allow spawners to spawn mobs over water in spigot?

#

i made a little test farm but the mobs dont spawn

icy cosmos
#

make your own spawner system

#

Completely disable spigots one

bronze marten
#

@inland depot I think that should work though, but it needs to be dark? Otherwise you could try to place som eslabs

inland depot
#

@bronze marten it didnt work

bronze marten
#

do they need to be on a special Y level mbe? honestly no clue how spawners work lol. Afaik, my players could just have such spawners where spiders were falling out of the sky

inland depot
#

dont think so

#

i've done this before and it should work

#

but before i recode the spawning system i'd be curious if there's a simple fix

#

@subtle blade sorry to bother you but do you have any idea if there's an easy fix to my problem?

late wyvern
bronze marten
#

what version?

late wyvern
#

1.12.2

bronze marten
#

interesting

#

I had some bug like this as well in intellij, try this:

#

For me it didnt recognize classes in the same package

late wyvern
#

still hasnt worked 😦

near lodge
#

you must be using an old bukkit api

late wyvern
subtle blade
#

That's a Spigot method

viral prairie
#

You guys wouldn't happen to know how to use custom items in custom recipes would you? Like items with their own meta I can't seem to figure it out

subtle blade
#

Oh I lied, it is Bukkit ;P

#

Last I recalled it was Spigot-exclusive. That may have been the case in 1.12.2

near lodge
#

@late wyvern let me see your pom

velvet halo
#

I think it is part of spigot

#

Maybe idk

subtle blade
#

It's Bukkit in the latest version, though I remember that being Spigot-exclusive at one point

near lodge
#

I'm 95% sure a library you are using is using an older version of the api

late wyvern
near lodge
#

@late wyvern move the bukkit api to the top of the dependencies

#

oh

#

hmm

velvet halo
#

I had that problem also

#

A while ago

subtle blade
#

That's the one

#

That's 1.14 I think

near lodge
#

1.13

subtle blade
#

1.13.2, yea

near lodge
#

yeah

subtle blade
#

I knew I wasn't crazy!

near lodge
#

😛

#

that day

#

it was just transferred

#

Why are some methods still spigot exclusive?

subtle blade
#

Because Spigot is the successor

#

Core functionality is targeted to Bukkit but most performance-related functionality is driven towards Spigot

#

Bukkit is considered mostly legacy. It's maintained only so Spigot can build upon it

late wyvern
#

what can i do about it then/

#

should i just use 1.13.2?

#

fixed it when switching to 1.13.2 thanks guys! you are the best!

bright forge
#

Is there a way to appeal to be able to report?

#

Is there any way to appeal the report button so i can use it

#

Because i can't report anyone rn

pastel condor
#

wtf is that

#

thats kinda stupid

naive goblet
#

That’s horrible

pastel condor
#

mind if I ask what plugin?

naive goblet
#

Search up minkizz

pastel condor
#

lol

#

this guy is spamming

naive goblet
pastel condor
#

yeah xD

frigid ember
#

is it possible to get rid of the beginning [15:06:22] [Server thread/INFO]: in println?

naive goblet
#

Change the logger format

#

With code

#

Maybe reflection idk

frigid ember
#

aight

pastel fox
#

How can I get an OfflinePlayer but only from server cache (without calling the API)?

#

Bukkit#getOfflinePlayer(String name) is deprecated so I don't want to use that

#

And AFAIK it's deprecated because it calls the API and it's blocking

pastel condor
#

Bukkit.getOfflinePlayer(uuid)

#

that?

#

just store the uuid of all the players who join your server, then you can punch in the string and get uuid, then the offline player

#

@pastel fox

pastel fox
#

@pastel condor doesn't Bukkit already store them though?

#

Yeah I want to fetch by username from a command

#

I guess if nothing else I'll store them too

fathom shard
#

so.. Just ran build tools 1.8.8 and when i try run ```code
java -Xms2048m -Xmx4096M -jar spigot.jar -nogui
PAUSE

brisk mango
#

when you try to run... ?

fathom shard
#

yeah the server jar

#

when i try run the server jar it just prints this shit

brisk mango
#

what

fathom shard
#

SEVERE: 'n' is not a recognized option it prints this

#

but no where in my command script does it uses n

#

ohh

brisk mango
#

nogui

fathom shard
#

I swear thats existed for like

#

versions from 1.6

brisk mango
#

wtf

fathom shard
#

Strange oh well its solved

#

stupid error ig

#

@brisk mango Any idea why that final Player player = event.getPlayer().getKiller(); is throwing an NPE on InventoryOpenEvent

#

I need the player object to message but thats obviously not happening

#

Apparantly "player is null" due to my debugging but its not lol

tiny dagger
#

it clearly is

#

getKiller is nullable pretty sure

fathom shard
#

nvm im stupid, realised LivingEntity is part of a superclass so i can access the method I need from LivingEntity

brisk mango
#

I wouldnt use Player#getKiller @fathom shard

#

because that doesnt return the actual killer

#

for example, if a zombie would hit you and you would drown it would return zombie as a killer

fathom shard
#

Nah i realised LivingEntity inherits the CommandSender's methods

#

so i can actually fetch the method i need from that

brisk mango
#

ah fine

bright forge
#

Can someone ban this guy?

#

I can't report because i don't have the report button

#

Btw whats the way to use "PlayerPickupItemEvent" as it says its deprecated

finite belfry
#

hi

#

i added the prefix for the default player but the prefix dont work

#

this is luckperms bungeecord

cloud crater
#

with no chat plugin, great lol

finite belfry
#

so i need to install one more plugin

#

?

wanton delta
#

so if i have map.merge(key, value, (object1, object2) -> {}); is object1 value or is object2 value?

silk bane
#

that shouldn't compile

cloud crater
#

any chat plugin that supports vault prefix or luckperms

bright forge
#

nvm i just noticed i have to use EntityPickupItemEvent

brisk mango
#

object 1 is key and object2 is value @wanton delta

#

u would use a BiConsumer

silk bane
#

it should be a bifunction

wanton delta
#

its bifunction

silk bane
#

so needs to return something

#

yeah

wanton delta
#

object1 and object2 are both of the same type as value

brisk mango
#

ah I never honestly used merge method

wanton delta
#

and one of them is value

#

i just dont know which one

finite belfry
#

so i need to install the plugin in every spigot server or just the bungeecord server

any chat plugin that supports vault prefix or luckperms
@cloud crater

silk bane
#

they are both value

#

@wanton delta merge merges two values

wanton delta
#

no

cloud crater
#

@finite belfry just use the luckperms discord, they will help a lot more

wanton delta
#

one of them is the new value i set as value

cloud crater
#

dm me if you need a invite

wanton delta
#

the other one is the current value in the map

silk bane
#

your operator should be commutative so it shouldn't matter

finite belfry
#

ok thx

silk bane
#

as it happens the first one is the value in the map

wanton delta
#

is that consistent?

silk bane
#

see "Implementation requirements"

#
 V newValue = (oldValue == null) ? value :
              remappingFunction.apply(oldValue, value);```
#

so oldValue is passed as the first argument

#

also - looks like i'm wrong about it being commutative, not sure why i though that

wanton delta
#

yea lol

#

yea i saw that

#

i just didnt really know

silk bane
#

yeah it being the first value is well defined behaviour

wanton delta
#

how to read it correctly

#

thanks 👍

grand aurora
#

Hello, I am using a YamlConfiguration to load data, and I am serializing a location by joining the x,y,z, and world uuid with a semicolon. When I load it in, the second string location it encounters only loads the first few digits. This is my location deserializer function:
public Location locFromString(String loc) { String[] vars = loc.split(";"); double x = Double.valueOf(vars[0]); double y = Double.valueOf(vars[1]); double z = Double.valueOf(vars[2]); return new Location(Bukkit.getWorld(vars[3]), x, y, z); }

double y = Double.valueOf(vars[1]) produces an index out of bounds exception
This is my loading function:
this.game.chests = new HashMap<Location, ItemStack[]>(); for (Map.Entry<String, Object> c : (this.game.config.getConfigurationSection("Chests").getValues(false).entrySet())) { this.game.chests.put( this.game.locFromString(c.getKey()), this.game.deserializeInventory((List<Map<String, Object>>) c.getValue()) ); }

frigid ember
#

On bungee how could i disable the send message?

marsh hawk
#

@grand aurora why dont you just save the Location Object as a whole

grand aurora
#

Because I need to serialize it to store it in a yml file

marsh hawk
#

Oh you're using YamlConfig

#

if you use FileConfiguration you can use FileConfiguration#(path, Obj) and it serializes it for you

#

rather than having to split it yourself

subtle blade
#

YamlConfiguration inherits from FileConfiguration

grand aurora
#

On the forums, someone told me to do it this way because I don't think location auto-serializes. My problem is with loading it from the configuration file. The data is there, but only some of it is loaded.

fathom shard
#

And Location is ConfigurationSerializable

grand aurora
#

How do I serialize location through the built-in methods?

velvet halo
#
getConfig().set("location", location); //serialize
Location location = (Location) getConfig().get("location"); //deserialize 
grand aurora
#

Thanks!

velvet halo
#

You have to always cast it to the a ConfigurationSerializable object to get it from the config file.

#

I personally prefer gson as it is much nicer to serialize encapsulation classes.

barren abyss
#

How can I get data from the api using javascript?
Thats what I've been trying so far:

const cheerio = require('cheerio');
const request = require('request-promise');

async function init() {
    var url = "https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=78993"
    const response = await request(url);
    console.log(response)
}

init();
#

it gives me errors because of cloudflare so... how can I use the API?

grand aurora
#

How would I be able to get an ArrayList of locations from the YamlConfiguration this way?

subtle blade
#

@velvet halo getLocation()

#

No need to get() and cast

#

Anything from Bukkit that is configuration serializable has its own getter

#

Anything else can use getSerializable()

velvet halo
#

oh 😮

barren abyss
#

@grand aurora

Locations:
  loc1: "50 20 12"
  loc2: "40 20 10"

and then with getConfig().getString("Locations.*") or something like that i guess?

velvet halo
#

I didn't know getLocation was serializable

grand aurora
#

Okay, thanks

barren abyss
#

@subtle blade help me with the API ;_;

subtle blade
#

It works the same as any other REST API would work

#

Returns JSON

velvet halo
#

You need to declare a configuration section if you want to get an array of locations. Choco sent java docs already

subtle blade
#

If you're being blocked by cloud flare, supply a user agent (though you should be supplying one anyways)

#

If you're still being blocked, create an issue on the GitHub

velvet halo
#

I am finally happy with handling my claim data but I need to know if this is a good way todo it >.<

#
public class Claim {

    private final long data;

    public Claim(Chunk chunk) {
        data = convert(chunk);
    }

    public boolean equals(Chunk chunk) {
        return data == convert(chunk);
    }

    private long convert(Chunk chunk) {
        return ((long) chunk.getX() << 32) | (chunk.getZ() & 0xFFFFFFFFL);
    }
}
#

I am handling the claim data with a map. UUID as a key and a set of claims as a value

sick citrus
#

So you claim... Chunks?

subtle blade
#

Are there any collisions with that?

#

Negative values?

velvet halo
#

Yes there are negative values when serialized in json

sick citrus
#

Also chunk.getZ and oxffffffff shouldn't do much

velvet halo
#

wdym?

sick citrus
#

Hang on whats the max value for chunk x and z again?

#

Are they ints?

velvet halo
#

x and z are integers

subtle blade
#

They are ints, yes

#

That's truncating 24 of those bits

#

Though I'm curious as to why you're truncating them?

#

You have x and z, both are 32 bit values, right?

#

They can both fit into a long comfortably

sick citrus
#

Just shifting x should be right

subtle blade
#

^

velvet halo
#

Oh yeah hmm

subtle blade
#

((long) chunk.getX() << 32) | chunk.getZ()

velvet halo
#

Yea

subtle blade
#

ez pz, lemon squeezy?

#

😄

velvet halo
#

Sounds good!

subtle blade
#

However, question

#

Why aren't you just holding the x and z values? lol

#

It's not like you're sending this claim data over a network, and even if you were, sending the values individually wouldn't increase network congestion at all

storm vessel
#

I just setup bungeecord, and when I connected to my spigot server it was like there was no player data. No death counts, inventories, etc

velvet halo
#

I know I am not sending over a network but I want it to format nicely in a json file.

storm vessel
#

What could cause this?

sick citrus
#

Would be nicer with xz

#

Imo

velvet halo
#
{
  "c476c4bb-08bc-4c33-80b5-60af5cbd5945": [
    { "data": -34359738371 },
    { "data": -38654705667 }
  ]
}
subtle blade
#

Yea but "x" and "z"

#

Writing the data like that is prone to corruption

sick citrus
#

Also definitely more readable

subtle blade
#

I'd also imagine file size will be marginally smaller

#

"data": -34359738371 vs
"x": 123, "z": 321

#

MARGINALLY

#

lol

velvet halo
#

xD

#
public class Claim {

    private final int x, z;

    public Claim(Chunk chunk) {
        x = chunk.getX();
        z = chunk.getZ();
    }

    public boolean equals(Chunk chunk) {
        return chunk.getX() == x && chunk.getZ() == z;
    }
}
``` Yeah you are right
#

lol

subtle blade
#

Saved you some unnecessary complication, lesgo

velvet halo
#

and yes I could do two vectors for claiming

#

Yes

#

but I honestly like the feeling of just having it chunks

subtle blade
#

Chunks makes sense to me

sick citrus
#

Can chunk be null?

velvet halo
#

what do you mean?