#help-development

1 messages ยท Page 1512 of 1

stone sinew
#

I just broke your "solution" of checking x/z

wraith rapids
#

like I said, x/z applies when you only process one shroom at a time

#

for multiple shrooms, use a treemap keyed by y

stone sinew
wraith rapids
#

you break the entire mushroom in one go, yes?

stone sinew
#

yeap

wraith rapids
#

for each vertical column x/z, populate a treemap keyed by y

#

insert the mushroom type into this treemap

stone sinew
#

the above image literally breaks that

wraith rapids
#

then, when you need to know the type of a stem, query the treemap located at that column, and find the nearest y key above that block's y value

#

for the lower mushroom, it will return red

#

for the top mushroom, it will return brown

stone sinew
#

If you check X/Z there is both a brown mushroom and a red mushroom. If you check Y there is a stem for a brown mushroom and a stem for a red mushroom.

wraith rapids
#

do you know what a treemap is

#

the cap of the red mushroom and the cap of the brown mushroom are both in the treemap

#

however, only one can be nearest&above to a given y key at the same time

#

that is the type of the stem being queried

stone sinew
#

Now the mushroom blocks are the exact distances from each other so that would break your above solution

wraith rapids
#

nearest and above

#

again, do you know what a treemap is?

distant sedge
#

can I get a private static class in another class with reflection?

quiet ice
#

Class.forName

wraith rapids
#

define "get"

distant sedge
#

the class is a static class inside another class

#

and its private

wraith rapids
#

what do you mean by get

#

do you want the Class<> object for it?

quiet ice
#

Class.forName("outerclass$innerclass"); if not obfuscated nor compiled unconventionally

distant sedge
#

I want to create a instance of it

quiet ice
#

Otherwise, you are fucked

stone sinew
#

Also... blocks are broken down wards.... meaning there are no mushroom blocks to be checked. Only stems.

wraith rapids
#

i would prefer Class::getDeclaredClasses and finding it by name there

quiet ice
#

what is the rationale behind that?

distant sedge
#

its not obfuscated

wraith rapids
#

as some compilers don't use the same syntax

#

and the class could be relocated

#

and hardcoding entire class names in strings is bad news bears

quaint mantle
#

I recently saw people making custom blocks through barriers. How can this be repeated? I already use one method related to note blocks, but I find barriers to be more practical.

wraith rapids
#

@stone sinew breaking blocks downwards means that you are checking the caps first and the stems last

wraith rapids
#

which is fine

distant sedge
#

but its cursed

stone sinew
wraith rapids
#

yes

#

and by this point you have found all of the caps

eager sapphire
wraith rapids
#

and they are safely in memory in the treemap

#

waiting for you to query it

eager sapphire
#

oh.. well unless you really want to save every block broke (which sounds like a very cumbersome idea) I think you are stuck

quiet ice
#

My solution would be just to replant below leaves, but it is inefficient at times

wraith rapids
#

also, if you are doing it top-to-bottom, you are doing it 1 mushroom at a time as far as the y axis is concerned

#

so the x/z solution will work as well

eternal oxide
#

You could always put some meta on the bottom block when you start chopping

stone sinew
# wraith rapids and they are safely in memory in the treemap

In my latest test I'm running the lumberjack through 50x132x50 region... to test for speed/performance.... imagine if all of those were mushroom blocks.... I can't check each of those blocks for a stem underneath then saving those to memory (memory leak) then checking that map for the location and material of that stem.

wraith rapids
#

mushroom blocks aren't tile entities, no meta for you

#

that's not what a memory leak is

#

and also yes, you can

quiet ice
#

can't you just store it in a x, y, z, boolean record?

eternal oxide
stone sinew
wraith rapids
#

they do? how does that work exactly

#

and how have I never heard of that before

eternal oxide
#

spigot just died. No jd

wraith rapids
#

does it actually respect stuff like pistons/explosions/whatever, or is it just a glorified Block -> data map

#

4gb is an enermous amount of memory

#

treemaps are highly space efficient, moreso than regular hashmaps

quiet ice
#

Even then, you could probably store around 12.5k instances per MB

#

(assuming 80 bytes per entry - which is quite a lot)

stone sinew
wraith rapids
#

you're saving them to memory when cutting them down

#

not permanently

stone sinew
quiet ice
wraith rapids
#

and not all of those 1m blocks will be mushroom blocks

#

and yeah, even so, insignificant memory wise

#

you underestimate the size of a gigabyte

#

a gigabyte is absolutely a fucking enermous amount of space

eternal night
#

Tell that to my docker daemon

sonic dirge
#

Also with an actual 800+ player server, I would hope they got more than 4GB of memory lol.

stone sinew
#

I overestimate the users lol I expect them to have High radius's high speed of the lumberjack, multiple lumberjacks per player etc...

eager sapphire
quiet ice
wraith rapids
#

also with an 800 player server with everybody cutting down 1 million fucking blocks concurrently the CPU will die way before you run into memory issues

eager sapphire
#

no idea if that'll do something weird or make them render in a broken way though ๐Ÿ˜…

quiet ice
stone sinew
stone sinew
eager sapphire
#

True, but you could do it on structure grow event I guess

#

just catch them growing and tag the stems ๐Ÿคทโ€โ™‚๏ธ

wraith rapids
#

storing it in memory is fine

#

memory is cheap

stone sinew
wraith rapids
#

CPU is not

stone sinew
eager sapphire
wraith rapids
#

what's that supposed to mean

eager sapphire
#

I'm not like completely following but if that's the part you're trying to get back, that might work

quiet ice
#

I think, lemme check

stone sinew
eager sapphire
#

Nah I mean the block state

#

It'd get saved by MC

wraith rapids
#

yes, you would have to persist the data while cutting things down

eager sapphire
#

you can set the block state flags, there are directional flags for mushroom blocks

wraith rapids
#

but that in no way differs from what you have to do now

eager sapphire
#

saying which faces are visible

quiet ice
eager sapphire
#

NESW for stems normally, I'll bet the bottom bit is never used (no real idea tho)

stone sinew
wraith rapids
#

yeah, treemaps are logarithmic time complexity for most operations

#

as opposed to constant time for hashmaps

#

but the advantage is that they are sorted and have cheap next/pervious operations

eager sapphire
#

Well it differs in that you don't have to store the data yourself in a separate map that you maybe have to persist (not sure if you care about coming back to a chunk after a server restart or something?)

wraith rapids
#

which is what we want here

#

as we want to find the first cap upwards

quiet ice
#

but hashmaps are pretty expensive when they recompute the hashes

wraith rapids
#

yeah, you would want to estimate the initial size properly for a hashmap

stone sinew
wraith rapids
#

anyway, yeah, if you're truly doing it top to bottom, use a simple x/z map

#

if you're doing it in a more complicated fashion, nest a y treemap in the x/z map

#

possibly use a quadtree for the x/z map but a hashmap will suffice just fine as well

eager sapphire
#

Is there a clean way to know if you're on the main thread (not inside of an async scheduler task)?

wraith rapids
#

on paper, yes

#

Bukkit.isPrimaryThread()

#

not sure if it's been pulled to spigot

stone sinew
#

its on spigot

#

just checked. I told him check Thread.currentThread() lol

eager sapphire
#

nice, thank you!

wraith rapids
#

that is also doable

#

that's what I did iirc before that primary thread one was added

#

i'd like weakref the main thread in onenable and compare that to currentThread

eager sapphire
#

Seems like that's more or less what Bukkit.isPrimaryThread does

wraith rapids
#

myeah

eager sapphire
#

and I will probably have to do it your way for old api support reasons ๐Ÿ™‚

wraith rapids
#

you people should just stop pandering to ancient versions

stone sinew
eager sapphire
#

I get real nervous when someone with a Hitler avatar starts throwing around "you people" ๐Ÿ˜‚

wraith rapids
#

TOTALEN KRIEG

quiet ice
#

but the sunglasses!

quaint mantle
#

how i can set inventory location when it creating?

fiery inlet
#

i made my first kick gui

#

any new ideas anyone

lusty cipher
#

๐Ÿค”

#

too lazy to type /kick barryxbtw? xd

ornate hollow
#

is there like a chance somone got spring data jpa to work with there plugin, would help me a lot if there is a sample plugin with it. I really need it to speed up my development

onyx shale
#

Can someone test if config.getString with a default returns the right value? seems its always returning the default

#

might be a bug with 1.17

eternal oxide
#

Works fine. Nothing changed with snake

onyx shale
#

strange for some reason

#

it takes the default everytime

#

i removed it and it took the value right

mortal hare
#
        int size = elements.size();
        List<ItemStack> items = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            items.set(i, elements.get(i).getItemStack());
        }
        this.contentPacket.getItemListModifier().write(0, 
items);

am i dumb or what but for some reason this throws out of bounds error for items arraylist (ArrayOutOfBoundsException)

#

any ideas?

#

Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0

#

How can it be outofbounds

#

when im literally using arraylist

#

which grows

#

wtf

eternal oxide
#

You can;t set an item in the list that is empty

quiet ice
#

set?

#

You mean get

eternal oxide
#

set

mortal hare
#

so you're saying that i need to use add()

#

instead of .set()

quiet ice
#

interesting

onyx shale
#

by his logic yes

#

a arraylist should basically upgrade itself

quiet ice
#

ah, I know why

onyx shale
#

meaning once created should have a size of 0

eternal oxide
#

yes, if your items List is empty you can;t randomly set(0)

onyx shale
#

not 1

quiet ice
#

yea, use add instead

gaunt relic
#

Intellij keeps eating my disc usage even tho it's doing nothing

quiet ice
#

set overwrites the value

#

add inserts it

gaunt relic
mortal hare
#

it doesnt grow

eternal oxide
#

ther is no value to overwrite

mortal hare
#

?

#

i have been coding for a year

#

and still didnt knew

#

this was a thing

#

how pathetic i am

onyx shale
#

its a thing you usually dont care about

#

there are cases never met or discussed for everyone

#

now you know๐Ÿ‘

quiet ice
gaunt relic
#

Disk Usage

eternal oxide
#

You could just put elements in the newArrayLIst() and it will be inserted. you can then loop your list

#

not sure why you are transfering to a List

clear galleon
#

what is an event for when an entity moves

gaunt relic
#

Hard Drive Usage, however it's called in english

onyx shale
gaunt relic
#

It's always on 10mb/s no matter what

onyx shale
#

with reason also..

quiet ice
clear galleon
#

how can i add a particle trail to an arrow

onyx shale
#

you store the arrow

#

and reference it

quiet ice
#

haven't seen anyone complain about the FIO of IntelliJ

eternal oxide
#

run a task that every tick places a particle

onyx shale
#

i would go with velocity as canceller

#

cancel the runnable when velocity hits 0(arrow stopped in something)

#

or it dissapeared(hit a entity)

eternal oxide
#

just cancel it in the hit event

onyx shale
#

it could go into unloaded chunks

#

and cause some form of issues tho

clear galleon
#

arrow already disappears on projectile hit

onyx shale
#

then just check ifthe arrow is null

mortal hare
#

what if i preset the capacity of arraylist

#

doesnt it

#

preload arraylist

#

with nonsense data

onyx shale
#

should work

eternal oxide
#

if theres no arrow cancel the task

eternal oxide
clear galleon
#

call the task from onshootbowevent

eternal oxide
#

Arrays do

eternal oxide
#

You can just List<ItemStack> items = Arrays.asList(elements);

mortal hare
#

it does have initialcapacity

#

not fixed one

#

ofc

mortal hare
onyx shale
#

new ArrayList<Integer>(10); ?

eternal oxide
onyx shale
#

calling that 10 means 10 null objects

#

inside the list

eternal oxide
#

not even null

onyx shale
#

ah yeah nvm

eternal oxide
#

create a new List and try to access the 10th element

quiet ice
#

the capcity is the size of the underlying array

eternal oxide
#

^

quiet ice
#

However arraylist does not allow to set values beyond the first empty spot

eternal oxide
#

Yep, you have to fill it at creation or add.

winter fog
#

Is there a good tutorial for making random chest loot?

Like skywars, hunger games, ect.

mortal hare
#

i don't get it why java doesn't allow method static fields

#

like in c we have both global per translation unit variables and local variables

#

which are static

somber tinsel
#

Hello guys, I have issue that when I perform command /arena set <name>, nothing change in arenas.yml file (the file is reloaded), what am I doing wrong?
Code: https://paste.helpch.at/buragokofe.java

mortal hare
#

why are creating new file object every save?

#

sorry im too busy right now to debug your code

#

maybe someone who can help will help to you

winter fog
quiet ice
#

That would wreck havoc

mortal hare
#

well in C langs it doesnt

#

its basically within function encapsulated global static field

#

which is only accessible within the function scope

quiet ice
#

I guess the compiler could just knock it out into a class scope as a synthetic field

#

But that is too much synthetic sugar for me, I would prefer my goto statements over that

eternal oxide
#

wipes out anything in memory

winter fog
#

@eternal oxide do u have a link to a tutorial that could help me

quaint mantle
#

is it normal that on the interact event, the when I left click it counts as a right click?

somber tinsel
quaint mantle
#

what do you mean @eternal oxide ?

#

so e.getHand()?

#

and if it's left it's a right click? x/

burnt current
#

Hey, quick question: I already had a problem earlier when I programmed a villager whose custom name corresponds to the display name of the book when you click on it with a written book in your hand. Unfortunately, as I said, this gave me an error, with which unfortunately several people have not yet been able to help me. So I wanted to ask whether it is possible to right-click on a villager to bring up a sign on which you can write something and what you write on it becomes the custom name of the villager. Does anyone know how to do that? Thanks in advance

gaunt hatch
gaunt hatch
burnt current
#

OK. So there is really no way to do it in any other way using a display name, book pages, etc.?

onyx shale
#

its possible through all the ways the problem is how advanced are you when it comes to nsm

gaunt hatch
#

That is why i said maybe with protlib.

quaint mantle
gaunt hatch
#

Doesn't matter the game thinks you are.

lean osprey
#

yea the event is called 2 times

gaunt hatch
#

^

quaint mantle
#

okay but I added that

#

if(e.getHand() != EquipmentSlot.HAND)
return;

#

still doesn't work

#

and + it never detects a right click

#

only the left one

lean osprey
#

would be better if you show us your code

gaunt hatch
#

^

lean osprey
#

and not only the part that we have sent you

#

for crops?

quaint mantle
#
            {
                e.setCancelled(true);
                if(e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR)
                {                     
                    if(e.getHand() != EquipmentSlot.HAND)
                        return;
                    player.sendMessage(String.valueOf(e.getAction() + "SCORE: " + ce.getFishingData().getScore()));
                    if(ce.getFishingData().getCursor().getLoc() > 0){ 
                        
                        ce.getFishingData().getCursor().setLoc(ce.getFishingData().getCursor().getLoc()-1); 
                        }
                    player.sendMessage(String.valueOf(ce.getFishingData().getCursor().getLoc()));
                }```
gaunt hatch
#

cause you aonly check for left click only

quaint mantle
#

na

lean osprey
#

bruh

gaunt hatch
#

LEFT_CLICK_BLOCK || LEFT_CLICK_AIR

quaint mantle
#

I check for right too

lean osprey
#

thats left click...

gaunt hatch
#

no you dont

quaint mantle
gaunt hatch
#

that would be RIGHT_CLICK_AIR ...

lean osprey
#

^

gaunt hatch
#
  if(e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR)
quaint mantle
#

omg

#

dude...

gaunt hatch
#

this if statment is saying left click only

quaint mantle
#
            {
                e.setCancelled(true);
                if(e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR)
                {                     
                    if(e.getHand() != EquipmentSlot.HAND)
                        return;
                    player.sendMessage(String.valueOf(e.getAction() + "SCORE: " + ce.getFishingData().getScore()));
                    if(ce.getFishingData().getCursor().getLoc() > 0){ 
                        
                        ce.getFishingData().getCursor().setLoc(ce.getFishingData().getCursor().getLoc()-1); 
                        }
                    player.sendMessage(String.valueOf(ce.getFishingData().getCursor().getLoc()));
                }
                if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR)
                { 
                    player.sendMessage(String.valueOf(e.getAction() + "SCORE: " + ce.getFishingData().getScore()));
                    if(ce.getFishingData().getCursor().getLoc() <ce.getTotalLength()){ 
                        
                        ce.getFishingData().getCursor().setLoc(ce.getFishingData().getCursor().getLoc()+1); 
                        }
                    player.sendMessage(String.valueOf(ce.getFishingData().getCursor().getLoc()));
                }```
#

didn't wanna send the whole thing cuz its kinda useless

gaunt hatch
#

ok

quaint mantle
#

-.-

gaunt hatch
#

else if maybe ?

#

you want to move the hand check before any of that

#

probley the first check you do

lean osprey
#

also do you get any errors?

quaint mantle
#

I do not

#

there is no issue except that the right click is somehow replaced with a left one

lean osprey
#

replaced?

#

when you right click, it sends you the code from left click?

#

or wdym

gaunt hatch
#

else if might help with that

gaunt hatch
#

and also would be better for the proformace with a else if

lean osprey
quaint mantle
gaunt hatch
#

its faster

#

with a else if it does the validation once where 2 if does the check 2 times

#

but that is back to me saying it all adds up and cause lag time in the code.

lean osprey
#

try to just debug it

quaint mantle
#

It tried

#

so many times

#

and

lean osprey
#

o.o

quaint mantle
#

the right click is getting replaced with left click

#

for some reason

gaunt hatch
#

so do this

lean osprey
#

ooof

#

didnt mean to do that

gaunt hatch
#

do the hand check before the is fishing check

#

and make the right click a else if

#

and see what it does

lean osprey
#
if(ce.getFishingData().isFishing())
            {
                e.setCancelled(true);
                if(e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR)
                {                     
                    if(e.getHand() != EquipmentSlot.HAND) {
                        return;
                    }
                    player.sendMessage("Left click");

                    player.sendMessage(String.valueOf(e.getAction() + "SCORE: " + ce.getFishingData().getScore()));
                    if(ce.getFishingData().getCursor().getLoc() > 0){ 
                        
                        ce.getFishingData().getCursor().setLoc(ce.getFishingData().getCursor().getLoc()-1); 
                        }
                    player.sendMessage(String.valueOf(ce.getFishingData().getCursor().getLoc()));
                }
                if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR)
                { 
                    if(e.getHand() != EquipmentSlot.HAND) {
                        return;
                    }
                    player.sendMessage("Right click");

                    player.sendMessage(String.valueOf(e.getAction() + "SCORE: " + ce.getFishingData().getScore()));
                    if(ce.getFishingData().getCursor().getLoc() <ce.getTotalLength()){ 
                        
                        ce.getFishingData().getCursor().setLoc(ce.getFishingData().getCursor().getLoc()+1); 
                        }
                    player.sendMessage(String.valueOf(ce.getFishingData().getCursor().getLoc()));
                }
gaunt hatch
#

now you are doing more work in the if statments lol

lean osprey
#

I just copied his code

hybrid spoke
quaint mantle
#

i'm a cool kid now

gaunt hatch
#

yes but when you have a if else if it checks all the validation at once with if and if it takes longer cause you are doing the work aprat from each other

#

its faster in the end with else if

quaint mantle
#

so

quaint mantle
lean osprey
#

what does it say

#

when you right click

#

in the chat

quaint mantle
#

Left click

#

only

lean osprey
#

wth

gaunt hatch
#

omg am i going to have to send a code sample

#

iots coding 101 dude

lean osprey
#

wait

#

why do u check actions using ==

#

use .equals()

hybrid spoke
lean osprey
#

wait

gaunt hatch
#

enum are numbers

hybrid spoke
#

enums should always be checked with ==

lean osprey
#

I am so confused rn

#

ughh

#

okay nvm

gaunt hatch
#

you just see the value in the IDE but in running code ints 1,2,3,4

lean osprey
#

idk where's the issue

hybrid spoke
#

enums arent numbers

#

enums are constants with the type of the class

gaunt hatch
#

...

silver cove
#

if u go into the method

hybrid spoke
silver cove
#

gotcha

hybrid spoke
#

.equals is not

lean osprey
#

ah yea

gaunt hatch
#

Short for enumeration, an enum variable type can be found in C (ANSI, not the original K&R), C++ and C#. The idea is that instead of using an int to represent a set of values, a type with a restricted set of values is used instead.

#

The idea is that instead of using an int to represent a set of values

#

enum are int when its running the code on the client level

#

the IDE shows the value as set value

#

i swear no knows programming 101

hybrid spoke
#

you use == for enums, because == checks if the checked enum is the same adress in the heap or not

silver cove
gaunt hatch
lean osprey
#

xDDDD

#

yea I was actually thinking about that too

gaunt hatch
#

i have seen some werid things in my time coding and support lol

lean osprey
#

and there still could be an issue in an other part of his code

hybrid spoke
#

can you send us your full code?

#

?paste

undone axleBOT
gaunt hatch
#

i mean we can change it from If to a switch to clean it up a bit, but it looks ok

gaunt hatch
#

can you paste the whole method or event (w/e its called in here ๐Ÿ™‚ ) ?

lean osprey
quaint mantle
#

yes

lean osprey
#

what

#

thats impossible

quaint mantle
#

well it does

lean osprey
#

u know what

dusty herald
#

no need to be a dick

lean osprey
#

do u use fishing rod?

#

@quaint mantle

quaint mantle
#

ya ๐Ÿ˜ณ

lean osprey
#

uh yea

#

@gaunt hatch I might know wheres the issue

#

because mc calls events by hand animations

#

and when you right click the rod

#

it looks like left click

hybrid spoke
#

nope

quaint mantle
#

ye no

lean osprey
#

the same issue is when you drop an item

hybrid spoke
#

we're not in packets

lean osprey
#

I am not talking about packets

quaint mantle
#

ye

lean osprey
#

thats in the interact event

gaunt hatch
#

i am adding to me code to see

quaint mantle
#
  • when i click a block it works normally
chrome beacon
#

Interact event does fire twice once for each hand

hybrid spoke
#

the interaction event is not called when a hand animation is made

lean osprey
#

yea as Fenzy told

#

when you look into air

#

it also calls left click

hybrid spoke
#

the interaction event is called when an interaction is being made

lean osprey
#

no

#

try it by yourself

quaint mantle
#

it only calls left *

hybrid spoke
#

i did.

lean osprey
#

make a listener

hybrid spoke
#

bro

#

xD

lean osprey
#

with left-clicks

#

and look into air

#

and drop an item

#

it calls left-click event

hybrid spoke
#

Represents an event that is called when a player interacts with an object or air, potentially fired once for each hand. The hand can be determined using getHand().

gaunt hatch
#

i do not like this

FishingTask.runningTasks.containsKey(player.getUniqueId()
lean osprey
#

why do you still talk about 2 hands?

gaunt hatch
#

Access the list from outside of a control state is BAD!!

lean osprey
#

we already return it

gaunt hatch
#

concurrent issues ready to happen

#

anyway

hybrid spoke
#

was more pointing to Represents an event that is called when a player interacts with an object or air,

lean osprey
#

I am telling you that when you even drop an item, it calls the interact event for left-click-air

vivid lion
quaint mantle
gaunt hatch
#

still building method to add,get,check,remove and keeping the list object private and final is way safer

vivid lion
#

what version btw

quaint mantle
#

mhm i don't really know how that would change anything here

gaunt hatch
#

is this for fishing?

quaint mantle
#

?

gaunt hatch
lean osprey
quaint mantle
#

no its player interact event

lean osprey
#

@vivid lion

gaunt hatch
#

when is it used?

quaint mantle
# lean osprey 4

weird cuz when i right click on the block it doesnt trigger the interact event but still does the animation

lean osprey
#

put ignoreCancelled = true into the annotation

#

and try it again

vivid lion
#

let me try

#

in 1.16

#

1.12 seems fine

lean osprey
#

its okay in 1.12

#

I think

vivid lion
#

ye ill try in 1.16

lean osprey
#

however I just sent a vid from 1.16

vivid lion
#

and ill let you know

lean osprey
#

bruh I just sent you a video o.o

hybrid spoke
#

never trust people on the internet

lean osprey
#

xDD

hybrid spoke
#

seems like i were wrong FOR THE NEWER VERSIONS

lean osprey
#

I am going to sleep, cya

hybrid spoke
#

cya

wraith rapids
#

you will have a nightmare

quaint mantle
#

oh no notyou

vivid lion
#

i see the issue

#

im gonna attempt to resolve it

somber tinsel
#

Hi guys, when I call saveArenaConfig method, it create new file instead of saving actual one. Can somebody explain my why please? My head is not getting it - https://paste.helpch.at/nefesebodu.java

wraith rapids
#

your save method does nothing

#

the first thing it does is loads the config from the disk

chrome beacon
#

^^

wraith rapids
#

then it immediately saves that same, unchanged config back to the disk

#

nothing happens

minor garnet
#

Its possible return a type of object in java ? I mean boolean, string, int indtead of check the object value

wraith rapids
#

wat

drifting halo
#

return yourType?

somber tinsel
wraith rapids
#

yes, again, you are not doing anything

#

let me reiterate; the first thing your save method does is loads the config

#

the config on the disk will not have any of the changes you made with FileConfiguration#set

#

it will be blank

#

the blank configuration is loaded

#

and then saved back to disk

#

you call getArenaConfig(), which is
return YamlConfiguration.loadConfiguration(getArenaFile());

#

notice the loadConfiguration

minor garnet
#

It is possible to return the object type without making a condition to check its type in java

wraith rapids
#
    public void saveArenaConfig() {
        try {
            getArenaConfig().save(YamlConfiguration.loadConfiguration(getArenaFile()));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
#

this is what you code does

#

it first loads the blank config from disk, and then saves that blank config back to disk

#

it doesn't actually do anything

minor garnet
#

I want to create a hashmap where I can accept values โ€‹โ€‹of type int and boolean without creating several for each type of value.

sweet sun
#

oh

wraith rapids
#

no, you can not have a map that takes both ints and booleans

#

or, well, you "can", by having a Map<K, Object>, and then checking instanceof and casting the Object to either Integer or Boolean

#

but that is gay and you shouldn't do that, nor should you have any need to do that

minor garnet
#

not some smart java tool that does that

wraith rapids
#

design your shit so that you don't need to hold both integers and booleans in the same place

#

type safety is a thing for a reason

minor garnet
#

you ya nervous

#

๐Ÿค—

vivid lion
#

@lean osprey

#

fix it to be better now

#

but heres a solution

#
public class PlayerInteractListener implements Listener {

    private final Map<UUID, ItemStack> drop = new HashMap<>();

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
        Player p;
        e.setCancelled(drop.containsKey((p = e.getPlayer()).getUniqueId()));
        Bukkit.broadcastMessage(String.valueOf(e.isCancelled()));
        drop.remove(p.getUniqueId());
    }

    @EventHandler
    public void onDrop(PlayerDropItemEvent e) {
        Player p;
        drop.put((p = e.getPlayer()).getUniqueId(),p.getInventory().getItemInMainHand());
    }

    @EventHandler
    public void onQuit(PlayerQuitEvent e) {
        drop.remove(e.getPlayer().getUniqueId());
    }


}
hybrid spoke
#

i think it was @quaint mantles thing

wraith rapids
#

drop.put((p = e.getPlayer()).getUniqueId(),p.getInventory().getItemInMainHand());
what

vivid lion
#

should be boolean lmfao

#

ngl

wraith rapids
#

probably want to get the dropped item from the event

#

as the player can drop items from other slots than the main hand slot

#

and there is no guarantee the item is in the main hand slot anymore

vivid lion
#

thats why i said fix it XD

lean osprey
wraith rapids
#

and what the shit is up with these assignments

vivid lion
#

but this is a temp solution to his problem

wraith rapids
#

.containsKey((p = e.getPlayer()).getUniqueId()));

lean osprey
#

bcs the left click is a cancelled event

wraith rapids
#

why do you repeatedly do this

vivid lion
#

whats wrong lol

wraith rapids
#

just Player p = e.getPlayer()

vivid lion
#

getting triggered

#

XD

vivid lion
#

but let me readjust this code

#

to be better rq

hybrid spoke
#

go to your bathroom, there you have 1

somber tinsel
# wraith rapids this is what you code does

I m really not getting it lol, then how? I thought that its getArenaConfig().save(FILE) then but it's not working too (sorry im stupid)

File customFile = new File(plugin.getDataFolder(), "arenas.yml");
FileConfiguration customConfig = YamlConfiguration.loadConfiguration(customFile);
try {
   customConfig.save(customFile);```
hybrid spoke
#

you aren't changing anything

#

its like
hey, gimme my data.
thanks.
now save it unchanged again.
thanks

wraith rapids
#

imagine the disk is a shop

#

you go to the shop to buy some coca cola

#

now, once you have your bottle of coke

#

you immediately return it back to the shop

#

without doing anything with it

#

why are you still thirsty?

somber tinsel
#

im thirsty but i dont know how to get bottle of coca cola ๐Ÿ˜”

wraith rapids
#

you need to hold onto the bottle of coke that you get

#

right now you are either getting it and throwing it away, or getting it and putting it back immediately

#

you need a field in this class that holds the coke bottle

#

private YamlConfiguration config;

#

make getCustomConfig return that config

#

make it return that coke bottle that you have

#

instead of getting a new one from the shop each time

somber tinsel
#

rip coca cola

wraith rapids
#

YamlConfiguration.loadConfiguration(getCustomFile()) gets the bottle from the shop

#

getCustomConfig().save(getCustomFile()) takes it back to the shop

#

now, since you want to drink it, you will want to put it in the fridge in between

#

so, you have 3 operations that you want to do

#

#1 get the bottle from the shop, put it in the fridge

#

#2 take the bottle from the fridge when you want a drink

#

#3 once you're done with the bottle, take it back to the shop

#

#1 -> customConfig = YamlConfiguration.loadConfiguration(getCustomFile());

#

#2 -> a method that does nothing else than return customConfig;

#

#3 -> getCustomConfig().save(getCustomFile());

#
    private YamlConfiguration customConfig; //this is our fridge, the coke bottle will be put here
    private File customFile;

    public File getCustomFile() {
        this.customFile = new File(plugin.getDataFolder(), "arenas.yml");
        return customFile;
    }
    public YamlConfiguration getCustomConfig() { //take the bottle out of the fridge
        return customConfig;
    }
    public void loadCustomConfig() { //get the bottle from the shop, put it in the fridge
        this.customConfig = YamlConfiguration.loadConfiguration(getCustomFile());
    }
    public void saveCustomConfig() { //return the bottle to the shop
        try {
           getCustomConfig().save(getCustomFile());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
somber tinsel
#

Oh my god

#

It's working and I get it finally

#

Thank you Mr. NNYaKNpGms0eUVpiSdHx

#

Thank you for cocacola bottle ๐Ÿ˜Ž

quiet hearth
#

How do u make text bold and color like for example. lore.add(ChatColor.GOLD + โ€œLegendaryโ€) how would i make it also bold

somber tinsel
#

ChatColor.GOLD + "" + ChatColor.BOLD I think (maybe, not sure) or just use ยง

sacred vector
#

how can i use java player.discoverRecipe(); With a custom recipe

sage swift
#

the NamespacedKey...?

sudden stirrup
#

I'm curious: because I use Linux, is there any reason at all to use a development environment to make a plugin?

#

I mean, Linux IS a dev environment, so idk why I would use eclipse or something else

mental stump
#

Linux isnt an IDE.

ivory sleet
#

IDE != DE

sudden stirrup
#

No it isn't, but everything is integrated

mental stump
#

You need an IDE and compiler to make plugins.

vagrant stratus
#

^

mental stump
#

Youโ€™re telling me your linux comes with an IDE and compiler?

sudden stirrup
#

So what, writing code in a file doesn't work anymore?

ivory sleet
#

Java code needs to be compiled in order for the jvm to run it

sudden stirrup
#

Yes

ivory sleet
#

For that you need what is called a Java compiler

quaint mantle
#

yes, write java code in a txt file

mental stump
#

It also needs the correct formatting

vagrant stratus
quaint mantle
#

with wordpad

sudden stirrup
#

Yes I can compile Java from terminal

vagrant stratus
#

no compiler either

#

just checked :p

sudden stirrup
#

I mean, what is jdk for?

quaint mantle
#

java development kit

ivory sleet
#

its basically the java standard lib

quaint mantle
#

its for.. developing java programs

vagrant stratus
#

it's how you compile your java classes :3

mental stump
#

I use jdk as the runtime not gonna lie

sudden stirrup
#

Same lol

#

Okay well, that aside, I'm not sure where to start. I've tried before to write a plugin, but either the documentation is outdated or it's just something I'm not getting.

quaint mantle
#

Anyone wanna help me test out my plugin on 1.17?

jagged monolith
sudden stirrup
#

The documentation on the Spigot website

ivory sleet
#

Oh yeah some of that stuff is outdated

sudden stirrup
#

I think it's because, back when I tried to follow it, nothing linked right so it would never compile and I thought it was my fault for doing something wrong

#

I'm not formally educated in development, but as long as I get the basics down where I can compile a hello world example, everything from there is fine

#

So if the Spigot docs are outdated, where should I be looking instead?

sage swift
#

my butt

sacred vector
#

wht is namespaceKey

vagrant stratus
#

?jd

vagrant stratus
#

Look it up in the documentation m8

vagrant stratus
#

The conversation is all over the place ๐Ÿ‘€

ivory sleet
sage swift
sacred vector
#
            ItemStack pickaxe = new ItemStack(itemManager.smallPickaxe);
            ShapedRecipe pickaxe1 = new ShapedRecipe(pickaxe);
            pickaxe1.shape("ddd", "aea", "ddd");
            pickaxe1.setIngredient('d', Material.DIAMOND_BLOCK);
            pickaxe1.setIngredient('a', Material.NETHERITE_PICKAXE);
            pickaxe1.setIngredient('e', Material.NETHERITE_BLOCK);
            getServer().addRecipe(pickaxe1);
``` I made them like this
sage swift
#

literally deprecated

hot gull
#

java.lang.NoClassDefFoundError: me/clip/placeholderapi/external/EZPlaceholderHook

sacred vector
#

huh?
my friend showed me this how make recipes and it works... i just want to make it show in the recipe book

hot gull
#

any help?

sacred vector
hot gull
#

whats app are best for coding pl?

#

IntelliJ IDEA?

sacred vector
#

user preference, i use intellij and vscode

hot gull
#

Ultimate
For web and enterprise development

Community
For JVM and Android development

sacred vector
#

its what ever you want to use

hot gull
#

idk

#

java.lang.NoClassDefFoundError: me/clip/placeholderapi/external/EZPlaceholderHook btw you know how to fix?

sacred vector
#

nope i only started java and plugin dev 2 days ago

hot gull
#

oh ok

ivory sleet
#

@hot gull it means that class doesnt exist at runtime

#

u got papi installed?

hot gull
#

oh no

ivory sleet
#

also do u use the most recent version of papi?

hot gull
#

i have placeholderapi

ivory sleet
#

This wiki page is no longer maintained, please visit the GitHub page for an up to date version.

hot gull
#

ok

#

how i can download?

ivory sleet
hot gull
#

yea i have it

ivory sleet
#

may I ask what you're doing exactly

hot gull
#

Error occurred while enabling NetworkLevels v2.7 (Is it up to date?)
java.lang.NoClassDefFoundError: me/clip/placeholderapi/external/EZPlaceholderHook

#

only the problem

ivory sleet
#

NetworkLevels is using a legacy version of PlaceholderAPI

#

ask the developer if they can update it

quaint mantle
#

I've created a custom configuration file and I have been trying to save the default but I get this error: https://paste.md-5.net/modecocexu.css
This is the code I've tried to use:

    public void saveDefaultConfig() {
        if (this.getMessageConfig() == null) {
            file = new File(Bukkit.getServer().getPluginManager().getPlugin("OITC").getDataFolder(), "messages.yml");
        }
        if (!file.exists()) {
            Bukkit.getServer().getPluginManager().getPlugin("OITC").saveResource("messages.yml", false);
        }
    }```
quaint mantle
hybrid spoke
#

seems like messageConfigManager is null

quaint mantle
#

ait I fixed that, it's not null anymore and does not print any error

#

but it still doesnt save the default

#

I've put stuff in the messages.yml fie in my ide and none of it is in the yml file

vital swift
#

My custom economy is returning null to other plugins

    public double getBalance(OfflinePlayer offlinePlayer) {
        Bukkit.broadcastMessage("OFFLINE_PLAYER#22");
        map.put(offlinePlayer, PlayerData.getIntOF2(offlinePlayer, "Coins"));
        Double i = map.get(offlinePlayer);
        Bukkit.broadcastMessage("Double: " + i);
        return i;
    }
vital swift
#

i meant null my bad

hybrid spoke
hot gull
#

Your system doesn't have requirements to run JavaScript expressions

#

wat

#

Your system doesn't have requirements to run JavaScript expressions

hybrid spoke
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

hybrid spoke
#

@hot gull โฌ†๏ธ

hot gull
#

and idk why its say

hybrid spoke
hot gull
#

LMAO

cold pawn
#

Anyone know why I get an npe?

agile vessel
#

Guys, do u know if there's a plugin that allows to change the normal exp given on breaking any type of block? I found some plugins that allow that but only with ores... ty

sage swift
#

This is the place where you make your own plugin for it

agile vessel
#

I really don't know where can I ask it... but if i don't found anything I should make it myself

clear galleon
#

how do i add a custom recipe to players' recipe books

quaint mantle
#

Bukkit.getServer().addRecipe(Recipe)

clear galleon
#

i mean add the recipe to their recipebooks not the server

#

like the green one you click

clear galleon
#

ty

quartz goblet
#

any easy way to get a chatcolor from a string? like take the argument command "blue" and convert to ChatColor.BLUE?

young knoll
#

ChatColor.valueOf

quartz goblet
#

thanks

winter fog
#

What code would I use to set the loottable of a chest that has been opend

#
    public void onInteract(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        Block b = e.getClickedBlock();

        if (b.getType() == Material.CHEST) {
            
        }
    }``` 
Is what I have
young knoll
winter fog
#

And I need to switch the loot table to random loot

gaunt hatch
#

Any know why npc's always look south on spawn?

winter fog
#

entity0.setPositionRotation(x, y, z, yaw, pitch);

#

I think

gaunt hatch
#

doesn't work

winter fog
#

hm

gaunt hatch
#

i have that set in the contrustior of the npc

setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
winter fog
#

South is deafault

#

i dont know, im pretty new to spigot

gaunt hatch
#

i thought it was PacketPlayOutEntityHeadRotation but that didnt work

winter fog
#

thats why im asking this stuff

#

I got that from a tutorial

gaunt hatch
#

ahhhh

winter fog
#

I just wanna know how to make chests spawn with random loot

#

And some of the Javadocs are confusing me

young knoll
#

Any ideas on hooking into the Mojang structure system?

#

I'd rather avoid a custom jar, but ASM seems like a headache as well

winter fog
#

noob question : how do I store a string from args 1 and on

#

String t = args[WHAT DO I PUT HERE];

young knoll
#

the index

winter fog
#

?

young knoll
#

What?

winter fog
#

nvm

#

meant to search that*

young knoll
#

It's an array

#

You just put a number

tired ferry
#

What does Level Height Accessor do and what should I set it too?

#

It's a new thing in 1.17, 1.16 does not have it

young knoll
#

Passing a world should work fine

ornate heart
#

Noob question but why do I have to use BuildTools instead of download a spigot jar from the bukkit website?

tired ferry
young knoll
winter fog
young knoll
#

no?

winter fog
#

like form anything arg 1 and on

young knoll
#

no?

young knoll
tired ferry
young knoll
#

And then you will find a private static final variable

#

And become sad that you can't change it

tired ferry
#

;|

#

can I simply create a Height Accessor through the constructor?

winter fog
#

idk how else to explain

tired ferry
#

I think I may of figured it out, thanks for your help

maiden thicket
#

it's the net.minecraft.server package so u can fuck with packets and stuff

#

๐Ÿคท๐Ÿพโ€โ™‚๏ธ

ivory sleet
#

unspigot verson of coding

#

roflmao

hardy swan
unreal quartz
#

cuz you download minecraft from mojang

#

and it puts all the shit together

hardy swan
#

yea how is that diff from downloading sth that already has its shit put tgt

unreal quartz
#

cuz the shit thatโ€™s put together has minecraft code in it

#

so if you distribute that

#

u distribute my

#

mc

#

which is the problem

hardy swan
#

but cloning the code locally not considered distribution?

unreal quartz
#

well itโ€™s downloading the minecraft server from mojang

#

and itโ€™s cloning the patches from spigot

#

and then puts it all together and spits out a patched jar

#

so no

#

no distributing mojang code

hardy swan
#

noob question, so if I upload this jar that it spits out, it is illegal?

young knoll
#

yes

#

If you are hosting it for redownload

hardy swan
#

oh ok I understand that

quaint mantle
#

how do i read stdout

#
Sender      Me    Console
  |         |        |
  --------------------
quartz goblet
#

Anyone able to help me with "The project cannot be built until build path errors are resolved" in eclipse? ive tried everything on stack overslow but I just cant get it. Happening with trying to use java 16

cinder thistle
quaint mantle
#

catch System.out

cinder thistle
#

Google my guy

quaint mantle
cinder thistle
#

I got that with an easy google search

young knoll
#

I think Iโ€™ve discovered code cursed enough to get past my little reflections issue

worldly ingot
young knoll
#

The power of the unsafe class

summer scroll
#

So I have a List of Entity and I wanted to check if there is no Player inside the List, how can I do that?

young knoll
#

You could do something fancy with streams

#

But the simple way is just a loop

summer scroll
#

All I can think is something like this

            int players = 0;
            for(Entity entity : nearbyEntities){
                if(entity instanceof Player){
                    players++;
                }
            }
            if(players == 0){
                // Means the list doesn't have any player
            }
young knoll
#

Start with a false Boolean

#

As soon as you find a player, set it to true and then break;

summer scroll
#

ah, alright

#

thank you

young knoll
#

No reason to keep looking unless you want the number of players in the list

tired ferry
#

why does worldDataServer.getGeneratorSettings() return null?

#

On previous versions, such as 1.16 it does not.

#

I am importing net.minecraft.world.level.levelgen.GeneratorSettings

young knoll
#

Goodness what are you doing with all this NMs

quaint mantle
#

why do NMS on 1.16 and not use mojang mappings is the real question

young knoll
#

Gotta remap them

#

Which is fine if you arenโ€™t using reflection I guess

tired ferry
#

I would prefer to not use nms, but I'm updating a plugin that uses it.

young knoll
#

What plugin

tired ferry
#

slime world manager

young knoll
#

I see

tired ferry
#

some of the issues make almost no sense, because the code from 1.16 is nearly identical to 1.17

quaint mantle
tired ferry
#

anyone know what this does? (Specifically what are level data, nbt, and craft magic numbers) extraTag.hasKeyOfType("LevelData", CraftMagicNumbers.NBT.TAG_COMPOUND)

frosty tinsel
dusky spade
#

anybody know of this plugin

#

where you have like a hub/server star

#

that gives u access to many things

#

i have seen it on different servers so it cant be custom made

tired ferry
#

why can't I cast the bukkit chunk generator to the nms chunk generator?

maiden thicket
#

because they're not related

#

i think

tired ferry
#

then how can I get the chunk generator? The getChunkProvider().getChunkGenerator() method has been removed in 1.17.

dusky spade
#

so nobody know the plguin I showed above? ๐Ÿ˜ฆ

young knoll
quaint mantle
#

Static getHandlerList method required!

young knoll
#

You donโ€™t have that method

#

Also

undone axleBOT
young knoll
#

?paste

quaint mantle
#

ah

#

thanks...

stuck kindle
#

anyone here know the difference between javax.vecmath.matrix4f vs just matrix4f? Is there one that's more optimal than the other?

narrow nexus
#

how would I go about obtaining the block xz coordinates from given chunk xz coordinates?

#

i bitshifted the chunk coordinates to the left by 4, but that doesn't seem to line up with the right block coordinates

lofty junco
fleet badger
#

Can anyone help me with this? Trying to fix an issue with GriefPrevention, and for that, I need to add Material.GLOW_ITEM_FRAME in the PlayerEventHandler. I did that (without adding an import statement which I think is where my mistake is), and changed the dependency in the screenshot below, but its giving me an error. I know I'm doing something wrong

fleet badger
#

ah, so I'll run buildtools with --remapped

sand bough
#

Hey Guys , i think im obviosly too dumb for creating a config file and the wiki page doesnt helps me much ,could someone explain me in an easier way how i do that ? Thanks

fleet badger
clear fable
#

Hi guys! I'm trying to send complex chat messages using BaseComponents, but I'm having some weird issues with it. When ever I run the command to see the message it works fine, but when my friend runs the command it doesnt send anything in his chat. The server is running Tunity 1.16.5, I am using fabric 1.16.5, and he is using Lunar 1.16.5. The client shouldn't make a difference but it works for him when he uses a vanilla client. Am I doing something wrong or is it just a lunar bug? This is the code for my chat message.

ComponentBuilder message = new ComponentBuilder().append("ยง7[ยง9DiscordVerificationยง7] ");

// Clickable and Hoverable code
{
    TextComponent code = new TextComponent(encoded);
    code.setColor(ChatColor.AQUA);
    code.setUnderlined(true);

    Text codeHover = new Text(ChatColor.translateAlternateColorCodes('&',
            "&7Click to copy &b " + encoded + " &7to clipboard!"
    ));
    code.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, codeHover));
    code.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, encoded));
    message.append(code);
}

p.spigot().sendMessage(ChatMessageType.CHAT, message.create());
System.out.println(p.getDisplayName() + " | " + encoded);```
spring river
#

So I think that the problem is lunar

torn shuttle
#

does anyone happen to know off the top of their minds if I make a feature for the worldedit API whether it will automatically work with FAWE?

chrome beacon
#

It will sort of work...

#

When using FAWE api calls should be done async

torn shuttle
#

ok so if all I want to do is import a schematic and paste it and nothing else it should be fine?

chrome beacon
#

Yeah

torn shuttle
#

thanks

violet niche
weary geyser
quaint mantle
#

This channel is for making plugins, not for server management.

chrome beacon
violet niche
#

A passing impression of it, but I'm confident I can pick it up fairly quickly based on the C# Ive done

chrome beacon
#

C# is quite simillar however we do follow different naming conventions, not that it affects anything important

#

Well that wiki page should be enough

violet niche
#

alrighty

#

afaict, the normal whitelist command will look up a player's current name through mojang's api to find their uuid

#

Is there a bukkit api function that behaves the same way?

wraith rapids
#

getOfflinePlayer will not query mojang's api if you are querying by UUID

#

if you are querying by name, it will first check the local cache and return the user from there if found, or query mojang for it

violet niche
#

The command syntax is /whitelist add <Player Name> so I need to be able to query by name

#

Great!

#

Thats perfect then, ty

wraith rapids
#

which is network IO and should not be done on the main thread

violet niche
#

This should be easy

#

oh, I need to put that in another thread manually?

wraith rapids
#

well, the issue with it is that it takes time, since it has to grab a server from across the globe and communicate with it

#

if you call the method on the main thread, the main thread will have to wait for that communication to complete

violet niche
#

Yup, I understand ๐Ÿ™‚ I'd assumed bukkit would do it internally

wraith rapids
#

my point is that even if it did it internally, it would still be an issue

#

since it returns the plain OfflinePlayer object

#

the method cannot return before it has something to return

#

for it to have something to return, the communication has to happen

violet niche
#

Right. Does Java use explicit promise style concurrency?

wraith rapids
#

that'd be Futures

violet niche
#

Nice, okay. If I wanted to write a function that looked up the name off the main thread (and encapsulate it), I'd use Futures, right?

wraith rapids
#

you could do that, or you could move all of your logic off the main thread, depending on how much of the bukkit api you're using

violet niche
#

I think it's just this query. Im only planning on writing a thin command wrapper over bukkit's whitelist api

#

Is there a way to tell which commands might block for a while in the api docs?

wraith rapids
#

nnot really

#

and if you actually block the command execution, the whole main thread will be blocking on it too, as commands run on the main thread

#

you'll want to do whatever you can do immediately in the command executor, then rig up the futures or scheduling you need for the query, and then return immediately

#

and then either continue asynchronously on a separate thread, or resume on the main thread once you've completed the query

violet niche
#

What's the idiomatic way to schedule a future in spigot?

wraith rapids
#

with futures, you can use CompletableFuture.supplyAsync or whatever

#

depending on how much you need to hop off and back onto the main thread though, futures may not be the best option

#

getting the whole arsenal provided by futures to work with bukkit properly is kind of difficult

#

as bukkit wants you to be on the main thread if you invoke most of its api methods

#

and futures don't have a good and simple way of telling something to execute on a specific thread

paper olive
#

How silly would it be to store some persistent data in my config file that isn't actually config related?

wraith rapids
#

all comments get nuked levels of silly

paper olive
#

Like, I have a single boolean flag that I want for my mod to manage. Just one. It seems like the most efficient way of handling this is writing a file

#

but ... I've already got a config file. It seems like the server administrators will interact with it in essentially the same way

wraith rapids
#

the issue with writing data to a config file is that each time you write to it, all of the formatting and comments and everything other than the raw data in the config file are nuked

#

which means that you can't have comments in your config, the end user can't comment-out parts of the config, the formatting will be ass, and so on

#

write it to a separate config file

paper olive
#

ah. hm. okay, you're right

vital ridge
#

Could someone help so i can fully understand this:

private void drawCircle(Location loc, float radius, Player p) {

        for (double t = 0; t < 50; t += 0.5) {

            float x = radius * (float) Math.sin(t);
            float z = radius * (float) Math.cos(t);

            loc.getWorld().spawnParticle(Particle.REDSTONE,
                    new Location(loc.getWorld(), loc.getX() + x, loc.getY() + 0.5, loc.getZ() + z), 1,
                    new Particle.DustOptions(Color.PURPLE, 1));

        }

    }

Like Ik that sin gets the y and cos gets the x
but i dont rlly understand how its used to create a circle like that, like i have an idea, but not fully.
I dont understand why the double t is used for the cos and sin since I know that you take degrees to cos or sin and multiply it with hypothenus to calculate the x or y trajectory in math.

quaint mantle
#

Can I see what the block was generated or placed by the player?

past maple
#

I think that you can also make a for loop to 0 at 360, with an increment of 0.1 (angle theta) for exemple, and so
x = rcos(theta)
y = r
sin(theta)

vital ridge
summer scroll
violet niche
silver cove
#

by running buildtools

violet niche
#

Where will it be output?

lusty cipher
lusty cipher
violet niche
#

Im not, but Im not following the IDEA Maven guide

#

oh that apache-maven-3.6.0 thing?

lusty cipher
#

no it get's put at C:\Users\<username>\.m2\repository\org\spigotmc\

violet niche
#

Right, I'm just not sure how to point idea at that page

lusty cipher
#

Well you would when using Maven :)
However if you really are following that guide that does not use maven or gradle, I think it's telling you to download the .jar files from the link I sent

#

however, I really recommend using maven or gradle

violet niche
#

Alright, I have the maven tutorial working

#

How do I make my plugin non-legacy?

#

oic

silver cove
lusty cipher
silver cove
#

they include bukkit in the official jar but not craftbukkit

#

if u run --compile craftbukkit (not 100% sure) it'll compile craftbukkit to ur local maven repo

#

so u can use it

#

used for nms stuff

burnt current
#

Hey, does anyone know how I can use custom skulls from the Custom heads site? I found a little bit on the internet but it was always a bit older and didn't work.

opal juniper
#

Anyone got a good version checker that checks the minor versions?

violet niche
#
package red.frost.Whitelist;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

class WelcomeCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 1) {
            Bukkit.getOfflinePlayer(args[0]).setWhitelisted(true);
            return true;
        } else {
            return false;
        }
    }
}
public class Whitelist extends JavaPlugin {
    @Override
    public void onEnable() {
        this.getCommand("welcome").setExecutor(new WelcomeCommand());
    }
}
```Wonderful ๐Ÿ™‚ any style tips?
undone axleBOT
chrome beacon
undone axleBOT
eternal oxide
hardy swan
#

this works for newer version where the material is PLAYER_HEAD

#

try matching material with name, if not found, get a SKULL and set dura to 1 iirc

violet niche
#

What happened there?

#

Is the UUID just made up on the spot by spigot?

eternal oxide
# violet niche Is the UUID just made up on the spot by spigot?

If you getOfflinePlayer(name) and they are unknown/invalid, you still get an OfflinePlayer object returned. However their name will/should be null and they have a generated UUID. You MUST check if their name is null to know if they are a valid player.

humble stirrup
#

how does bungee's ProxyServer#getPlayer behave when specifying a uuid of an offline player?

violet niche
#

thankyou!

burnt current
violet niche
#

The "Unknown or incomplete blah blah"

hardy swan
#

prob just set it in your language YAML file and get the string from it

violet niche
#

Im not sure how Id begin doing that ๐Ÿ˜›

humble stirrup
#

they're provided by brigadier

#

they're notoriously a pain in the ass to use

violet niche
#

Sure ๐Ÿ˜„

hardy swan
#

does brigadier have multi-lang support?

humble stirrup
#

yes, its all client side

#

which is great if youre writing a vanilla command but its also super inflexible

hardy swan
#

that doesn't look that bad

#

yet

humble stirrup
#

commodore doesnt handle any of the parsing, just the validation iirc

#

i tried using it once

#

how the hell does bungee tabcompletion work

#

i found an event, is that all i get?

opal juniper
hardy swan
#

com.mojang.authlib.properties.Property

opal juniper
#

thanks

#

it seems i dont have it in my local

hardy swan
#

GameProfile from there too

opal juniper
#

yep

hardy swan
opal juniper
#

it seems i was depending on the api

#

not the jar

#

๐Ÿคท

#

idk why

#

nice method tho

#

1.16.5 has those classes iirc?

hardy swan
#

thx, but I definitely didn't write that myself, i forgot whr i got that from lol

#

yea, even 1.17

#

you sure your artifactId for spigot dependency is spigot?๐Ÿ˜‚

opal juniper
#

nah - it was spigot-api

#

i changed it now

hardy swan
#

yea that's prob why

opal juniper
#

yeah it was

#

i was so confused cause all of the imports didn't look correct

#

whoops

#

๐Ÿคฃ

sly surge
#

ghost ping?

opal juniper
#

yeah sorry that was me

#

accident

sly surge
#

ok np

summer scroll
#

How can I spawn invisible armor stand? I've tried to use armorStand.setInvisible(true); but the armor stand still visible.

hardy swan
#

because

#

it is setVisible(false)

#

lmao

opal juniper
#

They should both work afaik

hardy swan
hardy swan
opal juniper
#

But if yours didn't work - try solar's

violet niche
summer scroll
#

oh and btw i put the armor stand in the player passenger

eternal oxide
summer scroll
hardy swan
#

player passenger?

violet niche
#

I'm using a spigot jar that I just build on --rev 1.17 and api-version: 1.16

opal juniper
summer scroll
hardy swan
#

ohh

opal juniper
quaint mantle
summer scroll
eternal oxide